@restura/core 0.2.0 → 0.2.1
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 +46 -46
- package/dist/index.d.ts +46 -46
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1058,7 +1058,22 @@ var groupBySchema = z3.object({
|
|
|
1058
1058
|
var whereDataSchema = z3.object({
|
|
1059
1059
|
tableName: z3.string().optional(),
|
|
1060
1060
|
columnName: z3.string().optional(),
|
|
1061
|
-
operator: z3.enum([
|
|
1061
|
+
operator: z3.enum([
|
|
1062
|
+
"=",
|
|
1063
|
+
"<",
|
|
1064
|
+
">",
|
|
1065
|
+
"<=",
|
|
1066
|
+
">=",
|
|
1067
|
+
"!=",
|
|
1068
|
+
"LIKE",
|
|
1069
|
+
"NOT LIKE",
|
|
1070
|
+
"IN",
|
|
1071
|
+
"NOT IN",
|
|
1072
|
+
"STARTS WITH",
|
|
1073
|
+
"ENDS WITH",
|
|
1074
|
+
"IS",
|
|
1075
|
+
"IS NOT"
|
|
1076
|
+
]).optional(),
|
|
1062
1077
|
value: z3.string().or(z3.number()).optional(),
|
|
1063
1078
|
custom: z3.string().optional(),
|
|
1064
1079
|
conjunction: z3.enum(["AND", "OR"]).optional()
|
|
@@ -2381,16 +2396,19 @@ DELETE FROM "${routeData.table}" ${joinStatement} ${whereClause}`;
|
|
|
2381
2396
|
`Invalid where clause in route ${routeData.name}, missing required fields if not custom`
|
|
2382
2397
|
);
|
|
2383
2398
|
let operator = item.operator;
|
|
2399
|
+
let value = item.value;
|
|
2384
2400
|
if (operator === "LIKE") {
|
|
2385
|
-
|
|
2401
|
+
value = `'%${value}%'`;
|
|
2402
|
+
} else if (operator === "NOT LIKE") {
|
|
2403
|
+
value = `'%${value}%'`;
|
|
2386
2404
|
} else if (operator === "STARTS WITH") {
|
|
2387
2405
|
operator = "LIKE";
|
|
2388
|
-
|
|
2406
|
+
value = `'${value}%'`;
|
|
2389
2407
|
} else if (operator === "ENDS WITH") {
|
|
2390
2408
|
operator = "LIKE";
|
|
2391
|
-
|
|
2409
|
+
value = `'%${value}'`;
|
|
2392
2410
|
}
|
|
2393
|
-
const replacedValue = this.replaceParamKeywords(
|
|
2411
|
+
const replacedValue = this.replaceParamKeywords(value, routeData, req, sqlParams);
|
|
2394
2412
|
whereClause += ` ${item.conjunction || ""} "${item.tableName}"."${item.columnName}" ${operator.replace("LIKE", "ILIKE")} ${["IN", "NOT IN"].includes(operator) ? `(${replacedValue})` : replacedValue}
|
|
2395
2413
|
`;
|
|
2396
2414
|
});
|