@restura/core 0.1.0-alpha.6 → 0.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,1363 @@
1
+ import winston from 'winston';
1
2
  import * as express from 'express';
3
+ import { z } from 'zod';
4
+ import { PoolConfig, Pool } from 'pg';
5
+
6
+ declare const logger: winston.Logger;
7
+
8
+ declare const resturaConfigSchema: z.ZodObject<{
9
+ authToken: z.ZodString;
10
+ sendErrorStackTrace: z.ZodDefault<z.ZodBoolean>;
11
+ schemaFilePath: z.ZodDefault<z.ZodString>;
12
+ generatedTypesPath: z.ZodDefault<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ authToken: string;
15
+ sendErrorStackTrace: boolean;
16
+ schemaFilePath: string;
17
+ generatedTypesPath: string;
18
+ }, {
19
+ authToken: string;
20
+ sendErrorStackTrace?: boolean | undefined;
21
+ schemaFilePath?: string | undefined;
22
+ generatedTypesPath?: string | undefined;
23
+ }>;
24
+ type ResturaConfigSchema = z.infer<typeof resturaConfigSchema>;
25
+
26
+ declare const resturaZodSchema: z.ZodObject<{
27
+ database: z.ZodArray<z.ZodObject<{
28
+ name: z.ZodString;
29
+ columns: z.ZodArray<z.ZodObject<{
30
+ name: z.ZodString;
31
+ type: z.ZodUnion<[z.ZodEnum<["SMALLINT", "INTEGER", "BIGINT", "DECIMAL", "NUMERIC", "REAL", "DOUBLE PRECISION", "SERIAL", "BIGSERIAL"]>, z.ZodEnum<["CHAR", "VARCHAR", "TEXT", "BYTEA"]>, z.ZodEnum<["DATE", "TIMESTAMP", "TIMESTAMPTZ", "TIME", "INTERVAL"]>, z.ZodEnum<["BOOLEAN", "TINYINT", "SMALLINT", "MEDIUMINT", "INTEGER", "BIGINT", "DECIMAL", "FLOAT", "DOUBLE"]>, z.ZodEnum<["CHAR", "VARCHAR", "TINYTEXT", "TINYBLOB", "TEXT", "BLOB", "MEDIUMTEXT", "MEDIUMBLOB", "LONGTEXT", "JSON", "LONGBLOB", "ENUM"]>, z.ZodEnum<["DATE", "DATETIME", "TIME", "TIMESTAMP"]>]>;
32
+ isNullable: z.ZodBoolean;
33
+ roles: z.ZodArray<z.ZodString, "many">;
34
+ comment: z.ZodOptional<z.ZodString>;
35
+ default: z.ZodOptional<z.ZodString>;
36
+ value: z.ZodOptional<z.ZodString>;
37
+ isPrimary: z.ZodOptional<z.ZodBoolean>;
38
+ isUnique: z.ZodOptional<z.ZodBoolean>;
39
+ hasAutoIncrement: z.ZodOptional<z.ZodBoolean>;
40
+ length: z.ZodOptional<z.ZodNumber>;
41
+ }, "strict", z.ZodTypeAny, {
42
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
43
+ name: string;
44
+ roles: string[];
45
+ isNullable: boolean;
46
+ length?: number | undefined;
47
+ value?: string | undefined;
48
+ default?: string | undefined;
49
+ comment?: string | undefined;
50
+ isPrimary?: boolean | undefined;
51
+ isUnique?: boolean | undefined;
52
+ hasAutoIncrement?: boolean | undefined;
53
+ }, {
54
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
55
+ name: string;
56
+ roles: string[];
57
+ isNullable: boolean;
58
+ length?: number | undefined;
59
+ value?: string | undefined;
60
+ default?: string | undefined;
61
+ comment?: string | undefined;
62
+ isPrimary?: boolean | undefined;
63
+ isUnique?: boolean | undefined;
64
+ hasAutoIncrement?: boolean | undefined;
65
+ }>, "many">;
66
+ indexes: z.ZodArray<z.ZodObject<{
67
+ name: z.ZodString;
68
+ columns: z.ZodArray<z.ZodString, "many">;
69
+ isUnique: z.ZodBoolean;
70
+ isPrimaryKey: z.ZodBoolean;
71
+ order: z.ZodEnum<["ASC", "DESC"]>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ order: "ASC" | "DESC";
74
+ name: string;
75
+ isUnique: boolean;
76
+ columns: string[];
77
+ isPrimaryKey: boolean;
78
+ }, {
79
+ order: "ASC" | "DESC";
80
+ name: string;
81
+ isUnique: boolean;
82
+ columns: string[];
83
+ isPrimaryKey: boolean;
84
+ }>, "many">;
85
+ foreignKeys: z.ZodArray<z.ZodObject<{
86
+ name: z.ZodString;
87
+ column: z.ZodString;
88
+ refTable: z.ZodString;
89
+ refColumn: z.ZodString;
90
+ onDelete: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
91
+ onUpdate: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
92
+ }, "strict", z.ZodTypeAny, {
93
+ name: string;
94
+ column: string;
95
+ refTable: string;
96
+ refColumn: string;
97
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
98
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
99
+ }, {
100
+ name: string;
101
+ column: string;
102
+ refTable: string;
103
+ refColumn: string;
104
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
105
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
106
+ }>, "many">;
107
+ checkConstraints: z.ZodArray<z.ZodObject<{
108
+ name: z.ZodString;
109
+ check: z.ZodString;
110
+ }, "strict", z.ZodTypeAny, {
111
+ name: string;
112
+ check: string;
113
+ }, {
114
+ name: string;
115
+ check: string;
116
+ }>, "many">;
117
+ roles: z.ZodArray<z.ZodString, "many">;
118
+ }, "strict", z.ZodTypeAny, {
119
+ name: string;
120
+ roles: string[];
121
+ columns: {
122
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
123
+ name: string;
124
+ roles: string[];
125
+ isNullable: boolean;
126
+ length?: number | undefined;
127
+ value?: string | undefined;
128
+ default?: string | undefined;
129
+ comment?: string | undefined;
130
+ isPrimary?: boolean | undefined;
131
+ isUnique?: boolean | undefined;
132
+ hasAutoIncrement?: boolean | undefined;
133
+ }[];
134
+ indexes: {
135
+ order: "ASC" | "DESC";
136
+ name: string;
137
+ isUnique: boolean;
138
+ columns: string[];
139
+ isPrimaryKey: boolean;
140
+ }[];
141
+ foreignKeys: {
142
+ name: string;
143
+ column: string;
144
+ refTable: string;
145
+ refColumn: string;
146
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
147
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
148
+ }[];
149
+ checkConstraints: {
150
+ name: string;
151
+ check: string;
152
+ }[];
153
+ }, {
154
+ name: string;
155
+ roles: string[];
156
+ columns: {
157
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
158
+ name: string;
159
+ roles: string[];
160
+ isNullable: boolean;
161
+ length?: number | undefined;
162
+ value?: string | undefined;
163
+ default?: string | undefined;
164
+ comment?: string | undefined;
165
+ isPrimary?: boolean | undefined;
166
+ isUnique?: boolean | undefined;
167
+ hasAutoIncrement?: boolean | undefined;
168
+ }[];
169
+ indexes: {
170
+ order: "ASC" | "DESC";
171
+ name: string;
172
+ isUnique: boolean;
173
+ columns: string[];
174
+ isPrimaryKey: boolean;
175
+ }[];
176
+ foreignKeys: {
177
+ name: string;
178
+ column: string;
179
+ refTable: string;
180
+ refColumn: string;
181
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
182
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
183
+ }[];
184
+ checkConstraints: {
185
+ name: string;
186
+ check: string;
187
+ }[];
188
+ }>, "many">;
189
+ endpoints: z.ZodArray<z.ZodObject<{
190
+ name: z.ZodString;
191
+ description: z.ZodString;
192
+ baseUrl: z.ZodString;
193
+ routes: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
194
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
195
+ name: z.ZodString;
196
+ description: z.ZodString;
197
+ path: z.ZodString;
198
+ roles: z.ZodArray<z.ZodString, "many">;
199
+ }, {
200
+ type: z.ZodEnum<["ONE", "ARRAY", "PAGED"]>;
201
+ table: z.ZodString;
202
+ joins: z.ZodArray<z.ZodObject<{
203
+ table: z.ZodString;
204
+ localColumnName: z.ZodOptional<z.ZodString>;
205
+ foreignColumnName: z.ZodOptional<z.ZodString>;
206
+ custom: z.ZodOptional<z.ZodString>;
207
+ type: z.ZodEnum<["LEFT", "INNER"]>;
208
+ alias: z.ZodOptional<z.ZodString>;
209
+ }, "strict", z.ZodTypeAny, {
210
+ type: "LEFT" | "INNER";
211
+ table: string;
212
+ custom?: string | undefined;
213
+ localColumnName?: string | undefined;
214
+ foreignColumnName?: string | undefined;
215
+ alias?: string | undefined;
216
+ }, {
217
+ type: "LEFT" | "INNER";
218
+ table: string;
219
+ custom?: string | undefined;
220
+ localColumnName?: string | undefined;
221
+ foreignColumnName?: string | undefined;
222
+ alias?: string | undefined;
223
+ }>, "many">;
224
+ assignments: z.ZodArray<z.ZodObject<{
225
+ name: z.ZodString;
226
+ value: z.ZodString;
227
+ }, "strict", z.ZodTypeAny, {
228
+ value: string;
229
+ name: string;
230
+ }, {
231
+ value: string;
232
+ name: string;
233
+ }>, "many">;
234
+ where: z.ZodArray<z.ZodObject<{
235
+ tableName: z.ZodOptional<z.ZodString>;
236
+ columnName: z.ZodOptional<z.ZodString>;
237
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
238
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
239
+ custom: z.ZodOptional<z.ZodString>;
240
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
241
+ }, "strict", z.ZodTypeAny, {
242
+ value?: string | number | undefined;
243
+ custom?: string | undefined;
244
+ columnName?: string | undefined;
245
+ tableName?: string | undefined;
246
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
247
+ conjunction?: "AND" | "OR" | undefined;
248
+ }, {
249
+ value?: string | number | undefined;
250
+ custom?: string | undefined;
251
+ columnName?: string | undefined;
252
+ tableName?: string | undefined;
253
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
254
+ conjunction?: "AND" | "OR" | undefined;
255
+ }>, "many">;
256
+ request: z.ZodArray<z.ZodObject<{
257
+ name: z.ZodString;
258
+ required: z.ZodBoolean;
259
+ validator: z.ZodArray<z.ZodObject<{
260
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
261
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
262
+ }, "strict", z.ZodTypeAny, {
263
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
264
+ value: string | number | string[] | number[];
265
+ }, {
266
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
267
+ value: string | number | string[] | number[];
268
+ }>, "many">;
269
+ }, "strict", z.ZodTypeAny, {
270
+ validator: {
271
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
272
+ value: string | number | string[] | number[];
273
+ }[];
274
+ name: string;
275
+ required: boolean;
276
+ }, {
277
+ validator: {
278
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
279
+ value: string | number | string[] | number[];
280
+ }[];
281
+ name: string;
282
+ required: boolean;
283
+ }>, "many">;
284
+ response: z.ZodArray<z.ZodObject<{
285
+ name: z.ZodString;
286
+ selector: z.ZodOptional<z.ZodString>;
287
+ subquery: z.ZodOptional<z.ZodObject<{
288
+ table: z.ZodString;
289
+ joins: z.ZodArray<z.ZodObject<{
290
+ table: z.ZodString;
291
+ localColumnName: z.ZodOptional<z.ZodString>;
292
+ foreignColumnName: z.ZodOptional<z.ZodString>;
293
+ custom: z.ZodOptional<z.ZodString>;
294
+ type: z.ZodEnum<["LEFT", "INNER"]>;
295
+ alias: z.ZodOptional<z.ZodString>;
296
+ }, "strict", z.ZodTypeAny, {
297
+ type: "LEFT" | "INNER";
298
+ table: string;
299
+ custom?: string | undefined;
300
+ localColumnName?: string | undefined;
301
+ foreignColumnName?: string | undefined;
302
+ alias?: string | undefined;
303
+ }, {
304
+ type: "LEFT" | "INNER";
305
+ table: string;
306
+ custom?: string | undefined;
307
+ localColumnName?: string | undefined;
308
+ foreignColumnName?: string | undefined;
309
+ alias?: string | undefined;
310
+ }>, "many">;
311
+ where: z.ZodArray<z.ZodObject<{
312
+ tableName: z.ZodOptional<z.ZodString>;
313
+ columnName: z.ZodOptional<z.ZodString>;
314
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
315
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
316
+ custom: z.ZodOptional<z.ZodString>;
317
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
318
+ }, "strict", z.ZodTypeAny, {
319
+ value?: string | number | undefined;
320
+ custom?: string | undefined;
321
+ columnName?: string | undefined;
322
+ tableName?: string | undefined;
323
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
324
+ conjunction?: "AND" | "OR" | undefined;
325
+ }, {
326
+ value?: string | number | undefined;
327
+ custom?: string | undefined;
328
+ columnName?: string | undefined;
329
+ tableName?: string | undefined;
330
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
331
+ conjunction?: "AND" | "OR" | undefined;
332
+ }>, "many">;
333
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
334
+ groupBy: z.ZodOptional<z.ZodObject<{
335
+ columnName: z.ZodString;
336
+ tableName: z.ZodString;
337
+ }, "strict", z.ZodTypeAny, {
338
+ columnName: string;
339
+ tableName: string;
340
+ }, {
341
+ columnName: string;
342
+ tableName: string;
343
+ }>>;
344
+ orderBy: z.ZodOptional<z.ZodObject<{
345
+ columnName: z.ZodString;
346
+ order: z.ZodEnum<["ASC", "DESC"]>;
347
+ tableName: z.ZodString;
348
+ }, "strict", z.ZodTypeAny, {
349
+ columnName: string;
350
+ order: "ASC" | "DESC";
351
+ tableName: string;
352
+ }, {
353
+ columnName: string;
354
+ order: "ASC" | "DESC";
355
+ tableName: string;
356
+ }>>;
357
+ }, "strip", z.ZodTypeAny, {
358
+ table: string;
359
+ joins: {
360
+ type: "LEFT" | "INNER";
361
+ table: string;
362
+ custom?: string | undefined;
363
+ localColumnName?: string | undefined;
364
+ foreignColumnName?: string | undefined;
365
+ alias?: string | undefined;
366
+ }[];
367
+ where: {
368
+ value?: string | number | undefined;
369
+ custom?: string | undefined;
370
+ columnName?: string | undefined;
371
+ tableName?: string | undefined;
372
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
373
+ conjunction?: "AND" | "OR" | undefined;
374
+ }[];
375
+ properties: any[];
376
+ groupBy?: {
377
+ columnName: string;
378
+ tableName: string;
379
+ } | undefined;
380
+ orderBy?: {
381
+ columnName: string;
382
+ order: "ASC" | "DESC";
383
+ tableName: string;
384
+ } | undefined;
385
+ }, {
386
+ table: string;
387
+ joins: {
388
+ type: "LEFT" | "INNER";
389
+ table: string;
390
+ custom?: string | undefined;
391
+ localColumnName?: string | undefined;
392
+ foreignColumnName?: string | undefined;
393
+ alias?: string | undefined;
394
+ }[];
395
+ where: {
396
+ value?: string | number | undefined;
397
+ custom?: string | undefined;
398
+ columnName?: string | undefined;
399
+ tableName?: string | undefined;
400
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
401
+ conjunction?: "AND" | "OR" | undefined;
402
+ }[];
403
+ properties: any[];
404
+ groupBy?: {
405
+ columnName: string;
406
+ tableName: string;
407
+ } | undefined;
408
+ orderBy?: {
409
+ columnName: string;
410
+ order: "ASC" | "DESC";
411
+ tableName: string;
412
+ } | undefined;
413
+ }>>;
414
+ }, "strict", z.ZodTypeAny, {
415
+ name: string;
416
+ selector?: string | undefined;
417
+ subquery?: {
418
+ table: string;
419
+ joins: {
420
+ type: "LEFT" | "INNER";
421
+ table: string;
422
+ custom?: string | undefined;
423
+ localColumnName?: string | undefined;
424
+ foreignColumnName?: string | undefined;
425
+ alias?: string | undefined;
426
+ }[];
427
+ where: {
428
+ value?: string | number | undefined;
429
+ custom?: string | undefined;
430
+ columnName?: string | undefined;
431
+ tableName?: string | undefined;
432
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
433
+ conjunction?: "AND" | "OR" | undefined;
434
+ }[];
435
+ properties: any[];
436
+ groupBy?: {
437
+ columnName: string;
438
+ tableName: string;
439
+ } | undefined;
440
+ orderBy?: {
441
+ columnName: string;
442
+ order: "ASC" | "DESC";
443
+ tableName: string;
444
+ } | undefined;
445
+ } | undefined;
446
+ }, {
447
+ name: string;
448
+ selector?: string | undefined;
449
+ subquery?: {
450
+ table: string;
451
+ joins: {
452
+ type: "LEFT" | "INNER";
453
+ table: string;
454
+ custom?: string | undefined;
455
+ localColumnName?: string | undefined;
456
+ foreignColumnName?: string | undefined;
457
+ alias?: string | undefined;
458
+ }[];
459
+ where: {
460
+ value?: string | number | undefined;
461
+ custom?: string | undefined;
462
+ columnName?: string | undefined;
463
+ tableName?: string | undefined;
464
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
465
+ conjunction?: "AND" | "OR" | undefined;
466
+ }[];
467
+ properties: any[];
468
+ groupBy?: {
469
+ columnName: string;
470
+ tableName: string;
471
+ } | undefined;
472
+ orderBy?: {
473
+ columnName: string;
474
+ order: "ASC" | "DESC";
475
+ tableName: string;
476
+ } | undefined;
477
+ } | undefined;
478
+ }>, "many">;
479
+ groupBy: z.ZodOptional<z.ZodObject<{
480
+ columnName: z.ZodString;
481
+ tableName: z.ZodString;
482
+ }, "strict", z.ZodTypeAny, {
483
+ columnName: string;
484
+ tableName: string;
485
+ }, {
486
+ columnName: string;
487
+ tableName: string;
488
+ }>>;
489
+ orderBy: z.ZodOptional<z.ZodObject<{
490
+ columnName: z.ZodString;
491
+ order: z.ZodEnum<["ASC", "DESC"]>;
492
+ tableName: z.ZodString;
493
+ }, "strict", z.ZodTypeAny, {
494
+ columnName: string;
495
+ order: "ASC" | "DESC";
496
+ tableName: string;
497
+ }, {
498
+ columnName: string;
499
+ order: "ASC" | "DESC";
500
+ tableName: string;
501
+ }>>;
502
+ }>, "strict", z.ZodTypeAny, {
503
+ path: string;
504
+ type: "PAGED" | "ARRAY" | "ONE";
505
+ name: string;
506
+ table: string;
507
+ joins: {
508
+ type: "LEFT" | "INNER";
509
+ table: string;
510
+ custom?: string | undefined;
511
+ localColumnName?: string | undefined;
512
+ foreignColumnName?: string | undefined;
513
+ alias?: string | undefined;
514
+ }[];
515
+ where: {
516
+ value?: string | number | undefined;
517
+ custom?: string | undefined;
518
+ columnName?: string | undefined;
519
+ tableName?: string | undefined;
520
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
521
+ conjunction?: "AND" | "OR" | undefined;
522
+ }[];
523
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
524
+ description: string;
525
+ roles: string[];
526
+ assignments: {
527
+ value: string;
528
+ name: string;
529
+ }[];
530
+ request: {
531
+ validator: {
532
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
533
+ value: string | number | string[] | number[];
534
+ }[];
535
+ name: string;
536
+ required: boolean;
537
+ }[];
538
+ response: {
539
+ name: string;
540
+ selector?: string | undefined;
541
+ subquery?: {
542
+ table: string;
543
+ joins: {
544
+ type: "LEFT" | "INNER";
545
+ table: string;
546
+ custom?: string | undefined;
547
+ localColumnName?: string | undefined;
548
+ foreignColumnName?: string | undefined;
549
+ alias?: string | undefined;
550
+ }[];
551
+ where: {
552
+ value?: string | number | undefined;
553
+ custom?: string | undefined;
554
+ columnName?: string | undefined;
555
+ tableName?: string | undefined;
556
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
557
+ conjunction?: "AND" | "OR" | undefined;
558
+ }[];
559
+ properties: any[];
560
+ groupBy?: {
561
+ columnName: string;
562
+ tableName: string;
563
+ } | undefined;
564
+ orderBy?: {
565
+ columnName: string;
566
+ order: "ASC" | "DESC";
567
+ tableName: string;
568
+ } | undefined;
569
+ } | undefined;
570
+ }[];
571
+ groupBy?: {
572
+ columnName: string;
573
+ tableName: string;
574
+ } | undefined;
575
+ orderBy?: {
576
+ columnName: string;
577
+ order: "ASC" | "DESC";
578
+ tableName: string;
579
+ } | undefined;
580
+ }, {
581
+ path: string;
582
+ type: "PAGED" | "ARRAY" | "ONE";
583
+ name: string;
584
+ table: string;
585
+ joins: {
586
+ type: "LEFT" | "INNER";
587
+ table: string;
588
+ custom?: string | undefined;
589
+ localColumnName?: string | undefined;
590
+ foreignColumnName?: string | undefined;
591
+ alias?: string | undefined;
592
+ }[];
593
+ where: {
594
+ value?: string | number | undefined;
595
+ custom?: string | undefined;
596
+ columnName?: string | undefined;
597
+ tableName?: string | undefined;
598
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
599
+ conjunction?: "AND" | "OR" | undefined;
600
+ }[];
601
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
602
+ description: string;
603
+ roles: string[];
604
+ assignments: {
605
+ value: string;
606
+ name: string;
607
+ }[];
608
+ request: {
609
+ validator: {
610
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
611
+ value: string | number | string[] | number[];
612
+ }[];
613
+ name: string;
614
+ required: boolean;
615
+ }[];
616
+ response: {
617
+ name: string;
618
+ selector?: string | undefined;
619
+ subquery?: {
620
+ table: string;
621
+ joins: {
622
+ type: "LEFT" | "INNER";
623
+ table: string;
624
+ custom?: string | undefined;
625
+ localColumnName?: string | undefined;
626
+ foreignColumnName?: string | undefined;
627
+ alias?: string | undefined;
628
+ }[];
629
+ where: {
630
+ value?: string | number | undefined;
631
+ custom?: string | undefined;
632
+ columnName?: string | undefined;
633
+ tableName?: string | undefined;
634
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
635
+ conjunction?: "AND" | "OR" | undefined;
636
+ }[];
637
+ properties: any[];
638
+ groupBy?: {
639
+ columnName: string;
640
+ tableName: string;
641
+ } | undefined;
642
+ orderBy?: {
643
+ columnName: string;
644
+ order: "ASC" | "DESC";
645
+ tableName: string;
646
+ } | undefined;
647
+ } | undefined;
648
+ }[];
649
+ groupBy?: {
650
+ columnName: string;
651
+ tableName: string;
652
+ } | undefined;
653
+ orderBy?: {
654
+ columnName: string;
655
+ order: "ASC" | "DESC";
656
+ tableName: string;
657
+ } | undefined;
658
+ }>, z.ZodObject<z.objectUtil.extendShape<{
659
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
660
+ name: z.ZodString;
661
+ description: z.ZodString;
662
+ path: z.ZodString;
663
+ roles: z.ZodArray<z.ZodString, "many">;
664
+ }, {
665
+ type: z.ZodEnum<["CUSTOM_ONE", "CUSTOM_ARRAY", "CUSTOM_PAGED"]>;
666
+ responseType: z.ZodUnion<[z.ZodString, z.ZodEnum<["string", "number", "boolean"]>]>;
667
+ requestType: z.ZodOptional<z.ZodString>;
668
+ request: z.ZodOptional<z.ZodArray<z.ZodObject<{
669
+ name: z.ZodString;
670
+ required: z.ZodBoolean;
671
+ validator: z.ZodArray<z.ZodObject<{
672
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
673
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
674
+ }, "strict", z.ZodTypeAny, {
675
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
676
+ value: string | number | string[] | number[];
677
+ }, {
678
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
679
+ value: string | number | string[] | number[];
680
+ }>, "many">;
681
+ }, "strict", z.ZodTypeAny, {
682
+ validator: {
683
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
684
+ value: string | number | string[] | number[];
685
+ }[];
686
+ name: string;
687
+ required: boolean;
688
+ }, {
689
+ validator: {
690
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
691
+ value: string | number | string[] | number[];
692
+ }[];
693
+ name: string;
694
+ required: boolean;
695
+ }>, "many">>;
696
+ table: z.ZodUndefined;
697
+ joins: z.ZodUndefined;
698
+ assignments: z.ZodUndefined;
699
+ fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
700
+ }>, "strict", z.ZodTypeAny, {
701
+ path: string;
702
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
703
+ name: string;
704
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
705
+ description: string;
706
+ roles: string[];
707
+ responseType: string;
708
+ table?: undefined;
709
+ joins?: undefined;
710
+ assignments?: undefined;
711
+ request?: {
712
+ validator: {
713
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
714
+ value: string | number | string[] | number[];
715
+ }[];
716
+ name: string;
717
+ required: boolean;
718
+ }[] | undefined;
719
+ requestType?: string | undefined;
720
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
721
+ }, {
722
+ path: string;
723
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
724
+ name: string;
725
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
726
+ description: string;
727
+ roles: string[];
728
+ responseType: string;
729
+ table?: undefined;
730
+ joins?: undefined;
731
+ assignments?: undefined;
732
+ request?: {
733
+ validator: {
734
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
735
+ value: string | number | string[] | number[];
736
+ }[];
737
+ name: string;
738
+ required: boolean;
739
+ }[] | undefined;
740
+ requestType?: string | undefined;
741
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
742
+ }>]>, "many">;
743
+ }, "strict", z.ZodTypeAny, {
744
+ name: string;
745
+ description: string;
746
+ baseUrl: string;
747
+ routes: ({
748
+ path: string;
749
+ type: "PAGED" | "ARRAY" | "ONE";
750
+ name: string;
751
+ table: string;
752
+ joins: {
753
+ type: "LEFT" | "INNER";
754
+ table: string;
755
+ custom?: string | undefined;
756
+ localColumnName?: string | undefined;
757
+ foreignColumnName?: string | undefined;
758
+ alias?: string | undefined;
759
+ }[];
760
+ where: {
761
+ value?: string | number | undefined;
762
+ custom?: string | undefined;
763
+ columnName?: string | undefined;
764
+ tableName?: string | undefined;
765
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
766
+ conjunction?: "AND" | "OR" | undefined;
767
+ }[];
768
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
769
+ description: string;
770
+ roles: string[];
771
+ assignments: {
772
+ value: string;
773
+ name: string;
774
+ }[];
775
+ request: {
776
+ validator: {
777
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
778
+ value: string | number | string[] | number[];
779
+ }[];
780
+ name: string;
781
+ required: boolean;
782
+ }[];
783
+ response: {
784
+ name: string;
785
+ selector?: string | undefined;
786
+ subquery?: {
787
+ table: string;
788
+ joins: {
789
+ type: "LEFT" | "INNER";
790
+ table: string;
791
+ custom?: string | undefined;
792
+ localColumnName?: string | undefined;
793
+ foreignColumnName?: string | undefined;
794
+ alias?: string | undefined;
795
+ }[];
796
+ where: {
797
+ value?: string | number | undefined;
798
+ custom?: string | undefined;
799
+ columnName?: string | undefined;
800
+ tableName?: string | undefined;
801
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
802
+ conjunction?: "AND" | "OR" | undefined;
803
+ }[];
804
+ properties: any[];
805
+ groupBy?: {
806
+ columnName: string;
807
+ tableName: string;
808
+ } | undefined;
809
+ orderBy?: {
810
+ columnName: string;
811
+ order: "ASC" | "DESC";
812
+ tableName: string;
813
+ } | undefined;
814
+ } | undefined;
815
+ }[];
816
+ groupBy?: {
817
+ columnName: string;
818
+ tableName: string;
819
+ } | undefined;
820
+ orderBy?: {
821
+ columnName: string;
822
+ order: "ASC" | "DESC";
823
+ tableName: string;
824
+ } | undefined;
825
+ } | {
826
+ path: string;
827
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
828
+ name: string;
829
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
830
+ description: string;
831
+ roles: string[];
832
+ responseType: string;
833
+ table?: undefined;
834
+ joins?: undefined;
835
+ assignments?: undefined;
836
+ request?: {
837
+ validator: {
838
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
839
+ value: string | number | string[] | number[];
840
+ }[];
841
+ name: string;
842
+ required: boolean;
843
+ }[] | undefined;
844
+ requestType?: string | undefined;
845
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
846
+ })[];
847
+ }, {
848
+ name: string;
849
+ description: string;
850
+ baseUrl: string;
851
+ routes: ({
852
+ path: string;
853
+ type: "PAGED" | "ARRAY" | "ONE";
854
+ name: string;
855
+ table: string;
856
+ joins: {
857
+ type: "LEFT" | "INNER";
858
+ table: string;
859
+ custom?: string | undefined;
860
+ localColumnName?: string | undefined;
861
+ foreignColumnName?: string | undefined;
862
+ alias?: string | undefined;
863
+ }[];
864
+ where: {
865
+ value?: string | number | undefined;
866
+ custom?: string | undefined;
867
+ columnName?: string | undefined;
868
+ tableName?: string | undefined;
869
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
870
+ conjunction?: "AND" | "OR" | undefined;
871
+ }[];
872
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
873
+ description: string;
874
+ roles: string[];
875
+ assignments: {
876
+ value: string;
877
+ name: string;
878
+ }[];
879
+ request: {
880
+ validator: {
881
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
882
+ value: string | number | string[] | number[];
883
+ }[];
884
+ name: string;
885
+ required: boolean;
886
+ }[];
887
+ response: {
888
+ name: string;
889
+ selector?: string | undefined;
890
+ subquery?: {
891
+ table: string;
892
+ joins: {
893
+ type: "LEFT" | "INNER";
894
+ table: string;
895
+ custom?: string | undefined;
896
+ localColumnName?: string | undefined;
897
+ foreignColumnName?: string | undefined;
898
+ alias?: string | undefined;
899
+ }[];
900
+ where: {
901
+ value?: string | number | undefined;
902
+ custom?: string | undefined;
903
+ columnName?: string | undefined;
904
+ tableName?: string | undefined;
905
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
906
+ conjunction?: "AND" | "OR" | undefined;
907
+ }[];
908
+ properties: any[];
909
+ groupBy?: {
910
+ columnName: string;
911
+ tableName: string;
912
+ } | undefined;
913
+ orderBy?: {
914
+ columnName: string;
915
+ order: "ASC" | "DESC";
916
+ tableName: string;
917
+ } | undefined;
918
+ } | undefined;
919
+ }[];
920
+ groupBy?: {
921
+ columnName: string;
922
+ tableName: string;
923
+ } | undefined;
924
+ orderBy?: {
925
+ columnName: string;
926
+ order: "ASC" | "DESC";
927
+ tableName: string;
928
+ } | undefined;
929
+ } | {
930
+ path: string;
931
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
932
+ name: string;
933
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
934
+ description: string;
935
+ roles: string[];
936
+ responseType: string;
937
+ table?: undefined;
938
+ joins?: undefined;
939
+ assignments?: undefined;
940
+ request?: {
941
+ validator: {
942
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
943
+ value: string | number | string[] | number[];
944
+ }[];
945
+ name: string;
946
+ required: boolean;
947
+ }[] | undefined;
948
+ requestType?: string | undefined;
949
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
950
+ })[];
951
+ }>, "many">;
952
+ globalParams: z.ZodArray<z.ZodString, "many">;
953
+ roles: z.ZodArray<z.ZodString, "many">;
954
+ customTypes: z.ZodString;
955
+ }, "strict", z.ZodTypeAny, {
956
+ roles: string[];
957
+ database: {
958
+ name: string;
959
+ roles: string[];
960
+ columns: {
961
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
962
+ name: string;
963
+ roles: string[];
964
+ isNullable: boolean;
965
+ length?: number | undefined;
966
+ value?: string | undefined;
967
+ default?: string | undefined;
968
+ comment?: string | undefined;
969
+ isPrimary?: boolean | undefined;
970
+ isUnique?: boolean | undefined;
971
+ hasAutoIncrement?: boolean | undefined;
972
+ }[];
973
+ indexes: {
974
+ order: "ASC" | "DESC";
975
+ name: string;
976
+ isUnique: boolean;
977
+ columns: string[];
978
+ isPrimaryKey: boolean;
979
+ }[];
980
+ foreignKeys: {
981
+ name: string;
982
+ column: string;
983
+ refTable: string;
984
+ refColumn: string;
985
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
986
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
987
+ }[];
988
+ checkConstraints: {
989
+ name: string;
990
+ check: string;
991
+ }[];
992
+ }[];
993
+ endpoints: {
994
+ name: string;
995
+ description: string;
996
+ baseUrl: string;
997
+ routes: ({
998
+ path: string;
999
+ type: "PAGED" | "ARRAY" | "ONE";
1000
+ name: string;
1001
+ table: string;
1002
+ joins: {
1003
+ type: "LEFT" | "INNER";
1004
+ table: string;
1005
+ custom?: string | undefined;
1006
+ localColumnName?: string | undefined;
1007
+ foreignColumnName?: string | undefined;
1008
+ alias?: string | undefined;
1009
+ }[];
1010
+ where: {
1011
+ value?: string | number | undefined;
1012
+ custom?: string | undefined;
1013
+ columnName?: string | undefined;
1014
+ tableName?: string | undefined;
1015
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1016
+ conjunction?: "AND" | "OR" | undefined;
1017
+ }[];
1018
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1019
+ description: string;
1020
+ roles: string[];
1021
+ assignments: {
1022
+ value: string;
1023
+ name: string;
1024
+ }[];
1025
+ request: {
1026
+ validator: {
1027
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1028
+ value: string | number | string[] | number[];
1029
+ }[];
1030
+ name: string;
1031
+ required: boolean;
1032
+ }[];
1033
+ response: {
1034
+ name: string;
1035
+ selector?: string | undefined;
1036
+ subquery?: {
1037
+ table: string;
1038
+ joins: {
1039
+ type: "LEFT" | "INNER";
1040
+ table: string;
1041
+ custom?: string | undefined;
1042
+ localColumnName?: string | undefined;
1043
+ foreignColumnName?: string | undefined;
1044
+ alias?: string | undefined;
1045
+ }[];
1046
+ where: {
1047
+ value?: string | number | undefined;
1048
+ custom?: string | undefined;
1049
+ columnName?: string | undefined;
1050
+ tableName?: string | undefined;
1051
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1052
+ conjunction?: "AND" | "OR" | undefined;
1053
+ }[];
1054
+ properties: any[];
1055
+ groupBy?: {
1056
+ columnName: string;
1057
+ tableName: string;
1058
+ } | undefined;
1059
+ orderBy?: {
1060
+ columnName: string;
1061
+ order: "ASC" | "DESC";
1062
+ tableName: string;
1063
+ } | undefined;
1064
+ } | undefined;
1065
+ }[];
1066
+ groupBy?: {
1067
+ columnName: string;
1068
+ tableName: string;
1069
+ } | undefined;
1070
+ orderBy?: {
1071
+ columnName: string;
1072
+ order: "ASC" | "DESC";
1073
+ tableName: string;
1074
+ } | undefined;
1075
+ } | {
1076
+ path: string;
1077
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
1078
+ name: string;
1079
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1080
+ description: string;
1081
+ roles: string[];
1082
+ responseType: string;
1083
+ table?: undefined;
1084
+ joins?: undefined;
1085
+ assignments?: undefined;
1086
+ request?: {
1087
+ validator: {
1088
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1089
+ value: string | number | string[] | number[];
1090
+ }[];
1091
+ name: string;
1092
+ required: boolean;
1093
+ }[] | undefined;
1094
+ requestType?: string | undefined;
1095
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
1096
+ })[];
1097
+ }[];
1098
+ globalParams: string[];
1099
+ customTypes: string;
1100
+ }, {
1101
+ roles: string[];
1102
+ database: {
1103
+ name: string;
1104
+ roles: string[];
1105
+ columns: {
1106
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "JSON" | "LONGBLOB" | "ENUM" | "DATETIME";
1107
+ name: string;
1108
+ roles: string[];
1109
+ isNullable: boolean;
1110
+ length?: number | undefined;
1111
+ value?: string | undefined;
1112
+ default?: string | undefined;
1113
+ comment?: string | undefined;
1114
+ isPrimary?: boolean | undefined;
1115
+ isUnique?: boolean | undefined;
1116
+ hasAutoIncrement?: boolean | undefined;
1117
+ }[];
1118
+ indexes: {
1119
+ order: "ASC" | "DESC";
1120
+ name: string;
1121
+ isUnique: boolean;
1122
+ columns: string[];
1123
+ isPrimaryKey: boolean;
1124
+ }[];
1125
+ foreignKeys: {
1126
+ name: string;
1127
+ column: string;
1128
+ refTable: string;
1129
+ refColumn: string;
1130
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1131
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1132
+ }[];
1133
+ checkConstraints: {
1134
+ name: string;
1135
+ check: string;
1136
+ }[];
1137
+ }[];
1138
+ endpoints: {
1139
+ name: string;
1140
+ description: string;
1141
+ baseUrl: string;
1142
+ routes: ({
1143
+ path: string;
1144
+ type: "PAGED" | "ARRAY" | "ONE";
1145
+ name: string;
1146
+ table: string;
1147
+ joins: {
1148
+ type: "LEFT" | "INNER";
1149
+ table: string;
1150
+ custom?: string | undefined;
1151
+ localColumnName?: string | undefined;
1152
+ foreignColumnName?: string | undefined;
1153
+ alias?: string | undefined;
1154
+ }[];
1155
+ where: {
1156
+ value?: string | number | undefined;
1157
+ custom?: string | undefined;
1158
+ columnName?: string | undefined;
1159
+ tableName?: string | undefined;
1160
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1161
+ conjunction?: "AND" | "OR" | undefined;
1162
+ }[];
1163
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1164
+ description: string;
1165
+ roles: string[];
1166
+ assignments: {
1167
+ value: string;
1168
+ name: string;
1169
+ }[];
1170
+ request: {
1171
+ validator: {
1172
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1173
+ value: string | number | string[] | number[];
1174
+ }[];
1175
+ name: string;
1176
+ required: boolean;
1177
+ }[];
1178
+ response: {
1179
+ name: string;
1180
+ selector?: string | undefined;
1181
+ subquery?: {
1182
+ table: string;
1183
+ joins: {
1184
+ type: "LEFT" | "INNER";
1185
+ table: string;
1186
+ custom?: string | undefined;
1187
+ localColumnName?: string | undefined;
1188
+ foreignColumnName?: string | undefined;
1189
+ alias?: string | undefined;
1190
+ }[];
1191
+ where: {
1192
+ value?: string | number | undefined;
1193
+ custom?: string | undefined;
1194
+ columnName?: string | undefined;
1195
+ tableName?: string | undefined;
1196
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1197
+ conjunction?: "AND" | "OR" | undefined;
1198
+ }[];
1199
+ properties: any[];
1200
+ groupBy?: {
1201
+ columnName: string;
1202
+ tableName: string;
1203
+ } | undefined;
1204
+ orderBy?: {
1205
+ columnName: string;
1206
+ order: "ASC" | "DESC";
1207
+ tableName: string;
1208
+ } | undefined;
1209
+ } | undefined;
1210
+ }[];
1211
+ groupBy?: {
1212
+ columnName: string;
1213
+ tableName: string;
1214
+ } | undefined;
1215
+ orderBy?: {
1216
+ columnName: string;
1217
+ order: "ASC" | "DESC";
1218
+ tableName: string;
1219
+ } | undefined;
1220
+ } | {
1221
+ path: string;
1222
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
1223
+ name: string;
1224
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1225
+ description: string;
1226
+ roles: string[];
1227
+ responseType: string;
1228
+ table?: undefined;
1229
+ joins?: undefined;
1230
+ assignments?: undefined;
1231
+ request?: {
1232
+ validator: {
1233
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1234
+ value: string | number | string[] | number[];
1235
+ }[];
1236
+ name: string;
1237
+ required: boolean;
1238
+ }[] | undefined;
1239
+ requestType?: string | undefined;
1240
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
1241
+ })[];
1242
+ }[];
1243
+ globalParams: string[];
1244
+ customTypes: string;
1245
+ }>;
1246
+ type ResturaSchema = z.infer<typeof resturaZodSchema>;
1247
+
1248
+ interface RequesterDetails {
1249
+ role?: string;
1250
+ host: string;
1251
+ ipAddress: string;
1252
+ [key: string]: string | number | undefined | null | boolean;
1253
+ }
1254
+ interface RsRequest<T = unknown> extends express.Request {
1255
+ requesterDetails: RequesterDetails;
1256
+ data: T;
1257
+ }
1258
+
1259
+ interface RoleWithOptionalUserDetails {
1260
+ role: string;
1261
+ [key: string]: string | number | boolean | object | null;
1262
+ }
1263
+ type AuthenticateHandler = (req: RsRequest<unknown>, onValid: (userDetails: RoleWithOptionalUserDetails) => void, onReject: (errorMessage: string) => void) => Promise<void>;
1264
+
1265
+ declare class PsqlPool {
1266
+ poolConfig: PoolConfig;
1267
+ pool: Pool;
1268
+ constructor(poolConfig: PoolConfig);
1269
+ queryOne(query: string, options: Array<any>): Promise<any>;
1270
+ runQuery(query: string, options: any[]): Promise<any[]>;
1271
+ }
2
1272
 
3
1273
  declare class ResturaEngine {
4
- init(app: express.Application): void;
1274
+ resturaConfig: ResturaConfigSchema;
1275
+ private resturaRouter;
1276
+ private publicEndpoints;
1277
+ private expressApp;
1278
+ private schema;
1279
+ private responseValidator;
1280
+ private authenticationHandler;
1281
+ private customTypeValidation;
1282
+ private psqlConnectionPool;
1283
+ private psqlEngine;
1284
+ /**
1285
+ * Initializes the Restura engine with the provided Express application.
1286
+ *
1287
+ * @param app - The Express application instance to initialize with Restura.
1288
+ * @returns A promise that resolves when the initialization is complete.
1289
+ */
1290
+ init(app: express.Application, authenticationHandler: AuthenticateHandler, psqlConnectionPool: PsqlPool): Promise<void>;
1291
+ /**
1292
+ * Determines if a given endpoint is public based on the HTTP method and full URL. This
1293
+ * is determined on whether the endpoint in the schema has no roles assigned to it.
1294
+ *
1295
+ * @param method - The HTTP method (e.g., 'GET', 'POST', 'PUT', 'PATCH', 'DELETE').
1296
+ * @param fullUrl - The full URL of the endpoint.
1297
+ * @returns A boolean indicating whether the endpoint is public.
1298
+ */
1299
+ isEndpointPublic(method: string, fullUrl: string): boolean;
1300
+ /**
1301
+ * Checks if an endpoint exists for a given HTTP method and full URL.
1302
+ *
1303
+ * @param method - The HTTP method to check (e.g., 'GET', 'POST', 'PUT', 'PATCH', 'DELETE').
1304
+ * @param fullUrl - The full URL of the endpoint to check.
1305
+ * @returns `true` if the endpoint exists, otherwise `false`.
1306
+ */
1307
+ doesEndpointExist(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', fullUrl: string): boolean;
1308
+ /**
1309
+ * Generates an API from the provided schema and writes it to the specified output file.
1310
+ *
1311
+ * @param outputFile - The path to the file where the generated API will be written.
1312
+ * @param providedSchema - The schema from which the API will be generated.
1313
+ * @returns A promise that resolves when the API has been successfully generated and written to the output file.
1314
+ */
1315
+ generateApiFromSchema(outputFile: string, providedSchema: ResturaSchema): Promise<void>;
1316
+ /**
1317
+ * Generates a model from the provided schema and writes it to the specified output file.
1318
+ *
1319
+ * @param outputFile - The path to the file where the generated model will be written.
1320
+ * @param providedSchema - The schema from which the model will be generated.
1321
+ * @returns A promise that resolves when the model has been successfully written to the output file.
1322
+ */
1323
+ generateModelFromSchema(outputFile: string, providedSchema: ResturaSchema): Promise<void>;
1324
+ /**
1325
+ * Retrieves the latest file system schema for Restura.
1326
+ *
1327
+ * @returns {Promise<ResturaSchema>} A promise that resolves to the latest Restura schema.
1328
+ * @throws {Error} If the schema file is missing or the schema is not valid.
1329
+ */
1330
+ getLatestFileSystemSchema(): Promise<ResturaSchema>;
1331
+ /**
1332
+ * Asynchronously generates and retrieves hashes for the provided schema and related generated files.
1333
+ *
1334
+ * @param providedSchema - The schema for which hashes need to be generated.
1335
+ * @returns A promise that resolves to an object containing:
1336
+ * - `schemaHash`: The hash of the provided schema.
1337
+ * - `apiCreatedSchemaHash`: The hash extracted from the generated `api.d.ts` file.
1338
+ * - `modelCreatedSchemaHash`: The hash extracted from the generated `models.d.ts` file.
1339
+ */
1340
+ getHashes(providedSchema: ResturaSchema): Promise<{
1341
+ schemaHash: string;
1342
+ apiCreatedSchemaHash: string;
1343
+ modelCreatedSchemaHash: string;
1344
+ }>;
1345
+ private reloadEndpoints;
1346
+ private validateGeneratedTypesFolder;
5
1347
  private resturaAuthentication;
1348
+ private previewCreateSchema;
1349
+ private updateSchema;
1350
+ private updateTypes;
1351
+ private getSchema;
1352
+ private getSchemaAndTypes;
1353
+ private executeRouteLogic;
1354
+ private isCustomRoute;
1355
+ private generateHashForSchema;
1356
+ private storeFileSystemSchema;
1357
+ private resetPublicEndpoints;
1358
+ private validateAuthorization;
1359
+ private getRouteData;
6
1360
  }
7
1361
  declare const restura: ResturaEngine;
8
1362
 
9
- export { restura };
1363
+ export { PsqlPool, logger, restura };