prisma-sql 1.15.0 → 1.17.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 +19 -12
- package/dist/generator.cjs.map +1 -1
- package/dist/generator.js +19 -12
- package/dist/generator.js.map +1 -1
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/readme.md +435 -594
package/dist/generator.js
CHANGED
|
@@ -54,7 +54,7 @@ var require_package = __commonJS({
|
|
|
54
54
|
"package.json"(exports$1, module) {
|
|
55
55
|
module.exports = {
|
|
56
56
|
name: "prisma-sql",
|
|
57
|
-
version: "1.
|
|
57
|
+
version: "1.17.0",
|
|
58
58
|
description: "Convert Prisma queries to optimized SQL with type safety. 2-7x faster than Prisma Client.",
|
|
59
59
|
main: "dist/index.cjs",
|
|
60
60
|
module: "dist/index.js",
|
|
@@ -117,13 +117,15 @@ var require_package = __commonJS({
|
|
|
117
117
|
license: "MIT",
|
|
118
118
|
dependencies: {
|
|
119
119
|
"@dee-wan/schema-parser": "1.3.0",
|
|
120
|
+
"@prisma/client": "6.16.3",
|
|
120
121
|
"@prisma/generator-helper": "^7.2.0",
|
|
121
|
-
"@prisma/internals": "^7.2.0"
|
|
122
|
+
"@prisma/internals": "^7.2.0",
|
|
123
|
+
prisma: "6.16.3"
|
|
122
124
|
},
|
|
123
125
|
devDependencies: {
|
|
124
126
|
"@faker-js/faker": "^10.2.0",
|
|
125
|
-
"@prisma/adapter-better-sqlite3": "^
|
|
126
|
-
"@prisma/adapter-pg": "^
|
|
127
|
+
"@prisma/adapter-better-sqlite3": "^6.16.3",
|
|
128
|
+
"@prisma/adapter-pg": "^6.16.3",
|
|
127
129
|
"@prisma/client": "7.2.0",
|
|
128
130
|
"@types/better-sqlite3": "^7.6.13",
|
|
129
131
|
"@types/node": "^20.0.0",
|
|
@@ -1823,7 +1825,15 @@ function buildOperator(expr, op, val, ctx, mode, fieldType) {
|
|
|
1823
1825
|
return buildArrayOperator(expr, op, val, ctx.params, fieldType, ctx.dialect);
|
|
1824
1826
|
}
|
|
1825
1827
|
if (fieldType && isJsonType(fieldType)) {
|
|
1826
|
-
|
|
1828
|
+
const JSON_OPS = /* @__PURE__ */ new Set([
|
|
1829
|
+
Ops.PATH,
|
|
1830
|
+
Ops.STRING_CONTAINS,
|
|
1831
|
+
Ops.STRING_STARTS_WITH,
|
|
1832
|
+
Ops.STRING_ENDS_WITH
|
|
1833
|
+
]);
|
|
1834
|
+
if (JSON_OPS.has(op)) {
|
|
1835
|
+
return buildJsonOperator(expr, op, val, ctx.params, ctx.dialect);
|
|
1836
|
+
}
|
|
1827
1837
|
}
|
|
1828
1838
|
return buildScalarOperator(
|
|
1829
1839
|
expr,
|
|
@@ -4520,13 +4530,10 @@ function extractDynamicParams(args: any, dynamicKeys: string[]): unknown[] {
|
|
|
4520
4530
|
|
|
4521
4531
|
for (const key of dynamicKeys) {
|
|
4522
4532
|
const parts = key.split(':')
|
|
4523
|
-
|
|
4524
|
-
|
|
4533
|
+
|
|
4534
|
+
const lookupKey = parts.length === 2 ? parts[1] : key
|
|
4525
4535
|
|
|
4526
|
-
|
|
4527
|
-
if (value === null || value === undefined) break
|
|
4528
|
-
value = value[part]
|
|
4529
|
-
}
|
|
4536
|
+
const value = args[lookupKey]
|
|
4530
4537
|
|
|
4531
4538
|
if (value === undefined) {
|
|
4532
4539
|
throw new Error(\`Missing required parameter: \${key}\`)
|
|
@@ -4601,7 +4608,7 @@ export function createExtension(config: {
|
|
|
4601
4608
|
return this.$parent[modelName][method](args)
|
|
4602
4609
|
}
|
|
4603
4610
|
|
|
4604
|
-
const result = buildSQL(model, MODELS, method, args, DIALECT)
|
|
4611
|
+
const result = buildSQL(model, MODELS, method, args || {}, DIALECT)
|
|
4605
4612
|
sql = result.sql
|
|
4606
4613
|
params = result.params
|
|
4607
4614
|
}
|