@restura/core 0.1.0-alpha.3 → 0.1.0-alpha.31

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.mts CHANGED
@@ -1,3 +1,2611 @@
1
- declare function isEven(value: number): boolean;
1
+ import winston from 'winston';
2
+ import { UUID } from 'crypto';
3
+ import * as express from 'express';
4
+ import { IncomingHttpHeaders } from 'http2';
5
+ import { z } from 'zod';
6
+ import { QueryResultRow, QueryConfigValues, QueryResult, PoolConfig, Pool, ClientConfig, Client } from 'pg';
2
7
 
3
- export { isEven };
8
+ declare const logger: winston.Logger;
9
+
10
+ interface RsErrorInternalData {
11
+ err: ErrorCode;
12
+ msg: string;
13
+ stack: string;
14
+ status: number;
15
+ message?: string;
16
+ }
17
+ declare enum HtmlStatusCodes {
18
+ BAD_REQUEST = 400,
19
+ UNAUTHORIZED = 401,
20
+ FORBIDDEN = 403,
21
+ NOT_FOUND = 404,
22
+ METHOD_NOT_ALLOWED = 405,
23
+ CONFLICT = 409,
24
+ VERSION_OUT_OF_DATE = 418,// Technically this is the I'm a teapot code that was a joke.
25
+ SERVER_ERROR = 500,
26
+ SERVICE_UNAVAILABLE = 503,
27
+ NETWORK_CONNECT_TIMEOUT = 599
28
+ }
29
+ type ErrorCode = 'UNKNOWN_ERROR' | 'NOT_FOUND' | 'EMAIL_TAKEN' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'CONFLICT' | 'UPDATE_FORBIDDEN' | 'CREATE_FORBIDDEN' | 'DELETE_FORBIDDEN' | 'DELETE_FAILURE' | 'BAD_REQUEST' | 'INVALID_TOKEN' | 'INCORRECT_EMAIL_OR_PASSWORD' | 'DUPLICATE_TOKEN' | 'DUPLICATE_USERNAME' | 'DUPLICATE_EMAIL' | 'DUPLICATE' | 'EMAIL_NOT_VERIFIED' | 'UPDATE_WITHOUT_ID' | 'CONNECTION_ERROR' | 'INVALID_PAYMENT' | 'DECLINED_PAYMENT' | 'INTEGRATION_ERROR' | 'CANNOT_RESERVE' | 'REFUND_FAILURE' | 'INVALID_INVOICE' | 'INVALID_COUPON' | 'SERVICE_UNAVAILABLE' | 'METHOD_UNALLOWED' | 'LOGIN_EXPIRED' | 'THIRD_PARTY_ERROR' | 'ACCESS_DENIED' | 'DATABASE_ERROR' | 'SCHEMA_ERROR';
30
+ declare class RsError {
31
+ err: ErrorCode;
32
+ msg: string;
33
+ status?: number;
34
+ stack: string;
35
+ constructor(errCode: ErrorCode, message?: string);
36
+ static htmlStatus(code: ErrorCode): number;
37
+ static isRsError(error: unknown): error is RsError;
38
+ }
39
+
40
+ interface SchemaChangeValue {
41
+ name: string;
42
+ changeType: 'NEW' | 'MODIFIED' | 'DELETED';
43
+ }
44
+ interface SchemaPreview {
45
+ commands: string;
46
+ endPoints: SchemaChangeValue[];
47
+ globalParams: SchemaChangeValue[];
48
+ roles: SchemaChangeValue[];
49
+ customTypes: boolean;
50
+ }
51
+ type StandardOrderTypes = 'ASC' | 'DESC' | 'RAND' | 'NONE';
52
+ type ConjunctionTypes = 'AND' | 'OR';
53
+ type MatchTypes = 'exact' | 'fuzzy' | 'like' | 'greaterThan' | 'greaterThanEqual' | 'lessThan' | 'lessThanEqual';
54
+ interface RsResponseData<T> {
55
+ data: T;
56
+ }
57
+ interface RsErrorData {
58
+ err: string;
59
+ msg: string;
60
+ stack?: string;
61
+ }
62
+ interface RsPagedResponseData<T> extends RsResponseData<T> {
63
+ total: number;
64
+ }
65
+ interface PageQuery {
66
+ page: number;
67
+ perPage: number;
68
+ sortBy: string;
69
+ sortOrder: StandardOrderTypes;
70
+ filter?: string;
71
+ [key: string]: string | number | boolean | object | null | undefined;
72
+ }
73
+ interface AuthenticationUserDetails {
74
+ role: string;
75
+ userId?: number;
76
+ [key: string]: string | number | boolean | object | null | undefined;
77
+ }
78
+ type ValidAuthenticationCallback = (userDetails: AuthenticationUserDetails) => void;
79
+ type AuthenticateHandler = (req: RsRequest<unknown>, res: RsResponse<unknown>, onValid: ValidAuthenticationCallback) => Promise<void>;
80
+
81
+ interface RsHeaders extends IncomingHttpHeaders {
82
+ 'x-auth-token'?: string;
83
+ }
84
+ type ApiMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
85
+ type RequesterDetails<T extends object = {}> = {
86
+ role: string;
87
+ host: string;
88
+ ipAddress: string;
89
+ userId?: number;
90
+ isSystemUser?: boolean;
91
+ } & T;
92
+ interface RsRequest<T = unknown, U extends object = Record<string, unknown>> extends express.Request {
93
+ requesterDetails: RequesterDetails<U>;
94
+ data: T;
95
+ }
96
+ type DynamicObject<T = unknown> = {
97
+ [key: string]: T;
98
+ };
99
+ interface RsResponse<T = unknown> extends express.Response {
100
+ sendData: (data: T, statusCode?: number) => void;
101
+ sendNoWrap: (data: T, statusCode?: number) => void;
102
+ sendError: (err: ErrorCode, msg: string, htmlStatusCode?: HtmlStatusCodes, stack?: string) => void;
103
+ sendPaginated: (pagedData: RsPagedResponseData<T>, statusCode?: number) => void;
104
+ _contentLength?: number;
105
+ }
106
+ type RsRouteHandler<T = unknown, U = unknown> = (req: RsRequest<T>, res: RsResponse<U>, next?: express.NextFunction) => Promise<void>;
107
+ interface AsyncExpressApplication {
108
+ get: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
109
+ post: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
110
+ put: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
111
+ patch: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
112
+ delete: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
113
+ }
114
+
115
+ type EventType = 'DATABASE_ROW_DELETE' | 'DATABASE_ROW_INSERT' | 'DATABASE_COLUMN_UPDATE' | 'WEBHOOK';
116
+ type MutationType = 'INSERT' | 'UPDATE' | 'DELETE';
117
+ interface SqlMutationData {
118
+ mutationType: MutationType;
119
+ queryMetadata: QueryMetadata;
120
+ }
121
+ interface DatabaseActionData {
122
+ tableName: string;
123
+ queryMetadata: QueryMetadata;
124
+ }
125
+ interface ActionRowInsertData<T = DynamicObject> extends DatabaseActionData {
126
+ insertId: number;
127
+ insertObject: T;
128
+ }
129
+ interface ActionRowDeleteData<T = DynamicObject> extends DatabaseActionData {
130
+ deletedRow: T;
131
+ }
132
+ interface ActionColumnChangeData<T = DynamicObject> extends DatabaseActionData {
133
+ tableName: string;
134
+ rowId: number;
135
+ newData: T;
136
+ oldData: T;
137
+ }
138
+ interface ActionRowInsertFilter {
139
+ tableName: string;
140
+ }
141
+ interface ActionRowDeleteFilter {
142
+ tableName: string;
143
+ }
144
+ interface ActionColumnChangeFilter {
145
+ tableName: string;
146
+ columns: string[];
147
+ }
148
+ type TriggerResult = {
149
+ table: string;
150
+ insertId?: number;
151
+ query: string;
152
+ record: DynamicObject;
153
+ previousRecord: DynamicObject;
154
+ requesterId: number;
155
+ };
156
+ type QueryMetadata = RequesterDetails & {
157
+ connectionInstanceId: UUID;
158
+ };
159
+ declare class EventManager {
160
+ private actionHandlers;
161
+ addRowInsertHandler<T>(onInsert: (data: ActionRowInsertData<T>, queryMetadata: QueryMetadata) => Promise<void>, filter?: ActionRowInsertFilter): void;
162
+ addColumnChangeHandler<T>(onUpdate: (data: ActionColumnChangeData<T>, queryMetadata: QueryMetadata) => Promise<void>, filter: ActionColumnChangeFilter): void;
163
+ addRowDeleteHandler<T>(onDelete: (data: ActionRowDeleteData<T>, queryMetadata: QueryMetadata) => Promise<void>, filter?: ActionRowDeleteFilter): void;
164
+ fireActionFromDbTrigger(sqlMutationData: SqlMutationData, result: TriggerResult): Promise<void>;
165
+ private fireInsertActions;
166
+ private fireDeleteActions;
167
+ private fireUpdateActions;
168
+ private hasHandlersForEventType;
169
+ }
170
+ declare const eventManager: EventManager;
171
+
172
+ declare const resturaConfigSchema: z.ZodObject<{
173
+ authToken: z.ZodString;
174
+ sendErrorStackTrace: z.ZodDefault<z.ZodBoolean>;
175
+ schemaFilePath: z.ZodDefault<z.ZodString>;
176
+ customApiFolderPath: z.ZodDefault<z.ZodString>;
177
+ generatedTypesPath: z.ZodDefault<z.ZodString>;
178
+ fileTempCachePath: z.ZodOptional<z.ZodString>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ authToken: string;
181
+ sendErrorStackTrace: boolean;
182
+ schemaFilePath: string;
183
+ customApiFolderPath: string;
184
+ generatedTypesPath: string;
185
+ fileTempCachePath?: string | undefined;
186
+ }, {
187
+ authToken: string;
188
+ sendErrorStackTrace?: boolean | undefined;
189
+ schemaFilePath?: string | undefined;
190
+ customApiFolderPath?: string | undefined;
191
+ generatedTypesPath?: string | undefined;
192
+ fileTempCachePath?: string | undefined;
193
+ }>;
194
+ type ResturaConfigSchema = z.infer<typeof resturaConfigSchema>;
195
+
196
+ declare const whereDataSchema: z.ZodObject<{
197
+ tableName: z.ZodOptional<z.ZodString>;
198
+ columnName: z.ZodOptional<z.ZodString>;
199
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
200
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
201
+ custom: z.ZodOptional<z.ZodString>;
202
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
203
+ }, "strict", z.ZodTypeAny, {
204
+ value?: string | number | undefined;
205
+ custom?: string | undefined;
206
+ tableName?: string | undefined;
207
+ columnName?: string | undefined;
208
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
209
+ conjunction?: "AND" | "OR" | undefined;
210
+ }, {
211
+ value?: string | number | undefined;
212
+ custom?: string | undefined;
213
+ tableName?: string | undefined;
214
+ columnName?: string | undefined;
215
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
216
+ conjunction?: "AND" | "OR" | undefined;
217
+ }>;
218
+ type WhereData = z.infer<typeof whereDataSchema>;
219
+ declare const joinDataSchema: z.ZodObject<{
220
+ table: z.ZodString;
221
+ localColumnName: z.ZodOptional<z.ZodString>;
222
+ foreignColumnName: z.ZodOptional<z.ZodString>;
223
+ custom: z.ZodOptional<z.ZodString>;
224
+ type: z.ZodEnum<["LEFT", "INNER"]>;
225
+ alias: z.ZodOptional<z.ZodString>;
226
+ }, "strict", z.ZodTypeAny, {
227
+ type: "LEFT" | "INNER";
228
+ table: string;
229
+ custom?: string | undefined;
230
+ localColumnName?: string | undefined;
231
+ foreignColumnName?: string | undefined;
232
+ alias?: string | undefined;
233
+ }, {
234
+ type: "LEFT" | "INNER";
235
+ table: string;
236
+ custom?: string | undefined;
237
+ localColumnName?: string | undefined;
238
+ foreignColumnName?: string | undefined;
239
+ alias?: string | undefined;
240
+ }>;
241
+ type JoinData = z.infer<typeof joinDataSchema>;
242
+ declare const responseDataSchema: z.ZodObject<{
243
+ name: z.ZodString;
244
+ selector: z.ZodOptional<z.ZodString>;
245
+ subquery: z.ZodOptional<z.ZodObject<{
246
+ table: z.ZodString;
247
+ joins: z.ZodArray<z.ZodObject<{
248
+ table: z.ZodString;
249
+ localColumnName: z.ZodOptional<z.ZodString>;
250
+ foreignColumnName: z.ZodOptional<z.ZodString>;
251
+ custom: z.ZodOptional<z.ZodString>;
252
+ type: z.ZodEnum<["LEFT", "INNER"]>;
253
+ alias: z.ZodOptional<z.ZodString>;
254
+ }, "strict", z.ZodTypeAny, {
255
+ type: "LEFT" | "INNER";
256
+ table: string;
257
+ custom?: string | undefined;
258
+ localColumnName?: string | undefined;
259
+ foreignColumnName?: string | undefined;
260
+ alias?: string | undefined;
261
+ }, {
262
+ type: "LEFT" | "INNER";
263
+ table: string;
264
+ custom?: string | undefined;
265
+ localColumnName?: string | undefined;
266
+ foreignColumnName?: string | undefined;
267
+ alias?: string | undefined;
268
+ }>, "many">;
269
+ where: z.ZodArray<z.ZodObject<{
270
+ tableName: z.ZodOptional<z.ZodString>;
271
+ columnName: z.ZodOptional<z.ZodString>;
272
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
273
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
274
+ custom: z.ZodOptional<z.ZodString>;
275
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
276
+ }, "strict", z.ZodTypeAny, {
277
+ value?: string | number | undefined;
278
+ custom?: string | undefined;
279
+ tableName?: string | undefined;
280
+ columnName?: string | undefined;
281
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
282
+ conjunction?: "AND" | "OR" | undefined;
283
+ }, {
284
+ value?: string | number | undefined;
285
+ custom?: string | undefined;
286
+ tableName?: string | undefined;
287
+ columnName?: string | undefined;
288
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
289
+ conjunction?: "AND" | "OR" | undefined;
290
+ }>, "many">;
291
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
292
+ groupBy: z.ZodOptional<z.ZodObject<{
293
+ columnName: z.ZodString;
294
+ tableName: z.ZodString;
295
+ }, "strict", z.ZodTypeAny, {
296
+ tableName: string;
297
+ columnName: string;
298
+ }, {
299
+ tableName: string;
300
+ columnName: string;
301
+ }>>;
302
+ orderBy: z.ZodOptional<z.ZodObject<{
303
+ columnName: z.ZodString;
304
+ order: z.ZodEnum<["ASC", "DESC"]>;
305
+ tableName: z.ZodString;
306
+ }, "strict", z.ZodTypeAny, {
307
+ tableName: string;
308
+ columnName: string;
309
+ order: "ASC" | "DESC";
310
+ }, {
311
+ tableName: string;
312
+ columnName: string;
313
+ order: "ASC" | "DESC";
314
+ }>>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ table: string;
317
+ joins: {
318
+ type: "LEFT" | "INNER";
319
+ table: string;
320
+ custom?: string | undefined;
321
+ localColumnName?: string | undefined;
322
+ foreignColumnName?: string | undefined;
323
+ alias?: string | undefined;
324
+ }[];
325
+ where: {
326
+ value?: string | number | undefined;
327
+ custom?: string | undefined;
328
+ tableName?: string | undefined;
329
+ columnName?: string | undefined;
330
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
331
+ conjunction?: "AND" | "OR" | undefined;
332
+ }[];
333
+ properties: any[];
334
+ groupBy?: {
335
+ tableName: string;
336
+ columnName: string;
337
+ } | undefined;
338
+ orderBy?: {
339
+ tableName: string;
340
+ columnName: string;
341
+ order: "ASC" | "DESC";
342
+ } | undefined;
343
+ }, {
344
+ table: string;
345
+ joins: {
346
+ type: "LEFT" | "INNER";
347
+ table: string;
348
+ custom?: string | undefined;
349
+ localColumnName?: string | undefined;
350
+ foreignColumnName?: string | undefined;
351
+ alias?: string | undefined;
352
+ }[];
353
+ where: {
354
+ value?: string | number | undefined;
355
+ custom?: string | undefined;
356
+ tableName?: string | undefined;
357
+ columnName?: string | undefined;
358
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
359
+ conjunction?: "AND" | "OR" | undefined;
360
+ }[];
361
+ properties: any[];
362
+ groupBy?: {
363
+ tableName: string;
364
+ columnName: string;
365
+ } | undefined;
366
+ orderBy?: {
367
+ tableName: string;
368
+ columnName: string;
369
+ order: "ASC" | "DESC";
370
+ } | undefined;
371
+ }>>;
372
+ }, "strict", z.ZodTypeAny, {
373
+ name: string;
374
+ selector?: string | undefined;
375
+ subquery?: {
376
+ table: string;
377
+ joins: {
378
+ type: "LEFT" | "INNER";
379
+ table: string;
380
+ custom?: string | undefined;
381
+ localColumnName?: string | undefined;
382
+ foreignColumnName?: string | undefined;
383
+ alias?: string | undefined;
384
+ }[];
385
+ where: {
386
+ value?: string | number | undefined;
387
+ custom?: string | undefined;
388
+ tableName?: string | undefined;
389
+ columnName?: string | undefined;
390
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
391
+ conjunction?: "AND" | "OR" | undefined;
392
+ }[];
393
+ properties: any[];
394
+ groupBy?: {
395
+ tableName: string;
396
+ columnName: string;
397
+ } | undefined;
398
+ orderBy?: {
399
+ tableName: string;
400
+ columnName: string;
401
+ order: "ASC" | "DESC";
402
+ } | undefined;
403
+ } | undefined;
404
+ }, {
405
+ name: string;
406
+ selector?: string | undefined;
407
+ subquery?: {
408
+ table: string;
409
+ joins: {
410
+ type: "LEFT" | "INNER";
411
+ table: string;
412
+ custom?: string | undefined;
413
+ localColumnName?: string | undefined;
414
+ foreignColumnName?: string | undefined;
415
+ alias?: string | undefined;
416
+ }[];
417
+ where: {
418
+ value?: string | number | undefined;
419
+ custom?: string | undefined;
420
+ tableName?: string | undefined;
421
+ columnName?: string | undefined;
422
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
423
+ conjunction?: "AND" | "OR" | undefined;
424
+ }[];
425
+ properties: any[];
426
+ groupBy?: {
427
+ tableName: string;
428
+ columnName: string;
429
+ } | undefined;
430
+ orderBy?: {
431
+ tableName: string;
432
+ columnName: string;
433
+ order: "ASC" | "DESC";
434
+ } | undefined;
435
+ } | undefined;
436
+ }>;
437
+ type ResponseData = z.infer<typeof responseDataSchema>;
438
+ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
439
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
440
+ name: z.ZodString;
441
+ description: z.ZodString;
442
+ path: z.ZodString;
443
+ roles: z.ZodArray<z.ZodString, "many">;
444
+ }, {
445
+ type: z.ZodEnum<["ONE", "ARRAY", "PAGED"]>;
446
+ table: z.ZodString;
447
+ joins: z.ZodArray<z.ZodObject<{
448
+ table: z.ZodString;
449
+ localColumnName: z.ZodOptional<z.ZodString>;
450
+ foreignColumnName: z.ZodOptional<z.ZodString>;
451
+ custom: z.ZodOptional<z.ZodString>;
452
+ type: z.ZodEnum<["LEFT", "INNER"]>;
453
+ alias: z.ZodOptional<z.ZodString>;
454
+ }, "strict", z.ZodTypeAny, {
455
+ type: "LEFT" | "INNER";
456
+ table: string;
457
+ custom?: string | undefined;
458
+ localColumnName?: string | undefined;
459
+ foreignColumnName?: string | undefined;
460
+ alias?: string | undefined;
461
+ }, {
462
+ type: "LEFT" | "INNER";
463
+ table: string;
464
+ custom?: string | undefined;
465
+ localColumnName?: string | undefined;
466
+ foreignColumnName?: string | undefined;
467
+ alias?: string | undefined;
468
+ }>, "many">;
469
+ assignments: z.ZodArray<z.ZodObject<{
470
+ name: z.ZodString;
471
+ value: z.ZodString;
472
+ }, "strict", z.ZodTypeAny, {
473
+ value: string;
474
+ name: string;
475
+ }, {
476
+ value: string;
477
+ name: string;
478
+ }>, "many">;
479
+ where: z.ZodArray<z.ZodObject<{
480
+ tableName: z.ZodOptional<z.ZodString>;
481
+ columnName: z.ZodOptional<z.ZodString>;
482
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
483
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
484
+ custom: z.ZodOptional<z.ZodString>;
485
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
486
+ }, "strict", z.ZodTypeAny, {
487
+ value?: string | number | undefined;
488
+ custom?: string | undefined;
489
+ tableName?: string | undefined;
490
+ columnName?: string | undefined;
491
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
492
+ conjunction?: "AND" | "OR" | undefined;
493
+ }, {
494
+ value?: string | number | undefined;
495
+ custom?: string | undefined;
496
+ tableName?: string | undefined;
497
+ columnName?: string | undefined;
498
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
499
+ conjunction?: "AND" | "OR" | undefined;
500
+ }>, "many">;
501
+ request: z.ZodArray<z.ZodObject<{
502
+ name: z.ZodString;
503
+ required: z.ZodBoolean;
504
+ isNullable: z.ZodOptional<z.ZodBoolean>;
505
+ validator: z.ZodArray<z.ZodObject<{
506
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
507
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
508
+ }, "strict", z.ZodTypeAny, {
509
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
510
+ value: string | number | string[] | number[];
511
+ }, {
512
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
513
+ value: string | number | string[] | number[];
514
+ }>, "many">;
515
+ }, "strict", z.ZodTypeAny, {
516
+ name: string;
517
+ required: boolean;
518
+ validator: {
519
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
520
+ value: string | number | string[] | number[];
521
+ }[];
522
+ isNullable?: boolean | undefined;
523
+ }, {
524
+ name: string;
525
+ required: boolean;
526
+ validator: {
527
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
528
+ value: string | number | string[] | number[];
529
+ }[];
530
+ isNullable?: boolean | undefined;
531
+ }>, "many">;
532
+ response: z.ZodArray<z.ZodObject<{
533
+ name: z.ZodString;
534
+ selector: z.ZodOptional<z.ZodString>;
535
+ subquery: z.ZodOptional<z.ZodObject<{
536
+ table: z.ZodString;
537
+ joins: z.ZodArray<z.ZodObject<{
538
+ table: z.ZodString;
539
+ localColumnName: z.ZodOptional<z.ZodString>;
540
+ foreignColumnName: z.ZodOptional<z.ZodString>;
541
+ custom: z.ZodOptional<z.ZodString>;
542
+ type: z.ZodEnum<["LEFT", "INNER"]>;
543
+ alias: z.ZodOptional<z.ZodString>;
544
+ }, "strict", z.ZodTypeAny, {
545
+ type: "LEFT" | "INNER";
546
+ table: string;
547
+ custom?: string | undefined;
548
+ localColumnName?: string | undefined;
549
+ foreignColumnName?: string | undefined;
550
+ alias?: string | undefined;
551
+ }, {
552
+ type: "LEFT" | "INNER";
553
+ table: string;
554
+ custom?: string | undefined;
555
+ localColumnName?: string | undefined;
556
+ foreignColumnName?: string | undefined;
557
+ alias?: string | undefined;
558
+ }>, "many">;
559
+ where: z.ZodArray<z.ZodObject<{
560
+ tableName: z.ZodOptional<z.ZodString>;
561
+ columnName: z.ZodOptional<z.ZodString>;
562
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
563
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
564
+ custom: z.ZodOptional<z.ZodString>;
565
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
566
+ }, "strict", z.ZodTypeAny, {
567
+ value?: string | number | undefined;
568
+ custom?: string | undefined;
569
+ tableName?: string | undefined;
570
+ columnName?: string | undefined;
571
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
572
+ conjunction?: "AND" | "OR" | undefined;
573
+ }, {
574
+ value?: string | number | undefined;
575
+ custom?: string | undefined;
576
+ tableName?: string | undefined;
577
+ columnName?: string | undefined;
578
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
579
+ conjunction?: "AND" | "OR" | undefined;
580
+ }>, "many">;
581
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
582
+ groupBy: z.ZodOptional<z.ZodObject<{
583
+ columnName: z.ZodString;
584
+ tableName: z.ZodString;
585
+ }, "strict", z.ZodTypeAny, {
586
+ tableName: string;
587
+ columnName: string;
588
+ }, {
589
+ tableName: string;
590
+ columnName: string;
591
+ }>>;
592
+ orderBy: z.ZodOptional<z.ZodObject<{
593
+ columnName: z.ZodString;
594
+ order: z.ZodEnum<["ASC", "DESC"]>;
595
+ tableName: z.ZodString;
596
+ }, "strict", z.ZodTypeAny, {
597
+ tableName: string;
598
+ columnName: string;
599
+ order: "ASC" | "DESC";
600
+ }, {
601
+ tableName: string;
602
+ columnName: string;
603
+ order: "ASC" | "DESC";
604
+ }>>;
605
+ }, "strip", z.ZodTypeAny, {
606
+ table: string;
607
+ joins: {
608
+ type: "LEFT" | "INNER";
609
+ table: string;
610
+ custom?: string | undefined;
611
+ localColumnName?: string | undefined;
612
+ foreignColumnName?: string | undefined;
613
+ alias?: string | undefined;
614
+ }[];
615
+ where: {
616
+ value?: string | number | undefined;
617
+ custom?: string | undefined;
618
+ tableName?: string | undefined;
619
+ columnName?: string | undefined;
620
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
621
+ conjunction?: "AND" | "OR" | undefined;
622
+ }[];
623
+ properties: any[];
624
+ groupBy?: {
625
+ tableName: string;
626
+ columnName: string;
627
+ } | undefined;
628
+ orderBy?: {
629
+ tableName: string;
630
+ columnName: string;
631
+ order: "ASC" | "DESC";
632
+ } | undefined;
633
+ }, {
634
+ table: string;
635
+ joins: {
636
+ type: "LEFT" | "INNER";
637
+ table: string;
638
+ custom?: string | undefined;
639
+ localColumnName?: string | undefined;
640
+ foreignColumnName?: string | undefined;
641
+ alias?: string | undefined;
642
+ }[];
643
+ where: {
644
+ value?: string | number | undefined;
645
+ custom?: string | undefined;
646
+ tableName?: string | undefined;
647
+ columnName?: string | undefined;
648
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
649
+ conjunction?: "AND" | "OR" | undefined;
650
+ }[];
651
+ properties: any[];
652
+ groupBy?: {
653
+ tableName: string;
654
+ columnName: string;
655
+ } | undefined;
656
+ orderBy?: {
657
+ tableName: string;
658
+ columnName: string;
659
+ order: "ASC" | "DESC";
660
+ } | undefined;
661
+ }>>;
662
+ }, "strict", z.ZodTypeAny, {
663
+ name: string;
664
+ selector?: string | undefined;
665
+ subquery?: {
666
+ table: string;
667
+ joins: {
668
+ type: "LEFT" | "INNER";
669
+ table: string;
670
+ custom?: string | undefined;
671
+ localColumnName?: string | undefined;
672
+ foreignColumnName?: string | undefined;
673
+ alias?: string | undefined;
674
+ }[];
675
+ where: {
676
+ value?: string | number | undefined;
677
+ custom?: string | undefined;
678
+ tableName?: string | undefined;
679
+ columnName?: string | undefined;
680
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
681
+ conjunction?: "AND" | "OR" | undefined;
682
+ }[];
683
+ properties: any[];
684
+ groupBy?: {
685
+ tableName: string;
686
+ columnName: string;
687
+ } | undefined;
688
+ orderBy?: {
689
+ tableName: string;
690
+ columnName: string;
691
+ order: "ASC" | "DESC";
692
+ } | undefined;
693
+ } | undefined;
694
+ }, {
695
+ name: string;
696
+ selector?: string | undefined;
697
+ subquery?: {
698
+ table: string;
699
+ joins: {
700
+ type: "LEFT" | "INNER";
701
+ table: string;
702
+ custom?: string | undefined;
703
+ localColumnName?: string | undefined;
704
+ foreignColumnName?: string | undefined;
705
+ alias?: string | undefined;
706
+ }[];
707
+ where: {
708
+ value?: string | number | undefined;
709
+ custom?: string | undefined;
710
+ tableName?: string | undefined;
711
+ columnName?: string | undefined;
712
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
713
+ conjunction?: "AND" | "OR" | undefined;
714
+ }[];
715
+ properties: any[];
716
+ groupBy?: {
717
+ tableName: string;
718
+ columnName: string;
719
+ } | undefined;
720
+ orderBy?: {
721
+ tableName: string;
722
+ columnName: string;
723
+ order: "ASC" | "DESC";
724
+ } | undefined;
725
+ } | undefined;
726
+ }>, "many">;
727
+ groupBy: z.ZodOptional<z.ZodObject<{
728
+ columnName: z.ZodString;
729
+ tableName: z.ZodString;
730
+ }, "strict", z.ZodTypeAny, {
731
+ tableName: string;
732
+ columnName: string;
733
+ }, {
734
+ tableName: string;
735
+ columnName: string;
736
+ }>>;
737
+ orderBy: z.ZodOptional<z.ZodObject<{
738
+ columnName: z.ZodString;
739
+ order: z.ZodEnum<["ASC", "DESC"]>;
740
+ tableName: z.ZodString;
741
+ }, "strict", z.ZodTypeAny, {
742
+ tableName: string;
743
+ columnName: string;
744
+ order: "ASC" | "DESC";
745
+ }, {
746
+ tableName: string;
747
+ columnName: string;
748
+ order: "ASC" | "DESC";
749
+ }>>;
750
+ }>, "strict", z.ZodTypeAny, {
751
+ path: string;
752
+ type: "ONE" | "ARRAY" | "PAGED";
753
+ name: string;
754
+ table: string;
755
+ joins: {
756
+ type: "LEFT" | "INNER";
757
+ table: string;
758
+ custom?: string | undefined;
759
+ localColumnName?: string | undefined;
760
+ foreignColumnName?: string | undefined;
761
+ alias?: string | undefined;
762
+ }[];
763
+ where: {
764
+ value?: string | number | undefined;
765
+ custom?: string | undefined;
766
+ tableName?: string | undefined;
767
+ columnName?: string | undefined;
768
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
769
+ conjunction?: "AND" | "OR" | undefined;
770
+ }[];
771
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
772
+ description: string;
773
+ roles: string[];
774
+ assignments: {
775
+ value: string;
776
+ name: string;
777
+ }[];
778
+ request: {
779
+ name: string;
780
+ required: boolean;
781
+ validator: {
782
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
783
+ value: string | number | string[] | number[];
784
+ }[];
785
+ isNullable?: boolean | undefined;
786
+ }[];
787
+ response: {
788
+ name: string;
789
+ selector?: string | undefined;
790
+ subquery?: {
791
+ table: string;
792
+ joins: {
793
+ type: "LEFT" | "INNER";
794
+ table: string;
795
+ custom?: string | undefined;
796
+ localColumnName?: string | undefined;
797
+ foreignColumnName?: string | undefined;
798
+ alias?: string | undefined;
799
+ }[];
800
+ where: {
801
+ value?: string | number | undefined;
802
+ custom?: string | undefined;
803
+ tableName?: string | undefined;
804
+ columnName?: string | undefined;
805
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
806
+ conjunction?: "AND" | "OR" | undefined;
807
+ }[];
808
+ properties: any[];
809
+ groupBy?: {
810
+ tableName: string;
811
+ columnName: string;
812
+ } | undefined;
813
+ orderBy?: {
814
+ tableName: string;
815
+ columnName: string;
816
+ order: "ASC" | "DESC";
817
+ } | undefined;
818
+ } | undefined;
819
+ }[];
820
+ groupBy?: {
821
+ tableName: string;
822
+ columnName: string;
823
+ } | undefined;
824
+ orderBy?: {
825
+ tableName: string;
826
+ columnName: string;
827
+ order: "ASC" | "DESC";
828
+ } | undefined;
829
+ }, {
830
+ path: string;
831
+ type: "ONE" | "ARRAY" | "PAGED";
832
+ name: string;
833
+ table: string;
834
+ joins: {
835
+ type: "LEFT" | "INNER";
836
+ table: string;
837
+ custom?: string | undefined;
838
+ localColumnName?: string | undefined;
839
+ foreignColumnName?: string | undefined;
840
+ alias?: string | undefined;
841
+ }[];
842
+ where: {
843
+ value?: string | number | undefined;
844
+ custom?: string | undefined;
845
+ tableName?: string | undefined;
846
+ columnName?: string | undefined;
847
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
848
+ conjunction?: "AND" | "OR" | undefined;
849
+ }[];
850
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
851
+ description: string;
852
+ roles: string[];
853
+ assignments: {
854
+ value: string;
855
+ name: string;
856
+ }[];
857
+ request: {
858
+ name: string;
859
+ required: boolean;
860
+ validator: {
861
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
862
+ value: string | number | string[] | number[];
863
+ }[];
864
+ isNullable?: boolean | undefined;
865
+ }[];
866
+ response: {
867
+ name: string;
868
+ selector?: string | undefined;
869
+ subquery?: {
870
+ table: string;
871
+ joins: {
872
+ type: "LEFT" | "INNER";
873
+ table: string;
874
+ custom?: string | undefined;
875
+ localColumnName?: string | undefined;
876
+ foreignColumnName?: string | undefined;
877
+ alias?: string | undefined;
878
+ }[];
879
+ where: {
880
+ value?: string | number | undefined;
881
+ custom?: string | undefined;
882
+ tableName?: string | undefined;
883
+ columnName?: string | undefined;
884
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
885
+ conjunction?: "AND" | "OR" | undefined;
886
+ }[];
887
+ properties: any[];
888
+ groupBy?: {
889
+ tableName: string;
890
+ columnName: string;
891
+ } | undefined;
892
+ orderBy?: {
893
+ tableName: string;
894
+ columnName: string;
895
+ order: "ASC" | "DESC";
896
+ } | undefined;
897
+ } | undefined;
898
+ }[];
899
+ groupBy?: {
900
+ tableName: string;
901
+ columnName: string;
902
+ } | undefined;
903
+ orderBy?: {
904
+ tableName: string;
905
+ columnName: string;
906
+ order: "ASC" | "DESC";
907
+ } | undefined;
908
+ }>;
909
+ type StandardRouteData = z.infer<typeof standardRouteSchema>;
910
+ declare const customRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
911
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
912
+ name: z.ZodString;
913
+ description: z.ZodString;
914
+ path: z.ZodString;
915
+ roles: z.ZodArray<z.ZodString, "many">;
916
+ }, {
917
+ type: z.ZodEnum<["CUSTOM_ONE", "CUSTOM_ARRAY", "CUSTOM_PAGED"]>;
918
+ responseType: z.ZodUnion<[z.ZodString, z.ZodEnum<["string", "number", "boolean"]>]>;
919
+ requestType: z.ZodOptional<z.ZodString>;
920
+ request: z.ZodOptional<z.ZodArray<z.ZodObject<{
921
+ name: z.ZodString;
922
+ required: z.ZodBoolean;
923
+ isNullable: z.ZodOptional<z.ZodBoolean>;
924
+ validator: z.ZodArray<z.ZodObject<{
925
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
926
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
927
+ }, "strict", z.ZodTypeAny, {
928
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
929
+ value: string | number | string[] | number[];
930
+ }, {
931
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
932
+ value: string | number | string[] | number[];
933
+ }>, "many">;
934
+ }, "strict", z.ZodTypeAny, {
935
+ name: string;
936
+ required: boolean;
937
+ validator: {
938
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
939
+ value: string | number | string[] | number[];
940
+ }[];
941
+ isNullable?: boolean | undefined;
942
+ }, {
943
+ name: string;
944
+ required: boolean;
945
+ validator: {
946
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
947
+ value: string | number | string[] | number[];
948
+ }[];
949
+ isNullable?: boolean | undefined;
950
+ }>, "many">>;
951
+ table: z.ZodUndefined;
952
+ joins: z.ZodUndefined;
953
+ assignments: z.ZodUndefined;
954
+ fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
955
+ }>, "strict", z.ZodTypeAny, {
956
+ path: string;
957
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
958
+ name: string;
959
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
960
+ description: string;
961
+ roles: string[];
962
+ responseType: string;
963
+ table?: undefined;
964
+ joins?: undefined;
965
+ assignments?: undefined;
966
+ request?: {
967
+ name: string;
968
+ required: boolean;
969
+ validator: {
970
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
971
+ value: string | number | string[] | number[];
972
+ }[];
973
+ isNullable?: boolean | undefined;
974
+ }[] | undefined;
975
+ requestType?: string | undefined;
976
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
977
+ }, {
978
+ path: string;
979
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
980
+ name: string;
981
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
982
+ description: string;
983
+ roles: string[];
984
+ responseType: string;
985
+ table?: undefined;
986
+ joins?: undefined;
987
+ assignments?: undefined;
988
+ request?: {
989
+ name: string;
990
+ required: boolean;
991
+ validator: {
992
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
993
+ value: string | number | string[] | number[];
994
+ }[];
995
+ isNullable?: boolean | undefined;
996
+ }[] | undefined;
997
+ requestType?: string | undefined;
998
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
999
+ }>;
1000
+ type CustomRouteData = z.infer<typeof customRouteSchema>;
1001
+ type RouteData = CustomRouteData | StandardRouteData;
1002
+ declare const tableDataSchema: z.ZodObject<{
1003
+ name: z.ZodString;
1004
+ columns: z.ZodArray<z.ZodObject<{
1005
+ name: z.ZodString;
1006
+ 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<["JSON", "JSONB"]>, 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"]>]>;
1007
+ isNullable: z.ZodBoolean;
1008
+ roles: z.ZodArray<z.ZodString, "many">;
1009
+ comment: z.ZodOptional<z.ZodString>;
1010
+ default: z.ZodOptional<z.ZodString>;
1011
+ value: z.ZodOptional<z.ZodString>;
1012
+ isPrimary: z.ZodOptional<z.ZodBoolean>;
1013
+ isUnique: z.ZodOptional<z.ZodBoolean>;
1014
+ hasAutoIncrement: z.ZodOptional<z.ZodBoolean>;
1015
+ length: z.ZodOptional<z.ZodNumber>;
1016
+ }, "strict", z.ZodTypeAny, {
1017
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1018
+ name: string;
1019
+ isNullable: boolean;
1020
+ roles: string[];
1021
+ length?: number | undefined;
1022
+ value?: string | undefined;
1023
+ default?: string | undefined;
1024
+ comment?: string | undefined;
1025
+ isPrimary?: boolean | undefined;
1026
+ isUnique?: boolean | undefined;
1027
+ hasAutoIncrement?: boolean | undefined;
1028
+ }, {
1029
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1030
+ name: string;
1031
+ isNullable: boolean;
1032
+ roles: string[];
1033
+ length?: number | undefined;
1034
+ value?: string | undefined;
1035
+ default?: string | undefined;
1036
+ comment?: string | undefined;
1037
+ isPrimary?: boolean | undefined;
1038
+ isUnique?: boolean | undefined;
1039
+ hasAutoIncrement?: boolean | undefined;
1040
+ }>, "many">;
1041
+ indexes: z.ZodArray<z.ZodObject<{
1042
+ name: z.ZodString;
1043
+ columns: z.ZodArray<z.ZodString, "many">;
1044
+ isUnique: z.ZodBoolean;
1045
+ isPrimaryKey: z.ZodBoolean;
1046
+ order: z.ZodEnum<["ASC", "DESC"]>;
1047
+ }, "strict", z.ZodTypeAny, {
1048
+ order: "ASC" | "DESC";
1049
+ name: string;
1050
+ isUnique: boolean;
1051
+ columns: string[];
1052
+ isPrimaryKey: boolean;
1053
+ }, {
1054
+ order: "ASC" | "DESC";
1055
+ name: string;
1056
+ isUnique: boolean;
1057
+ columns: string[];
1058
+ isPrimaryKey: boolean;
1059
+ }>, "many">;
1060
+ foreignKeys: z.ZodArray<z.ZodObject<{
1061
+ name: z.ZodString;
1062
+ column: z.ZodString;
1063
+ refTable: z.ZodString;
1064
+ refColumn: z.ZodString;
1065
+ onDelete: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
1066
+ onUpdate: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
1067
+ }, "strict", z.ZodTypeAny, {
1068
+ name: string;
1069
+ column: string;
1070
+ refTable: string;
1071
+ refColumn: string;
1072
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1073
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1074
+ }, {
1075
+ name: string;
1076
+ column: string;
1077
+ refTable: string;
1078
+ refColumn: string;
1079
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1080
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1081
+ }>, "many">;
1082
+ checkConstraints: z.ZodArray<z.ZodObject<{
1083
+ name: z.ZodString;
1084
+ check: z.ZodString;
1085
+ }, "strict", z.ZodTypeAny, {
1086
+ name: string;
1087
+ check: string;
1088
+ }, {
1089
+ name: string;
1090
+ check: string;
1091
+ }>, "many">;
1092
+ roles: z.ZodArray<z.ZodString, "many">;
1093
+ }, "strict", z.ZodTypeAny, {
1094
+ name: string;
1095
+ roles: string[];
1096
+ columns: {
1097
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1098
+ name: string;
1099
+ isNullable: boolean;
1100
+ roles: string[];
1101
+ length?: number | undefined;
1102
+ value?: string | undefined;
1103
+ default?: string | undefined;
1104
+ comment?: string | undefined;
1105
+ isPrimary?: boolean | undefined;
1106
+ isUnique?: boolean | undefined;
1107
+ hasAutoIncrement?: boolean | undefined;
1108
+ }[];
1109
+ indexes: {
1110
+ order: "ASC" | "DESC";
1111
+ name: string;
1112
+ isUnique: boolean;
1113
+ columns: string[];
1114
+ isPrimaryKey: boolean;
1115
+ }[];
1116
+ foreignKeys: {
1117
+ name: string;
1118
+ column: string;
1119
+ refTable: string;
1120
+ refColumn: string;
1121
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1122
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1123
+ }[];
1124
+ checkConstraints: {
1125
+ name: string;
1126
+ check: string;
1127
+ }[];
1128
+ }, {
1129
+ name: string;
1130
+ roles: string[];
1131
+ columns: {
1132
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1133
+ name: string;
1134
+ isNullable: boolean;
1135
+ roles: string[];
1136
+ length?: number | undefined;
1137
+ value?: string | undefined;
1138
+ default?: string | undefined;
1139
+ comment?: string | undefined;
1140
+ isPrimary?: boolean | undefined;
1141
+ isUnique?: boolean | undefined;
1142
+ hasAutoIncrement?: boolean | undefined;
1143
+ }[];
1144
+ indexes: {
1145
+ order: "ASC" | "DESC";
1146
+ name: string;
1147
+ isUnique: boolean;
1148
+ columns: string[];
1149
+ isPrimaryKey: boolean;
1150
+ }[];
1151
+ foreignKeys: {
1152
+ name: string;
1153
+ column: string;
1154
+ refTable: string;
1155
+ refColumn: string;
1156
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1157
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1158
+ }[];
1159
+ checkConstraints: {
1160
+ name: string;
1161
+ check: string;
1162
+ }[];
1163
+ }>;
1164
+ type TableData = z.infer<typeof tableDataSchema>;
1165
+ declare const resturaSchema: z.ZodObject<{
1166
+ database: z.ZodArray<z.ZodObject<{
1167
+ name: z.ZodString;
1168
+ columns: z.ZodArray<z.ZodObject<{
1169
+ name: z.ZodString;
1170
+ 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<["JSON", "JSONB"]>, 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"]>]>;
1171
+ isNullable: z.ZodBoolean;
1172
+ roles: z.ZodArray<z.ZodString, "many">;
1173
+ comment: z.ZodOptional<z.ZodString>;
1174
+ default: z.ZodOptional<z.ZodString>;
1175
+ value: z.ZodOptional<z.ZodString>;
1176
+ isPrimary: z.ZodOptional<z.ZodBoolean>;
1177
+ isUnique: z.ZodOptional<z.ZodBoolean>;
1178
+ hasAutoIncrement: z.ZodOptional<z.ZodBoolean>;
1179
+ length: z.ZodOptional<z.ZodNumber>;
1180
+ }, "strict", z.ZodTypeAny, {
1181
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1182
+ name: string;
1183
+ isNullable: boolean;
1184
+ roles: string[];
1185
+ length?: number | undefined;
1186
+ value?: string | undefined;
1187
+ default?: string | undefined;
1188
+ comment?: string | undefined;
1189
+ isPrimary?: boolean | undefined;
1190
+ isUnique?: boolean | undefined;
1191
+ hasAutoIncrement?: boolean | undefined;
1192
+ }, {
1193
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1194
+ name: string;
1195
+ isNullable: boolean;
1196
+ roles: string[];
1197
+ length?: number | undefined;
1198
+ value?: string | undefined;
1199
+ default?: string | undefined;
1200
+ comment?: string | undefined;
1201
+ isPrimary?: boolean | undefined;
1202
+ isUnique?: boolean | undefined;
1203
+ hasAutoIncrement?: boolean | undefined;
1204
+ }>, "many">;
1205
+ indexes: z.ZodArray<z.ZodObject<{
1206
+ name: z.ZodString;
1207
+ columns: z.ZodArray<z.ZodString, "many">;
1208
+ isUnique: z.ZodBoolean;
1209
+ isPrimaryKey: z.ZodBoolean;
1210
+ order: z.ZodEnum<["ASC", "DESC"]>;
1211
+ }, "strict", z.ZodTypeAny, {
1212
+ order: "ASC" | "DESC";
1213
+ name: string;
1214
+ isUnique: boolean;
1215
+ columns: string[];
1216
+ isPrimaryKey: boolean;
1217
+ }, {
1218
+ order: "ASC" | "DESC";
1219
+ name: string;
1220
+ isUnique: boolean;
1221
+ columns: string[];
1222
+ isPrimaryKey: boolean;
1223
+ }>, "many">;
1224
+ foreignKeys: z.ZodArray<z.ZodObject<{
1225
+ name: z.ZodString;
1226
+ column: z.ZodString;
1227
+ refTable: z.ZodString;
1228
+ refColumn: z.ZodString;
1229
+ onDelete: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
1230
+ onUpdate: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
1231
+ }, "strict", z.ZodTypeAny, {
1232
+ name: string;
1233
+ column: string;
1234
+ refTable: string;
1235
+ refColumn: string;
1236
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1237
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1238
+ }, {
1239
+ name: string;
1240
+ column: string;
1241
+ refTable: string;
1242
+ refColumn: string;
1243
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1244
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1245
+ }>, "many">;
1246
+ checkConstraints: z.ZodArray<z.ZodObject<{
1247
+ name: z.ZodString;
1248
+ check: z.ZodString;
1249
+ }, "strict", z.ZodTypeAny, {
1250
+ name: string;
1251
+ check: string;
1252
+ }, {
1253
+ name: string;
1254
+ check: string;
1255
+ }>, "many">;
1256
+ roles: z.ZodArray<z.ZodString, "many">;
1257
+ }, "strict", z.ZodTypeAny, {
1258
+ name: string;
1259
+ roles: string[];
1260
+ columns: {
1261
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1262
+ name: string;
1263
+ isNullable: boolean;
1264
+ roles: string[];
1265
+ length?: number | undefined;
1266
+ value?: string | undefined;
1267
+ default?: string | undefined;
1268
+ comment?: string | undefined;
1269
+ isPrimary?: boolean | undefined;
1270
+ isUnique?: boolean | undefined;
1271
+ hasAutoIncrement?: boolean | undefined;
1272
+ }[];
1273
+ indexes: {
1274
+ order: "ASC" | "DESC";
1275
+ name: string;
1276
+ isUnique: boolean;
1277
+ columns: string[];
1278
+ isPrimaryKey: boolean;
1279
+ }[];
1280
+ foreignKeys: {
1281
+ name: string;
1282
+ column: string;
1283
+ refTable: string;
1284
+ refColumn: string;
1285
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1286
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1287
+ }[];
1288
+ checkConstraints: {
1289
+ name: string;
1290
+ check: string;
1291
+ }[];
1292
+ }, {
1293
+ name: string;
1294
+ roles: string[];
1295
+ columns: {
1296
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
1297
+ name: string;
1298
+ isNullable: boolean;
1299
+ roles: string[];
1300
+ length?: number | undefined;
1301
+ value?: string | undefined;
1302
+ default?: string | undefined;
1303
+ comment?: string | undefined;
1304
+ isPrimary?: boolean | undefined;
1305
+ isUnique?: boolean | undefined;
1306
+ hasAutoIncrement?: boolean | undefined;
1307
+ }[];
1308
+ indexes: {
1309
+ order: "ASC" | "DESC";
1310
+ name: string;
1311
+ isUnique: boolean;
1312
+ columns: string[];
1313
+ isPrimaryKey: boolean;
1314
+ }[];
1315
+ foreignKeys: {
1316
+ name: string;
1317
+ column: string;
1318
+ refTable: string;
1319
+ refColumn: string;
1320
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1321
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1322
+ }[];
1323
+ checkConstraints: {
1324
+ name: string;
1325
+ check: string;
1326
+ }[];
1327
+ }>, "many">;
1328
+ endpoints: z.ZodArray<z.ZodObject<{
1329
+ name: z.ZodString;
1330
+ description: z.ZodString;
1331
+ baseUrl: z.ZodString;
1332
+ routes: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
1333
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
1334
+ name: z.ZodString;
1335
+ description: z.ZodString;
1336
+ path: z.ZodString;
1337
+ roles: z.ZodArray<z.ZodString, "many">;
1338
+ }, {
1339
+ type: z.ZodEnum<["ONE", "ARRAY", "PAGED"]>;
1340
+ table: z.ZodString;
1341
+ joins: z.ZodArray<z.ZodObject<{
1342
+ table: z.ZodString;
1343
+ localColumnName: z.ZodOptional<z.ZodString>;
1344
+ foreignColumnName: z.ZodOptional<z.ZodString>;
1345
+ custom: z.ZodOptional<z.ZodString>;
1346
+ type: z.ZodEnum<["LEFT", "INNER"]>;
1347
+ alias: z.ZodOptional<z.ZodString>;
1348
+ }, "strict", z.ZodTypeAny, {
1349
+ type: "LEFT" | "INNER";
1350
+ table: string;
1351
+ custom?: string | undefined;
1352
+ localColumnName?: string | undefined;
1353
+ foreignColumnName?: string | undefined;
1354
+ alias?: string | undefined;
1355
+ }, {
1356
+ type: "LEFT" | "INNER";
1357
+ table: string;
1358
+ custom?: string | undefined;
1359
+ localColumnName?: string | undefined;
1360
+ foreignColumnName?: string | undefined;
1361
+ alias?: string | undefined;
1362
+ }>, "many">;
1363
+ assignments: z.ZodArray<z.ZodObject<{
1364
+ name: z.ZodString;
1365
+ value: z.ZodString;
1366
+ }, "strict", z.ZodTypeAny, {
1367
+ value: string;
1368
+ name: string;
1369
+ }, {
1370
+ value: string;
1371
+ name: string;
1372
+ }>, "many">;
1373
+ where: z.ZodArray<z.ZodObject<{
1374
+ tableName: z.ZodOptional<z.ZodString>;
1375
+ columnName: z.ZodOptional<z.ZodString>;
1376
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
1377
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1378
+ custom: z.ZodOptional<z.ZodString>;
1379
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
1380
+ }, "strict", z.ZodTypeAny, {
1381
+ value?: string | number | undefined;
1382
+ custom?: string | undefined;
1383
+ tableName?: string | undefined;
1384
+ columnName?: string | undefined;
1385
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1386
+ conjunction?: "AND" | "OR" | undefined;
1387
+ }, {
1388
+ value?: string | number | undefined;
1389
+ custom?: string | undefined;
1390
+ tableName?: string | undefined;
1391
+ columnName?: string | undefined;
1392
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1393
+ conjunction?: "AND" | "OR" | undefined;
1394
+ }>, "many">;
1395
+ request: z.ZodArray<z.ZodObject<{
1396
+ name: z.ZodString;
1397
+ required: z.ZodBoolean;
1398
+ isNullable: z.ZodOptional<z.ZodBoolean>;
1399
+ validator: z.ZodArray<z.ZodObject<{
1400
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
1401
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
1402
+ }, "strict", z.ZodTypeAny, {
1403
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1404
+ value: string | number | string[] | number[];
1405
+ }, {
1406
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1407
+ value: string | number | string[] | number[];
1408
+ }>, "many">;
1409
+ }, "strict", z.ZodTypeAny, {
1410
+ name: string;
1411
+ required: boolean;
1412
+ validator: {
1413
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1414
+ value: string | number | string[] | number[];
1415
+ }[];
1416
+ isNullable?: boolean | undefined;
1417
+ }, {
1418
+ name: string;
1419
+ required: boolean;
1420
+ validator: {
1421
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1422
+ value: string | number | string[] | number[];
1423
+ }[];
1424
+ isNullable?: boolean | undefined;
1425
+ }>, "many">;
1426
+ response: z.ZodArray<z.ZodObject<{
1427
+ name: z.ZodString;
1428
+ selector: z.ZodOptional<z.ZodString>;
1429
+ subquery: z.ZodOptional<z.ZodObject<{
1430
+ table: z.ZodString;
1431
+ joins: z.ZodArray<z.ZodObject<{
1432
+ table: z.ZodString;
1433
+ localColumnName: z.ZodOptional<z.ZodString>;
1434
+ foreignColumnName: z.ZodOptional<z.ZodString>;
1435
+ custom: z.ZodOptional<z.ZodString>;
1436
+ type: z.ZodEnum<["LEFT", "INNER"]>;
1437
+ alias: z.ZodOptional<z.ZodString>;
1438
+ }, "strict", z.ZodTypeAny, {
1439
+ type: "LEFT" | "INNER";
1440
+ table: string;
1441
+ custom?: string | undefined;
1442
+ localColumnName?: string | undefined;
1443
+ foreignColumnName?: string | undefined;
1444
+ alias?: string | undefined;
1445
+ }, {
1446
+ type: "LEFT" | "INNER";
1447
+ table: string;
1448
+ custom?: string | undefined;
1449
+ localColumnName?: string | undefined;
1450
+ foreignColumnName?: string | undefined;
1451
+ alias?: string | undefined;
1452
+ }>, "many">;
1453
+ where: z.ZodArray<z.ZodObject<{
1454
+ tableName: z.ZodOptional<z.ZodString>;
1455
+ columnName: z.ZodOptional<z.ZodString>;
1456
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH", "IS", "IS NOT"]>>;
1457
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1458
+ custom: z.ZodOptional<z.ZodString>;
1459
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
1460
+ }, "strict", z.ZodTypeAny, {
1461
+ value?: string | number | undefined;
1462
+ custom?: string | undefined;
1463
+ tableName?: string | undefined;
1464
+ columnName?: string | undefined;
1465
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1466
+ conjunction?: "AND" | "OR" | undefined;
1467
+ }, {
1468
+ value?: string | number | undefined;
1469
+ custom?: string | undefined;
1470
+ tableName?: string | undefined;
1471
+ columnName?: string | undefined;
1472
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1473
+ conjunction?: "AND" | "OR" | undefined;
1474
+ }>, "many">;
1475
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
1476
+ groupBy: z.ZodOptional<z.ZodObject<{
1477
+ columnName: z.ZodString;
1478
+ tableName: z.ZodString;
1479
+ }, "strict", z.ZodTypeAny, {
1480
+ tableName: string;
1481
+ columnName: string;
1482
+ }, {
1483
+ tableName: string;
1484
+ columnName: string;
1485
+ }>>;
1486
+ orderBy: z.ZodOptional<z.ZodObject<{
1487
+ columnName: z.ZodString;
1488
+ order: z.ZodEnum<["ASC", "DESC"]>;
1489
+ tableName: z.ZodString;
1490
+ }, "strict", z.ZodTypeAny, {
1491
+ tableName: string;
1492
+ columnName: string;
1493
+ order: "ASC" | "DESC";
1494
+ }, {
1495
+ tableName: string;
1496
+ columnName: string;
1497
+ order: "ASC" | "DESC";
1498
+ }>>;
1499
+ }, "strip", z.ZodTypeAny, {
1500
+ table: string;
1501
+ joins: {
1502
+ type: "LEFT" | "INNER";
1503
+ table: string;
1504
+ custom?: string | undefined;
1505
+ localColumnName?: string | undefined;
1506
+ foreignColumnName?: string | undefined;
1507
+ alias?: string | undefined;
1508
+ }[];
1509
+ where: {
1510
+ value?: string | number | undefined;
1511
+ custom?: string | undefined;
1512
+ tableName?: string | undefined;
1513
+ columnName?: string | undefined;
1514
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1515
+ conjunction?: "AND" | "OR" | undefined;
1516
+ }[];
1517
+ properties: any[];
1518
+ groupBy?: {
1519
+ tableName: string;
1520
+ columnName: string;
1521
+ } | undefined;
1522
+ orderBy?: {
1523
+ tableName: string;
1524
+ columnName: string;
1525
+ order: "ASC" | "DESC";
1526
+ } | undefined;
1527
+ }, {
1528
+ table: string;
1529
+ joins: {
1530
+ type: "LEFT" | "INNER";
1531
+ table: string;
1532
+ custom?: string | undefined;
1533
+ localColumnName?: string | undefined;
1534
+ foreignColumnName?: string | undefined;
1535
+ alias?: string | undefined;
1536
+ }[];
1537
+ where: {
1538
+ value?: string | number | undefined;
1539
+ custom?: string | undefined;
1540
+ tableName?: string | undefined;
1541
+ columnName?: string | undefined;
1542
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1543
+ conjunction?: "AND" | "OR" | undefined;
1544
+ }[];
1545
+ properties: any[];
1546
+ groupBy?: {
1547
+ tableName: string;
1548
+ columnName: string;
1549
+ } | undefined;
1550
+ orderBy?: {
1551
+ tableName: string;
1552
+ columnName: string;
1553
+ order: "ASC" | "DESC";
1554
+ } | undefined;
1555
+ }>>;
1556
+ }, "strict", z.ZodTypeAny, {
1557
+ name: string;
1558
+ selector?: string | undefined;
1559
+ subquery?: {
1560
+ table: string;
1561
+ joins: {
1562
+ type: "LEFT" | "INNER";
1563
+ table: string;
1564
+ custom?: string | undefined;
1565
+ localColumnName?: string | undefined;
1566
+ foreignColumnName?: string | undefined;
1567
+ alias?: string | undefined;
1568
+ }[];
1569
+ where: {
1570
+ value?: string | number | undefined;
1571
+ custom?: string | undefined;
1572
+ tableName?: string | undefined;
1573
+ columnName?: string | undefined;
1574
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1575
+ conjunction?: "AND" | "OR" | undefined;
1576
+ }[];
1577
+ properties: any[];
1578
+ groupBy?: {
1579
+ tableName: string;
1580
+ columnName: string;
1581
+ } | undefined;
1582
+ orderBy?: {
1583
+ tableName: string;
1584
+ columnName: string;
1585
+ order: "ASC" | "DESC";
1586
+ } | undefined;
1587
+ } | undefined;
1588
+ }, {
1589
+ name: string;
1590
+ selector?: string | undefined;
1591
+ subquery?: {
1592
+ table: string;
1593
+ joins: {
1594
+ type: "LEFT" | "INNER";
1595
+ table: string;
1596
+ custom?: string | undefined;
1597
+ localColumnName?: string | undefined;
1598
+ foreignColumnName?: string | undefined;
1599
+ alias?: string | undefined;
1600
+ }[];
1601
+ where: {
1602
+ value?: string | number | undefined;
1603
+ custom?: string | undefined;
1604
+ tableName?: string | undefined;
1605
+ columnName?: string | undefined;
1606
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1607
+ conjunction?: "AND" | "OR" | undefined;
1608
+ }[];
1609
+ properties: any[];
1610
+ groupBy?: {
1611
+ tableName: string;
1612
+ columnName: string;
1613
+ } | undefined;
1614
+ orderBy?: {
1615
+ tableName: string;
1616
+ columnName: string;
1617
+ order: "ASC" | "DESC";
1618
+ } | undefined;
1619
+ } | undefined;
1620
+ }>, "many">;
1621
+ groupBy: z.ZodOptional<z.ZodObject<{
1622
+ columnName: z.ZodString;
1623
+ tableName: z.ZodString;
1624
+ }, "strict", z.ZodTypeAny, {
1625
+ tableName: string;
1626
+ columnName: string;
1627
+ }, {
1628
+ tableName: string;
1629
+ columnName: string;
1630
+ }>>;
1631
+ orderBy: z.ZodOptional<z.ZodObject<{
1632
+ columnName: z.ZodString;
1633
+ order: z.ZodEnum<["ASC", "DESC"]>;
1634
+ tableName: z.ZodString;
1635
+ }, "strict", z.ZodTypeAny, {
1636
+ tableName: string;
1637
+ columnName: string;
1638
+ order: "ASC" | "DESC";
1639
+ }, {
1640
+ tableName: string;
1641
+ columnName: string;
1642
+ order: "ASC" | "DESC";
1643
+ }>>;
1644
+ }>, "strict", z.ZodTypeAny, {
1645
+ path: string;
1646
+ type: "ONE" | "ARRAY" | "PAGED";
1647
+ name: string;
1648
+ table: string;
1649
+ joins: {
1650
+ type: "LEFT" | "INNER";
1651
+ table: string;
1652
+ custom?: string | undefined;
1653
+ localColumnName?: string | undefined;
1654
+ foreignColumnName?: string | undefined;
1655
+ alias?: string | undefined;
1656
+ }[];
1657
+ where: {
1658
+ value?: string | number | undefined;
1659
+ custom?: string | undefined;
1660
+ tableName?: string | undefined;
1661
+ columnName?: string | undefined;
1662
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1663
+ conjunction?: "AND" | "OR" | undefined;
1664
+ }[];
1665
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1666
+ description: string;
1667
+ roles: string[];
1668
+ assignments: {
1669
+ value: string;
1670
+ name: string;
1671
+ }[];
1672
+ request: {
1673
+ name: string;
1674
+ required: boolean;
1675
+ validator: {
1676
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1677
+ value: string | number | string[] | number[];
1678
+ }[];
1679
+ isNullable?: boolean | undefined;
1680
+ }[];
1681
+ response: {
1682
+ name: string;
1683
+ selector?: string | undefined;
1684
+ subquery?: {
1685
+ table: string;
1686
+ joins: {
1687
+ type: "LEFT" | "INNER";
1688
+ table: string;
1689
+ custom?: string | undefined;
1690
+ localColumnName?: string | undefined;
1691
+ foreignColumnName?: string | undefined;
1692
+ alias?: string | undefined;
1693
+ }[];
1694
+ where: {
1695
+ value?: string | number | undefined;
1696
+ custom?: string | undefined;
1697
+ tableName?: string | undefined;
1698
+ columnName?: string | undefined;
1699
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1700
+ conjunction?: "AND" | "OR" | undefined;
1701
+ }[];
1702
+ properties: any[];
1703
+ groupBy?: {
1704
+ tableName: string;
1705
+ columnName: string;
1706
+ } | undefined;
1707
+ orderBy?: {
1708
+ tableName: string;
1709
+ columnName: string;
1710
+ order: "ASC" | "DESC";
1711
+ } | undefined;
1712
+ } | undefined;
1713
+ }[];
1714
+ groupBy?: {
1715
+ tableName: string;
1716
+ columnName: string;
1717
+ } | undefined;
1718
+ orderBy?: {
1719
+ tableName: string;
1720
+ columnName: string;
1721
+ order: "ASC" | "DESC";
1722
+ } | undefined;
1723
+ }, {
1724
+ path: string;
1725
+ type: "ONE" | "ARRAY" | "PAGED";
1726
+ name: string;
1727
+ table: string;
1728
+ joins: {
1729
+ type: "LEFT" | "INNER";
1730
+ table: string;
1731
+ custom?: string | undefined;
1732
+ localColumnName?: string | undefined;
1733
+ foreignColumnName?: string | undefined;
1734
+ alias?: string | undefined;
1735
+ }[];
1736
+ where: {
1737
+ value?: string | number | undefined;
1738
+ custom?: string | undefined;
1739
+ tableName?: string | undefined;
1740
+ columnName?: string | undefined;
1741
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1742
+ conjunction?: "AND" | "OR" | undefined;
1743
+ }[];
1744
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1745
+ description: string;
1746
+ roles: string[];
1747
+ assignments: {
1748
+ value: string;
1749
+ name: string;
1750
+ }[];
1751
+ request: {
1752
+ name: string;
1753
+ required: boolean;
1754
+ validator: {
1755
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1756
+ value: string | number | string[] | number[];
1757
+ }[];
1758
+ isNullable?: boolean | undefined;
1759
+ }[];
1760
+ response: {
1761
+ name: string;
1762
+ selector?: string | undefined;
1763
+ subquery?: {
1764
+ table: string;
1765
+ joins: {
1766
+ type: "LEFT" | "INNER";
1767
+ table: string;
1768
+ custom?: string | undefined;
1769
+ localColumnName?: string | undefined;
1770
+ foreignColumnName?: string | undefined;
1771
+ alias?: string | undefined;
1772
+ }[];
1773
+ where: {
1774
+ value?: string | number | undefined;
1775
+ custom?: string | undefined;
1776
+ tableName?: string | undefined;
1777
+ columnName?: string | undefined;
1778
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1779
+ conjunction?: "AND" | "OR" | undefined;
1780
+ }[];
1781
+ properties: any[];
1782
+ groupBy?: {
1783
+ tableName: string;
1784
+ columnName: string;
1785
+ } | undefined;
1786
+ orderBy?: {
1787
+ tableName: string;
1788
+ columnName: string;
1789
+ order: "ASC" | "DESC";
1790
+ } | undefined;
1791
+ } | undefined;
1792
+ }[];
1793
+ groupBy?: {
1794
+ tableName: string;
1795
+ columnName: string;
1796
+ } | undefined;
1797
+ orderBy?: {
1798
+ tableName: string;
1799
+ columnName: string;
1800
+ order: "ASC" | "DESC";
1801
+ } | undefined;
1802
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1803
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
1804
+ name: z.ZodString;
1805
+ description: z.ZodString;
1806
+ path: z.ZodString;
1807
+ roles: z.ZodArray<z.ZodString, "many">;
1808
+ }, {
1809
+ type: z.ZodEnum<["CUSTOM_ONE", "CUSTOM_ARRAY", "CUSTOM_PAGED"]>;
1810
+ responseType: z.ZodUnion<[z.ZodString, z.ZodEnum<["string", "number", "boolean"]>]>;
1811
+ requestType: z.ZodOptional<z.ZodString>;
1812
+ request: z.ZodOptional<z.ZodArray<z.ZodObject<{
1813
+ name: z.ZodString;
1814
+ required: z.ZodBoolean;
1815
+ isNullable: z.ZodOptional<z.ZodBoolean>;
1816
+ validator: z.ZodArray<z.ZodObject<{
1817
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
1818
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
1819
+ }, "strict", z.ZodTypeAny, {
1820
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1821
+ value: string | number | string[] | number[];
1822
+ }, {
1823
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1824
+ value: string | number | string[] | number[];
1825
+ }>, "many">;
1826
+ }, "strict", z.ZodTypeAny, {
1827
+ name: string;
1828
+ required: boolean;
1829
+ validator: {
1830
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1831
+ value: string | number | string[] | number[];
1832
+ }[];
1833
+ isNullable?: boolean | undefined;
1834
+ }, {
1835
+ name: string;
1836
+ required: boolean;
1837
+ validator: {
1838
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1839
+ value: string | number | string[] | number[];
1840
+ }[];
1841
+ isNullable?: boolean | undefined;
1842
+ }>, "many">>;
1843
+ table: z.ZodUndefined;
1844
+ joins: z.ZodUndefined;
1845
+ assignments: z.ZodUndefined;
1846
+ fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
1847
+ }>, "strict", z.ZodTypeAny, {
1848
+ path: string;
1849
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
1850
+ name: string;
1851
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1852
+ description: string;
1853
+ roles: string[];
1854
+ responseType: string;
1855
+ table?: undefined;
1856
+ joins?: undefined;
1857
+ assignments?: undefined;
1858
+ request?: {
1859
+ name: string;
1860
+ required: boolean;
1861
+ validator: {
1862
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1863
+ value: string | number | string[] | number[];
1864
+ }[];
1865
+ isNullable?: boolean | undefined;
1866
+ }[] | undefined;
1867
+ requestType?: string | undefined;
1868
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
1869
+ }, {
1870
+ path: string;
1871
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
1872
+ name: string;
1873
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1874
+ description: string;
1875
+ roles: string[];
1876
+ responseType: string;
1877
+ table?: undefined;
1878
+ joins?: undefined;
1879
+ assignments?: undefined;
1880
+ request?: {
1881
+ name: string;
1882
+ required: boolean;
1883
+ validator: {
1884
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1885
+ value: string | number | string[] | number[];
1886
+ }[];
1887
+ isNullable?: boolean | undefined;
1888
+ }[] | undefined;
1889
+ requestType?: string | undefined;
1890
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
1891
+ }>]>, "many">;
1892
+ }, "strict", z.ZodTypeAny, {
1893
+ name: string;
1894
+ description: string;
1895
+ baseUrl: string;
1896
+ routes: ({
1897
+ path: string;
1898
+ type: "ONE" | "ARRAY" | "PAGED";
1899
+ name: string;
1900
+ table: string;
1901
+ joins: {
1902
+ type: "LEFT" | "INNER";
1903
+ table: string;
1904
+ custom?: string | undefined;
1905
+ localColumnName?: string | undefined;
1906
+ foreignColumnName?: string | undefined;
1907
+ alias?: string | undefined;
1908
+ }[];
1909
+ where: {
1910
+ value?: string | number | undefined;
1911
+ custom?: string | undefined;
1912
+ tableName?: string | undefined;
1913
+ columnName?: string | undefined;
1914
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1915
+ conjunction?: "AND" | "OR" | undefined;
1916
+ }[];
1917
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1918
+ description: string;
1919
+ roles: string[];
1920
+ assignments: {
1921
+ value: string;
1922
+ name: string;
1923
+ }[];
1924
+ request: {
1925
+ name: string;
1926
+ required: boolean;
1927
+ validator: {
1928
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1929
+ value: string | number | string[] | number[];
1930
+ }[];
1931
+ isNullable?: boolean | undefined;
1932
+ }[];
1933
+ response: {
1934
+ name: string;
1935
+ selector?: string | undefined;
1936
+ subquery?: {
1937
+ table: string;
1938
+ joins: {
1939
+ type: "LEFT" | "INNER";
1940
+ table: string;
1941
+ custom?: string | undefined;
1942
+ localColumnName?: string | undefined;
1943
+ foreignColumnName?: string | undefined;
1944
+ alias?: string | undefined;
1945
+ }[];
1946
+ where: {
1947
+ value?: string | number | undefined;
1948
+ custom?: string | undefined;
1949
+ tableName?: string | undefined;
1950
+ columnName?: string | undefined;
1951
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
1952
+ conjunction?: "AND" | "OR" | undefined;
1953
+ }[];
1954
+ properties: any[];
1955
+ groupBy?: {
1956
+ tableName: string;
1957
+ columnName: string;
1958
+ } | undefined;
1959
+ orderBy?: {
1960
+ tableName: string;
1961
+ columnName: string;
1962
+ order: "ASC" | "DESC";
1963
+ } | undefined;
1964
+ } | undefined;
1965
+ }[];
1966
+ groupBy?: {
1967
+ tableName: string;
1968
+ columnName: string;
1969
+ } | undefined;
1970
+ orderBy?: {
1971
+ tableName: string;
1972
+ columnName: string;
1973
+ order: "ASC" | "DESC";
1974
+ } | undefined;
1975
+ } | {
1976
+ path: string;
1977
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
1978
+ name: string;
1979
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1980
+ description: string;
1981
+ roles: string[];
1982
+ responseType: string;
1983
+ table?: undefined;
1984
+ joins?: undefined;
1985
+ assignments?: undefined;
1986
+ request?: {
1987
+ name: string;
1988
+ required: boolean;
1989
+ validator: {
1990
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
1991
+ value: string | number | string[] | number[];
1992
+ }[];
1993
+ isNullable?: boolean | undefined;
1994
+ }[] | undefined;
1995
+ requestType?: string | undefined;
1996
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
1997
+ })[];
1998
+ }, {
1999
+ name: string;
2000
+ description: string;
2001
+ baseUrl: string;
2002
+ routes: ({
2003
+ path: string;
2004
+ type: "ONE" | "ARRAY" | "PAGED";
2005
+ name: string;
2006
+ table: string;
2007
+ joins: {
2008
+ type: "LEFT" | "INNER";
2009
+ table: string;
2010
+ custom?: string | undefined;
2011
+ localColumnName?: string | undefined;
2012
+ foreignColumnName?: string | undefined;
2013
+ alias?: string | undefined;
2014
+ }[];
2015
+ where: {
2016
+ value?: string | number | undefined;
2017
+ custom?: string | undefined;
2018
+ tableName?: string | undefined;
2019
+ columnName?: string | undefined;
2020
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2021
+ conjunction?: "AND" | "OR" | undefined;
2022
+ }[];
2023
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2024
+ description: string;
2025
+ roles: string[];
2026
+ assignments: {
2027
+ value: string;
2028
+ name: string;
2029
+ }[];
2030
+ request: {
2031
+ name: string;
2032
+ required: boolean;
2033
+ validator: {
2034
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2035
+ value: string | number | string[] | number[];
2036
+ }[];
2037
+ isNullable?: boolean | undefined;
2038
+ }[];
2039
+ response: {
2040
+ name: string;
2041
+ selector?: string | undefined;
2042
+ subquery?: {
2043
+ table: string;
2044
+ joins: {
2045
+ type: "LEFT" | "INNER";
2046
+ table: string;
2047
+ custom?: string | undefined;
2048
+ localColumnName?: string | undefined;
2049
+ foreignColumnName?: string | undefined;
2050
+ alias?: string | undefined;
2051
+ }[];
2052
+ where: {
2053
+ value?: string | number | undefined;
2054
+ custom?: string | undefined;
2055
+ tableName?: string | undefined;
2056
+ columnName?: string | undefined;
2057
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2058
+ conjunction?: "AND" | "OR" | undefined;
2059
+ }[];
2060
+ properties: any[];
2061
+ groupBy?: {
2062
+ tableName: string;
2063
+ columnName: string;
2064
+ } | undefined;
2065
+ orderBy?: {
2066
+ tableName: string;
2067
+ columnName: string;
2068
+ order: "ASC" | "DESC";
2069
+ } | undefined;
2070
+ } | undefined;
2071
+ }[];
2072
+ groupBy?: {
2073
+ tableName: string;
2074
+ columnName: string;
2075
+ } | undefined;
2076
+ orderBy?: {
2077
+ tableName: string;
2078
+ columnName: string;
2079
+ order: "ASC" | "DESC";
2080
+ } | undefined;
2081
+ } | {
2082
+ path: string;
2083
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
2084
+ name: string;
2085
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2086
+ description: string;
2087
+ roles: string[];
2088
+ responseType: string;
2089
+ table?: undefined;
2090
+ joins?: undefined;
2091
+ assignments?: undefined;
2092
+ request?: {
2093
+ name: string;
2094
+ required: boolean;
2095
+ validator: {
2096
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2097
+ value: string | number | string[] | number[];
2098
+ }[];
2099
+ isNullable?: boolean | undefined;
2100
+ }[] | undefined;
2101
+ requestType?: string | undefined;
2102
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
2103
+ })[];
2104
+ }>, "many">;
2105
+ globalParams: z.ZodArray<z.ZodString, "many">;
2106
+ roles: z.ZodArray<z.ZodString, "many">;
2107
+ customTypes: z.ZodString;
2108
+ }, "strict", z.ZodTypeAny, {
2109
+ roles: string[];
2110
+ database: {
2111
+ name: string;
2112
+ roles: string[];
2113
+ columns: {
2114
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
2115
+ name: string;
2116
+ isNullable: boolean;
2117
+ roles: string[];
2118
+ length?: number | undefined;
2119
+ value?: string | undefined;
2120
+ default?: string | undefined;
2121
+ comment?: string | undefined;
2122
+ isPrimary?: boolean | undefined;
2123
+ isUnique?: boolean | undefined;
2124
+ hasAutoIncrement?: boolean | undefined;
2125
+ }[];
2126
+ indexes: {
2127
+ order: "ASC" | "DESC";
2128
+ name: string;
2129
+ isUnique: boolean;
2130
+ columns: string[];
2131
+ isPrimaryKey: boolean;
2132
+ }[];
2133
+ foreignKeys: {
2134
+ name: string;
2135
+ column: string;
2136
+ refTable: string;
2137
+ refColumn: string;
2138
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
2139
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
2140
+ }[];
2141
+ checkConstraints: {
2142
+ name: string;
2143
+ check: string;
2144
+ }[];
2145
+ }[];
2146
+ endpoints: {
2147
+ name: string;
2148
+ description: string;
2149
+ baseUrl: string;
2150
+ routes: ({
2151
+ path: string;
2152
+ type: "ONE" | "ARRAY" | "PAGED";
2153
+ name: string;
2154
+ table: string;
2155
+ joins: {
2156
+ type: "LEFT" | "INNER";
2157
+ table: string;
2158
+ custom?: string | undefined;
2159
+ localColumnName?: string | undefined;
2160
+ foreignColumnName?: string | undefined;
2161
+ alias?: string | undefined;
2162
+ }[];
2163
+ where: {
2164
+ value?: string | number | undefined;
2165
+ custom?: string | undefined;
2166
+ tableName?: string | undefined;
2167
+ columnName?: string | undefined;
2168
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2169
+ conjunction?: "AND" | "OR" | undefined;
2170
+ }[];
2171
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2172
+ description: string;
2173
+ roles: string[];
2174
+ assignments: {
2175
+ value: string;
2176
+ name: string;
2177
+ }[];
2178
+ request: {
2179
+ name: string;
2180
+ required: boolean;
2181
+ validator: {
2182
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2183
+ value: string | number | string[] | number[];
2184
+ }[];
2185
+ isNullable?: boolean | undefined;
2186
+ }[];
2187
+ response: {
2188
+ name: string;
2189
+ selector?: string | undefined;
2190
+ subquery?: {
2191
+ table: string;
2192
+ joins: {
2193
+ type: "LEFT" | "INNER";
2194
+ table: string;
2195
+ custom?: string | undefined;
2196
+ localColumnName?: string | undefined;
2197
+ foreignColumnName?: string | undefined;
2198
+ alias?: string | undefined;
2199
+ }[];
2200
+ where: {
2201
+ value?: string | number | undefined;
2202
+ custom?: string | undefined;
2203
+ tableName?: string | undefined;
2204
+ columnName?: string | undefined;
2205
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2206
+ conjunction?: "AND" | "OR" | undefined;
2207
+ }[];
2208
+ properties: any[];
2209
+ groupBy?: {
2210
+ tableName: string;
2211
+ columnName: string;
2212
+ } | undefined;
2213
+ orderBy?: {
2214
+ tableName: string;
2215
+ columnName: string;
2216
+ order: "ASC" | "DESC";
2217
+ } | undefined;
2218
+ } | undefined;
2219
+ }[];
2220
+ groupBy?: {
2221
+ tableName: string;
2222
+ columnName: string;
2223
+ } | undefined;
2224
+ orderBy?: {
2225
+ tableName: string;
2226
+ columnName: string;
2227
+ order: "ASC" | "DESC";
2228
+ } | undefined;
2229
+ } | {
2230
+ path: string;
2231
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
2232
+ name: string;
2233
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2234
+ description: string;
2235
+ roles: string[];
2236
+ responseType: string;
2237
+ table?: undefined;
2238
+ joins?: undefined;
2239
+ assignments?: undefined;
2240
+ request?: {
2241
+ name: string;
2242
+ required: boolean;
2243
+ validator: {
2244
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2245
+ value: string | number | string[] | number[];
2246
+ }[];
2247
+ isNullable?: boolean | undefined;
2248
+ }[] | undefined;
2249
+ requestType?: string | undefined;
2250
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
2251
+ })[];
2252
+ }[];
2253
+ globalParams: string[];
2254
+ customTypes: string;
2255
+ }, {
2256
+ roles: string[];
2257
+ database: {
2258
+ name: string;
2259
+ roles: string[];
2260
+ columns: {
2261
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
2262
+ name: string;
2263
+ isNullable: boolean;
2264
+ roles: string[];
2265
+ length?: number | undefined;
2266
+ value?: string | undefined;
2267
+ default?: string | undefined;
2268
+ comment?: string | undefined;
2269
+ isPrimary?: boolean | undefined;
2270
+ isUnique?: boolean | undefined;
2271
+ hasAutoIncrement?: boolean | undefined;
2272
+ }[];
2273
+ indexes: {
2274
+ order: "ASC" | "DESC";
2275
+ name: string;
2276
+ isUnique: boolean;
2277
+ columns: string[];
2278
+ isPrimaryKey: boolean;
2279
+ }[];
2280
+ foreignKeys: {
2281
+ name: string;
2282
+ column: string;
2283
+ refTable: string;
2284
+ refColumn: string;
2285
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
2286
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
2287
+ }[];
2288
+ checkConstraints: {
2289
+ name: string;
2290
+ check: string;
2291
+ }[];
2292
+ }[];
2293
+ endpoints: {
2294
+ name: string;
2295
+ description: string;
2296
+ baseUrl: string;
2297
+ routes: ({
2298
+ path: string;
2299
+ type: "ONE" | "ARRAY" | "PAGED";
2300
+ name: string;
2301
+ table: string;
2302
+ joins: {
2303
+ type: "LEFT" | "INNER";
2304
+ table: string;
2305
+ custom?: string | undefined;
2306
+ localColumnName?: string | undefined;
2307
+ foreignColumnName?: string | undefined;
2308
+ alias?: string | undefined;
2309
+ }[];
2310
+ where: {
2311
+ value?: string | number | undefined;
2312
+ custom?: string | undefined;
2313
+ tableName?: string | undefined;
2314
+ columnName?: string | undefined;
2315
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2316
+ conjunction?: "AND" | "OR" | undefined;
2317
+ }[];
2318
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2319
+ description: string;
2320
+ roles: string[];
2321
+ assignments: {
2322
+ value: string;
2323
+ name: string;
2324
+ }[];
2325
+ request: {
2326
+ name: string;
2327
+ required: boolean;
2328
+ validator: {
2329
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2330
+ value: string | number | string[] | number[];
2331
+ }[];
2332
+ isNullable?: boolean | undefined;
2333
+ }[];
2334
+ response: {
2335
+ name: string;
2336
+ selector?: string | undefined;
2337
+ subquery?: {
2338
+ table: string;
2339
+ joins: {
2340
+ type: "LEFT" | "INNER";
2341
+ table: string;
2342
+ custom?: string | undefined;
2343
+ localColumnName?: string | undefined;
2344
+ foreignColumnName?: string | undefined;
2345
+ alias?: string | undefined;
2346
+ }[];
2347
+ where: {
2348
+ value?: string | number | undefined;
2349
+ custom?: string | undefined;
2350
+ tableName?: string | undefined;
2351
+ columnName?: string | undefined;
2352
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | "IS" | "IS NOT" | undefined;
2353
+ conjunction?: "AND" | "OR" | undefined;
2354
+ }[];
2355
+ properties: any[];
2356
+ groupBy?: {
2357
+ tableName: string;
2358
+ columnName: string;
2359
+ } | undefined;
2360
+ orderBy?: {
2361
+ tableName: string;
2362
+ columnName: string;
2363
+ order: "ASC" | "DESC";
2364
+ } | undefined;
2365
+ } | undefined;
2366
+ }[];
2367
+ groupBy?: {
2368
+ tableName: string;
2369
+ columnName: string;
2370
+ } | undefined;
2371
+ orderBy?: {
2372
+ tableName: string;
2373
+ columnName: string;
2374
+ order: "ASC" | "DESC";
2375
+ } | undefined;
2376
+ } | {
2377
+ path: string;
2378
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
2379
+ name: string;
2380
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2381
+ description: string;
2382
+ roles: string[];
2383
+ responseType: string;
2384
+ table?: undefined;
2385
+ joins?: undefined;
2386
+ assignments?: undefined;
2387
+ request?: {
2388
+ name: string;
2389
+ required: boolean;
2390
+ validator: {
2391
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
2392
+ value: string | number | string[] | number[];
2393
+ }[];
2394
+ isNullable?: boolean | undefined;
2395
+ }[] | undefined;
2396
+ requestType?: string | undefined;
2397
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
2398
+ })[];
2399
+ }[];
2400
+ globalParams: string[];
2401
+ customTypes: string;
2402
+ }>;
2403
+ type ResturaSchema = z.infer<typeof resturaSchema>;
2404
+
2405
+ declare abstract class PsqlConnection {
2406
+ readonly instanceId: UUID;
2407
+ protected constructor(instanceId?: UUID);
2408
+ protected abstract query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
2409
+ queryOne<T>(query: string, options: any[], requesterDetails: RequesterDetails): Promise<T>;
2410
+ runQuery<T>(query: string, options: any[], requesterDetails: RequesterDetails): Promise<T[]>;
2411
+ private logSqlStatement;
2412
+ }
2413
+
2414
+ declare class PsqlPool extends PsqlConnection {
2415
+ poolConfig: PoolConfig;
2416
+ pool: Pool;
2417
+ constructor(poolConfig: PoolConfig);
2418
+ protected query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
2419
+ }
2420
+
2421
+ declare class ResturaEngine {
2422
+ resturaConfig: ResturaConfigSchema;
2423
+ private multerCommonUpload;
2424
+ private resturaRouter;
2425
+ private publicEndpoints;
2426
+ private expressApp;
2427
+ private schema;
2428
+ private responseValidator;
2429
+ private authenticationHandler;
2430
+ private customTypeValidation;
2431
+ private psqlConnectionPool;
2432
+ private psqlEngine;
2433
+ /**
2434
+ * Initializes the Restura engine with the provided Express application.
2435
+ *
2436
+ * @param app - The Express application instance to initialize with Restura.
2437
+ * @returns A promise that resolves when the initialization is complete.
2438
+ */
2439
+ init(app: express.Application, authenticationHandler: AuthenticateHandler, psqlConnectionPool: PsqlPool): Promise<void>;
2440
+ /**
2441
+ * Determines if a given endpoint is public based on the HTTP method and full URL. This
2442
+ * is determined on whether the endpoint in the schema has no roles assigned to it.
2443
+ *
2444
+ * @param method - The HTTP method (e.g., 'GET', 'POST', 'PUT', 'PATCH', 'DELETE').
2445
+ * @param fullUrl - The full URL of the endpoint.
2446
+ * @returns A boolean indicating whether the endpoint is public.
2447
+ */
2448
+ isEndpointPublic(method: string, fullUrl: string): boolean;
2449
+ /**
2450
+ * Checks if an endpoint exists for a given HTTP method and full URL.
2451
+ *
2452
+ * @param method - The HTTP method to check (e.g., 'GET', 'POST', 'PUT', 'PATCH', 'DELETE').
2453
+ * @param fullUrl - The full URL of the endpoint to check.
2454
+ * @returns `true` if the endpoint exists, otherwise `false`.
2455
+ */
2456
+ doesEndpointExist(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', fullUrl: string): boolean;
2457
+ /**
2458
+ * Generates an API from the provided schema and writes it to the specified output file.
2459
+ *
2460
+ * @param outputFile - The path to the file where the generated API will be written.
2461
+ * @param providedSchema - The schema from which the API will be generated.
2462
+ * @returns A promise that resolves when the API has been successfully generated and written to the output file.
2463
+ */
2464
+ generateApiFromSchema(outputFile: string, providedSchema: ResturaSchema): Promise<void>;
2465
+ /**
2466
+ * Generates a model from the provided schema and writes it to the specified output file.
2467
+ *
2468
+ * @param outputFile - The path to the file where the generated model will be written.
2469
+ * @param providedSchema - The schema from which the model will be generated.
2470
+ * @returns A promise that resolves when the model has been successfully written to the output file.
2471
+ */
2472
+ generateModelFromSchema(outputFile: string, providedSchema: ResturaSchema): Promise<void>;
2473
+ /**
2474
+ * Generates the ambient module declaration for Restura global types and writes it to the specified output file.
2475
+ * These types are used sometimes in the CustomTypes
2476
+ * @param outputFile
2477
+ */
2478
+ generateResturaGlobalTypes(outputFile: string): void;
2479
+ /**
2480
+ * Retrieves the latest file system schema for Restura.
2481
+ *
2482
+ * @returns {Promise<ResturaSchema>} A promise that resolves to the latest Restura schema.
2483
+ * @throws {Error} If the schema file is missing or the schema is not valid.
2484
+ */
2485
+ getLatestFileSystemSchema(): Promise<ResturaSchema>;
2486
+ private reloadEndpoints;
2487
+ private validateGeneratedTypesFolder;
2488
+ private resturaAuthentication;
2489
+ private previewCreateSchema;
2490
+ private updateSchema;
2491
+ private updateTypes;
2492
+ private getSchema;
2493
+ private getSchemaAndTypes;
2494
+ private getMulterFilesIfAny;
2495
+ private executeRouteLogic;
2496
+ private isCustomRoute;
2497
+ private runCustomRouteLogic;
2498
+ private storeFileSystemSchema;
2499
+ private resetPublicEndpoints;
2500
+ private validateAuthorization;
2501
+ private getRouteData;
2502
+ }
2503
+ declare const restura: ResturaEngine;
2504
+
2505
+ declare abstract class SqlEngine {
2506
+ runQueryForRoute(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[] | boolean>;
2507
+ protected getTableSchema(schema: ResturaSchema, tableName: string): TableData;
2508
+ protected doesRoleHavePermissionToColumn(role: string | undefined | null, schema: ResturaSchema, item: ResponseData, joins: JoinData[]): boolean;
2509
+ protected doesRoleHavePermissionToTable(userRole: string | undefined, schema: ResturaSchema, tableName: string): boolean;
2510
+ protected abstract generateJoinStatements(req: RsRequest<unknown>, joins: JoinData[], baseTable: string, routeData: StandardRouteData, schema: ResturaSchema, userRole: string | undefined, sqlParams: string[]): string;
2511
+ protected abstract generateGroupBy(routeData: StandardRouteData): string;
2512
+ protected abstract generateOrderBy(req: RsRequest<unknown>, routeData: StandardRouteData): string;
2513
+ protected abstract generateWhereClause(req: RsRequest<unknown>, where: WhereData[], routeData: StandardRouteData, sqlParams: string[]): string;
2514
+ protected replaceParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2515
+ protected replaceLocalParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2516
+ protected replaceGlobalParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2517
+ abstract generateDatabaseSchemaFromSchema(schema: ResturaSchema): string;
2518
+ abstract diffDatabaseToSchema(schema: ResturaSchema): Promise<string>;
2519
+ protected abstract createNestedSelect(req: RsRequest<unknown>, schema: ResturaSchema, item: ResponseData, routeData: StandardRouteData, userRole: string | undefined, sqlParams: string[]): string;
2520
+ protected abstract executeCreateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2521
+ protected abstract executeGetRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[]>;
2522
+ protected abstract executeUpdateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2523
+ protected abstract executeDeleteRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<boolean>;
2524
+ }
2525
+
2526
+ declare class PsqlEngine extends SqlEngine {
2527
+ private psqlConnectionPool;
2528
+ setupTriggerListeners: Promise<void> | undefined;
2529
+ private triggerClient;
2530
+ constructor(psqlConnectionPool: PsqlPool, shouldListenForDbTriggers?: boolean);
2531
+ close(): Promise<void>;
2532
+ private setupPgReturnTypes;
2533
+ private listenForDbTriggers;
2534
+ private handleTrigger;
2535
+ createDatabaseFromSchema(schema: ResturaSchema, connection: PsqlPool): Promise<string>;
2536
+ generateDatabaseSchemaFromSchema(schema: ResturaSchema): string;
2537
+ private getScratchPool;
2538
+ diffDatabaseToSchema(schema: ResturaSchema): Promise<string>;
2539
+ protected createNestedSelect(req: RsRequest<unknown>, schema: ResturaSchema, item: ResponseData, routeData: StandardRouteData, userRole: string | undefined, sqlParams: string[]): string;
2540
+ protected executeCreateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2541
+ protected executeGetRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[]>;
2542
+ protected executeUpdateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2543
+ protected executeDeleteRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<boolean>;
2544
+ protected generateJoinStatements(req: RsRequest<unknown>, joins: JoinData[], baseTable: string, routeData: StandardRouteData | CustomRouteData, schema: ResturaSchema, userRole: string | undefined, sqlParams: string[]): string;
2545
+ protected generateGroupBy(routeData: StandardRouteData): string;
2546
+ protected generateOrderBy(req: RsRequest<unknown>, routeData: StandardRouteData): string;
2547
+ protected generateWhereClause(req: RsRequest<unknown>, where: WhereData[], routeData: StandardRouteData | CustomRouteData, sqlParams: string[]): string;
2548
+ private createUpdateTrigger;
2549
+ private createDeleteTrigger;
2550
+ private createInsertTriggers;
2551
+ private schemaToPsqlType;
2552
+ }
2553
+
2554
+ declare class PsqlTransaction extends PsqlConnection {
2555
+ clientConfig: ClientConfig;
2556
+ client: Client;
2557
+ private beginTransactionPromise;
2558
+ private connectPromise;
2559
+ constructor(clientConfig: ClientConfig, instanceId?: UUID);
2560
+ close(): Promise<void>;
2561
+ private beginTransaction;
2562
+ rollback(): Promise<QueryResult<QueryResultRow>>;
2563
+ commit(): Promise<QueryResult<QueryResultRow>>;
2564
+ release(): Promise<void>;
2565
+ protected query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
2566
+ }
2567
+
2568
+ /**
2569
+ * This method does a couple of things:
2570
+ * 1. It escapes the column name to prevent SQL injection by removing any double quotes.
2571
+ * 2. It wraps the column name in double quotes to prevent any issues with reserved words or casing.
2572
+ * 3. It replaces any periods in the column name with a period wrapped in double quotes to prevent any issues with schema names.
2573
+ * NOTE: I looked into using pg-format ident() method but that will strip the double quotes when not needed.
2574
+ * @param columnName
2575
+ * @returns
2576
+ */
2577
+ declare function escapeColumnName(columnName: string | undefined): string;
2578
+ /**
2579
+ * Converts a query with question marks to a query with numbered parameters,
2580
+ * however it ignores question marks inside single or double quotes.
2581
+ * @param query PostgreSQL query with question marks
2582
+ * @returns A string with numbered parameters such as $1, $2 in replacement of question marks
2583
+ */
2584
+ declare function questionMarksToOrderedParams(query: string): string;
2585
+ /**
2586
+ * Creates a query to insert an object into a table.
2587
+ * @param table Table name to insert the object into
2588
+ * @param obj Data to insert into the table
2589
+ * @returns the query to insert the object into the table
2590
+ */
2591
+ declare function insertObjectQuery(table: string, obj: DynamicObject): string;
2592
+ /**
2593
+ * Creates a query to update an object in a table.
2594
+ * @param table Table name to update the object in
2595
+ * @param obj Data to update in the table
2596
+ * @param whereStatement Where clause to determine which rows to update
2597
+ * @returns the query to update the object in the table
2598
+ */
2599
+ declare function updateObjectQuery(table: string, obj: DynamicObject, whereStatement: string): string;
2600
+ declare function isValueNumber(value: unknown): value is number;
2601
+ /**
2602
+ * This method is used to format a query and escape user input.
2603
+ * Use this with the SQL tag to escape user input. For example:
2604
+ * SQL`UPDATE "USER" SET "firstName" = ${firstName}, "isActive" = ${isActive} WHERE "id" = ${id} RETURNING *`
2605
+ * @param strings template strings array
2606
+ * @param values values to escape
2607
+ * @returns An escaped query with user input
2608
+ */
2609
+ declare function SQL(strings: TemplateStringsArray, ...values: unknown[]): string;
2610
+
2611
+ export { type ActionColumnChangeData, type ActionColumnChangeFilter, type ActionRowDeleteData, type ActionRowDeleteFilter, type ActionRowInsertData, type ActionRowInsertFilter, type ApiMethod, type AsyncExpressApplication, type AuthenticateHandler, type AuthenticationUserDetails, type ConjunctionTypes, type DatabaseActionData, type DynamicObject, type ErrorCode, type EventType, HtmlStatusCodes, type MatchTypes, type MutationType, type PageQuery, PsqlConnection, PsqlEngine, PsqlPool, PsqlTransaction, type QueryMetadata, type RequesterDetails, RsError, type RsErrorData, type RsErrorInternalData, type RsHeaders, type RsPagedResponseData, type RsRequest, type RsResponse, type RsResponseData, type RsRouteHandler, SQL, type SchemaChangeValue, type SchemaPreview, type SqlMutationData, type StandardOrderTypes, type TriggerResult, type ValidAuthenticationCallback, escapeColumnName, eventManager, insertObjectQuery, isValueNumber, logger, questionMarksToOrderedParams, restura, updateObjectQuery };