prisma-sql 1.39.0 → 1.40.0
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/generator.cjs +15 -4
- package/dist/generator.cjs.map +1 -1
- package/dist/generator.js +15 -4
- package/dist/generator.js.map +1 -1
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -56,7 +56,7 @@ var require_package = __commonJS({
|
|
|
56
56
|
"package.json"(exports$1, module) {
|
|
57
57
|
module.exports = {
|
|
58
58
|
name: "prisma-sql",
|
|
59
|
-
version: "1.
|
|
59
|
+
version: "1.40.0",
|
|
60
60
|
description: "Convert Prisma queries to optimized SQL with type safety. 2-7x faster than Prisma Client.",
|
|
61
61
|
main: "dist/index.cjs",
|
|
62
62
|
module: "dist/index.js",
|
|
@@ -292,6 +292,17 @@ var LIMITS = Object.freeze({
|
|
|
292
292
|
MAX_STRING_LENGTH: 1e4
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
+
// src/utils/normalize-value.ts
|
|
296
|
+
function normalizeValue(value) {
|
|
297
|
+
if (value instanceof Date) {
|
|
298
|
+
return value.toISOString();
|
|
299
|
+
}
|
|
300
|
+
if (Array.isArray(value)) {
|
|
301
|
+
return value.map(normalizeValue);
|
|
302
|
+
}
|
|
303
|
+
return value;
|
|
304
|
+
}
|
|
305
|
+
|
|
295
306
|
// src/sql-builder-dialect.ts
|
|
296
307
|
var globalDialect = "postgres";
|
|
297
308
|
function setGlobalDialect(dialect) {
|
|
@@ -468,7 +479,7 @@ function prepareArrayParam(value, dialect) {
|
|
|
468
479
|
throw new Error("prepareArrayParam requires array value");
|
|
469
480
|
}
|
|
470
481
|
if (dialect === "postgres") {
|
|
471
|
-
return value;
|
|
482
|
+
return value.map(normalizeValue);
|
|
472
483
|
}
|
|
473
484
|
return JSON.stringify(value);
|
|
474
485
|
}
|
|
@@ -2535,7 +2546,7 @@ function validateState(params, mappings, index) {
|
|
|
2535
2546
|
validateMappings(mappings);
|
|
2536
2547
|
assertNextIndexMatches(mappings.length, index);
|
|
2537
2548
|
}
|
|
2538
|
-
function
|
|
2549
|
+
function normalizeValue2(value) {
|
|
2539
2550
|
if (value instanceof Date) {
|
|
2540
2551
|
return value.toISOString();
|
|
2541
2552
|
}
|
|
@@ -2583,7 +2594,7 @@ function createStoreInternal(startIndex, initialParams = [], initialMappings = [
|
|
|
2583
2594
|
}
|
|
2584
2595
|
function addStatic(value) {
|
|
2585
2596
|
const position = index;
|
|
2586
|
-
const normalizedValue =
|
|
2597
|
+
const normalizedValue = normalizeValue2(value);
|
|
2587
2598
|
params.push(normalizedValue);
|
|
2588
2599
|
mappings.push({ index: position, value: normalizedValue });
|
|
2589
2600
|
index++;
|