@restura/core 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -6
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -480,9 +480,6 @@ declare const customRouteSchema: z.ZodObject<{
|
|
|
480
480
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
|
|
481
481
|
}, z.core.$strict>>;
|
|
482
482
|
}, z.core.$strict>>>;
|
|
483
|
-
table: z.ZodUndefined;
|
|
484
|
-
joins: z.ZodUndefined;
|
|
485
|
-
assignments: z.ZodUndefined;
|
|
486
483
|
fileUploadType: z.ZodOptional<z.ZodEnum<{
|
|
487
484
|
SINGLE: "SINGLE";
|
|
488
485
|
MULTIPLE: "MULTIPLE";
|
|
@@ -896,9 +893,6 @@ declare const resturaSchema: z.ZodObject<{
|
|
|
896
893
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
|
|
897
894
|
}, z.core.$strict>>;
|
|
898
895
|
}, z.core.$strict>>>;
|
|
899
|
-
table: z.ZodUndefined;
|
|
900
|
-
joins: z.ZodUndefined;
|
|
901
|
-
assignments: z.ZodUndefined;
|
|
902
896
|
fileUploadType: z.ZodOptional<z.ZodEnum<{
|
|
903
897
|
SINGLE: "SINGLE";
|
|
904
898
|
MULTIPLE: "MULTIPLE";
|
package/dist/index.js
CHANGED
|
@@ -1163,9 +1163,6 @@ var customRouteSchema = routeDataBaseSchema.extend({
|
|
|
1163
1163
|
responseType: z3.union([z3.string(), z3.enum(["string", "number", "boolean"])]),
|
|
1164
1164
|
requestType: z3.string().optional(),
|
|
1165
1165
|
request: z3.array(requestDataSchema).optional(),
|
|
1166
|
-
table: z3.undefined(),
|
|
1167
|
-
joins: z3.undefined(),
|
|
1168
|
-
assignments: z3.undefined(),
|
|
1169
1166
|
fileUploadType: z3.enum(["SINGLE", "MULTIPLE"]).optional()
|
|
1170
1167
|
}).strict();
|
|
1171
1168
|
var postgresColumnNumericTypesSchema = z3.enum([
|
|
@@ -1403,7 +1400,11 @@ function requestValidator(req, routeData, validationSchema) {
|
|
|
1403
1400
|
if (!routeData.requestType) throw new RsError("BAD_REQUEST", `No request type defined for custom request.`);
|
|
1404
1401
|
const currentInterface = validationSchema[routeData.requestType];
|
|
1405
1402
|
const validator = new jsonschema.Validator();
|
|
1406
|
-
const
|
|
1403
|
+
const strictSchema = {
|
|
1404
|
+
...currentInterface,
|
|
1405
|
+
additionalProperties: false
|
|
1406
|
+
};
|
|
1407
|
+
const executeValidation = validator.validate(req.data, strictSchema);
|
|
1407
1408
|
if (!executeValidation.valid) {
|
|
1408
1409
|
throw new RsError(
|
|
1409
1410
|
"BAD_REQUEST",
|
|
@@ -2419,7 +2420,17 @@ var PsqlEngine = class extends SqlEngine {
|
|
|
2419
2420
|
item.name
|
|
2420
2421
|
)}`;
|
|
2421
2422
|
}
|
|
2422
|
-
|
|
2423
|
+
if (item.type) {
|
|
2424
|
+
const selectorWithReplacedKeywords = this.replaceParamKeywords(
|
|
2425
|
+
item.selector,
|
|
2426
|
+
routeData,
|
|
2427
|
+
req,
|
|
2428
|
+
sqlParams
|
|
2429
|
+
);
|
|
2430
|
+
return `${selectorWithReplacedKeywords} AS ${escapeColumnName(item.name)}`;
|
|
2431
|
+
} else {
|
|
2432
|
+
return `${escapeColumnName(item.selector)} AS ${escapeColumnName(item.name)}`;
|
|
2433
|
+
}
|
|
2423
2434
|
}).join(",\n ")}
|
|
2424
2435
|
`;
|
|
2425
2436
|
sqlStatement += `FROM "${routeData.table}"
|