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.
@@ -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.15.0",
59
+ version: "1.17.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",
@@ -119,13 +119,15 @@ var require_package = __commonJS({
119
119
  license: "MIT",
120
120
  dependencies: {
121
121
  "@dee-wan/schema-parser": "1.3.0",
122
+ "@prisma/client": "6.16.3",
122
123
  "@prisma/generator-helper": "^7.2.0",
123
- "@prisma/internals": "^7.2.0"
124
+ "@prisma/internals": "^7.2.0",
125
+ prisma: "6.16.3"
124
126
  },
125
127
  devDependencies: {
126
128
  "@faker-js/faker": "^10.2.0",
127
- "@prisma/adapter-better-sqlite3": "^7.2.0",
128
- "@prisma/adapter-pg": "^7.2.0",
129
+ "@prisma/adapter-better-sqlite3": "^6.16.3",
130
+ "@prisma/adapter-pg": "^6.16.3",
129
131
  "@prisma/client": "7.2.0",
130
132
  "@types/better-sqlite3": "^7.6.13",
131
133
  "@types/node": "^20.0.0",
@@ -1825,7 +1827,15 @@ function buildOperator(expr, op, val, ctx, mode, fieldType) {
1825
1827
  return buildArrayOperator(expr, op, val, ctx.params, fieldType, ctx.dialect);
1826
1828
  }
1827
1829
  if (fieldType && isJsonType(fieldType)) {
1828
- return buildJsonOperator(expr, op, val, ctx.params, ctx.dialect);
1830
+ const JSON_OPS = /* @__PURE__ */ new Set([
1831
+ Ops.PATH,
1832
+ Ops.STRING_CONTAINS,
1833
+ Ops.STRING_STARTS_WITH,
1834
+ Ops.STRING_ENDS_WITH
1835
+ ]);
1836
+ if (JSON_OPS.has(op)) {
1837
+ return buildJsonOperator(expr, op, val, ctx.params, ctx.dialect);
1838
+ }
1829
1839
  }
1830
1840
  return buildScalarOperator(
1831
1841
  expr,
@@ -4522,13 +4532,10 @@ function extractDynamicParams(args: any, dynamicKeys: string[]): unknown[] {
4522
4532
 
4523
4533
  for (const key of dynamicKeys) {
4524
4534
  const parts = key.split(':')
4525
- const path = parts[0].split('.')
4526
- let value: any = args
4535
+
4536
+ const lookupKey = parts.length === 2 ? parts[1] : key
4527
4537
 
4528
- for (const part of path) {
4529
- if (value === null || value === undefined) break
4530
- value = value[part]
4531
- }
4538
+ const value = args[lookupKey]
4532
4539
 
4533
4540
  if (value === undefined) {
4534
4541
  throw new Error(\`Missing required parameter: \${key}\`)
@@ -4603,7 +4610,7 @@ export function createExtension(config: {
4603
4610
  return this.$parent[modelName][method](args)
4604
4611
  }
4605
4612
 
4606
- const result = buildSQL(model, MODELS, method, args, DIALECT)
4613
+ const result = buildSQL(model, MODELS, method, args || {}, DIALECT)
4607
4614
  sql = result.sql
4608
4615
  params = result.params
4609
4616
  }