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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import winston from 'winston';
2
2
  import * as express from 'express';
3
3
  import { z } from 'zod';
4
+ import { PoolConfig, Pool } from 'pg';
4
5
 
5
6
  declare const logger: winston.Logger;
6
7
 
@@ -234,18 +235,18 @@ declare const resturaZodSchema: z.ZodObject<{
234
235
  tableName: z.ZodOptional<z.ZodString>;
235
236
  columnName: z.ZodOptional<z.ZodString>;
236
237
  operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
237
- value: z.ZodOptional<z.ZodString>;
238
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
238
239
  custom: z.ZodOptional<z.ZodString>;
239
240
  conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
240
241
  }, "strict", z.ZodTypeAny, {
241
- value?: string | undefined;
242
+ value?: string | number | undefined;
242
243
  custom?: string | undefined;
243
244
  columnName?: string | undefined;
244
245
  tableName?: string | undefined;
245
246
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
246
247
  conjunction?: "AND" | "OR" | undefined;
247
248
  }, {
248
- value?: string | undefined;
249
+ value?: string | number | undefined;
249
250
  custom?: string | undefined;
250
251
  columnName?: string | undefined;
251
252
  tableName?: string | undefined;
@@ -311,18 +312,18 @@ declare const resturaZodSchema: z.ZodObject<{
311
312
  tableName: z.ZodOptional<z.ZodString>;
312
313
  columnName: z.ZodOptional<z.ZodString>;
313
314
  operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
314
- value: z.ZodOptional<z.ZodString>;
315
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
315
316
  custom: z.ZodOptional<z.ZodString>;
316
317
  conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
317
318
  }, "strict", z.ZodTypeAny, {
318
- value?: string | undefined;
319
+ value?: string | number | undefined;
319
320
  custom?: string | undefined;
320
321
  columnName?: string | undefined;
321
322
  tableName?: string | undefined;
322
323
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
323
324
  conjunction?: "AND" | "OR" | undefined;
324
325
  }, {
325
- value?: string | undefined;
326
+ value?: string | number | undefined;
326
327
  custom?: string | undefined;
327
328
  columnName?: string | undefined;
328
329
  tableName?: string | undefined;
@@ -364,7 +365,7 @@ declare const resturaZodSchema: z.ZodObject<{
364
365
  alias?: string | undefined;
365
366
  }[];
366
367
  where: {
367
- value?: string | undefined;
368
+ value?: string | number | undefined;
368
369
  custom?: string | undefined;
369
370
  columnName?: string | undefined;
370
371
  tableName?: string | undefined;
@@ -392,7 +393,7 @@ declare const resturaZodSchema: z.ZodObject<{
392
393
  alias?: string | undefined;
393
394
  }[];
394
395
  where: {
395
- value?: string | undefined;
396
+ value?: string | number | undefined;
396
397
  custom?: string | undefined;
397
398
  columnName?: string | undefined;
398
399
  tableName?: string | undefined;
@@ -424,7 +425,7 @@ declare const resturaZodSchema: z.ZodObject<{
424
425
  alias?: string | undefined;
425
426
  }[];
426
427
  where: {
427
- value?: string | undefined;
428
+ value?: string | number | undefined;
428
429
  custom?: string | undefined;
429
430
  columnName?: string | undefined;
430
431
  tableName?: string | undefined;
@@ -456,7 +457,7 @@ declare const resturaZodSchema: z.ZodObject<{
456
457
  alias?: string | undefined;
457
458
  }[];
458
459
  where: {
459
- value?: string | undefined;
460
+ value?: string | number | undefined;
460
461
  custom?: string | undefined;
461
462
  columnName?: string | undefined;
462
463
  tableName?: string | undefined;
@@ -512,7 +513,7 @@ declare const resturaZodSchema: z.ZodObject<{
512
513
  alias?: string | undefined;
513
514
  }[];
514
515
  where: {
515
- value?: string | undefined;
516
+ value?: string | number | undefined;
516
517
  custom?: string | undefined;
517
518
  columnName?: string | undefined;
518
519
  tableName?: string | undefined;
@@ -548,7 +549,7 @@ declare const resturaZodSchema: z.ZodObject<{
548
549
  alias?: string | undefined;
549
550
  }[];
550
551
  where: {
551
- value?: string | undefined;
552
+ value?: string | number | undefined;
552
553
  custom?: string | undefined;
553
554
  columnName?: string | undefined;
554
555
  tableName?: string | undefined;
@@ -590,7 +591,7 @@ declare const resturaZodSchema: z.ZodObject<{
590
591
  alias?: string | undefined;
591
592
  }[];
592
593
  where: {
593
- value?: string | undefined;
594
+ value?: string | number | undefined;
594
595
  custom?: string | undefined;
595
596
  columnName?: string | undefined;
596
597
  tableName?: string | undefined;
@@ -626,7 +627,7 @@ declare const resturaZodSchema: z.ZodObject<{
626
627
  alias?: string | undefined;
627
628
  }[];
628
629
  where: {
629
- value?: string | undefined;
630
+ value?: string | number | undefined;
630
631
  custom?: string | undefined;
631
632
  columnName?: string | undefined;
632
633
  tableName?: string | undefined;
@@ -692,6 +693,9 @@ declare const resturaZodSchema: z.ZodObject<{
692
693
  name: string;
693
694
  required: boolean;
694
695
  }>, "many">>;
696
+ table: z.ZodUndefined;
697
+ joins: z.ZodUndefined;
698
+ assignments: z.ZodUndefined;
695
699
  fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
696
700
  }>, "strict", z.ZodTypeAny, {
697
701
  path: string;
@@ -701,6 +705,9 @@ declare const resturaZodSchema: z.ZodObject<{
701
705
  description: string;
702
706
  roles: string[];
703
707
  responseType: string;
708
+ table?: undefined;
709
+ joins?: undefined;
710
+ assignments?: undefined;
704
711
  request?: {
705
712
  validator: {
706
713
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -719,6 +726,9 @@ declare const resturaZodSchema: z.ZodObject<{
719
726
  description: string;
720
727
  roles: string[];
721
728
  responseType: string;
729
+ table?: undefined;
730
+ joins?: undefined;
731
+ assignments?: undefined;
722
732
  request?: {
723
733
  validator: {
724
734
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -748,7 +758,7 @@ declare const resturaZodSchema: z.ZodObject<{
748
758
  alias?: string | undefined;
749
759
  }[];
750
760
  where: {
751
- value?: string | undefined;
761
+ value?: string | number | undefined;
752
762
  custom?: string | undefined;
753
763
  columnName?: string | undefined;
754
764
  tableName?: string | undefined;
@@ -784,7 +794,7 @@ declare const resturaZodSchema: z.ZodObject<{
784
794
  alias?: string | undefined;
785
795
  }[];
786
796
  where: {
787
- value?: string | undefined;
797
+ value?: string | number | undefined;
788
798
  custom?: string | undefined;
789
799
  columnName?: string | undefined;
790
800
  tableName?: string | undefined;
@@ -820,6 +830,9 @@ declare const resturaZodSchema: z.ZodObject<{
820
830
  description: string;
821
831
  roles: string[];
822
832
  responseType: string;
833
+ table?: undefined;
834
+ joins?: undefined;
835
+ assignments?: undefined;
823
836
  request?: {
824
837
  validator: {
825
838
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -849,7 +862,7 @@ declare const resturaZodSchema: z.ZodObject<{
849
862
  alias?: string | undefined;
850
863
  }[];
851
864
  where: {
852
- value?: string | undefined;
865
+ value?: string | number | undefined;
853
866
  custom?: string | undefined;
854
867
  columnName?: string | undefined;
855
868
  tableName?: string | undefined;
@@ -885,7 +898,7 @@ declare const resturaZodSchema: z.ZodObject<{
885
898
  alias?: string | undefined;
886
899
  }[];
887
900
  where: {
888
- value?: string | undefined;
901
+ value?: string | number | undefined;
889
902
  custom?: string | undefined;
890
903
  columnName?: string | undefined;
891
904
  tableName?: string | undefined;
@@ -921,6 +934,9 @@ declare const resturaZodSchema: z.ZodObject<{
921
934
  description: string;
922
935
  roles: string[];
923
936
  responseType: string;
937
+ table?: undefined;
938
+ joins?: undefined;
939
+ assignments?: undefined;
924
940
  request?: {
925
941
  validator: {
926
942
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -992,7 +1008,7 @@ declare const resturaZodSchema: z.ZodObject<{
992
1008
  alias?: string | undefined;
993
1009
  }[];
994
1010
  where: {
995
- value?: string | undefined;
1011
+ value?: string | number | undefined;
996
1012
  custom?: string | undefined;
997
1013
  columnName?: string | undefined;
998
1014
  tableName?: string | undefined;
@@ -1028,7 +1044,7 @@ declare const resturaZodSchema: z.ZodObject<{
1028
1044
  alias?: string | undefined;
1029
1045
  }[];
1030
1046
  where: {
1031
- value?: string | undefined;
1047
+ value?: string | number | undefined;
1032
1048
  custom?: string | undefined;
1033
1049
  columnName?: string | undefined;
1034
1050
  tableName?: string | undefined;
@@ -1064,6 +1080,9 @@ declare const resturaZodSchema: z.ZodObject<{
1064
1080
  description: string;
1065
1081
  roles: string[];
1066
1082
  responseType: string;
1083
+ table?: undefined;
1084
+ joins?: undefined;
1085
+ assignments?: undefined;
1067
1086
  request?: {
1068
1087
  validator: {
1069
1088
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -1134,7 +1153,7 @@ declare const resturaZodSchema: z.ZodObject<{
1134
1153
  alias?: string | undefined;
1135
1154
  }[];
1136
1155
  where: {
1137
- value?: string | undefined;
1156
+ value?: string | number | undefined;
1138
1157
  custom?: string | undefined;
1139
1158
  columnName?: string | undefined;
1140
1159
  tableName?: string | undefined;
@@ -1170,7 +1189,7 @@ declare const resturaZodSchema: z.ZodObject<{
1170
1189
  alias?: string | undefined;
1171
1190
  }[];
1172
1191
  where: {
1173
- value?: string | undefined;
1192
+ value?: string | number | undefined;
1174
1193
  custom?: string | undefined;
1175
1194
  columnName?: string | undefined;
1176
1195
  tableName?: string | undefined;
@@ -1206,6 +1225,9 @@ declare const resturaZodSchema: z.ZodObject<{
1206
1225
  description: string;
1207
1226
  roles: string[];
1208
1227
  responseType: string;
1228
+ table?: undefined;
1229
+ joins?: undefined;
1230
+ assignments?: undefined;
1209
1231
  request?: {
1210
1232
  validator: {
1211
1233
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -1227,6 +1249,7 @@ interface RequesterDetails {
1227
1249
  role?: string;
1228
1250
  host: string;
1229
1251
  ipAddress: string;
1252
+ [key: string]: string | number | undefined | null | boolean;
1230
1253
  }
1231
1254
  interface RsRequest<T = unknown> extends express.Request {
1232
1255
  requesterDetails: RequesterDetails;
@@ -1239,6 +1262,14 @@ interface RoleWithOptionalUserDetails {
1239
1262
  }
1240
1263
  type AuthenticateHandler = (req: RsRequest<unknown>, onValid: (userDetails: RoleWithOptionalUserDetails) => void, onReject: (errorMessage: string) => void) => Promise<void>;
1241
1264
 
1265
+ declare class PsqlPool {
1266
+ poolConfig: PoolConfig;
1267
+ pool: Pool;
1268
+ constructor(poolConfig: PoolConfig);
1269
+ queryOne(query: string, options: Array<any>): Promise<any>;
1270
+ runQuery(query: string, options: any[]): Promise<any[]>;
1271
+ }
1272
+
1242
1273
  declare class ResturaEngine {
1243
1274
  resturaConfig: ResturaConfigSchema;
1244
1275
  private resturaRouter;
@@ -1247,13 +1278,16 @@ declare class ResturaEngine {
1247
1278
  private schema;
1248
1279
  private responseValidator;
1249
1280
  private authenticationHandler;
1281
+ private customTypeValidation;
1282
+ private psqlConnectionPool;
1283
+ private psqlEngine;
1250
1284
  /**
1251
1285
  * Initializes the Restura engine with the provided Express application.
1252
1286
  *
1253
1287
  * @param app - The Express application instance to initialize with Restura.
1254
1288
  * @returns A promise that resolves when the initialization is complete.
1255
1289
  */
1256
- init(app: express.Application, authenticationHandler: AuthenticateHandler): Promise<void>;
1290
+ init(app: express.Application, authenticationHandler: AuthenticateHandler, psqlConnectionPool: PsqlPool): Promise<void>;
1257
1291
  /**
1258
1292
  * Determines if a given endpoint is public based on the HTTP method and full URL. This
1259
1293
  * is determined on whether the endpoint in the schema has no roles assigned to it.
@@ -1326,4 +1360,4 @@ declare class ResturaEngine {
1326
1360
  }
1327
1361
  declare const restura: ResturaEngine;
1328
1362
 
1329
- export { logger, restura };
1363
+ export { PsqlPool, logger, restura };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import winston from 'winston';
2
2
  import * as express from 'express';
3
3
  import { z } from 'zod';
4
+ import { PoolConfig, Pool } from 'pg';
4
5
 
5
6
  declare const logger: winston.Logger;
6
7
 
@@ -234,18 +235,18 @@ declare const resturaZodSchema: z.ZodObject<{
234
235
  tableName: z.ZodOptional<z.ZodString>;
235
236
  columnName: z.ZodOptional<z.ZodString>;
236
237
  operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
237
- value: z.ZodOptional<z.ZodString>;
238
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
238
239
  custom: z.ZodOptional<z.ZodString>;
239
240
  conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
240
241
  }, "strict", z.ZodTypeAny, {
241
- value?: string | undefined;
242
+ value?: string | number | undefined;
242
243
  custom?: string | undefined;
243
244
  columnName?: string | undefined;
244
245
  tableName?: string | undefined;
245
246
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
246
247
  conjunction?: "AND" | "OR" | undefined;
247
248
  }, {
248
- value?: string | undefined;
249
+ value?: string | number | undefined;
249
250
  custom?: string | undefined;
250
251
  columnName?: string | undefined;
251
252
  tableName?: string | undefined;
@@ -311,18 +312,18 @@ declare const resturaZodSchema: z.ZodObject<{
311
312
  tableName: z.ZodOptional<z.ZodString>;
312
313
  columnName: z.ZodOptional<z.ZodString>;
313
314
  operator: z.ZodOptional<z.ZodEnum<["=", "<", ">", "<=", ">=", "!=", "LIKE", "IN", "NOT IN", "STARTS WITH", "ENDS WITH"]>>;
314
- value: z.ZodOptional<z.ZodString>;
315
+ value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
315
316
  custom: z.ZodOptional<z.ZodString>;
316
317
  conjunction: z.ZodOptional<z.ZodEnum<["AND", "OR"]>>;
317
318
  }, "strict", z.ZodTypeAny, {
318
- value?: string | undefined;
319
+ value?: string | number | undefined;
319
320
  custom?: string | undefined;
320
321
  columnName?: string | undefined;
321
322
  tableName?: string | undefined;
322
323
  operator?: "=" | "<" | ">" | "<=" | ">=" | "!=" | "LIKE" | "IN" | "NOT IN" | "STARTS WITH" | "ENDS WITH" | undefined;
323
324
  conjunction?: "AND" | "OR" | undefined;
324
325
  }, {
325
- value?: string | undefined;
326
+ value?: string | number | undefined;
326
327
  custom?: string | undefined;
327
328
  columnName?: string | undefined;
328
329
  tableName?: string | undefined;
@@ -364,7 +365,7 @@ declare const resturaZodSchema: z.ZodObject<{
364
365
  alias?: string | undefined;
365
366
  }[];
366
367
  where: {
367
- value?: string | undefined;
368
+ value?: string | number | undefined;
368
369
  custom?: string | undefined;
369
370
  columnName?: string | undefined;
370
371
  tableName?: string | undefined;
@@ -392,7 +393,7 @@ declare const resturaZodSchema: z.ZodObject<{
392
393
  alias?: string | undefined;
393
394
  }[];
394
395
  where: {
395
- value?: string | undefined;
396
+ value?: string | number | undefined;
396
397
  custom?: string | undefined;
397
398
  columnName?: string | undefined;
398
399
  tableName?: string | undefined;
@@ -424,7 +425,7 @@ declare const resturaZodSchema: z.ZodObject<{
424
425
  alias?: string | undefined;
425
426
  }[];
426
427
  where: {
427
- value?: string | undefined;
428
+ value?: string | number | undefined;
428
429
  custom?: string | undefined;
429
430
  columnName?: string | undefined;
430
431
  tableName?: string | undefined;
@@ -456,7 +457,7 @@ declare const resturaZodSchema: z.ZodObject<{
456
457
  alias?: string | undefined;
457
458
  }[];
458
459
  where: {
459
- value?: string | undefined;
460
+ value?: string | number | undefined;
460
461
  custom?: string | undefined;
461
462
  columnName?: string | undefined;
462
463
  tableName?: string | undefined;
@@ -512,7 +513,7 @@ declare const resturaZodSchema: z.ZodObject<{
512
513
  alias?: string | undefined;
513
514
  }[];
514
515
  where: {
515
- value?: string | undefined;
516
+ value?: string | number | undefined;
516
517
  custom?: string | undefined;
517
518
  columnName?: string | undefined;
518
519
  tableName?: string | undefined;
@@ -548,7 +549,7 @@ declare const resturaZodSchema: z.ZodObject<{
548
549
  alias?: string | undefined;
549
550
  }[];
550
551
  where: {
551
- value?: string | undefined;
552
+ value?: string | number | undefined;
552
553
  custom?: string | undefined;
553
554
  columnName?: string | undefined;
554
555
  tableName?: string | undefined;
@@ -590,7 +591,7 @@ declare const resturaZodSchema: z.ZodObject<{
590
591
  alias?: string | undefined;
591
592
  }[];
592
593
  where: {
593
- value?: string | undefined;
594
+ value?: string | number | undefined;
594
595
  custom?: string | undefined;
595
596
  columnName?: string | undefined;
596
597
  tableName?: string | undefined;
@@ -626,7 +627,7 @@ declare const resturaZodSchema: z.ZodObject<{
626
627
  alias?: string | undefined;
627
628
  }[];
628
629
  where: {
629
- value?: string | undefined;
630
+ value?: string | number | undefined;
630
631
  custom?: string | undefined;
631
632
  columnName?: string | undefined;
632
633
  tableName?: string | undefined;
@@ -692,6 +693,9 @@ declare const resturaZodSchema: z.ZodObject<{
692
693
  name: string;
693
694
  required: boolean;
694
695
  }>, "many">>;
696
+ table: z.ZodUndefined;
697
+ joins: z.ZodUndefined;
698
+ assignments: z.ZodUndefined;
695
699
  fileUploadType: z.ZodOptional<z.ZodEnum<["SINGLE", "MULTIPLE"]>>;
696
700
  }>, "strict", z.ZodTypeAny, {
697
701
  path: string;
@@ -701,6 +705,9 @@ declare const resturaZodSchema: z.ZodObject<{
701
705
  description: string;
702
706
  roles: string[];
703
707
  responseType: string;
708
+ table?: undefined;
709
+ joins?: undefined;
710
+ assignments?: undefined;
704
711
  request?: {
705
712
  validator: {
706
713
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -719,6 +726,9 @@ declare const resturaZodSchema: z.ZodObject<{
719
726
  description: string;
720
727
  roles: string[];
721
728
  responseType: string;
729
+ table?: undefined;
730
+ joins?: undefined;
731
+ assignments?: undefined;
722
732
  request?: {
723
733
  validator: {
724
734
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -748,7 +758,7 @@ declare const resturaZodSchema: z.ZodObject<{
748
758
  alias?: string | undefined;
749
759
  }[];
750
760
  where: {
751
- value?: string | undefined;
761
+ value?: string | number | undefined;
752
762
  custom?: string | undefined;
753
763
  columnName?: string | undefined;
754
764
  tableName?: string | undefined;
@@ -784,7 +794,7 @@ declare const resturaZodSchema: z.ZodObject<{
784
794
  alias?: string | undefined;
785
795
  }[];
786
796
  where: {
787
- value?: string | undefined;
797
+ value?: string | number | undefined;
788
798
  custom?: string | undefined;
789
799
  columnName?: string | undefined;
790
800
  tableName?: string | undefined;
@@ -820,6 +830,9 @@ declare const resturaZodSchema: z.ZodObject<{
820
830
  description: string;
821
831
  roles: string[];
822
832
  responseType: string;
833
+ table?: undefined;
834
+ joins?: undefined;
835
+ assignments?: undefined;
823
836
  request?: {
824
837
  validator: {
825
838
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -849,7 +862,7 @@ declare const resturaZodSchema: z.ZodObject<{
849
862
  alias?: string | undefined;
850
863
  }[];
851
864
  where: {
852
- value?: string | undefined;
865
+ value?: string | number | undefined;
853
866
  custom?: string | undefined;
854
867
  columnName?: string | undefined;
855
868
  tableName?: string | undefined;
@@ -885,7 +898,7 @@ declare const resturaZodSchema: z.ZodObject<{
885
898
  alias?: string | undefined;
886
899
  }[];
887
900
  where: {
888
- value?: string | undefined;
901
+ value?: string | number | undefined;
889
902
  custom?: string | undefined;
890
903
  columnName?: string | undefined;
891
904
  tableName?: string | undefined;
@@ -921,6 +934,9 @@ declare const resturaZodSchema: z.ZodObject<{
921
934
  description: string;
922
935
  roles: string[];
923
936
  responseType: string;
937
+ table?: undefined;
938
+ joins?: undefined;
939
+ assignments?: undefined;
924
940
  request?: {
925
941
  validator: {
926
942
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -992,7 +1008,7 @@ declare const resturaZodSchema: z.ZodObject<{
992
1008
  alias?: string | undefined;
993
1009
  }[];
994
1010
  where: {
995
- value?: string | undefined;
1011
+ value?: string | number | undefined;
996
1012
  custom?: string | undefined;
997
1013
  columnName?: string | undefined;
998
1014
  tableName?: string | undefined;
@@ -1028,7 +1044,7 @@ declare const resturaZodSchema: z.ZodObject<{
1028
1044
  alias?: string | undefined;
1029
1045
  }[];
1030
1046
  where: {
1031
- value?: string | undefined;
1047
+ value?: string | number | undefined;
1032
1048
  custom?: string | undefined;
1033
1049
  columnName?: string | undefined;
1034
1050
  tableName?: string | undefined;
@@ -1064,6 +1080,9 @@ declare const resturaZodSchema: z.ZodObject<{
1064
1080
  description: string;
1065
1081
  roles: string[];
1066
1082
  responseType: string;
1083
+ table?: undefined;
1084
+ joins?: undefined;
1085
+ assignments?: undefined;
1067
1086
  request?: {
1068
1087
  validator: {
1069
1088
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -1134,7 +1153,7 @@ declare const resturaZodSchema: z.ZodObject<{
1134
1153
  alias?: string | undefined;
1135
1154
  }[];
1136
1155
  where: {
1137
- value?: string | undefined;
1156
+ value?: string | number | undefined;
1138
1157
  custom?: string | undefined;
1139
1158
  columnName?: string | undefined;
1140
1159
  tableName?: string | undefined;
@@ -1170,7 +1189,7 @@ declare const resturaZodSchema: z.ZodObject<{
1170
1189
  alias?: string | undefined;
1171
1190
  }[];
1172
1191
  where: {
1173
- value?: string | undefined;
1192
+ value?: string | number | undefined;
1174
1193
  custom?: string | undefined;
1175
1194
  columnName?: string | undefined;
1176
1195
  tableName?: string | undefined;
@@ -1206,6 +1225,9 @@ declare const resturaZodSchema: z.ZodObject<{
1206
1225
  description: string;
1207
1226
  roles: string[];
1208
1227
  responseType: string;
1228
+ table?: undefined;
1229
+ joins?: undefined;
1230
+ assignments?: undefined;
1209
1231
  request?: {
1210
1232
  validator: {
1211
1233
  type: "TYPE_CHECK" | "MIN" | "MAX" | "ONE_OF";
@@ -1227,6 +1249,7 @@ interface RequesterDetails {
1227
1249
  role?: string;
1228
1250
  host: string;
1229
1251
  ipAddress: string;
1252
+ [key: string]: string | number | undefined | null | boolean;
1230
1253
  }
1231
1254
  interface RsRequest<T = unknown> extends express.Request {
1232
1255
  requesterDetails: RequesterDetails;
@@ -1239,6 +1262,14 @@ interface RoleWithOptionalUserDetails {
1239
1262
  }
1240
1263
  type AuthenticateHandler = (req: RsRequest<unknown>, onValid: (userDetails: RoleWithOptionalUserDetails) => void, onReject: (errorMessage: string) => void) => Promise<void>;
1241
1264
 
1265
+ declare class PsqlPool {
1266
+ poolConfig: PoolConfig;
1267
+ pool: Pool;
1268
+ constructor(poolConfig: PoolConfig);
1269
+ queryOne(query: string, options: Array<any>): Promise<any>;
1270
+ runQuery(query: string, options: any[]): Promise<any[]>;
1271
+ }
1272
+
1242
1273
  declare class ResturaEngine {
1243
1274
  resturaConfig: ResturaConfigSchema;
1244
1275
  private resturaRouter;
@@ -1247,13 +1278,16 @@ declare class ResturaEngine {
1247
1278
  private schema;
1248
1279
  private responseValidator;
1249
1280
  private authenticationHandler;
1281
+ private customTypeValidation;
1282
+ private psqlConnectionPool;
1283
+ private psqlEngine;
1250
1284
  /**
1251
1285
  * Initializes the Restura engine with the provided Express application.
1252
1286
  *
1253
1287
  * @param app - The Express application instance to initialize with Restura.
1254
1288
  * @returns A promise that resolves when the initialization is complete.
1255
1289
  */
1256
- init(app: express.Application, authenticationHandler: AuthenticateHandler): Promise<void>;
1290
+ init(app: express.Application, authenticationHandler: AuthenticateHandler, psqlConnectionPool: PsqlPool): Promise<void>;
1257
1291
  /**
1258
1292
  * Determines if a given endpoint is public based on the HTTP method and full URL. This
1259
1293
  * is determined on whether the endpoint in the schema has no roles assigned to it.
@@ -1326,4 +1360,4 @@ declare class ResturaEngine {
1326
1360
  }
1327
1361
  declare const restura: ResturaEngine;
1328
1362
 
1329
- export { logger, restura };
1363
+ export { PsqlPool, logger, restura };