|
1 | 1 | import { Static, Type } from '@sinclair/typebox' |
2 | 2 |
|
3 | | -interface PostgresMetaOk<T> { |
| 3 | +export interface PostgresMetaOk<T> { |
4 | 4 | data: T |
5 | 5 | error: null |
6 | 6 | } |
7 | 7 |
|
8 | | -interface PostgresMetaErr { |
| 8 | +export interface PostgresMetaErr { |
9 | 9 | data: null |
10 | 10 | error: { |
11 | 11 | message: string |
@@ -150,31 +150,6 @@ export const postgresPublicationSchema = Type.Object({ |
150 | 150 | }) |
151 | 151 | export type PostgresPublication = Static<typeof postgresPublicationSchema> |
152 | 152 |
|
153 | | -export const postgresTriggerSchema = Type.Object({ |
154 | | - id: Type.Integer(), |
155 | | - enabled_mode: Type.Union([ |
156 | | - Type.Literal('ORIGIN'), |
157 | | - Type.Literal('REPLICA'), |
158 | | - Type.Literal('ALWAYS'), |
159 | | - Type.Literal('DISABLED'), |
160 | | - ]), |
161 | | - name: Type.String(), |
162 | | - table: Type.String(), |
163 | | - schema: Type.String(), |
164 | | - condition: Type.Union([Type.String(), Type.Null()]), |
165 | | - orientation: Type.Union([Type.Literal('ROW'), Type.Literal('STATEMENT')]), |
166 | | - activation: Type.Union([ |
167 | | - Type.Literal('BEFORE'), |
168 | | - Type.Literal('AFTER'), |
169 | | - Type.Literal('INSTEAD OF'), |
170 | | - ]), |
171 | | - events: Type.Array(Type.String()), |
172 | | - function_schema: Type.String(), |
173 | | - function_name: Type.String(), |
174 | | - function_args: Type.Array(Type.String()), |
175 | | -}) |
176 | | -export type PostgresTrigger = Static<typeof postgresTriggerSchema> |
177 | | - |
178 | 153 | export const postgresRelationshipSchema = Type.Object({ |
179 | 154 | id: Type.Integer(), |
180 | 155 | constraint_name: Type.String(), |
@@ -250,6 +225,31 @@ export const postgresTableSchema = Type.Object({ |
250 | 225 | }) |
251 | 226 | export type PostgresTable = Static<typeof postgresTableSchema> |
252 | 227 |
|
| 228 | +export const postgresTriggerSchema = Type.Object({ |
| 229 | + id: Type.Integer(), |
| 230 | + enabled_mode: Type.Union([ |
| 231 | + Type.Literal('ORIGIN'), |
| 232 | + Type.Literal('REPLICA'), |
| 233 | + Type.Literal('ALWAYS'), |
| 234 | + Type.Literal('DISABLED'), |
| 235 | + ]), |
| 236 | + name: Type.String(), |
| 237 | + table: Type.String(), |
| 238 | + schema: Type.String(), |
| 239 | + condition: Type.Union([Type.String(), Type.Null()]), |
| 240 | + orientation: Type.Union([Type.Literal('ROW'), Type.Literal('STATEMENT')]), |
| 241 | + activation: Type.Union([ |
| 242 | + Type.Literal('BEFORE'), |
| 243 | + Type.Literal('AFTER'), |
| 244 | + Type.Literal('INSTEAD OF'), |
| 245 | + ]), |
| 246 | + events: Type.Array(Type.String()), |
| 247 | + function_schema: Type.String(), |
| 248 | + function_name: Type.String(), |
| 249 | + function_args: Type.Array(Type.String()), |
| 250 | +}) |
| 251 | +export type PostgresTrigger = Static<typeof postgresTriggerSchema> |
| 252 | + |
253 | 253 | export const postgresTypeSchema = Type.Object({ |
254 | 254 | id: Type.Integer(), |
255 | 255 | name: Type.String(), |
|
0 commit comments