@restura/core 0.1.0-alpha.5 → 0.1.0-alpha.7

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