@restura/core 0.1.0-alpha.17 → 0.1.0-alpha.19

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
@@ -57,6 +57,975 @@ declare const resturaConfigSchema: z.ZodObject<{
57
57
  }>;
58
58
  type ResturaConfigSchema = z.infer<typeof resturaConfigSchema>;
59
59
 
60
+ declare const whereDataSchema: z.ZodObject<{
61
+ tableName: z.ZodOptional<z.ZodString>;
62
+ columnName: z.ZodOptional<z.ZodString>;
63
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
64
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
65
+ custom: z.ZodOptional<z.ZodString>;
66
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
67
+ }, "strict", z.ZodTypeAny, {
68
+ value?: string | number | undefined;
69
+ custom?: string | undefined;
70
+ columnName?: string | undefined;
71
+ tableName?: string | undefined;
72
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
73
+ conjunction?: "AND" | "OR" | undefined;
74
+ }, {
75
+ value?: string | number | undefined;
76
+ custom?: string | undefined;
77
+ columnName?: string | undefined;
78
+ tableName?: string | undefined;
79
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
80
+ conjunction?: "AND" | "OR" | undefined;
81
+ }>;
82
+ type WhereData = z.infer<typeof whereDataSchema>;
83
+ declare const joinDataSchema: z.ZodObject<{
84
+ table: z.ZodString;
85
+ localColumnName: z.ZodOptional<z.ZodString>;
86
+ foreignColumnName: z.ZodOptional<z.ZodString>;
87
+ custom: z.ZodOptional<z.ZodString>;
88
+ type: z.ZodEnum<["LEFT", "INNER"]>;
89
+ alias: z.ZodOptional<z.ZodString>;
90
+ }, "strict", z.ZodTypeAny, {
91
+ type: "LEFT" | "INNER";
92
+ table: string;
93
+ custom?: string | undefined;
94
+ localColumnName?: string | undefined;
95
+ foreignColumnName?: string | undefined;
96
+ alias?: string | undefined;
97
+ }, {
98
+ type: "LEFT" | "INNER";
99
+ table: string;
100
+ custom?: string | undefined;
101
+ localColumnName?: string | undefined;
102
+ foreignColumnName?: string | undefined;
103
+ alias?: string | undefined;
104
+ }>;
105
+ type JoinData = z.infer<typeof joinDataSchema>;
106
+ declare const responseDataSchema: z.ZodObject<{
107
+ name: z.ZodString;
108
+ selector: z.ZodOptional<z.ZodString>;
109
+ subquery: z.ZodOptional<z.ZodObject<{
110
+ table: z.ZodString;
111
+ joins: z.ZodArray<z.ZodObject<{
112
+ table: z.ZodString;
113
+ localColumnName: z.ZodOptional<z.ZodString>;
114
+ foreignColumnName: z.ZodOptional<z.ZodString>;
115
+ custom: z.ZodOptional<z.ZodString>;
116
+ type: z.ZodEnum<["LEFT", "INNER"]>;
117
+ alias: z.ZodOptional<z.ZodString>;
118
+ }, "strict", z.ZodTypeAny, {
119
+ type: "LEFT" | "INNER";
120
+ table: string;
121
+ custom?: string | undefined;
122
+ localColumnName?: string | undefined;
123
+ foreignColumnName?: string | undefined;
124
+ alias?: string | undefined;
125
+ }, {
126
+ type: "LEFT" | "INNER";
127
+ table: string;
128
+ custom?: string | undefined;
129
+ localColumnName?: string | undefined;
130
+ foreignColumnName?: string | undefined;
131
+ alias?: string | undefined;
132
+ }>, "many">;
133
+ where: z.ZodArray<z.ZodObject<{
134
+ tableName: z.ZodOptional<z.ZodString>;
135
+ columnName: z.ZodOptional<z.ZodString>;
136
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
137
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
138
+ custom: z.ZodOptional<z.ZodString>;
139
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
140
+ }, "strict", z.ZodTypeAny, {
141
+ value?: string | number | undefined;
142
+ custom?: string | undefined;
143
+ columnName?: string | undefined;
144
+ tableName?: string | undefined;
145
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
146
+ conjunction?: "AND" | "OR" | undefined;
147
+ }, {
148
+ value?: string | number | undefined;
149
+ custom?: string | undefined;
150
+ columnName?: string | undefined;
151
+ tableName?: string | undefined;
152
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
153
+ conjunction?: "AND" | "OR" | undefined;
154
+ }>, "many">;
155
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
156
+ groupBy: z.ZodOptional<z.ZodObject<{
157
+ columnName: z.ZodString;
158
+ tableName: z.ZodString;
159
+ }, "strict", z.ZodTypeAny, {
160
+ columnName: string;
161
+ tableName: string;
162
+ }, {
163
+ columnName: string;
164
+ tableName: string;
165
+ }>>;
166
+ orderBy: z.ZodOptional<z.ZodObject<{
167
+ columnName: z.ZodString;
168
+ order: z.ZodEnum<["ASC", "DESC"]>;
169
+ tableName: z.ZodString;
170
+ }, "strict", z.ZodTypeAny, {
171
+ columnName: string;
172
+ order: "ASC" | "DESC";
173
+ tableName: string;
174
+ }, {
175
+ columnName: string;
176
+ order: "ASC" | "DESC";
177
+ tableName: string;
178
+ }>>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ table: string;
181
+ joins: {
182
+ type: "LEFT" | "INNER";
183
+ table: string;
184
+ custom?: string | undefined;
185
+ localColumnName?: string | undefined;
186
+ foreignColumnName?: string | undefined;
187
+ alias?: string | undefined;
188
+ }[];
189
+ where: {
190
+ value?: string | number | undefined;
191
+ custom?: string | undefined;
192
+ columnName?: string | undefined;
193
+ tableName?: string | undefined;
194
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
195
+ conjunction?: "AND" | "OR" | undefined;
196
+ }[];
197
+ properties: any[];
198
+ groupBy?: {
199
+ columnName: string;
200
+ tableName: string;
201
+ } | undefined;
202
+ orderBy?: {
203
+ columnName: string;
204
+ order: "ASC" | "DESC";
205
+ tableName: string;
206
+ } | undefined;
207
+ }, {
208
+ table: string;
209
+ joins: {
210
+ type: "LEFT" | "INNER";
211
+ table: string;
212
+ custom?: string | undefined;
213
+ localColumnName?: string | undefined;
214
+ foreignColumnName?: string | undefined;
215
+ alias?: string | undefined;
216
+ }[];
217
+ where: {
218
+ value?: string | number | undefined;
219
+ custom?: string | undefined;
220
+ columnName?: string | undefined;
221
+ tableName?: string | undefined;
222
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
223
+ conjunction?: "AND" | "OR" | undefined;
224
+ }[];
225
+ properties: any[];
226
+ groupBy?: {
227
+ columnName: string;
228
+ tableName: string;
229
+ } | undefined;
230
+ orderBy?: {
231
+ columnName: string;
232
+ order: "ASC" | "DESC";
233
+ tableName: string;
234
+ } | undefined;
235
+ }>>;
236
+ }, "strict", z.ZodTypeAny, {
237
+ name: string;
238
+ selector?: string | undefined;
239
+ subquery?: {
240
+ table: string;
241
+ joins: {
242
+ type: "LEFT" | "INNER";
243
+ table: string;
244
+ custom?: string | undefined;
245
+ localColumnName?: string | undefined;
246
+ foreignColumnName?: string | undefined;
247
+ alias?: string | undefined;
248
+ }[];
249
+ where: {
250
+ value?: string | number | undefined;
251
+ custom?: string | undefined;
252
+ columnName?: string | undefined;
253
+ tableName?: string | undefined;
254
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
255
+ conjunction?: "AND" | "OR" | undefined;
256
+ }[];
257
+ properties: any[];
258
+ groupBy?: {
259
+ columnName: string;
260
+ tableName: string;
261
+ } | undefined;
262
+ orderBy?: {
263
+ columnName: string;
264
+ order: "ASC" | "DESC";
265
+ tableName: string;
266
+ } | undefined;
267
+ } | undefined;
268
+ }, {
269
+ name: string;
270
+ selector?: string | undefined;
271
+ subquery?: {
272
+ table: string;
273
+ joins: {
274
+ type: "LEFT" | "INNER";
275
+ table: string;
276
+ custom?: string | undefined;
277
+ localColumnName?: string | undefined;
278
+ foreignColumnName?: string | undefined;
279
+ alias?: string | undefined;
280
+ }[];
281
+ where: {
282
+ value?: string | number | undefined;
283
+ custom?: string | undefined;
284
+ columnName?: string | undefined;
285
+ tableName?: string | undefined;
286
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
287
+ conjunction?: "AND" | "OR" | undefined;
288
+ }[];
289
+ properties: any[];
290
+ groupBy?: {
291
+ columnName: string;
292
+ tableName: string;
293
+ } | undefined;
294
+ orderBy?: {
295
+ columnName: string;
296
+ order: "ASC" | "DESC";
297
+ tableName: string;
298
+ } | undefined;
299
+ } | undefined;
300
+ }>;
301
+ type ResponseData = z.infer<typeof responseDataSchema>;
302
+ declare const standardRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
303
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
304
+ name: z.ZodString;
305
+ description: z.ZodString;
306
+ path: z.ZodString;
307
+ roles: z.ZodArray<z.ZodString, "many">;
308
+ }, {
309
+ type: z.ZodEnum<["ONE", "ARRAY", "PAGED"]>;
310
+ table: z.ZodString;
311
+ joins: z.ZodArray<z.ZodObject<{
312
+ table: z.ZodString;
313
+ localColumnName: z.ZodOptional<z.ZodString>;
314
+ foreignColumnName: z.ZodOptional<z.ZodString>;
315
+ custom: z.ZodOptional<z.ZodString>;
316
+ type: z.ZodEnum<["LEFT", "INNER"]>;
317
+ alias: z.ZodOptional<z.ZodString>;
318
+ }, "strict", z.ZodTypeAny, {
319
+ type: "LEFT" | "INNER";
320
+ table: string;
321
+ custom?: string | undefined;
322
+ localColumnName?: string | undefined;
323
+ foreignColumnName?: string | undefined;
324
+ alias?: string | undefined;
325
+ }, {
326
+ type: "LEFT" | "INNER";
327
+ table: string;
328
+ custom?: string | undefined;
329
+ localColumnName?: string | undefined;
330
+ foreignColumnName?: string | undefined;
331
+ alias?: string | undefined;
332
+ }>, "many">;
333
+ assignments: z.ZodArray<z.ZodObject<{
334
+ name: z.ZodString;
335
+ value: z.ZodString;
336
+ }, "strict", z.ZodTypeAny, {
337
+ value: string;
338
+ name: string;
339
+ }, {
340
+ value: string;
341
+ name: string;
342
+ }>, "many">;
343
+ where: z.ZodArray<z.ZodObject<{
344
+ tableName: z.ZodOptional<z.ZodString>;
345
+ columnName: z.ZodOptional<z.ZodString>;
346
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
347
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
348
+ custom: z.ZodOptional<z.ZodString>;
349
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
350
+ }, "strict", z.ZodTypeAny, {
351
+ value?: string | number | undefined;
352
+ custom?: string | undefined;
353
+ columnName?: string | undefined;
354
+ tableName?: string | undefined;
355
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
356
+ conjunction?: "AND" | "OR" | undefined;
357
+ }, {
358
+ value?: string | number | undefined;
359
+ custom?: string | undefined;
360
+ columnName?: string | undefined;
361
+ tableName?: string | undefined;
362
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
363
+ conjunction?: "AND" | "OR" | undefined;
364
+ }>, "many">;
365
+ request: z.ZodArray<z.ZodObject<{
366
+ name: z.ZodString;
367
+ required: z.ZodBoolean;
368
+ isNullable: z.ZodOptional<z.ZodBoolean>;
369
+ validator: z.ZodArray<z.ZodObject<{
370
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
371
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
372
+ }, "strict", z.ZodTypeAny, {
373
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
374
+ value: string | number | string[] | number[];
375
+ }, {
376
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
377
+ value: string | number | string[] | number[];
378
+ }>, "many">;
379
+ }, "strict", z.ZodTypeAny, {
380
+ name: string;
381
+ required: boolean;
382
+ validator: {
383
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
384
+ value: string | number | string[] | number[];
385
+ }[];
386
+ isNullable?: boolean | undefined;
387
+ }, {
388
+ name: string;
389
+ required: boolean;
390
+ validator: {
391
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
392
+ value: string | number | string[] | number[];
393
+ }[];
394
+ isNullable?: boolean | undefined;
395
+ }>, "many">;
396
+ response: z.ZodArray<z.ZodObject<{
397
+ name: z.ZodString;
398
+ selector: z.ZodOptional<z.ZodString>;
399
+ subquery: z.ZodOptional<z.ZodObject<{
400
+ table: z.ZodString;
401
+ joins: z.ZodArray<z.ZodObject<{
402
+ table: z.ZodString;
403
+ localColumnName: z.ZodOptional<z.ZodString>;
404
+ foreignColumnName: z.ZodOptional<z.ZodString>;
405
+ custom: z.ZodOptional<z.ZodString>;
406
+ type: z.ZodEnum<["LEFT", "INNER"]>;
407
+ alias: z.ZodOptional<z.ZodString>;
408
+ }, "strict", z.ZodTypeAny, {
409
+ type: "LEFT" | "INNER";
410
+ table: string;
411
+ custom?: string | undefined;
412
+ localColumnName?: string | undefined;
413
+ foreignColumnName?: string | undefined;
414
+ alias?: string | undefined;
415
+ }, {
416
+ type: "LEFT" | "INNER";
417
+ table: string;
418
+ custom?: string | undefined;
419
+ localColumnName?: string | undefined;
420
+ foreignColumnName?: string | undefined;
421
+ alias?: string | undefined;
422
+ }>, "many">;
423
+ where: z.ZodArray<z.ZodObject<{
424
+ tableName: z.ZodOptional<z.ZodString>;
425
+ columnName: z.ZodOptional<z.ZodString>;
426
+ operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
427
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
428
+ custom: z.ZodOptional<z.ZodString>;
429
+ conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
430
+ }, "strict", z.ZodTypeAny, {
431
+ value?: string | number | undefined;
432
+ custom?: string | undefined;
433
+ columnName?: string | undefined;
434
+ tableName?: string | undefined;
435
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
436
+ conjunction?: "AND" | "OR" | undefined;
437
+ }, {
438
+ value?: string | number | undefined;
439
+ custom?: string | undefined;
440
+ columnName?: string | undefined;
441
+ tableName?: string | undefined;
442
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
443
+ conjunction?: "AND" | "OR" | undefined;
444
+ }>, "many">;
445
+ properties: z.ZodArray<z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>, "many">;
446
+ groupBy: z.ZodOptional<z.ZodObject<{
447
+ columnName: z.ZodString;
448
+ tableName: z.ZodString;
449
+ }, "strict", z.ZodTypeAny, {
450
+ columnName: string;
451
+ tableName: string;
452
+ }, {
453
+ columnName: string;
454
+ tableName: string;
455
+ }>>;
456
+ orderBy: z.ZodOptional<z.ZodObject<{
457
+ columnName: z.ZodString;
458
+ order: z.ZodEnum<["ASC", "DESC"]>;
459
+ tableName: z.ZodString;
460
+ }, "strict", z.ZodTypeAny, {
461
+ columnName: string;
462
+ order: "ASC" | "DESC";
463
+ tableName: string;
464
+ }, {
465
+ columnName: string;
466
+ order: "ASC" | "DESC";
467
+ tableName: string;
468
+ }>>;
469
+ }, "strip", z.ZodTypeAny, {
470
+ table: string;
471
+ joins: {
472
+ type: "LEFT" | "INNER";
473
+ table: string;
474
+ custom?: string | undefined;
475
+ localColumnName?: string | undefined;
476
+ foreignColumnName?: string | undefined;
477
+ alias?: string | undefined;
478
+ }[];
479
+ where: {
480
+ value?: string | number | undefined;
481
+ custom?: string | undefined;
482
+ columnName?: string | undefined;
483
+ tableName?: string | undefined;
484
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
485
+ conjunction?: "AND" | "OR" | undefined;
486
+ }[];
487
+ properties: any[];
488
+ groupBy?: {
489
+ columnName: string;
490
+ tableName: string;
491
+ } | undefined;
492
+ orderBy?: {
493
+ columnName: string;
494
+ order: "ASC" | "DESC";
495
+ tableName: string;
496
+ } | undefined;
497
+ }, {
498
+ table: string;
499
+ joins: {
500
+ type: "LEFT" | "INNER";
501
+ table: string;
502
+ custom?: string | undefined;
503
+ localColumnName?: string | undefined;
504
+ foreignColumnName?: string | undefined;
505
+ alias?: string | undefined;
506
+ }[];
507
+ where: {
508
+ value?: string | number | undefined;
509
+ custom?: string | undefined;
510
+ columnName?: string | undefined;
511
+ tableName?: string | undefined;
512
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
513
+ conjunction?: "AND" | "OR" | undefined;
514
+ }[];
515
+ properties: any[];
516
+ groupBy?: {
517
+ columnName: string;
518
+ tableName: string;
519
+ } | undefined;
520
+ orderBy?: {
521
+ columnName: string;
522
+ order: "ASC" | "DESC";
523
+ tableName: string;
524
+ } | undefined;
525
+ }>>;
526
+ }, "strict", z.ZodTypeAny, {
527
+ name: string;
528
+ selector?: string | undefined;
529
+ subquery?: {
530
+ table: string;
531
+ joins: {
532
+ type: "LEFT" | "INNER";
533
+ table: string;
534
+ custom?: string | undefined;
535
+ localColumnName?: string | undefined;
536
+ foreignColumnName?: string | undefined;
537
+ alias?: string | undefined;
538
+ }[];
539
+ where: {
540
+ value?: string | number | undefined;
541
+ custom?: string | undefined;
542
+ columnName?: string | undefined;
543
+ tableName?: string | undefined;
544
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
545
+ conjunction?: "AND" | "OR" | undefined;
546
+ }[];
547
+ properties: any[];
548
+ groupBy?: {
549
+ columnName: string;
550
+ tableName: string;
551
+ } | undefined;
552
+ orderBy?: {
553
+ columnName: string;
554
+ order: "ASC" | "DESC";
555
+ tableName: string;
556
+ } | undefined;
557
+ } | undefined;
558
+ }, {
559
+ name: string;
560
+ selector?: string | undefined;
561
+ subquery?: {
562
+ table: string;
563
+ joins: {
564
+ type: "LEFT" | "INNER";
565
+ table: string;
566
+ custom?: string | undefined;
567
+ localColumnName?: string | undefined;
568
+ foreignColumnName?: string | undefined;
569
+ alias?: string | undefined;
570
+ }[];
571
+ where: {
572
+ value?: string | number | undefined;
573
+ custom?: string | undefined;
574
+ columnName?: string | undefined;
575
+ tableName?: string | undefined;
576
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
577
+ conjunction?: "AND" | "OR" | undefined;
578
+ }[];
579
+ properties: any[];
580
+ groupBy?: {
581
+ columnName: string;
582
+ tableName: string;
583
+ } | undefined;
584
+ orderBy?: {
585
+ columnName: string;
586
+ order: "ASC" | "DESC";
587
+ tableName: string;
588
+ } | undefined;
589
+ } | undefined;
590
+ }>, "many">;
591
+ groupBy: z.ZodOptional<z.ZodObject<{
592
+ columnName: z.ZodString;
593
+ tableName: z.ZodString;
594
+ }, "strict", z.ZodTypeAny, {
595
+ columnName: string;
596
+ tableName: string;
597
+ }, {
598
+ columnName: string;
599
+ tableName: string;
600
+ }>>;
601
+ orderBy: z.ZodOptional<z.ZodObject<{
602
+ columnName: z.ZodString;
603
+ order: z.ZodEnum<["ASC", "DESC"]>;
604
+ tableName: z.ZodString;
605
+ }, "strict", z.ZodTypeAny, {
606
+ columnName: string;
607
+ order: "ASC" | "DESC";
608
+ tableName: string;
609
+ }, {
610
+ columnName: string;
611
+ order: "ASC" | "DESC";
612
+ tableName: string;
613
+ }>>;
614
+ }>, "strict", z.ZodTypeAny, {
615
+ path: string;
616
+ type: "ONE" | "ARRAY" | "PAGED";
617
+ name: string;
618
+ table: string;
619
+ joins: {
620
+ type: "LEFT" | "INNER";
621
+ table: string;
622
+ custom?: string | undefined;
623
+ localColumnName?: string | undefined;
624
+ foreignColumnName?: string | undefined;
625
+ alias?: string | undefined;
626
+ }[];
627
+ where: {
628
+ value?: string | number | undefined;
629
+ custom?: string | undefined;
630
+ columnName?: string | undefined;
631
+ tableName?: string | undefined;
632
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
633
+ conjunction?: "AND" | "OR" | undefined;
634
+ }[];
635
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
636
+ description: string;
637
+ roles: string[];
638
+ assignments: {
639
+ value: string;
640
+ name: string;
641
+ }[];
642
+ request: {
643
+ name: string;
644
+ required: boolean;
645
+ validator: {
646
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
647
+ value: string | number | string[] | number[];
648
+ }[];
649
+ isNullable?: boolean | undefined;
650
+ }[];
651
+ response: {
652
+ name: string;
653
+ selector?: string | undefined;
654
+ subquery?: {
655
+ table: string;
656
+ joins: {
657
+ type: "LEFT" | "INNER";
658
+ table: string;
659
+ custom?: string | undefined;
660
+ localColumnName?: string | undefined;
661
+ foreignColumnName?: string | undefined;
662
+ alias?: string | undefined;
663
+ }[];
664
+ where: {
665
+ value?: string | number | undefined;
666
+ custom?: string | undefined;
667
+ columnName?: string | undefined;
668
+ tableName?: string | undefined;
669
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
670
+ conjunction?: "AND" | "OR" | undefined;
671
+ }[];
672
+ properties: any[];
673
+ groupBy?: {
674
+ columnName: string;
675
+ tableName: string;
676
+ } | undefined;
677
+ orderBy?: {
678
+ columnName: string;
679
+ order: "ASC" | "DESC";
680
+ tableName: string;
681
+ } | undefined;
682
+ } | undefined;
683
+ }[];
684
+ groupBy?: {
685
+ columnName: string;
686
+ tableName: string;
687
+ } | undefined;
688
+ orderBy?: {
689
+ columnName: string;
690
+ order: "ASC" | "DESC";
691
+ tableName: string;
692
+ } | undefined;
693
+ }, {
694
+ path: string;
695
+ type: "ONE" | "ARRAY" | "PAGED";
696
+ name: string;
697
+ table: string;
698
+ joins: {
699
+ type: "LEFT" | "INNER";
700
+ table: string;
701
+ custom?: string | undefined;
702
+ localColumnName?: string | undefined;
703
+ foreignColumnName?: string | undefined;
704
+ alias?: string | undefined;
705
+ }[];
706
+ where: {
707
+ value?: string | number | undefined;
708
+ custom?: string | undefined;
709
+ columnName?: string | undefined;
710
+ tableName?: string | undefined;
711
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
712
+ conjunction?: "AND" | "OR" | undefined;
713
+ }[];
714
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
715
+ description: string;
716
+ roles: string[];
717
+ assignments: {
718
+ value: string;
719
+ name: string;
720
+ }[];
721
+ request: {
722
+ name: string;
723
+ required: boolean;
724
+ validator: {
725
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
726
+ value: string | number | string[] | number[];
727
+ }[];
728
+ isNullable?: boolean | undefined;
729
+ }[];
730
+ response: {
731
+ name: string;
732
+ selector?: string | undefined;
733
+ subquery?: {
734
+ table: string;
735
+ joins: {
736
+ type: "LEFT" | "INNER";
737
+ table: string;
738
+ custom?: string | undefined;
739
+ localColumnName?: string | undefined;
740
+ foreignColumnName?: string | undefined;
741
+ alias?: string | undefined;
742
+ }[];
743
+ where: {
744
+ value?: string | number | undefined;
745
+ custom?: string | undefined;
746
+ columnName?: string | undefined;
747
+ tableName?: string | undefined;
748
+ operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
749
+ conjunction?: "AND" | "OR" | undefined;
750
+ }[];
751
+ properties: any[];
752
+ groupBy?: {
753
+ columnName: string;
754
+ tableName: string;
755
+ } | undefined;
756
+ orderBy?: {
757
+ columnName: string;
758
+ order: "ASC" | "DESC";
759
+ tableName: string;
760
+ } | undefined;
761
+ } | undefined;
762
+ }[];
763
+ groupBy?: {
764
+ columnName: string;
765
+ tableName: string;
766
+ } | undefined;
767
+ orderBy?: {
768
+ columnName: string;
769
+ order: "ASC" | "DESC";
770
+ tableName: string;
771
+ } | undefined;
772
+ }>;
773
+ type StandardRouteData = z.infer<typeof standardRouteSchema>;
774
+ declare const customRouteSchema: z.ZodObject<z.objectUtil.extendShape<{
775
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
776
+ name: z.ZodString;
777
+ description: z.ZodString;
778
+ path: z.ZodString;
779
+ roles: z.ZodArray<z.ZodString, "many">;
780
+ }, {
781
+ type: z.ZodEnum<["CUSTOM_ONE", "CUSTOM_ARRAY", "CUSTOM_PAGED"]>;
782
+ responseType: z.ZodUnion<[z.ZodString, z.ZodEnum<["string", "number", "boolean"]>]>;
783
+ requestType: z.ZodOptional<z.ZodString>;
784
+ request: z.ZodOptional<z.ZodArray<z.ZodObject<{
785
+ name: z.ZodString;
786
+ required: z.ZodBoolean;
787
+ isNullable: z.ZodOptional<z.ZodBoolean>;
788
+ validator: z.ZodArray<z.ZodObject<{
789
+ type: z.ZodEnum<["TYPE_CHECK", "MIN", "MAX", "ONE_OF"]>;
790
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>;
791
+ }, "strict", z.ZodTypeAny, {
792
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
793
+ value: string | number | string[] | number[];
794
+ }, {
795
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
796
+ value: string | number | string[] | number[];
797
+ }>, "many">;
798
+ }, "strict", z.ZodTypeAny, {
799
+ name: string;
800
+ required: boolean;
801
+ validator: {
802
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
803
+ value: string | number | string[] | number[];
804
+ }[];
805
+ isNullable?: boolean | undefined;
806
+ }, {
807
+ name: string;
808
+ required: boolean;
809
+ validator: {
810
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
811
+ value: string | number | string[] | number[];
812
+ }[];
813
+ isNullable?: boolean | undefined;
814
+ }>, "many">>;
815
+ table: z.ZodUndefined;
816
+ joins: z.ZodUndefined;
817
+ assignments: z.ZodUndefined;
818
+ fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
819
+ }>, "strict", z.ZodTypeAny, {
820
+ path: string;
821
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
822
+ name: string;
823
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
824
+ description: string;
825
+ roles: string[];
826
+ responseType: string;
827
+ table?: undefined;
828
+ joins?: undefined;
829
+ assignments?: undefined;
830
+ request?: {
831
+ name: string;
832
+ required: boolean;
833
+ validator: {
834
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
835
+ value: string | number | string[] | number[];
836
+ }[];
837
+ isNullable?: boolean | undefined;
838
+ }[] | undefined;
839
+ requestType?: string | undefined;
840
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
841
+ }, {
842
+ path: string;
843
+ type: "CUSTOM_ONE" | "CUSTOM_ARRAY" | "CUSTOM_PAGED";
844
+ name: string;
845
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
846
+ description: string;
847
+ roles: string[];
848
+ responseType: string;
849
+ table?: undefined;
850
+ joins?: undefined;
851
+ assignments?: undefined;
852
+ request?: {
853
+ name: string;
854
+ required: boolean;
855
+ validator: {
856
+ type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
857
+ value: string | number | string[] | number[];
858
+ }[];
859
+ isNullable?: boolean | undefined;
860
+ }[] | undefined;
861
+ requestType?: string | undefined;
862
+ fileUploadType?: "SINGLE" | "MULTIPLE" | undefined;
863
+ }>;
864
+ type CustomRouteData = z.infer<typeof customRouteSchema>;
865
+ type RouteData = CustomRouteData | StandardRouteData;
866
+ declare const tableDataSchema: z.ZodObject<{
867
+ name: z.ZodString;
868
+ columns: z.ZodArray<z.ZodObject<{
869
+ name: z.ZodString;
870
+ 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"]>]>;
871
+ isNullable: z.ZodBoolean;
872
+ roles: z.ZodArray<z.ZodString, "many">;
873
+ comment: z.ZodOptional<z.ZodString>;
874
+ default: z.ZodOptional<z.ZodString>;
875
+ value: z.ZodOptional<z.ZodString>;
876
+ isPrimary: z.ZodOptional<z.ZodBoolean>;
877
+ isUnique: z.ZodOptional<z.ZodBoolean>;
878
+ hasAutoIncrement: z.ZodOptional<z.ZodBoolean>;
879
+ length: z.ZodOptional<z.ZodNumber>;
880
+ }, "strict", z.ZodTypeAny, {
881
+ 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";
882
+ name: string;
883
+ isNullable: boolean;
884
+ roles: string[];
885
+ length?: number | undefined;
886
+ value?: string | undefined;
887
+ default?: string | undefined;
888
+ comment?: string | undefined;
889
+ isPrimary?: boolean | undefined;
890
+ isUnique?: boolean | undefined;
891
+ hasAutoIncrement?: boolean | undefined;
892
+ }, {
893
+ 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";
894
+ name: string;
895
+ isNullable: boolean;
896
+ roles: string[];
897
+ length?: number | undefined;
898
+ value?: string | undefined;
899
+ default?: string | undefined;
900
+ comment?: string | undefined;
901
+ isPrimary?: boolean | undefined;
902
+ isUnique?: boolean | undefined;
903
+ hasAutoIncrement?: boolean | undefined;
904
+ }>, "many">;
905
+ indexes: z.ZodArray<z.ZodObject<{
906
+ name: z.ZodString;
907
+ columns: z.ZodArray<z.ZodString, "many">;
908
+ isUnique: z.ZodBoolean;
909
+ isPrimaryKey: z.ZodBoolean;
910
+ order: z.ZodEnum<["ASC", "DESC"]>;
911
+ }, "strict", z.ZodTypeAny, {
912
+ order: "ASC" | "DESC";
913
+ name: string;
914
+ isUnique: boolean;
915
+ columns: string[];
916
+ isPrimaryKey: boolean;
917
+ }, {
918
+ order: "ASC" | "DESC";
919
+ name: string;
920
+ isUnique: boolean;
921
+ columns: string[];
922
+ isPrimaryKey: boolean;
923
+ }>, "many">;
924
+ foreignKeys: z.ZodArray<z.ZodObject<{
925
+ name: z.ZodString;
926
+ column: z.ZodString;
927
+ refTable: z.ZodString;
928
+ refColumn: z.ZodString;
929
+ onDelete: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
930
+ onUpdate: z.ZodEnum<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION", "SET DEFAULT"]>;
931
+ }, "strict", z.ZodTypeAny, {
932
+ name: string;
933
+ column: string;
934
+ refTable: string;
935
+ refColumn: string;
936
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
937
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
938
+ }, {
939
+ name: string;
940
+ column: string;
941
+ refTable: string;
942
+ refColumn: string;
943
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
944
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
945
+ }>, "many">;
946
+ checkConstraints: z.ZodArray<z.ZodObject<{
947
+ name: z.ZodString;
948
+ check: z.ZodString;
949
+ }, "strict", z.ZodTypeAny, {
950
+ name: string;
951
+ check: string;
952
+ }, {
953
+ name: string;
954
+ check: string;
955
+ }>, "many">;
956
+ roles: z.ZodArray<z.ZodString, "many">;
957
+ }, "strict", z.ZodTypeAny, {
958
+ name: string;
959
+ roles: string[];
960
+ columns: {
961
+ type: "SMALLINT" | "INTEGER" | "BIGINT" | "DECIMAL" | "NUMERIC" | "REAL" | "DOUBLE PRECISION" | "SERIAL" | "BIGSERIAL" | "CHAR" | "VARCHAR" | "TEXT" | "BYTEA" | "DATE" | "TIMESTAMP" | "TIMESTAMPTZ" | "TIME" | "INTERVAL" | "JSON" | "JSONB" | "BOOLEAN" | "TINYINT" | "MEDIUMINT" | "FLOAT" | "DOUBLE" | "TINYTEXT" | "TINYBLOB" | "BLOB" | "MEDIUMTEXT" | "MEDIUMBLOB" | "LONGTEXT" | "LONGBLOB" | "ENUM" | "DATETIME";
962
+ name: string;
963
+ isNullable: boolean;
964
+ roles: string[];
965
+ length?: number | undefined;
966
+ value?: string | undefined;
967
+ default?: string | undefined;
968
+ comment?: string | undefined;
969
+ isPrimary?: boolean | undefined;
970
+ isUnique?: boolean | undefined;
971
+ hasAutoIncrement?: boolean | undefined;
972
+ }[];
973
+ indexes: {
974
+ order: "ASC" | "DESC";
975
+ name: string;
976
+ isUnique: boolean;
977
+ columns: string[];
978
+ isPrimaryKey: boolean;
979
+ }[];
980
+ foreignKeys: {
981
+ name: string;
982
+ column: string;
983
+ refTable: string;
984
+ refColumn: string;
985
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
986
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
987
+ }[];
988
+ checkConstraints: {
989
+ name: string;
990
+ check: string;
991
+ }[];
992
+ }, {
993
+ name: string;
994
+ roles: string[];
995
+ columns: {
996
+ 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";
997
+ name: string;
998
+ isNullable: boolean;
999
+ roles: string[];
1000
+ length?: number | undefined;
1001
+ value?: string | undefined;
1002
+ default?: string | undefined;
1003
+ comment?: string | undefined;
1004
+ isPrimary?: boolean | undefined;
1005
+ isUnique?: boolean | undefined;
1006
+ hasAutoIncrement?: boolean | undefined;
1007
+ }[];
1008
+ indexes: {
1009
+ order: "ASC" | "DESC";
1010
+ name: string;
1011
+ isUnique: boolean;
1012
+ columns: string[];
1013
+ isPrimaryKey: boolean;
1014
+ }[];
1015
+ foreignKeys: {
1016
+ name: string;
1017
+ column: string;
1018
+ refTable: string;
1019
+ refColumn: string;
1020
+ onDelete: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1021
+ onUpdate: "CASCADE" | "SET NULL" | "RESTRICT" | "NO ACTION" | "SET DEFAULT";
1022
+ }[];
1023
+ checkConstraints: {
1024
+ name: string;
1025
+ check: string;
1026
+ }[];
1027
+ }>;
1028
+ type TableData = z.infer<typeof tableDataSchema>;
60
1029
  declare const resturaZodSchema: z.ZodObject<{
61
1030
  database: z.ZodArray<z.ZodObject<{
62
1031
  name: z.ZodString;
@@ -1508,7 +2477,9 @@ declare class PsqlTransaction extends PsqlConnection {
1508
2477
  clientConfig: ClientConfig;
1509
2478
  client: Client;
1510
2479
  private beginTransactionPromise;
2480
+ private connectPromise;
1511
2481
  constructor(clientConfig: ClientConfig);
2482
+ close(): Promise<void>;
1512
2483
  private beginTransaction;
1513
2484
  rollback(): Promise<QueryResult<QueryResultRow>>;
1514
2485
  commit(): Promise<QueryResult<QueryResultRow>>;
@@ -1516,6 +2487,53 @@ declare class PsqlTransaction extends PsqlConnection {
1516
2487
  protected query<R extends QueryResultRow = QueryResultRow, T extends Array<unknown> = unknown[]>(query: string, values?: QueryConfigValues<T>): Promise<QueryResult<R>>;
1517
2488
  }
1518
2489
 
2490
+ declare abstract class SqlEngine {
2491
+ runQueryForRoute(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[] | boolean>;
2492
+ protected getTableSchema(schema: ResturaSchema, tableName: string): TableData;
2493
+ protected doesRoleHavePermissionToColumn(role: string | undefined | null, schema: ResturaSchema, item: ResponseData, joins: JoinData[]): boolean;
2494
+ protected doesRoleHavePermissionToTable(userRole: string | undefined, schema: ResturaSchema, tableName: string): boolean;
2495
+ protected abstract generateJoinStatements(req: RsRequest<unknown>, joins: JoinData[], baseTable: string, routeData: StandardRouteData, schema: ResturaSchema, userRole: string | undefined, sqlParams: string[]): string;
2496
+ protected abstract generateGroupBy(routeData: StandardRouteData): string;
2497
+ protected abstract generateOrderBy(req: RsRequest<unknown>, routeData: StandardRouteData): string;
2498
+ protected abstract generateWhereClause(req: RsRequest<unknown>, where: WhereData[], routeData: StandardRouteData, sqlParams: string[]): string;
2499
+ protected replaceParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2500
+ protected replaceLocalParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2501
+ protected replaceGlobalParamKeywords(value: string | number, routeData: RouteData, req: RsRequest<unknown>, sqlParams: string[]): string | number;
2502
+ abstract generateDatabaseSchemaFromSchema(schema: ResturaSchema): string;
2503
+ abstract diffDatabaseToSchema(schema: ResturaSchema): Promise<string>;
2504
+ protected abstract createNestedSelect(req: RsRequest<unknown>, schema: ResturaSchema, item: ResponseData, routeData: StandardRouteData, userRole: string | undefined, sqlParams: string[]): string;
2505
+ protected abstract executeCreateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2506
+ protected abstract executeGetRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[]>;
2507
+ protected abstract executeUpdateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2508
+ protected abstract executeDeleteRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<boolean>;
2509
+ }
2510
+
2511
+ declare class PsqlEngine extends SqlEngine {
2512
+ private psqlConnectionPool;
2513
+ setupTriggerListeners: Promise<void> | undefined;
2514
+ private triggerClient;
2515
+ constructor(psqlConnectionPool: PsqlPool, shouldListenForDbTriggers?: boolean);
2516
+ close(): Promise<void>;
2517
+ private listenForDbTriggers;
2518
+ private handleTrigger;
2519
+ createDatabaseFromSchema(schema: ResturaSchema, connection: PsqlPool): Promise<string>;
2520
+ generateDatabaseSchemaFromSchema(schema: ResturaSchema): string;
2521
+ private getScratchPool;
2522
+ diffDatabaseToSchema(schema: ResturaSchema): Promise<string>;
2523
+ protected createNestedSelect(req: RsRequest<unknown>, schema: ResturaSchema, item: ResponseData, routeData: StandardRouteData, userRole: string | undefined, sqlParams: string[]): string;
2524
+ protected executeCreateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2525
+ protected executeGetRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject | any[]>;
2526
+ protected executeUpdateRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<DynamicObject>;
2527
+ protected executeDeleteRequest(req: RsRequest<unknown>, routeData: StandardRouteData, schema: ResturaSchema): Promise<boolean>;
2528
+ protected generateJoinStatements(req: RsRequest<unknown>, joins: JoinData[], baseTable: string, routeData: StandardRouteData | CustomRouteData, schema: ResturaSchema, userRole: string | undefined, sqlParams: string[]): string;
2529
+ protected generateGroupBy(routeData: StandardRouteData): string;
2530
+ protected generateOrderBy(req: RsRequest<unknown>, routeData: StandardRouteData): string;
2531
+ protected generateWhereClause(req: RsRequest<unknown>, where: WhereData[], routeData: StandardRouteData | CustomRouteData, sqlParams: string[]): string;
2532
+ private createUpdateTrigger;
2533
+ private createDeleteTrigger;
2534
+ private createInsertTriggers;
2535
+ }
2536
+
1519
2537
  type EventType = 'DATABASE_ROW_DELETE' | 'DATABASE_ROW_INSERT' | 'DATABASE_COLUMN_UPDATE' | 'WEBHOOK';
1520
2538
  type MutationType = 'INSERT' | 'UPDATE' | 'DELETE';
1521
2539
  interface SqlMutationData {
@@ -1569,4 +2587,4 @@ declare class EventManager {
1569
2587
  }
1570
2588
  declare const eventManager: EventManager;
1571
2589
 
1572
- 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, PsqlPool, PsqlTransaction, 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 };
2590
+ 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 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 };