@restura/core 1.0.6 → 1.0.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.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([
@@ -2423,7 +2420,17 @@ var PsqlEngine = class extends SqlEngine {
2423
2420
  item.name
2424
2421
  )}`;
2425
2422
  }
2426
- return `${item.type ? item.selector : escapeColumnName(item.selector)} AS ${escapeColumnName(item.name)}`;
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
+ }
2427
2434
  }).join(",\n ")}
2428
2435
  `;
2429
2436
  sqlStatement += `FROM "${routeData.table}"
@@ -2580,7 +2587,9 @@ DELETE FROM "${routeData.table}" ${joinStatement} ${whereClause}`;
2580
2587
  where.forEach((item, index) => {
2581
2588
  if (index === 0) whereClause = "WHERE ";
2582
2589
  if (item.custom) {
2583
- whereClause += this.replaceParamKeywords(item.custom, routeData, req, sqlParams);
2590
+ const customReplaced = this.replaceParamKeywords(item.custom, routeData, req, sqlParams);
2591
+ whereClause += ` ${item.conjunction || ""} ${customReplaced}
2592
+ `;
2584
2593
  return;
2585
2594
  }
2586
2595
  if (item.operator === void 0 || item.value === void 0 || item.columnName === void 0 || item.tableName === void 0)