@restura/core 0.1.0-alpha.24 → 0.1.0-alpha.26

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,9 +1,9 @@
1
1
  import winston from 'winston';
2
+ import { UUID } from 'crypto';
2
3
  import * as express from 'express';
4
+ import { IncomingHttpHeaders } from 'http2';
3
5
  import { z } from 'zod';
4
6
  import { QueryResultRow, QueryConfigValues, QueryResult, PoolConfig, Pool, ClientConfig, Client } from 'pg';
5
- import { IncomingHttpHeaders } from 'http2';
6
- import { UUID } from 'crypto';
7
7
 
8
8
  declare const logger: winston.Logger;
9
9
 
@@ -34,8 +34,140 @@ declare class RsError {
34
34
  stack: string;
35
35
  constructor(errCode: ErrorCode, message?: string);
36
36
  static htmlStatus(code: ErrorCode): number;
37
- static isRsError(error: any): error is RsError;
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 extends DynamicObject>(onInsert: (data: ActionRowInsertData<T>, queryMetadata: QueryMetadata) => Promise<void>, filter?: ActionRowInsertFilter): void;
162
+ addColumnChangeHandler<T extends DynamicObject>(onUpdate: (data: ActionColumnChangeData<T>, queryMetadata: QueryMetadata) => Promise<void>, filter: ActionColumnChangeFilter): void;
163
+ addRowDeleteHandler<T extends DynamicObject>(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;
38
169
  }
170
+ declare const eventManager: EventManager;
39
171
 
40
172
  declare const resturaConfigSchema: z.ZodObject<{
41
173
  authToken: z.ZodString;
@@ -71,15 +203,15 @@ declare const whereDataSchema: z.ZodObject<{
71
203
  }, "strict", z.ZodTypeAny, {
72
204
  value?: string | number | undefined;
73
205
  custom?: string | undefined;
74
- columnName?: string | undefined;
75
206
  tableName?: string | undefined;
207
+ columnName?: string | undefined;
76
208
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
77
209
  conjunction?: "AND" | "OR" | undefined;
78
210
  }, {
79
211
  value?: string | number | undefined;
80
212
  custom?: string | undefined;
81
- columnName?: string | undefined;
82
213
  tableName?: string | undefined;
214
+ columnName?: string | undefined;
83
215
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
84
216
  conjunction?: "AND" | "OR" | undefined;
85
217
  }>;
@@ -144,15 +276,15 @@ declare const responseDataSchema: z.ZodObject<{
144
276
  }, "strict", z.ZodTypeAny, {
145
277
  value?: string | number | undefined;
146
278
  custom?: string | undefined;
147
- columnName?: string | undefined;
148
279
  tableName?: string | undefined;
280
+ columnName?: string | undefined;
149
281
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
150
282
  conjunction?: "AND" | "OR" | undefined;
151
283
  }, {
152
284
  value?: string | number | undefined;
153
285
  custom?: string | undefined;
154
- columnName?: string | undefined;
155
286
  tableName?: string | undefined;
287
+ columnName?: string | undefined;
156
288
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
157
289
  conjunction?: "AND" | "OR" | undefined;
158
290
  }>, "many">;
@@ -161,24 +293,24 @@ declare const responseDataSchema: z.ZodObject<{
161
293
  columnName: z.ZodString;
162
294
  tableName: z.ZodString;
163
295
  }, "strict", z.ZodTypeAny, {
164
- columnName: string;
165
296
  tableName: string;
166
- }, {
167
297
  columnName: string;
298
+ }, {
168
299
  tableName: string;
300
+ columnName: string;
169
301
  }>>;
170
302
  orderBy: z.ZodOptional<z.ZodObject<{
171
303
  columnName: z.ZodString;
172
304
  order: z.ZodEnum<["ASC", "DESC"]>;
173
305
  tableName: z.ZodString;
174
306
  }, "strict", z.ZodTypeAny, {
307
+ tableName: string;
175
308
  columnName: string;
176
309
  order: "ASC" | "DESC";
177
- tableName: string;
178
310
  }, {
311
+ tableName: string;
179
312
  columnName: string;
180
313
  order: "ASC" | "DESC";
181
- tableName: string;
182
314
  }>>;
183
315
  }, "strip", z.ZodTypeAny, {
184
316
  table: string;
@@ -193,20 +325,20 @@ declare const responseDataSchema: z.ZodObject<{
193
325
  where: {
194
326
  value?: string | number | undefined;
195
327
  custom?: string | undefined;
196
- columnName?: string | undefined;
197
328
  tableName?: string | undefined;
329
+ columnName?: string | undefined;
198
330
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
199
331
  conjunction?: "AND" | "OR" | undefined;
200
332
  }[];
201
333
  properties: any[];
202
334
  groupBy?: {
203
- columnName: string;
204
335
  tableName: string;
336
+ columnName: string;
205
337
  } | undefined;
206
338
  orderBy?: {
339
+ tableName: string;
207
340
  columnName: string;
208
341
  order: "ASC" | "DESC";
209
- tableName: string;
210
342
  } | undefined;
211
343
  }, {
212
344
  table: string;
@@ -221,20 +353,20 @@ declare const responseDataSchema: z.ZodObject<{
221
353
  where: {
222
354
  value?: string | number | undefined;
223
355
  custom?: string | undefined;
224
- columnName?: string | undefined;
225
356
  tableName?: string | undefined;
357
+ columnName?: string | undefined;
226
358
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
227
359
  conjunction?: "AND" | "OR" | undefined;
228
360
  }[];
229
361
  properties: any[];
230
362
  groupBy?: {
231
- columnName: string;
232
363
  tableName: string;
364
+ columnName: string;
233
365
  } | undefined;
234
366
  orderBy?: {
367
+ tableName: string;
235
368
  columnName: string;
236
369
  order: "ASC" | "DESC";
237
- tableName: string;
238
370
  } | undefined;
239
371
  }>>;
240
372
  }, "strict", z.ZodTypeAny, {
@@ -253,20 +385,20 @@ declare const responseDataSchema: z.ZodObject<{
253
385
  where: {
254
386
  value?: string | number | undefined;
255
387
  custom?: string | undefined;
256
- columnName?: string | undefined;
257
388
  tableName?: string | undefined;
389
+ columnName?: string | undefined;
258
390
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
259
391
  conjunction?: "AND" | "OR" | undefined;
260
392
  }[];
261
393
  properties: any[];
262
394
  groupBy?: {
263
- columnName: string;
264
395
  tableName: string;
396
+ columnName: string;
265
397
  } | undefined;
266
398
  orderBy?: {
399
+ tableName: string;
267
400
  columnName: string;
268
401
  order: "ASC" | "DESC";
269
- tableName: string;
270
402
  } | undefined;
271
403
  } | undefined;
272
404
  }, {
@@ -285,20 +417,20 @@ declare const responseDataSchema: z.ZodObject<{
285
417
  where: {
286
418
  value?: string | number | undefined;
287
419
  custom?: string | undefined;
288
- columnName?: string | undefined;
289
420
  tableName?: string | undefined;
421
+ columnName?: string | undefined;
290
422
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
291
423
  conjunction?: "AND" | "OR" | undefined;
292
424
  }[];
293
425
  properties: any[];
294
426
  groupBy?: {
295
- columnName: string;
296
427
  tableName: string;
428
+ columnName: string;
297
429
  } | undefined;
298
430
  orderBy?: {
431
+ tableName: string;
299
432
  columnName: string;
300
433
  order: "ASC" | "DESC";
301
- tableName: string;
302
434
  } | undefined;
303
435
  } | undefined;
304
436
  }>;
@@ -354,15 +486,15 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
354
486
  }, "strict", z.ZodTypeAny, {
355
487
  value?: string | number | undefined;
356
488
  custom?: string | undefined;
357
- columnName?: string | undefined;
358
489
  tableName?: string | undefined;
490
+ columnName?: string | undefined;
359
491
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
360
492
  conjunction?: "AND" | "OR" | undefined;
361
493
  }, {
362
494
  value?: string | number | undefined;
363
495
  custom?: string | undefined;
364
- columnName?: string | undefined;
365
496
  tableName?: string | undefined;
497
+ columnName?: string | undefined;
366
498
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
367
499
  conjunction?: "AND" | "OR" | undefined;
368
500
  }>, "many">;
@@ -434,15 +566,15 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
434
566
  }, "strict", z.ZodTypeAny, {
435
567
  value?: string | number | undefined;
436
568
  custom?: string | undefined;
437
- columnName?: string | undefined;
438
569
  tableName?: string | undefined;
570
+ columnName?: string | undefined;
439
571
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
440
572
  conjunction?: "AND" | "OR" | undefined;
441
573
  }, {
442
574
  value?: string | number | undefined;
443
575
  custom?: string | undefined;
444
- columnName?: string | undefined;
445
576
  tableName?: string | undefined;
577
+ columnName?: string | undefined;
446
578
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
447
579
  conjunction?: "AND" | "OR" | undefined;
448
580
  }>, "many">;
@@ -451,24 +583,24 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
451
583
  columnName: z.ZodString;
452
584
  tableName: z.ZodString;
453
585
  }, "strict", z.ZodTypeAny, {
454
- columnName: string;
455
586
  tableName: string;
456
- }, {
457
587
  columnName: string;
588
+ }, {
458
589
  tableName: string;
590
+ columnName: string;
459
591
  }>>;
460
592
  orderBy: z.ZodOptional<z.ZodObject<{
461
593
  columnName: z.ZodString;
462
594
  order: z.ZodEnum<["ASC", "DESC"]>;
463
595
  tableName: z.ZodString;
464
596
  }, "strict", z.ZodTypeAny, {
597
+ tableName: string;
465
598
  columnName: string;
466
599
  order: "ASC" | "DESC";
467
- tableName: string;
468
600
  }, {
601
+ tableName: string;
469
602
  columnName: string;
470
603
  order: "ASC" | "DESC";
471
- tableName: string;
472
604
  }>>;
473
605
  }, "strip", z.ZodTypeAny, {
474
606
  table: string;
@@ -483,20 +615,20 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
483
615
  where: {
484
616
  value?: string | number | undefined;
485
617
  custom?: string | undefined;
486
- columnName?: string | undefined;
487
618
  tableName?: string | undefined;
619
+ columnName?: string | undefined;
488
620
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
489
621
  conjunction?: "AND" | "OR" | undefined;
490
622
  }[];
491
623
  properties: any[];
492
624
  groupBy?: {
493
- columnName: string;
494
625
  tableName: string;
626
+ columnName: string;
495
627
  } | undefined;
496
628
  orderBy?: {
629
+ tableName: string;
497
630
  columnName: string;
498
631
  order: "ASC" | "DESC";
499
- tableName: string;
500
632
  } | undefined;
501
633
  }, {
502
634
  table: string;
@@ -511,20 +643,20 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
511
643
  where: {
512
644
  value?: string | number | undefined;
513
645
  custom?: string | undefined;
514
- columnName?: string | undefined;
515
646
  tableName?: string | undefined;
647
+ columnName?: string | undefined;
516
648
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
517
649
  conjunction?: "AND" | "OR" | undefined;
518
650
  }[];
519
651
  properties: any[];
520
652
  groupBy?: {
521
- columnName: string;
522
653
  tableName: string;
654
+ columnName: string;
523
655
  } | undefined;
524
656
  orderBy?: {
657
+ tableName: string;
525
658
  columnName: string;
526
659
  order: "ASC" | "DESC";
527
- tableName: string;
528
660
  } | undefined;
529
661
  }>>;
530
662
  }, "strict", z.ZodTypeAny, {
@@ -543,20 +675,20 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
543
675
  where: {
544
676
  value?: string | number | undefined;
545
677
  custom?: string | undefined;
546
- columnName?: string | undefined;
547
678
  tableName?: string | undefined;
679
+ columnName?: string | undefined;
548
680
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
549
681
  conjunction?: "AND" | "OR" | undefined;
550
682
  }[];
551
683
  properties: any[];
552
684
  groupBy?: {
553
- columnName: string;
554
685
  tableName: string;
686
+ columnName: string;
555
687
  } | undefined;
556
688
  orderBy?: {
689
+ tableName: string;
557
690
  columnName: string;
558
691
  order: "ASC" | "DESC";
559
- tableName: string;
560
692
  } | undefined;
561
693
  } | undefined;
562
694
  }, {
@@ -575,20 +707,20 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
575
707
  where: {
576
708
  value?: string | number | undefined;
577
709
  custom?: string | undefined;
578
- columnName?: string | undefined;
579
710
  tableName?: string | undefined;
711
+ columnName?: string | undefined;
580
712
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
581
713
  conjunction?: "AND" | "OR" | undefined;
582
714
  }[];
583
715
  properties: any[];
584
716
  groupBy?: {
585
- columnName: string;
586
717
  tableName: string;
718
+ columnName: string;
587
719
  } | undefined;
588
720
  orderBy?: {
721
+ tableName: string;
589
722
  columnName: string;
590
723
  order: "ASC" | "DESC";
591
- tableName: string;
592
724
  } | undefined;
593
725
  } | undefined;
594
726
  }>, "many">;
@@ -596,24 +728,24 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
596
728
  columnName: z.ZodString;
597
729
  tableName: z.ZodString;
598
730
  }, "strict", z.ZodTypeAny, {
599
- columnName: string;
600
731
  tableName: string;
601
- }, {
602
732
  columnName: string;
733
+ }, {
603
734
  tableName: string;
735
+ columnName: string;
604
736
  }>>;
605
737
  orderBy: z.ZodOptional<z.ZodObject<{
606
738
  columnName: z.ZodString;
607
739
  order: z.ZodEnum<["ASC", "DESC"]>;
608
740
  tableName: z.ZodString;
609
741
  }, "strict", z.ZodTypeAny, {
742
+ tableName: string;
610
743
  columnName: string;
611
744
  order: "ASC" | "DESC";
612
- tableName: string;
613
745
  }, {
746
+ tableName: string;
614
747
  columnName: string;
615
748
  order: "ASC" | "DESC";
616
- tableName: string;
617
749
  }>>;
618
750
  }>, "strict", z.ZodTypeAny, {
619
751
  path: string;
@@ -631,8 +763,8 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
631
763
  where: {
632
764
  value?: string | number | undefined;
633
765
  custom?: string | undefined;
634
- columnName?: string | undefined;
635
766
  tableName?: string | undefined;
767
+ columnName?: string | undefined;
636
768
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
637
769
  conjunction?: "AND" | "OR" | undefined;
638
770
  }[];
@@ -668,31 +800,31 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
668
800
  where: {
669
801
  value?: string | number | undefined;
670
802
  custom?: string | undefined;
671
- columnName?: string | undefined;
672
803
  tableName?: string | undefined;
804
+ columnName?: string | undefined;
673
805
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
674
806
  conjunction?: "AND" | "OR" | undefined;
675
807
  }[];
676
808
  properties: any[];
677
809
  groupBy?: {
678
- columnName: string;
679
810
  tableName: string;
811
+ columnName: string;
680
812
  } | undefined;
681
813
  orderBy?: {
814
+ tableName: string;
682
815
  columnName: string;
683
816
  order: "ASC" | "DESC";
684
- tableName: string;
685
817
  } | undefined;
686
818
  } | undefined;
687
819
  }[];
688
820
  groupBy?: {
689
- columnName: string;
690
821
  tableName: string;
822
+ columnName: string;
691
823
  } | undefined;
692
824
  orderBy?: {
825
+ tableName: string;
693
826
  columnName: string;
694
827
  order: "ASC" | "DESC";
695
- tableName: string;
696
828
  } | undefined;
697
829
  }, {
698
830
  path: string;
@@ -710,8 +842,8 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
710
842
  where: {
711
843
  value?: string | number | undefined;
712
844
  custom?: string | undefined;
713
- columnName?: string | undefined;
714
845
  tableName?: string | undefined;
846
+ columnName?: string | undefined;
715
847
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
716
848
  conjunction?: "AND" | "OR" | undefined;
717
849
  }[];
@@ -747,31 +879,31 @@ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
747
879
  where: {
748
880
  value?: string | number | undefined;
749
881
  custom?: string | undefined;
750
- columnName?: string | undefined;
751
882
  tableName?: string | undefined;
883
+ columnName?: string | undefined;
752
884
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
753
885
  conjunction?: "AND" | "OR" | undefined;
754
886
  }[];
755
887
  properties: any[];
756
888
  groupBy?: {
757
- columnName: string;
758
889
  tableName: string;
890
+ columnName: string;
759
891
  } | undefined;
760
892
  orderBy?: {
893
+ tableName: string;
761
894
  columnName: string;
762
895
  order: "ASC" | "DESC";
763
- tableName: string;
764
896
  } | undefined;
765
897
  } | undefined;
766
898
  }[];
767
899
  groupBy?: {
768
- columnName: string;
769
900
  tableName: string;
901
+ columnName: string;
770
902
  } | undefined;
771
903
  orderBy?: {
904
+ tableName: string;
772
905
  columnName: string;
773
906
  order: "ASC" | "DESC";
774
- tableName: string;
775
907
  } | undefined;
776
908
  }>;
777
909
  type StandardRouteData = z.infer<typeof standardRouteSchema>;
@@ -1030,7 +1162,7 @@ declare const tableDataSchema: z.ZodObject<{
1030
1162
  }[];
1031
1163
  }>;
1032
1164
  type TableData = z.infer<typeof tableDataSchema>;
1033
- declare const resturaZodSchema: z.ZodObject<{
1165
+ declare const resturaSchema: z.ZodObject<{
1034
1166
  database: z.ZodArray<z.ZodObject<{
1035
1167
  name: z.ZodString;
1036
1168
  columns: z.ZodArray<z.ZodObject<{
@@ -1248,15 +1380,15 @@ declare const resturaZodSchema: z.ZodObject<{
1248
1380
  }, "strict", z.ZodTypeAny, {
1249
1381
  value?: string | number | undefined;
1250
1382
  custom?: string | undefined;
1251
- columnName?: string | undefined;
1252
1383
  tableName?: string | undefined;
1384
+ columnName?: string | undefined;
1253
1385
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1254
1386
  conjunction?: "AND" | "OR" | undefined;
1255
1387
  }, {
1256
1388
  value?: string | number | undefined;
1257
1389
  custom?: string | undefined;
1258
- columnName?: string | undefined;
1259
1390
  tableName?: string | undefined;
1391
+ columnName?: string | undefined;
1260
1392
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1261
1393
  conjunction?: "AND" | "OR" | undefined;
1262
1394
  }>, "many">;
@@ -1328,15 +1460,15 @@ declare const resturaZodSchema: z.ZodObject<{
1328
1460
  }, "strict", z.ZodTypeAny, {
1329
1461
  value?: string | number | undefined;
1330
1462
  custom?: string | undefined;
1331
- columnName?: string | undefined;
1332
1463
  tableName?: string | undefined;
1464
+ columnName?: string | undefined;
1333
1465
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1334
1466
  conjunction?: "AND" | "OR" | undefined;
1335
1467
  }, {
1336
1468
  value?: string | number | undefined;
1337
1469
  custom?: string | undefined;
1338
- columnName?: string | undefined;
1339
1470
  tableName?: string | undefined;
1471
+ columnName?: string | undefined;
1340
1472
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1341
1473
  conjunction?: "AND" | "OR" | undefined;
1342
1474
  }>, "many">;
@@ -1345,24 +1477,24 @@ declare const resturaZodSchema: z.ZodObject<{
1345
1477
  columnName: z.ZodString;
1346
1478
  tableName: z.ZodString;
1347
1479
  }, "strict", z.ZodTypeAny, {
1348
- columnName: string;
1349
1480
  tableName: string;
1350
- }, {
1351
1481
  columnName: string;
1482
+ }, {
1352
1483
  tableName: string;
1484
+ columnName: string;
1353
1485
  }>>;
1354
1486
  orderBy: z.ZodOptional<z.ZodObject<{
1355
1487
  columnName: z.ZodString;
1356
1488
  order: z.ZodEnum<["ASC", "DESC"]>;
1357
1489
  tableName: z.ZodString;
1358
1490
  }, "strict", z.ZodTypeAny, {
1491
+ tableName: string;
1359
1492
  columnName: string;
1360
1493
  order: "ASC" | "DESC";
1361
- tableName: string;
1362
1494
  }, {
1495
+ tableName: string;
1363
1496
  columnName: string;
1364
1497
  order: "ASC" | "DESC";
1365
- tableName: string;
1366
1498
  }>>;
1367
1499
  }, "strip", z.ZodTypeAny, {
1368
1500
  table: string;
@@ -1377,20 +1509,20 @@ declare const resturaZodSchema: z.ZodObject<{
1377
1509
  where: {
1378
1510
  value?: string | number | undefined;
1379
1511
  custom?: string | undefined;
1380
- columnName?: string | undefined;
1381
1512
  tableName?: string | undefined;
1513
+ columnName?: string | undefined;
1382
1514
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1383
1515
  conjunction?: "AND" | "OR" | undefined;
1384
1516
  }[];
1385
1517
  properties: any[];
1386
1518
  groupBy?: {
1387
- columnName: string;
1388
1519
  tableName: string;
1520
+ columnName: string;
1389
1521
  } | undefined;
1390
1522
  orderBy?: {
1523
+ tableName: string;
1391
1524
  columnName: string;
1392
1525
  order: "ASC" | "DESC";
1393
- tableName: string;
1394
1526
  } | undefined;
1395
1527
  }, {
1396
1528
  table: string;
@@ -1405,20 +1537,20 @@ declare const resturaZodSchema: z.ZodObject<{
1405
1537
  where: {
1406
1538
  value?: string | number | undefined;
1407
1539
  custom?: string | undefined;
1408
- columnName?: string | undefined;
1409
1540
  tableName?: string | undefined;
1541
+ columnName?: string | undefined;
1410
1542
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1411
1543
  conjunction?: "AND" | "OR" | undefined;
1412
1544
  }[];
1413
1545
  properties: any[];
1414
1546
  groupBy?: {
1415
- columnName: string;
1416
1547
  tableName: string;
1548
+ columnName: string;
1417
1549
  } | undefined;
1418
1550
  orderBy?: {
1551
+ tableName: string;
1419
1552
  columnName: string;
1420
1553
  order: "ASC" | "DESC";
1421
- tableName: string;
1422
1554
  } | undefined;
1423
1555
  }>>;
1424
1556
  }, "strict", z.ZodTypeAny, {
@@ -1437,20 +1569,20 @@ declare const resturaZodSchema: z.ZodObject<{
1437
1569
  where: {
1438
1570
  value?: string | number | undefined;
1439
1571
  custom?: string | undefined;
1440
- columnName?: string | undefined;
1441
1572
  tableName?: string | undefined;
1573
+ columnName?: string | undefined;
1442
1574
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1443
1575
  conjunction?: "AND" | "OR" | undefined;
1444
1576
  }[];
1445
1577
  properties: any[];
1446
1578
  groupBy?: {
1447
- columnName: string;
1448
1579
  tableName: string;
1580
+ columnName: string;
1449
1581
  } | undefined;
1450
1582
  orderBy?: {
1583
+ tableName: string;
1451
1584
  columnName: string;
1452
1585
  order: "ASC" | "DESC";
1453
- tableName: string;
1454
1586
  } | undefined;
1455
1587
  } | undefined;
1456
1588
  }, {
@@ -1469,20 +1601,20 @@ declare const resturaZodSchema: z.ZodObject<{
1469
1601
  where: {
1470
1602
  value?: string | number | undefined;
1471
1603
  custom?: string | undefined;
1472
- columnName?: string | undefined;
1473
1604
  tableName?: string | undefined;
1605
+ columnName?: string | undefined;
1474
1606
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1475
1607
  conjunction?: "AND" | "OR" | undefined;
1476
1608
  }[];
1477
1609
  properties: any[];
1478
1610
  groupBy?: {
1479
- columnName: string;
1480
1611
  tableName: string;
1612
+ columnName: string;
1481
1613
  } | undefined;
1482
1614
  orderBy?: {
1615
+ tableName: string;
1483
1616
  columnName: string;
1484
1617
  order: "ASC" | "DESC";
1485
- tableName: string;
1486
1618
  } | undefined;
1487
1619
  } | undefined;
1488
1620
  }>, "many">;
@@ -1490,24 +1622,24 @@ declare const resturaZodSchema: z.ZodObject<{
1490
1622
  columnName: z.ZodString;
1491
1623
  tableName: z.ZodString;
1492
1624
  }, "strict", z.ZodTypeAny, {
1493
- columnName: string;
1494
1625
  tableName: string;
1495
- }, {
1496
1626
  columnName: string;
1627
+ }, {
1497
1628
  tableName: string;
1629
+ columnName: string;
1498
1630
  }>>;
1499
1631
  orderBy: z.ZodOptional<z.ZodObject<{
1500
1632
  columnName: z.ZodString;
1501
1633
  order: z.ZodEnum<["ASC", "DESC"]>;
1502
1634
  tableName: z.ZodString;
1503
1635
  }, "strict", z.ZodTypeAny, {
1636
+ tableName: string;
1504
1637
  columnName: string;
1505
1638
  order: "ASC" | "DESC";
1506
- tableName: string;
1507
1639
  }, {
1640
+ tableName: string;
1508
1641
  columnName: string;
1509
1642
  order: "ASC" | "DESC";
1510
- tableName: string;
1511
1643
  }>>;
1512
1644
  }>, "strict", z.ZodTypeAny, {
1513
1645
  path: string;
@@ -1525,8 +1657,8 @@ declare const resturaZodSchema: z.ZodObject<{
1525
1657
  where: {
1526
1658
  value?: string | number | undefined;
1527
1659
  custom?: string | undefined;
1528
- columnName?: string | undefined;
1529
1660
  tableName?: string | undefined;
1661
+ columnName?: string | undefined;
1530
1662
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1531
1663
  conjunction?: "AND" | "OR" | undefined;
1532
1664
  }[];
@@ -1562,31 +1694,31 @@ declare const resturaZodSchema: z.ZodObject<{
1562
1694
  where: {
1563
1695
  value?: string | number | undefined;
1564
1696
  custom?: string | undefined;
1565
- columnName?: string | undefined;
1566
1697
  tableName?: string | undefined;
1698
+ columnName?: string | undefined;
1567
1699
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1568
1700
  conjunction?: "AND" | "OR" | undefined;
1569
1701
  }[];
1570
1702
  properties: any[];
1571
1703
  groupBy?: {
1572
- columnName: string;
1573
1704
  tableName: string;
1705
+ columnName: string;
1574
1706
  } | undefined;
1575
1707
  orderBy?: {
1708
+ tableName: string;
1576
1709
  columnName: string;
1577
1710
  order: "ASC" | "DESC";
1578
- tableName: string;
1579
1711
  } | undefined;
1580
1712
  } | undefined;
1581
1713
  }[];
1582
1714
  groupBy?: {
1583
- columnName: string;
1584
1715
  tableName: string;
1716
+ columnName: string;
1585
1717
  } | undefined;
1586
1718
  orderBy?: {
1719
+ tableName: string;
1587
1720
  columnName: string;
1588
1721
  order: "ASC" | "DESC";
1589
- tableName: string;
1590
1722
  } | undefined;
1591
1723
  }, {
1592
1724
  path: string;
@@ -1604,8 +1736,8 @@ declare const resturaZodSchema: z.ZodObject<{
1604
1736
  where: {
1605
1737
  value?: string | number | undefined;
1606
1738
  custom?: string | undefined;
1607
- columnName?: string | undefined;
1608
1739
  tableName?: string | undefined;
1740
+ columnName?: string | undefined;
1609
1741
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1610
1742
  conjunction?: "AND" | "OR" | undefined;
1611
1743
  }[];
@@ -1641,31 +1773,31 @@ declare const resturaZodSchema: z.ZodObject<{
1641
1773
  where: {
1642
1774
  value?: string | number | undefined;
1643
1775
  custom?: string | undefined;
1644
- columnName?: string | undefined;
1645
1776
  tableName?: string | undefined;
1777
+ columnName?: string | undefined;
1646
1778
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1647
1779
  conjunction?: "AND" | "OR" | undefined;
1648
1780
  }[];
1649
1781
  properties: any[];
1650
1782
  groupBy?: {
1651
- columnName: string;
1652
1783
  tableName: string;
1784
+ columnName: string;
1653
1785
  } | undefined;
1654
1786
  orderBy?: {
1787
+ tableName: string;
1655
1788
  columnName: string;
1656
1789
  order: "ASC" | "DESC";
1657
- tableName: string;
1658
1790
  } | undefined;
1659
1791
  } | undefined;
1660
1792
  }[];
1661
1793
  groupBy?: {
1662
- columnName: string;
1663
1794
  tableName: string;
1795
+ columnName: string;
1664
1796
  } | undefined;
1665
1797
  orderBy?: {
1798
+ tableName: string;
1666
1799
  columnName: string;
1667
1800
  order: "ASC" | "DESC";
1668
- tableName: string;
1669
1801
  } | undefined;
1670
1802
  }>, z.ZodObject<z.objectUtil.extendShape<{
1671
1803
  method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
@@ -1777,8 +1909,8 @@ declare const resturaZodSchema: z.ZodObject<{
1777
1909
  where: {
1778
1910
  value?: string | number | undefined;
1779
1911
  custom?: string | undefined;
1780
- columnName?: string | undefined;
1781
1912
  tableName?: string | undefined;
1913
+ columnName?: string | undefined;
1782
1914
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1783
1915
  conjunction?: "AND" | "OR" | undefined;
1784
1916
  }[];
@@ -1814,31 +1946,31 @@ declare const resturaZodSchema: z.ZodObject<{
1814
1946
  where: {
1815
1947
  value?: string | number | undefined;
1816
1948
  custom?: string | undefined;
1817
- columnName?: string | undefined;
1818
1949
  tableName?: string | undefined;
1950
+ columnName?: string | undefined;
1819
1951
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1820
1952
  conjunction?: "AND" | "OR" | undefined;
1821
1953
  }[];
1822
1954
  properties: any[];
1823
1955
  groupBy?: {
1824
- columnName: string;
1825
1956
  tableName: string;
1957
+ columnName: string;
1826
1958
  } | undefined;
1827
1959
  orderBy?: {
1960
+ tableName: string;
1828
1961
  columnName: string;
1829
1962
  order: "ASC" | "DESC";
1830
- tableName: string;
1831
1963
  } | undefined;
1832
1964
  } | undefined;
1833
1965
  }[];
1834
1966
  groupBy?: {
1835
- columnName: string;
1836
1967
  tableName: string;
1968
+ columnName: string;
1837
1969
  } | undefined;
1838
1970
  orderBy?: {
1971
+ tableName: string;
1839
1972
  columnName: string;
1840
1973
  order: "ASC" | "DESC";
1841
- tableName: string;
1842
1974
  } | undefined;
1843
1975
  } | {
1844
1976
  path: string;
@@ -1883,8 +2015,8 @@ declare const resturaZodSchema: z.ZodObject<{
1883
2015
  where: {
1884
2016
  value?: string | number | undefined;
1885
2017
  custom?: string | undefined;
1886
- columnName?: string | undefined;
1887
2018
  tableName?: string | undefined;
2019
+ columnName?: string | undefined;
1888
2020
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1889
2021
  conjunction?: "AND" | "OR" | undefined;
1890
2022
  }[];
@@ -1920,31 +2052,31 @@ declare const resturaZodSchema: z.ZodObject<{
1920
2052
  where: {
1921
2053
  value?: string | number | undefined;
1922
2054
  custom?: string | undefined;
1923
- columnName?: string | undefined;
1924
2055
  tableName?: string | undefined;
2056
+ columnName?: string | undefined;
1925
2057
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
1926
2058
  conjunction?: "AND" | "OR" | undefined;
1927
2059
  }[];
1928
2060
  properties: any[];
1929
2061
  groupBy?: {
1930
- columnName: string;
1931
2062
  tableName: string;
2063
+ columnName: string;
1932
2064
  } | undefined;
1933
2065
  orderBy?: {
2066
+ tableName: string;
1934
2067
  columnName: string;
1935
2068
  order: "ASC" | "DESC";
1936
- tableName: string;
1937
2069
  } | undefined;
1938
2070
  } | undefined;
1939
2071
  }[];
1940
2072
  groupBy?: {
1941
- columnName: string;
1942
2073
  tableName: string;
2074
+ columnName: string;
1943
2075
  } | undefined;
1944
2076
  orderBy?: {
2077
+ tableName: string;
1945
2078
  columnName: string;
1946
2079
  order: "ASC" | "DESC";
1947
- tableName: string;
1948
2080
  } | undefined;
1949
2081
  } | {
1950
2082
  path: string;
@@ -2031,8 +2163,8 @@ declare const resturaZodSchema: z.ZodObject<{
2031
2163
  where: {
2032
2164
  value?: string | number | undefined;
2033
2165
  custom?: string | undefined;
2034
- columnName?: string | undefined;
2035
2166
  tableName?: string | undefined;
2167
+ columnName?: string | undefined;
2036
2168
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
2037
2169
  conjunction?: "AND" | "OR" | undefined;
2038
2170
  }[];
@@ -2068,31 +2200,31 @@ declare const resturaZodSchema: z.ZodObject<{
2068
2200
  where: {
2069
2201
  value?: string | number | undefined;
2070
2202
  custom?: string | undefined;
2071
- columnName?: string | undefined;
2072
2203
  tableName?: string | undefined;
2204
+ columnName?: string | undefined;
2073
2205
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
2074
2206
  conjunction?: "AND" | "OR" | undefined;
2075
2207
  }[];
2076
2208
  properties: any[];
2077
2209
  groupBy?: {
2078
- columnName: string;
2079
2210
  tableName: string;
2211
+ columnName: string;
2080
2212
  } | undefined;
2081
2213
  orderBy?: {
2214
+ tableName: string;
2082
2215
  columnName: string;
2083
2216
  order: "ASC" | "DESC";
2084
- tableName: string;
2085
2217
  } | undefined;
2086
2218
  } | undefined;
2087
2219
  }[];
2088
2220
  groupBy?: {
2089
- columnName: string;
2090
2221
  tableName: string;
2222
+ columnName: string;
2091
2223
  } | undefined;
2092
2224
  orderBy?: {
2225
+ tableName: string;
2093
2226
  columnName: string;
2094
2227
  order: "ASC" | "DESC";
2095
- tableName: string;
2096
2228
  } | undefined;
2097
2229
  } | {
2098
2230
  path: string;
@@ -2178,8 +2310,8 @@ declare const resturaZodSchema: z.ZodObject<{
2178
2310
  where: {
2179
2311
  value?: string | number | undefined;
2180
2312
  custom?: string | undefined;
2181
- columnName?: string | undefined;
2182
2313
  tableName?: string | undefined;
2314
+ columnName?: string | undefined;
2183
2315
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
2184
2316
  conjunction?: "AND" | "OR" | undefined;
2185
2317
  }[];
@@ -2215,31 +2347,31 @@ declare const resturaZodSchema: z.ZodObject<{
2215
2347
  where: {
2216
2348
  value?: string | number | undefined;
2217
2349
  custom?: string | undefined;
2218
- columnName?: string | undefined;
2219
2350
  tableName?: string | undefined;
2351
+ columnName?: string | undefined;
2220
2352
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
2221
2353
  conjunction?: "AND" | "OR" | undefined;
2222
2354
  }[];
2223
2355
  properties: any[];
2224
2356
  groupBy?: {
2225
- columnName: string;
2226
2357
  tableName: string;
2358
+ columnName: string;
2227
2359
  } | undefined;
2228
2360
  orderBy?: {
2361
+ tableName: string;
2229
2362
  columnName: string;
2230
2363
  order: "ASC" | "DESC";
2231
- tableName: string;
2232
2364
  } | undefined;
2233
2365
  } | undefined;
2234
2366
  }[];
2235
2367
  groupBy?: {
2236
- columnName: string;
2237
2368
  tableName: string;
2369
+ columnName: string;
2238
2370
  } | undefined;
2239
2371
  orderBy?: {
2372
+ tableName: string;
2240
2373
  columnName: string;
2241
2374
  order: "ASC" | "DESC";
2242
- tableName: string;
2243
2375
  } | undefined;
2244
2376
  } | {
2245
2377
  path: string;
@@ -2268,101 +2400,7 @@ declare const resturaZodSchema: z.ZodObject<{
2268
2400
  globalParams: string[];
2269
2401
  customTypes: string;
2270
2402
  }>;
2271
- type ResturaSchema = z.infer<typeof resturaZodSchema>;
2272
-
2273
- interface SchemaChangeValue {
2274
- name: string;
2275
- changeType: 'NEW' | 'MODIFIED' | 'DELETED';
2276
- }
2277
- interface SchemaPreview {
2278
- commands: string;
2279
- endPoints: SchemaChangeValue[];
2280
- globalParams: SchemaChangeValue[];
2281
- roles: SchemaChangeValue[];
2282
- customTypes: boolean;
2283
- }
2284
- interface LoginDetails {
2285
- token: string;
2286
- refreshToken: string;
2287
- expiresOn: string;
2288
- user: {
2289
- firstName: string;
2290
- lastName: string;
2291
- email: string;
2292
- };
2293
- }
2294
- type ValidatorString = 'boolean' | 'string' | 'number' | 'object' | 'any';
2295
- interface ResponseType {
2296
- isOptional?: boolean;
2297
- isArray?: boolean;
2298
- validator: ValidatorString | ResponseTypeMap | string[];
2299
- }
2300
- interface ResponseTypeMap {
2301
- [property: string]: ResponseType;
2302
- }
2303
- type StandardOrderTypes = 'ASC' | 'DESC' | 'RAND' | 'NONE';
2304
- type ConjunctionTypes = 'AND' | 'OR';
2305
- type MatchTypes = 'exact' | 'fuzzy' | 'like' | 'greaterThan' | 'greaterThanEqual' | 'lessThan' | 'lessThanEqual';
2306
- interface RsResponseData<T> {
2307
- data: T;
2308
- }
2309
- interface RsErrorData {
2310
- err: string;
2311
- msg: string;
2312
- stack?: string;
2313
- }
2314
- interface RsPagedResponseData<T> extends RsResponseData<T> {
2315
- total: number;
2316
- }
2317
- interface PageQuery {
2318
- page: number;
2319
- perPage: number;
2320
- sortBy: string;
2321
- sortOrder: StandardOrderTypes;
2322
- filter?: string;
2323
- [key: string]: string | number | boolean | object | null | undefined;
2324
- }
2325
- interface AuthenticationUserDetails {
2326
- role: string;
2327
- userId?: number;
2328
- [key: string]: string | number | boolean | object | null | undefined;
2329
- }
2330
- type ValidAuthenticationCallback = (userDetails: AuthenticationUserDetails) => void;
2331
- type AuthenticateHandler = (req: RsRequest<unknown>, res: RsResponse<unknown>, onValid: ValidAuthenticationCallback) => Promise<void>;
2332
-
2333
- interface RsHeaders extends IncomingHttpHeaders {
2334
- 'x-auth-token'?: string;
2335
- }
2336
- type ApiMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
2337
- type RequesterDetails<T extends object = {}> = {
2338
- role: string;
2339
- host: string;
2340
- ipAddress: string;
2341
- userId?: number;
2342
- isSystemUser?: boolean;
2343
- } & T;
2344
- interface RsRequest<T = unknown, U extends object = Record<string, unknown>> extends express.Request {
2345
- requesterDetails: RequesterDetails<U>;
2346
- data: T;
2347
- }
2348
- type DynamicObject<T = unknown> = {
2349
- [key: string]: T;
2350
- };
2351
- interface RsResponse<T = unknown> extends express.Response {
2352
- sendData: (data: T, statusCode?: number) => void;
2353
- sendNoWrap: (data: T, statusCode?: number) => void;
2354
- sendError: (err: ErrorCode, msg: string, htmlStatusCode?: HtmlStatusCodes, stack?: string) => void;
2355
- sendPaginated: (pagedData: RsPagedResponseData<T>, statusCode?: number) => void;
2356
- _contentLength?: number;
2357
- }
2358
- type RsRouteHandler<T = unknown, U = unknown> = (req: RsRequest<T>, res: RsResponse<U>, next?: express.NextFunction) => Promise<void>;
2359
- interface AsyncExpressApplication {
2360
- get: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
2361
- post: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
2362
- put: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
2363
- patch: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
2364
- delete: (url: string, handler: RsRouteHandler, nextFunction?: RsRouteHandler) => Promise<void> | void;
2365
- }
2403
+ type ResturaSchema = z.infer<typeof resturaSchema>;
2366
2404
 
2367
2405
  declare abstract class PsqlConnection {
2368
2406
  readonly instanceId: UUID;
@@ -2432,6 +2470,12 @@ declare class ResturaEngine {
2432
2470
  * @returns A promise that resolves when the model has been successfully written to the output file.
2433
2471
  */
2434
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;
2435
2479
  /**
2436
2480
  * Retrieves the latest file system schema for Restura.
2437
2481
  *
@@ -2439,20 +2483,6 @@ declare class ResturaEngine {
2439
2483
  * @throws {Error} If the schema file is missing or the schema is not valid.
2440
2484
  */
2441
2485
  getLatestFileSystemSchema(): Promise<ResturaSchema>;
2442
- /**
2443
- * Asynchronously generates and retrieves hashes for the provided schema and related generated files.
2444
- *
2445
- * @param providedSchema - The schema for which hashes need to be generated.
2446
- * @returns A promise that resolves to an object containing:
2447
- * - `schemaHash`: The hash of the provided schema.
2448
- * - `apiCreatedSchemaHash`: The hash extracted from the generated `api.d.ts` file.
2449
- * - `modelCreatedSchemaHash`: The hash extracted from the generated `models.d.ts` file.
2450
- */
2451
- getHashes(providedSchema: ResturaSchema): Promise<{
2452
- schemaHash: string;
2453
- apiCreatedSchemaHash: string;
2454
- modelCreatedSchemaHash: string;
2455
- }>;
2456
2486
  private reloadEndpoints;
2457
2487
  private validateGeneratedTypesFolder;
2458
2488
  private resturaAuthentication;
@@ -2465,7 +2495,6 @@ declare class ResturaEngine {
2465
2495
  private executeRouteLogic;
2466
2496
  private isCustomRoute;
2467
2497
  private runCustomRouteLogic;
2468
- private generateHashForSchema;
2469
2498
  private storeFileSystemSchema;
2470
2499
  private resetPublicEndpoints;
2471
2500
  private validateAuthorization;
@@ -2473,27 +2502,6 @@ declare class ResturaEngine {
2473
2502
  }
2474
2503
  declare const restura: ResturaEngine;
2475
2504
 
2476
- declare function escapeColumnName(columnName: string | undefined): string;
2477
- declare function questionMarksToOrderedParams(query: string): string;
2478
- declare function insertObjectQuery(table: string, obj: DynamicObject): string;
2479
- declare function updateObjectQuery(table: string, obj: DynamicObject, whereStatement: string): string;
2480
- declare function isValueNumber(value: unknown): value is number;
2481
- declare function SQL(strings: any, ...values: any): any;
2482
-
2483
- declare class PsqlTransaction extends PsqlConnection {
2484
- clientConfig: ClientConfig;
2485
- client: Client;
2486
- private beginTransactionPromise;
2487
- private connectPromise;
2488
- constructor(clientConfig: ClientConfig);
2489
- close(): Promise<void>;
2490
- private beginTransaction;
2491
- rollback(): Promise<QueryResult<QueryResultRow>>;
2492
- commit(): Promise<QueryResult<QueryResultRow>>;
2493
- release(): Promise<void>;
2494
- protected query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
2495
- }
2496
-
2497
2505
  declare abstract class SqlEngine {
2498
2506
  runQueryForRoute(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[] | boolean>;
2499
2507
  protected getTableSchema(schema: ResturaSchema, tableName: string): TableData;
@@ -2541,61 +2549,31 @@ declare class PsqlEngine extends SqlEngine {
2541
2549
  private createInsertTriggers;
2542
2550
  }
2543
2551
 
2544
- type EventType = 'DATABASE_ROW_DELETE' | 'DATABASE_ROW_INSERT' | 'DATABASE_COLUMN_UPDATE' | 'WEBHOOK';
2545
- type MutationType = 'INSERT' | 'UPDATE' | 'DELETE';
2546
- interface SqlMutationData {
2547
- mutationType: MutationType;
2548
- queryMetadata: QueryMetadata;
2549
- }
2550
- interface DatabaseActionData {
2551
- tableName: string;
2552
- queryMetadata: QueryMetadata;
2553
- }
2554
- interface ActionRowInsertData<T = DynamicObject> extends DatabaseActionData {
2555
- insertId: number;
2556
- insertObject: T;
2557
- }
2558
- interface ActionRowDeleteData extends DatabaseActionData {
2559
- deletedRow: DynamicObject;
2560
- }
2561
- interface ActionColumnChangeData extends DatabaseActionData {
2562
- tableName: string;
2563
- rowId: number;
2564
- newData: DynamicObject;
2565
- oldData: DynamicObject;
2566
- }
2567
- interface ActionRowInsertFilter {
2568
- tableName: string;
2569
- }
2570
- interface ActionRowDeleteFilter {
2571
- tableName: string;
2572
- }
2573
- interface ActionColumnChangeFilter {
2574
- tableName: string;
2575
- columns: string[];
2576
- }
2577
- type TriggerResult = {
2578
- table: string;
2579
- insertId?: number;
2580
- query: string;
2581
- record: DynamicObject;
2582
- previousRecord: DynamicObject;
2583
- requesterId: number;
2584
- };
2585
- type QueryMetadata = RequesterDetails & {
2586
- connectionInstanceId: UUID;
2587
- };
2588
- declare class EventManager {
2589
- private actionHandlers;
2590
- addRowInsertHandler(onInsert: (data: ActionRowInsertData<unknown>) => Promise<void>, filter?: ActionRowInsertFilter): void;
2591
- addColumnChangeHandler(onUpdate: (data: ActionColumnChangeData) => Promise<void>, filter: ActionColumnChangeFilter): void;
2592
- addRowDeleteHandler(onDelete: (data: ActionRowDeleteData) => Promise<void>, filter?: ActionRowDeleteFilter): void;
2593
- fireActionFromDbTrigger(sqlMutationData: SqlMutationData, result: TriggerResult): Promise<void>;
2594
- private fireInsertActions;
2595
- private fireDeleteActions;
2596
- private fireUpdateActions;
2597
- private hasHandlersForEventType;
2552
+ declare class PsqlTransaction extends PsqlConnection {
2553
+ clientConfig: ClientConfig;
2554
+ client: Client;
2555
+ private beginTransactionPromise;
2556
+ private connectPromise;
2557
+ constructor(clientConfig: ClientConfig);
2558
+ close(): Promise<void>;
2559
+ private beginTransaction;
2560
+ rollback(): Promise<QueryResult<QueryResultRow>>;
2561
+ commit(): Promise<QueryResult<QueryResultRow>>;
2562
+ release(): Promise<void>;
2563
+ protected query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
2598
2564
  }
2599
- declare const eventManager: EventManager;
2600
2565
 
2601
- 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 LoginDetails, type MatchTypes, type MutationType, type PageQuery, PsqlConnection, PsqlEngine, PsqlPool, PsqlTransaction, type QueryMetadata, type RequesterDetails, type ResponseType, type ResponseTypeMap, 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, type ValidatorString, escapeColumnName, eventManager, insertObjectQuery, isValueNumber, logger, questionMarksToOrderedParams, restura, updateObjectQuery };
2566
+ declare function escapeColumnName(columnName: string | undefined): string;
2567
+ /**
2568
+ * Converts a query with question marks to a query with numbered parameters,
2569
+ * however it ignores question marks inside single or double quotes.
2570
+ * @param query PostgreSQL query with question marks
2571
+ * @returns A string with numbered parameters such as $1, $2 in replacement of question marks
2572
+ */
2573
+ declare function questionMarksToOrderedParams(query: string): string;
2574
+ declare function insertObjectQuery(table: string, obj: DynamicObject): string;
2575
+ declare function updateObjectQuery(table: string, obj: DynamicObject, whereStatement: string): string;
2576
+ declare function isValueNumber(value: unknown): value is number;
2577
+ declare function SQL(strings: any, ...values: any): any;
2578
+
2579
+ 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 };