viborm 1.3.2 → 1.3.3

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.
Files changed (180) hide show
  1. package/dist/{adapter-namespace-B8XWzCev.mjs → adapter-namespace-CWLEmon2.mjs} +2 -2
  2. package/dist/{adapter-namespace-B8XWzCev.mjs.map → adapter-namespace-CWLEmon2.mjs.map} +1 -1
  3. package/dist/adapters.d.mts +1 -1
  4. package/dist/adapters.mjs +1 -1
  5. package/dist/{batch-refs-DoWlPD2h.mjs → batch-refs-DGJPz8-G.mjs} +2 -2
  6. package/dist/{batch-refs-DoWlPD2h.mjs.map → batch-refs-DGJPz8-G.mjs.map} +1 -1
  7. package/dist/{bind-parameter-capacity-qfEejeOX.mjs → bind-parameter-capacity-DiwRmZ1h.mjs} +2 -2
  8. package/dist/{bind-parameter-capacity-qfEejeOX.mjs.map → bind-parameter-capacity-DiwRmZ1h.mjs.map} +1 -1
  9. package/dist/{builder-DhxaVYP2.mjs → builder-D6Ug-zjM.mjs} +2 -2
  10. package/dist/{builder-DhxaVYP2.mjs.map → builder-D6Ug-zjM.mjs.map} +1 -1
  11. package/dist/bun-sql.d.mts +1 -1
  12. package/dist/bun-sql.mjs +1 -1
  13. package/dist/bun-sqlite.d.mts +1 -1
  14. package/dist/bun-sqlite.mjs +1 -1
  15. package/dist/cache/cloudflare-kv.d.mts +1 -1
  16. package/dist/cache/cloudflare-kv.mjs +1 -1
  17. package/dist/cache/memory.d.mts +1 -1
  18. package/dist/cache/memory.mjs +1 -1
  19. package/dist/cache.d.mts +1 -1
  20. package/dist/cache.mjs +1 -1
  21. package/dist/{chain-BjJ_M7EE.mjs → chain-B5IbqLGi.mjs} +2 -2
  22. package/dist/{chain-BjJ_M7EE.mjs.map → chain-B5IbqLGi.mjs.map} +1 -1
  23. package/dist/cli.mjs +1 -1
  24. package/dist/client-BmcHzDBa.mjs +2 -0
  25. package/dist/client-BmcHzDBa.mjs.map +1 -0
  26. package/dist/{client-Df81J4oB.d.mts → client-DR0vYetv.d.mts} +2 -2
  27. package/dist/{client-q6ccRgdO.mjs → client-DjtWangN.mjs} +3 -3
  28. package/dist/{client-q6ccRgdO.mjs.map → client-DjtWangN.mjs.map} +1 -1
  29. package/dist/client.d.mts +1 -1
  30. package/dist/client.mjs +1 -1
  31. package/dist/config.d.mts +1 -1
  32. package/dist/config.mjs +1 -1
  33. package/dist/d1.d.mts +1 -1
  34. package/dist/d1.mjs +1 -1
  35. package/dist/datetime-physical-codec-qKxFtI3B.mjs +2 -0
  36. package/dist/datetime-physical-codec-qKxFtI3B.mjs.map +1 -0
  37. package/dist/{driver-D6_Ik58x.mjs → driver-BvP7eW0A.mjs} +2 -2
  38. package/dist/{driver-D6_Ik58x.mjs.map → driver-BvP7eW0A.mjs.map} +1 -1
  39. package/dist/{driver-Ddt147dK.mjs → driver-Bzc0GCQ4.mjs} +2 -2
  40. package/dist/{driver-Ddt147dK.mjs.map → driver-Bzc0GCQ4.mjs.map} +1 -1
  41. package/dist/driver.d.mts +1 -1
  42. package/dist/driver.mjs +1 -1
  43. package/dist/{error-mapping-C9WgitPi.mjs → error-mapping-6op318w6.mjs} +2 -2
  44. package/dist/error-mapping-6op318w6.mjs.map +1 -0
  45. package/dist/every-WUr3mlvg.mjs +2 -0
  46. package/dist/{every-dpzVDwzu.mjs.map → every-WUr3mlvg.mjs.map} +1 -1
  47. package/dist/{geo-area-codec-CbkmFArQ.mjs → geo-area-codec-BmMmWgU_.mjs} +2 -2
  48. package/dist/{geo-area-codec-CbkmFArQ.mjs.map → geo-area-codec-BmMmWgU_.mjs.map} +1 -1
  49. package/dist/{geo-point-codec-DyEHMdJg.mjs → geo-point-codec-D95uXgDF.mjs} +2 -2
  50. package/dist/{geo-point-codec-DyEHMdJg.mjs.map → geo-point-codec-D95uXgDF.mjs.map} +1 -1
  51. package/dist/{hydration-C2uXmJy6.mjs → hydration-BflrXEIQ.mjs} +2 -2
  52. package/dist/{hydration-C2uXmJy6.mjs.map → hydration-BflrXEIQ.mjs.map} +1 -1
  53. package/dist/{identifier-conversion-C2pwwFOS.mjs → identifier-conversion-Bs7A2GGU.mjs} +2 -2
  54. package/dist/{identifier-conversion-C2pwwFOS.mjs.map → identifier-conversion-Bs7A2GGU.mjs.map} +1 -1
  55. package/dist/{index-D4O0Twvs.d.mts → index-B_jh2oaQ.d.mts} +22 -3
  56. package/dist/index.d.mts +2 -2
  57. package/dist/index.mjs +1 -1
  58. package/dist/instrumentation.d.mts +1 -1
  59. package/dist/instrumentation.mjs +1 -1
  60. package/dist/{key-B7vuAYPG.mjs → key-B89Z4vxn.mjs} +2 -2
  61. package/dist/{key-B7vuAYPG.mjs.map → key-B89Z4vxn.mjs.map} +1 -1
  62. package/dist/{libsql-DUO6vHad.mjs → libsql-C8dn4id0.mjs} +2 -2
  63. package/dist/{libsql-DUO6vHad.mjs.map → libsql-C8dn4id0.mjs.map} +1 -1
  64. package/dist/libsql.d.mts +1 -1
  65. package/dist/libsql.mjs +1 -1
  66. package/dist/{memory-BApsTkt1.mjs → memory-B7CcHS6I.mjs} +2 -2
  67. package/dist/{memory-BApsTkt1.mjs.map → memory-B7CcHS6I.mjs.map} +1 -1
  68. package/dist/migrations/mysql.d.mts +4 -4
  69. package/dist/migrations/mysql.mjs +1 -1
  70. package/dist/migrations/postgres.d.mts +4 -4
  71. package/dist/migrations/postgres.mjs +1 -1
  72. package/dist/migrations/sqlite.d.mts +4 -4
  73. package/dist/migrations/sqlite.mjs +1 -1
  74. package/dist/migrations/tenant.d.mts +2 -2
  75. package/dist/migrations/tenant.mjs +1 -1
  76. package/dist/migrations.d.mts +4 -4
  77. package/dist/migrations.mjs +1 -1
  78. package/dist/mysql-adapter-ABpgFB2N.mjs +2 -0
  79. package/dist/mysql-adapter-ABpgFB2N.mjs.map +1 -0
  80. package/dist/{mysql-D1GlcktG.mjs → mysql-mUmhH9Cf.mjs} +2 -2
  81. package/dist/{mysql-D1GlcktG.mjs.map → mysql-mUmhH9Cf.mjs.map} +1 -1
  82. package/dist/mysql2.d.mts +1 -1
  83. package/dist/mysql2.mjs +1 -1
  84. package/dist/neon-http.d.mts +1 -1
  85. package/dist/neon-http.mjs +1 -1
  86. package/dist/{object-store-BN64q8Zn.d.mts → object-store-Ds9NKRU6.d.mts} +3 -3
  87. package/dist/permissions.d.mts +1 -1
  88. package/dist/permissions.mjs +1 -1
  89. package/dist/permissions.mjs.map +1 -1
  90. package/dist/pg.d.mts +1 -1
  91. package/dist/pg.mjs +1 -1
  92. package/dist/pglite.d.mts +1 -1
  93. package/dist/pglite.mjs +1 -1
  94. package/dist/{physical-CAOaNM4R.mjs → physical-uJfmo4-Z.mjs} +2 -2
  95. package/dist/{physical-CAOaNM4R.mjs.map → physical-uJfmo4-Z.mjs.map} +1 -1
  96. package/dist/{pinned-session-CjvR0Ge2.mjs → pinned-session-C79aDzOg.mjs} +2 -2
  97. package/dist/{pinned-session-CjvR0Ge2.mjs.map → pinned-session-C79aDzOg.mjs.map} +1 -1
  98. package/dist/planetscale.d.mts +1 -1
  99. package/dist/planetscale.mjs +1 -1
  100. package/dist/{planner-8smxUOt9.d.mts → planner-DHZG9Vy7.d.mts} +1 -1
  101. package/dist/{postgres-Be0jMJWI.mjs → postgres-BACQ_wqF.mjs} +2 -2
  102. package/dist/{postgres-Be0jMJWI.mjs.map → postgres-BACQ_wqF.mjs.map} +1 -1
  103. package/dist/{postgres-adapter-C_Mt8lVC.mjs → postgres-adapter-Ci07rgh_.mjs} +2 -2
  104. package/dist/{postgres-adapter-C_Mt8lVC.mjs.map → postgres-adapter-Ci07rgh_.mjs.map} +1 -1
  105. package/dist/postgres-adapter-DaMvNOkx.mjs +2 -0
  106. package/dist/postgres-adapter-DaMvNOkx.mjs.map +1 -0
  107. package/dist/{postgres-result-CYu1dyI_.mjs → postgres-result-D403cLyA.mjs} +2 -2
  108. package/dist/{postgres-result-CYu1dyI_.mjs.map → postgres-result-D403cLyA.mjs.map} +1 -1
  109. package/dist/postgres.d.mts +1 -1
  110. package/dist/postgres.mjs +1 -1
  111. package/dist/{provider-limits-Da00ilvv.mjs → provider-limits-DSv2tYFr.mjs} +2 -2
  112. package/dist/{provider-limits-Da00ilvv.mjs.map → provider-limits-DSv2tYFr.mjs.map} +1 -1
  113. package/dist/result-shape-BKydBCsR.mjs +2 -0
  114. package/dist/result-shape-BKydBCsR.mjs.map +1 -0
  115. package/dist/{rows-JXjhWwyb.mjs → rows-v1VuwOTa.mjs} +2 -2
  116. package/dist/{rows-JXjhWwyb.mjs.map → rows-v1VuwOTa.mjs.map} +1 -1
  117. package/dist/{scalar-CqqZ6jWd.mjs → scalar-Cm7nMFmO.mjs} +2 -2
  118. package/dist/{scalar-CqqZ6jWd.mjs.map → scalar-Cm7nMFmO.mjs.map} +1 -1
  119. package/dist/schema/json.d.mts +1 -1
  120. package/dist/schema/json.mjs +1 -1
  121. package/dist/{schema-Cv-hhpl5.mjs → schema-D3-ScVH6.mjs} +2 -2
  122. package/dist/{schema-Cv-hhpl5.mjs.map → schema-D3-ScVH6.mjs.map} +1 -1
  123. package/dist/{schema-introspection-B2Rvqgut.mjs → schema-introspection-TdJrSaKd.mjs} +2 -2
  124. package/dist/{schema-introspection-B2Rvqgut.mjs.map → schema-introspection-TdJrSaKd.mjs.map} +1 -1
  125. package/dist/schema.d.mts +1 -1
  126. package/dist/schema.mjs +1 -1
  127. package/dist/{select-assembly-BxtETbG9.mjs → select-assembly-uZfvbYjz.mjs} +2 -2
  128. package/dist/select-assembly-uZfvbYjz.mjs.map +1 -0
  129. package/dist/soft-delete.d.mts +1 -1
  130. package/dist/sql-BvHwL73I.mjs +2 -0
  131. package/dist/sql-BvHwL73I.mjs.map +1 -0
  132. package/dist/{sql-EsoN_7Et.d.mts → sql-Q_twK-wW.d.mts} +5 -0
  133. package/dist/sql.d.mts +1 -1
  134. package/dist/sql.mjs +1 -1
  135. package/dist/sqlite-adapter-DPc9T6Lh.mjs +2 -0
  136. package/dist/sqlite-adapter-DPc9T6Lh.mjs.map +1 -0
  137. package/dist/{sqlite-utils-DIOll4P7.mjs → sqlite-utils-BvSlEs5W.mjs} +2 -2
  138. package/dist/{sqlite-utils-DIOll4P7.mjs.map → sqlite-utils-BvSlEs5W.mjs.map} +1 -1
  139. package/dist/sqlite3.d.mts +1 -1
  140. package/dist/sqlite3.mjs +1 -1
  141. package/dist/{standard-sql-mJt0RHHE.mjs → standard-sql-CYdZ_KXH.mjs} +2 -2
  142. package/dist/standard-sql-CYdZ_KXH.mjs.map +1 -0
  143. package/dist/{to-many-BSipkSbK.mjs → to-many-Btc9X5Ga.mjs} +2 -2
  144. package/dist/{to-many-BSipkSbK.mjs.map → to-many-Btc9X5Ga.mjs.map} +1 -1
  145. package/dist/{utils-DjXObbUK.mjs → utils-Qr8ug94X.mjs} +2 -2
  146. package/dist/{utils-DjXObbUK.mjs.map → utils-Qr8ug94X.mjs.map} +1 -1
  147. package/dist/{v-CrJYqdzu.mjs → v-514RME2X.mjs} +2 -2
  148. package/dist/{v-CrJYqdzu.mjs.map → v-514RME2X.mjs.map} +1 -1
  149. package/dist/{validation-BQtO6srU.mjs → validation-CPnrLcjW.mjs} +2 -2
  150. package/dist/{validation-BQtO6srU.mjs.map → validation-CPnrLcjW.mjs.map} +1 -1
  151. package/dist/validation-gwZYm3Yn.mjs +2 -0
  152. package/dist/validation-gwZYm3Yn.mjs.map +1 -0
  153. package/dist/validation.d.mts +1 -1
  154. package/dist/validation.mjs +1 -1
  155. package/dist/{validator-BqzpyNmt.mjs → validator-CQOw7G3q.mjs} +2 -2
  156. package/dist/{validator-BqzpyNmt.mjs.map → validator-CQOw7G3q.mjs.map} +1 -1
  157. package/dist/version-0RVYpih5.mjs +2 -0
  158. package/dist/{version-Dus3if78.mjs.map → version-0RVYpih5.mjs.map} +1 -1
  159. package/package.json +13 -13
  160. package/dist/client-BCgMXn6N.mjs +0 -2
  161. package/dist/client-BCgMXn6N.mjs.map +0 -1
  162. package/dist/datetime-physical-codec-BEqQbIP_.mjs +0 -2
  163. package/dist/datetime-physical-codec-BEqQbIP_.mjs.map +0 -1
  164. package/dist/error-mapping-C9WgitPi.mjs.map +0 -1
  165. package/dist/every-dpzVDwzu.mjs +0 -2
  166. package/dist/mysql-adapter-ClOoHKpn.mjs +0 -2
  167. package/dist/mysql-adapter-ClOoHKpn.mjs.map +0 -1
  168. package/dist/postgres-adapter-BoQ4RRwr.mjs +0 -2
  169. package/dist/postgres-adapter-BoQ4RRwr.mjs.map +0 -1
  170. package/dist/result-shape-DQc-tDJ5.mjs +0 -2
  171. package/dist/result-shape-DQc-tDJ5.mjs.map +0 -1
  172. package/dist/select-assembly-BxtETbG9.mjs.map +0 -1
  173. package/dist/sql-Bhxq9arK.mjs +0 -2
  174. package/dist/sql-Bhxq9arK.mjs.map +0 -1
  175. package/dist/sqlite-adapter-B_LNxPA0.mjs +0 -2
  176. package/dist/sqlite-adapter-B_LNxPA0.mjs.map +0 -1
  177. package/dist/standard-sql-mJt0RHHE.mjs.map +0 -1
  178. package/dist/validation-BamBwne9.mjs +0 -2
  179. package/dist/validation-BamBwne9.mjs.map +0 -1
  180. package/dist/version-Dus3if78.mjs +0 -2
@@ -1 +0,0 @@
1
- {"version":3,"file":"sql-Bhxq9arK.mjs","names":["result"],"sources":["../src/sql/sql.ts"],"sourcesContent":["/**\n * Values supported by SQL engine.\n */\nexport type Value = unknown;\n\n/**\n * Supported value or SQL instance.\n */\nexport type RawValue = Value | Sql;\n\ntype Placeholder = \"$n\" | \":n\" | \"?\";\n\ninterface SqlProjection {\n strings: string[];\n values: Value[];\n}\n\ntype StatementCache = Partial<Record<Placeholder, string>>;\n\n/**\n * A SQL instance can be nested within each other to build SQL strings.\n *\n * Composition is lazy: constructing a Sql just stores the raw fragments.\n * The nested tree is flattened in a single pass over raw fragments when\n * `strings`/`values` is first read (typically only on the root query), so\n * intermediate fragments never pay flattening or allocation.\n */\nexport class Sql {\n private rawStrings: readonly string[];\n private rawValues: readonly RawValue[];\n\n private projection: SqlProjection | undefined;\n private statements: StatementCache | undefined;\n\n constructor(rawStrings: readonly string[], rawValues: readonly RawValue[]) {\n if (rawStrings.length - 1 !== rawValues.length) {\n if (rawStrings.length === 0) {\n throw new TypeError(\"Expected at least 1 string\");\n }\n throw new TypeError(\n `Expected ${rawStrings.length} strings to have ${\n rawStrings.length - 1\n } values`\n );\n }\n\n this.rawStrings = rawStrings;\n this.rawValues = rawValues;\n }\n\n get values(): Value[] {\n return this.flatten().values;\n }\n\n get strings(): string[] {\n return this.flatten().strings;\n }\n\n /**\n * The projection {@link flatten} makes of `fragment`, made without keeping\n * it: a fragment holding an open {@link SqlSlot} reads its provisional text\n * and stays open.\n */\n static peek(fragment: Sql): { strings: string[]; values: Value[] } {\n if (fragment.projection !== undefined) return fragment.projection;\n const strings: string[] = [];\n const values: Value[] = [];\n let current = \"\";\n const walk = (\n rawStrings: readonly string[],\n rawValues: readonly RawValue[]\n ): void => {\n current += rawStrings[0]!;\n for (let i = 0; i < rawValues.length; i++) {\n const child = rawValues[i]!;\n if (child instanceof Sql) {\n walk(child.rawStrings, child.rawValues);\n } else {\n values.push(child);\n strings.push(current);\n current = \"\";\n }\n current += rawStrings[i + 1]!;\n }\n };\n walk(fragment.rawStrings, fragment.rawValues);\n strings.push(current);\n return { strings, values };\n }\n\n /**\n * {@link peek}'s text, also cut where a fragment `opaque` accepts begins\n * and ends, each run saying whether it lies inside one: a reader rewriting\n * the text its owner wrote can leave the text another party wrote alone.\n * Without an opaque fragment the runs are {@link peek}'s strings.\n */\n static peekRuns(\n fragment: Sql,\n opaque: (fragment: Sql) => boolean\n ): { runs: { text: string; opaque: boolean }[]; values: Value[] } {\n const runs: { text: string; opaque: boolean }[] = [];\n const values: Value[] = [];\n let current = \"\";\n let inside = false;\n const cut = (next: boolean): void => {\n if (next === inside) return;\n runs.push({ text: current, opaque: inside });\n current = \"\";\n inside = next;\n };\n const walk = (node: Sql, within: boolean): void => {\n const here = within || opaque(node);\n cut(here);\n current += node.rawStrings[0]!;\n for (let i = 0; i < node.rawValues.length; i++) {\n const child = node.rawValues[i]!;\n if (child instanceof Sql) {\n walk(child, here);\n cut(here);\n } else {\n values.push(child);\n runs.push({ text: current, opaque: inside });\n current = \"\";\n }\n current += node.rawStrings[i + 1]!;\n }\n };\n walk(fragment, false);\n runs.push({ text: current, opaque: inside });\n return { runs, values };\n }\n\n /** `slot`'s text replaced by `content`'s (see {@link SqlSlot.settle}). */\n protected static fill(slot: Sql, content: Sql): void {\n slot.rawStrings = [\"\", \"\"];\n slot.rawValues = [content];\n }\n\n /**\n * Flatten the raw fragment tree in one pass, walking children's raw\n * fragments directly so nested Sql instances are never flattened themselves.\n * The flat arrays then replace the raw tree as the canonical representation,\n * releasing child fragments that are not referenced elsewhere.\n */\n private flatten(): SqlProjection {\n if (this.projection !== undefined) {\n return this.projection;\n }\n\n const strings: string[] = [];\n const values: Value[] = [];\n let current = \"\";\n\n const walk = (\n rawStrings: readonly string[],\n rawValues: readonly RawValue[]\n ): void => {\n current += rawStrings[0]!;\n for (let i = 0; i < rawValues.length; i++) {\n const child = rawValues[i]!;\n if (child instanceof Sql) {\n walk(child.rawStrings, child.rawValues);\n } else {\n values.push(child);\n strings.push(current);\n current = \"\";\n }\n current += rawStrings[i + 1]!;\n }\n };\n\n walk(this.rawStrings, this.rawValues);\n strings.push(current);\n\n const projection: SqlProjection = { strings, values };\n\n this.rawStrings = strings;\n this.rawValues = values;\n this.projection = projection;\n\n return projection;\n }\n\n /**\n * Build the final SQL statement string with placeholders.\n * Results are cached per placeholder type for reuse.\n */\n toStatement(placeholder: Placeholder = \"?\"): string {\n const cached = this.statements?.[placeholder];\n if (cached !== undefined) return cached;\n\n const strings = this.strings;\n const len = strings.length;\n\n if (len === 1) {\n const result = strings[0]!;\n this.statements = { $n: result, \":n\": result, \"?\": result };\n return result;\n }\n\n let result: string;\n\n if (placeholder === \"?\") {\n result = strings.join(\"?\");\n } else {\n const prefix = placeholder === \"$n\" ? \"$\" : \":\";\n const parts = new Array<string>(len * 2 - 1);\n parts[0] = strings[0]!;\n for (let i = 1; i < len; i++) {\n parts[i * 2 - 1] = prefix + i;\n parts[i * 2] = strings[i]!;\n }\n result = parts.join(\"\");\n }\n\n const statements = this.statements ?? {};\n statements[placeholder] = result;\n this.statements = statements;\n\n return result;\n }\n}\n\n/**\n * Splice text into a statement verbatim — nothing here is bound as a\n * parameter. Two shapes live under this one name:\n *\n * - `raw(\"ORDER BY name DESC\")` — Prisma's unsafe string splice. The caller\n * owns the escaping; never hand it user input.\n * - ``raw`TRUE` `` — the tagged-template form the adapters use for dialect\n * keywords. Interpolations are refused; use `sql` for bound values.\n */\nfunction raw(value: string | readonly string[]): Sql;\nfunction raw(\n strings: string | readonly string[],\n ...values: readonly RawValue[]\n): Sql {\n if (\n values.length !== 0 ||\n (typeof strings !== \"string\" && strings.length !== 1)\n )\n throw new TypeError(\n \"raw templates cannot interpolate values; use sql for parameters or raw(trustedText) for explicit SQL text.\"\n );\n if (typeof strings === \"string\") {\n return new Sql([strings], []);\n }\n return new Sql(strings, []);\n}\n\n/**\n * Create a SQL query for a list of values.\n *\n * Values are `RawValue`s, matching Prisma: a nested `Sql` is spliced as a\n * fragment, anything else becomes a bound parameter.\n */\nfunction join(\n values: readonly RawValue[],\n separator = \",\",\n prefix = \"\",\n suffix = \"\"\n) {\n const len = values.length;\n if (len === 0) {\n return new Sql([prefix + suffix], []);\n }\n\n // Pre-allocate array with exact size instead of spread + fill\n const strings = new Array<string>(len + 1);\n strings[0] = prefix;\n for (let i = 1; i < len; i++) {\n strings[i] = separator;\n }\n strings[len] = suffix;\n\n return new Sql(strings, values);\n}\n\n/**\n * Placeholder value for \"no text\".\n */\nconst empty = raw``;\n\n/**\n * Create a SQL object from a template string.\n */\nfunction sql(strings: readonly string[], ...values: readonly RawValue[]) {\n return new Sql(strings, values);\n}\n\nconst sqlTag = Object.assign(sql, { raw, empty, join });\n\nexport { empty, join, raw, sqlTag as sql };\n\n/**\n * Type guard for Sql fragments. Structural check rather than instanceof so it\n * also matches fragments from a duplicated module instance. A document with\n * strings/values arrays is data; executable SQL also has the renderer method.\n */\nexport function isSql(value: unknown): value is Sql {\n if (value instanceof Sql) return true;\n if (value === null || typeof value !== \"object\") return false;\n\n const strings = Reflect.get(value, \"strings\");\n if (!Array.isArray(strings)) return false;\n\n const values = Reflect.get(value, \"values\");\n return (\n Array.isArray(values) &&\n strings.length === values.length + 1 &&\n strings.every((part) => typeof part === \"string\") &&\n typeof Reflect.get(value, \"toStatement\") === \"function\"\n );\n}\n"],"mappings":"yCA2BA,IAAa,EAAb,MAAa,GAAI,CACf,WACA,UAEA,WACA,WAEA,YAAY,EAA+B,EAAgC,CACzE,GAAI,EAAW,OAAS,IAAM,EAAU,OAItC,MAHI,EAAW,SAAW,EACd,UAAU,6BAA6B,CAEzC,UACR,YAAY,EAAW,OAAO,mBAC5B,EAAW,OAAS,EACrB,SACF,CAGH,KAAK,WAAa,EAClB,KAAK,UAAY,EAGnB,IAAI,QAAkB,CACpB,OAAO,KAAK,SAAS,CAAC,OAGxB,IAAI,SAAoB,CACtB,OAAO,KAAK,SAAS,CAAC,QAQxB,OAAO,KAAK,EAAuD,CACjE,GAAI,EAAS,aAAe,IAAA,GAAW,OAAO,EAAS,WACvD,IAAM,EAAoB,EAAE,CACtB,EAAkB,EAAE,CACtB,EAAU,GACR,MACJ,EACA,IACS,CACT,GAAW,EAAW,GACtB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAU,OAAQ,IAAK,CACzC,IAAM,EAAQ,EAAU,GACpB,aAAiB,IACnB,KAAK,EAAM,WAAY,EAAM,UAAU,EAEvC,EAAO,KAAK,EAAM,CAClB,EAAQ,KAAK,EAAQ,CACrB,EAAU,IAEZ,GAAW,EAAW,EAAI,KAK9B,OAFA,KAAK,EAAS,WAAY,EAAS,UAAU,CAC7C,EAAQ,KAAK,EAAQ,CACd,CAAE,UAAS,SAAQ,CAS5B,OAAO,SACL,EACA,EACgE,CAChE,IAAM,EAA4C,EAAE,CAC9C,EAAkB,EA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O,EAER,IAAI,EAAI,EAAS,EAAO,CAMjC,MAAM,EAAQ,GAAG,GAKjB,SAAS,IAAI,EAA4B,GAAG,EAA6B,CACvE,OAAO,IAAI,EAAI,EAAS,EAAO,CAGjC,MAAM,EAAS,OAAO,OAAO,IAAK,CAAE,IAAK,QAAO,KAAM,CAAC,CASvD,SAAgB,MAAM,EAA8B,CAClD,GAAI,aAAiB,EAAK,MAAO,GACjC,GAAsB,OAAO,GAAU,WAAnC,EAA6C,MAAO,GAExD,IAAM,EAAU,QAAQ,IAAI,EAAO,UAAU,CAC7C,GAAI,CAAC,MAAM,QAAQ,EAAQ,CAAE,MAAO,GAEpC,IAAM,EAAS,QAAQ,IAAI,EAAO,SAAS,CAC3C,OACE,MAAM,QAAQ,EAAO,EACrB,EAAQ,SAAW,EAAO,OAAS,GACnC,EAAQ,MAAO,GAAS,OAAO,GAAS,SAAS,EACjD,OAAO,QAAQ,IAAI,EAAO,cAAc,EAAK"}
@@ -1,2 +0,0 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{b as t,m as n}from"./validation-BamBwne9.mjs";import{E as r}from"./geo-point-codec-DyEHMdJg.mjs";import{o as i,t as a}from"./sql-Bhxq9arK.mjs";import{a as o,t as s}from"./physical-CAOaNM4R.mjs";import{r as c}from"./adapter-internals-AGgQRu5t.mjs";import{i as l}from"./datetime-physical-codec-BEqQbIP_.mjs";import{t as u}from"./json-number-DvmiNx0n.mjs";import{C as d,D as f,E as p,M as m,N as ee,O as h,S as te,T as ne,_ as re,a as ie,b as ae,d as oe,f as g,g as _,h as v,i as y,j as b,k as x,l as S,n as C,o as w,p as T,r as E,s as D,v as O,w as k,x as A,y as j}from"./standard-sql-mJt0RHHE.mjs";import{r as M,t as N}from"./batch-refs-DoWlPD2h.mjs";import{f as P,g as F,h as I,n as L,o as R,p as z,r as B,t as V,u as H}from"./select-assembly-BxtETbG9.mjs";const U=ee(`"`),W={quotient:(e,t)=>i`(${e} / ${t})`,remainder:(e,t)=>i`(${e} % ${t})`};function sqliteIntegerPrecision(e){let t=h(e);if(t<19)return t;if(!(t>19))return(e.startsWith(`-`)?e.slice(1)<=`9223372036854775808`:e<=`9223372036854775807`)?t:void 0}const G=i.raw(`1000000000000000000`),overflowCoefficient=e=>i.raw(`1${`0`.repeat(Math.min(e.precision,18))}`),guardedCoefficientAssignment=(e,t,n,r)=>i`${e} = CASE WHEN ${e} IS NULL OR ${t} THEN ${n} ELSE ${overflowCoefficient(r)} END`,K=/^\d+$/,q=/["\\]/,jsonPathLeg=e=>{if(K.test(e))return`$[${e}]`;if(q.test(e))throw Error(`SQLite JSON path segments containing " or \\ must be rejected by the portable query contract.`);return`$."${e}"`},jsonExtract=(e,t)=>{let n=i`${e} -> '$'`;for(let e of t)n=i`${n} -> ${jsonPathLeg(e)}`;return n},jsonExtractText=(e,t)=>{if(t.length===0)return i`${e} ->> '$'`;let n=t.map(jsonPathLeg),r=n.pop(),a=e;for(let e of n)a=i`${a} -> ${e}`;return i`${a} ->> ${r}`},jsonArrayConcat=(e,t)=>i`(CASE WHEN ${e} = '[]' THEN ${t} WHEN ${t} = '[]' THEN ${e} ELSE substr(${e}, 1, length(${e}) - 1) || ',' || substr(${t}, 2) END)`,sqliteJsonListValue=e=>i`${m(e)}`,se=[``,``],J=[`CAST(`,` AS INTEGER)`],ce=/\p{Cs}/u,Y=p().list;function jsonMember(e){return typeof e==`string`?ce.test(e)?void 0:JSON.stringify(e):e instanceof Uint8Array?`"${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}"`:typeof e==`bigint`||typeof e==`boolean`||Number.isSafeInteger(e)?String(e):void 0}function sqliteList(e){if(e.length<=25)return Y(e);let[t]=e,n=t?.strings[0]===J[0]?J:se,r=[],o=0;for(let t of e){let[i,a,s]=t.strings,c=t.values[0],l=jsonMember(c);if(l===void 0||i!==n[0]||a!==n[1]||s!==void 0)return Y(e);c instanceof Uint8Array&&o++,r.push(l)}return o!==0&&o!==e.length?Y(e):i`(SELECT ${new a(n,[i.raw(o===0?`value`:`unhex(value)`)])} FROM json_each(${`[${r.join(`,`)}]`}))`}const X={...p(),value:e=>{if(typeof e==`bigint`&&sqliteIntegerPrecision(String(e))===void 0)throw new n(`SQLite bigint values must fit signed 64-bit integers.`);return i`${e}`},true:()=>i.raw(`1`),false:()=>i.raw(`0`),json:e=>i`${JSON.stringify(e)}`,dateTime:(e,t)=>i`${l(e,s(t))}`,decimal:(e,t)=>new a(J,[r(e,t,`coefficient`)]),id:(e,t)=>i`${e}`,list:sqliteList},Z={...ie(),like:(e,t)=>i`${e} LIKE ${t} ESCAPE '\\'`,notLike:(e,t)=>i`${e} NOT LIKE ${t} ESCAPE '\\'`,ilike:(e,t)=>i`lower(${e}) LIKE lower(${t}) ESCAPE '\\'`,notIlike:(e,t)=>i`lower(${e}) NOT LIKE lower(${t}) ESCAPE '\\'`,containsText:(e,t)=>i`instr(${e}, ${t}) > 0`,startsWithText:(e,t)=>i`substr(${e}, 1, length(${t})) COLLATE BINARY = ${t}`,endsWithText:(e,t)=>i`substr(${e}, length(${e}) - length(${t}) + 1) COLLATE BINARY = ${t}`,startsWithPrefix:(e,t)=>i`${e} GLOB ${`${x(t)}*`}`,exactTextEq:(e,t)=>i`${e} COLLATE BINARY = ${t}`,exactTextIn:(e,t)=>i`${e} COLLATE BINARY IN ${t}`,..._(),...O(),...A(),...v(X.true,X.false),...oe()},le={...y(),asciiCaseFold:e=>i`lower(${e})`,caseSensitiveText:e=>i`${e} COLLATE BINARY`,concat:(...e)=>e.length===0?i.raw(`''`):e.length===1?e[0]:i`(${i.join(e,` || `)})`,greatest:(...e)=>i`MAX(${i.join(e,`, `)})`,least:(...e)=>i`MIN(${i.join(e,`, `)})`,integerDivide:(e,t)=>i`(${e} / CAST(${t} AS INTEGER))`,decimalCast:(e,t)=>i`CAST(${e} AS INTEGER)`,idCast:(e,t)=>t===`bytes`?i`unhex(${e})`:i`CAST(${e} AS TEXT)`,cast:E({text:`TEXT`,integer:`INTEGER`,bigint:`INTEGER`,boolean:`INTEGER`,numeric:`NUMERIC`}),blobToHex:e=>i`lower(hex(${e}))`},ue={...C(`9e999`),decimalAvg:(e,t)=>R(W,i`SUM(${e})`,i`COUNT(${e})`),decimalSumOperandPrecision:sqliteIntegerPrecision,integerSum:e=>{let t=i`SUM(${e} >> 32)`,n=i`SUM(${e} - ((${e} >> 32) << 32))`,r=i`(${t} + (${n} >> 32))`,a=i`(${n} & 4294967295)`,o=i`${r} * 4294967296.0 + ${a}`;return{parts:[t,n],value:i`CASE WHEN ${r} > 2147483647 THEN ${o} WHEN ${r} >= -2147483648 THEN ${r} * 4294967296 + ${a} ELSE MIN(${o}, -9223372036854777856.0) END`,order:[r,a]}}};function sqliteJsonEquals(e,t){let nodes=e=>i`SELECT fullkey, CASE WHEN type IN ('integer', 'real') THEN 'number' ELSE type END, atom FROM json_tree(${e})`;return i`(CASE WHEN ${e} IS NULL OR ${t} IS NULL THEN NULL ELSE NOT EXISTS (${nodes(e)} EXCEPT ${nodes(t)}) AND NOT EXISTS (${nodes(t)} EXCEPT ${nodes(e)}) END)`}const sqliteJsonObject=e=>{if(e.length===0)return i.raw(`json_object()`);let t=e.flatMap(([e,t])=>[i`${e}`,t]);return i`json_object(${i.join(t,`, `)})`},de={equals:sqliteJsonEquals,number:e=>i`CASE WHEN ${e} IS NULL THEN NULL ELSE printf(${i.raw(`'${u}'`)}, ${e}) END`,boolean:e=>i`json(CASE WHEN ${e} THEN 'true' ELSE 'false' END)`,document:e=>i`json(${e})`,object:sqliteJsonObject,array:e=>e.length===0?i.raw(`json_array()`):i`json_array(${i.join(e,`, `)})`,emptyArray:()=>i.raw(`json_array()`),agg:e=>i`COALESCE(json_group_array(json(${e})), json_array())`,objectFromColumns:sqliteJsonObject,extract:jsonExtract,extractText:jsonExtractText,numberAtPath:(e,t)=>i`(CASE WHEN json_type(${jsonExtract(e,t)}) IN ('integer', 'real') THEN CAST(${jsonExtractText(e,t)} AS REAL) END)`,stringAtPath:(e,t)=>i`((CASE WHEN json_type(${jsonExtract(e,t)}) = 'text' THEN ${jsonExtractText(e,t)} END) COLLATE BINARY)`,contains:(e,t)=>i`(json_type(${e}) = 'array' AND NOT EXISTS (SELECT 1 FROM json_each(${t}) AS required WHERE NOT EXISTS (SELECT 1 FROM json_each(${e}) AS candidate WHERE ${sqliteJsonEquals(i`${e} -> candidate.fullkey`,i`${t} -> required.fullkey`)})))`,lastElement:e=>i`${e} -> '$[#-1]'`,value:e=>i`${m(e)}`},fe={literal:e=>e.length===0?i.raw(`json_array()`):i`json_array(${i.join(e,`, `)})`,value:sqliteJsonListValue,enumValue:sqliteJsonListValue,has:(e,t)=>i`EXISTS (SELECT 1 FROM json_each(${e}) WHERE value = ${t})`,hasEvery:(e,t)=>i`(SELECT COUNT(*) FROM json_each(${t}) WHERE value IN (SELECT value FROM json_each(${e}))) = json_array_length(${t})`,hasSome:(e,t)=>i`EXISTS (SELECT 1 FROM json_each(${e}) AS a, json_each(${t}) AS b WHERE a.value = b.value)`,isEmpty:e=>i`(json_array_length(${e}) = 0 OR ${e} IS NULL)`,exactNumericProjection:e=>i`CAST(${e} AS TEXT)`,length:e=>i`json_array_length(${e})`,get:(e,t)=>i`json_extract(${e}, '$[' || ${t} || ']')`,push:(e,t)=>i`json_insert(${e}, '$[#]', ${t})`,set:(e,t,n)=>i`json_set(${e}, '$[' || ${t} || ']', ${n})`},pe={...S(),nullsFirst:(e,t)=>t===`desc`?i`${e} DESC NULLS FIRST`:i`${e} ASC NULLS FIRST`,nullsLast:(e,t)=>t===`desc`?i`${e} DESC NULLS LAST`:i`${e} ASC NULLS LAST`},me={...j(),multiply:(e,t,n)=>{let r=n?.decimal;return r?guardedCoefficientAssignment(e,i`${t} = 0 OR ABS(${e}) <= ${G} / ABS(${t})`,R(W,i`(${e} * ${t})`,H(r.scale)),r):i`${e} = ${e} * ${t}`},divide:(e,t,n)=>{let r=n?.decimal;if(r){let n=H(r.scale);return guardedCoefficientAssignment(e,i`ABS(${e}) <= ${G} / ${n}`,R(W,P(i`(${e} * ${n})`,t),i`ABS(${t})`),r)}return n?.integer?i`${e} = ${e} / CAST(${t} AS INTEGER)`:i`${e} = ${e} / ${t}`},push:(e,t)=>i`${e} = ${jsonArrayConcat(i`json(COALESCE(${e}, '[]'))`,t)}`,unshift:(e,t)=>i`${e} = ${jsonArrayConcat(t,i`json(COALESCE(${e}, '[]'))`)}`},Q={skipDuplicatesStrategy:`sql`,insert:T(U),insertDefault:e=>i`INSERT INTO ${e} DEFAULT VALUES`,...re(),returning:e=>i`RETURNING ${e}`,...ae()},he={exists:e=>i`SELECT CASE WHEN EXISTS (${e}) THEN 1 ELSE json_extract('x', '$') END AS "__viborm_assert__"`,notExists:e=>i`SELECT CASE WHEN NOT EXISTS (${e}) THEN 1 ELSE json_extract('x', '$') END AS "__viborm_assert__"`,holds:(e,t)=>i`SELECT CASE WHEN ${e} THEN 1 ELSE json_extract('{}', '__viborm_refused__') END AS "__viborm_judged__"${t?i` FROM ${t}`:i``}`},ge={...w(),right:(e,t)=>{throw Error(`SQLite does not support RIGHT JOIN. Restructure the query with joins.left and swapped operands.`)},full:(e,t)=>{throw Error(`SQLite does not support FULL OUTER JOIN. Check adapter.capabilities.supportsFullOuterJoin before calling.`)},lateral:(e,t)=>{throw Error(`SQLite does not support LATERAL joins. Check adapter.capabilities.supportsLateralJoins before calling.`)},lateralLeft:(e,t)=>{throw Error(`SQLite does not support LATERAL joins. Check adapter.capabilities.supportsLateralJoins before calling.`)}},_e={supportsReturning:!0,supportsCteWithMutations:!1,supportsFullOuterJoin:!1,supportsLateralJoins:!1,supportsVector:!1,supportsUpsertWhere:!0,supportsTargetedUpsert:!0,supportsMutationTargetInSubquery:!0,supportsMutationRowLimit:!1,supportsRowLocks:!1},ve={decimalRepresentation:`coefficient`,decimalListRepresentation:`coefficient`,dateTimeRepresentation:s,idRepresentation:(e,t)=>o(e,t,`sqlite`)?.representation??`text`,parseResult:F,parseRelation:(e,t)=>t(),parseField:(e,t,n)=>n()},ye=g(U),be=ne(),xe=d(),$=f(U),Se=D(U),Ce=k(U,(e,t,n)=>i`(${e.head} UNION ALL VALUES ${i.join(t.map(b),`, `)}) AS ${i.raw(U(n))}`),we=te();function balancedConjunction(e){let balanced=(...t)=>{if(t.length<=2)return e(...t);let n=Math.floor(t.length/2);return e(balanced(...t.slice(0,n)),balanced(...t.slice(n)))};return balanced}var SQLiteAdapter=class{constructor({temporaryObjects:e=!0,deepExpressions:t=!0,sharedRelationBodies:n=!1}={}){z(this,this.geoPoint),t||(this.subqueries.existsCheck=(e,t)=>i`SELECT 1 FROM (${$.existsCheck(e,t)})`,this.subqueries.isolated=e=>i`EXISTS (SELECT 1 FROM (SELECT 1 WHERE ${e}))`,this.operators.and=balancedConjunction(Z.and)),n&&(this.capabilities.sharesRelationBodies=!0);let r,createBatchRefs=()=>this.#t(e);c(this,{get batchRefs(){return r??=createBatchRefs(),r},constraints:I,select:this.#e.select})}raw=we;identifiers={...ye};literals={...X};operators={...Z};expressions={...le};aggregates={...ue};json={...de};arrays={...fe};orderBy={...pe};clauses={...be};set={...me};filters={...xe};subqueries={...$};noLimitValue=i.raw(`-1`);#e={select:e=>e.distinct?V(e,e.distinct,this.identifiers.escape,this.noLimitValue):L(i`SELECT ${e.columns}`,e,{forUpdate:`omit`,noLimitValue:this.noLimitValue})};cte={...Se};mutations={...Q};assertions={...he};joins={...ge};setOperations={...Ce};capabilities={..._e};lastInsertId=()=>i.raw(`last_insert_rowid()`);#t(e){let t=i.raw(U(N)),n=i.raw(e?`CREATE TEMP TABLE IF NOT EXISTS`:`CREATE TABLE IF NOT EXISTS`);return M({table:t,batchIdColumn:i.raw(`"batch_id"`),keyColumn:i.raw(`"ref_key"`),valueColumn:i.raw(`"ref_value"`),createTable:i`${n} ${t} ("batch_id" TEXT NOT NULL, "ref_key" TEXT NOT NULL, "ref_value" TEXT, PRIMARY KEY ("batch_id", "ref_key"))`,castValue:e=>i`CAST((${e}) AS TEXT)`,lastInsertId:()=>this.lastInsertId()})}vector=t;geoPoint=(()=>{let longitude=e=>this.json.numberAtPath(e,[`longitude`]),latitude=e=>this.json.numberAtPath(e,[`latitude`]);return{value:(e,t)=>i`json_object('longitude', ${this.json.document(this.json.number(e))}, 'latitude', ${this.json.document(this.json.number(t))})`,longitude,latitude,...B(longitude,latitude,this.operators)}})();result={...ve}};export{SQLiteAdapter as t};
2
- //# sourceMappingURL=sqlite-adapter-B_LNxPA0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-adapter-B_LNxPA0.mjs","names":["sql","#createBatchRefs","#assemble"],"sources":["../src/adapters/databases/sqlite/sqlite-adapter.ts"],"sourcesContent":["import { UnsupportedOperationError, unsupportedVector } from \"@errors\";\nimport { sqliteDateTimePhysicalForm } from \"@schema/scalars/datetime/physical\";\nimport type { NativeTypeDeclaration } from \"@schema/scalars/native-types\";\nimport { idStorageOf } from \"@schema/scalars/string/id-domain\";\nimport { Sql, sql } from \"@sql\";\nimport { encodePhysicalDateTime } from \"@validation/primitives/datetime-physical-codec\";\nimport {\n type DecimalDescriptor,\n encodePhysicalDecimal,\n} from \"@validation/primitives/decimal-codec\";\nimport type { IdRepresentation } from \"@validation/primitives/id-codec\";\nimport { createIdentifierQuoter } from \"../../../sql/identifiers\";\nimport type {\n ArithmeticTarget,\n BatchReferenceSqlAdapter,\n} from \"../../adapter-core-types\";\nimport { installAdapterInternals } from \"../../adapter-internals\";\nimport type { QueryParts } from \"../../adapter-query-parts\";\nimport {\n type AdapterResultParser,\n passThroughParseResult,\n} from \"../../adapter-result-parser\";\nimport { sqliteConstraintIdentities } from \"../../constraint-identity\";\nimport {\n type DatabaseAdapter,\n type GeoPointSql,\n installGeoPointSql,\n} from \"../../database-adapter\";\nimport {\n BATCH_REFS_TABLE,\n createOnConflictBatchRefs,\n} from \"../../shared/batch-refs\";\nimport {\n type ExactIntegerArithmetic,\n halfEvenQuotient,\n scaleFactorSql,\n signedNumerator,\n} from \"../../shared/decimal-arithmetic\";\nimport { createGeoPointCoordinatePredicates } from \"../../shared/geo-point\";\nimport {\n assembleDistinctOnEmulation,\n assembleSelectQuery,\n} from \"../../shared/select-assembly\";\nimport {\n createAggregateFunctions,\n createCastExpression,\n createCommonExpressions,\n createComparisonOperators,\n createCoreJoins,\n createCteBuilders,\n createDirectionOrderBy,\n createExistenceOperators,\n createIdentifiers,\n createInsertStatement,\n createLogicalOperators,\n createMembershipOperators,\n createMutationCommands,\n createNullOperators,\n createNumericSetOperations,\n createOnConflictBuilders,\n createRangeOperators,\n createRawSql,\n createRelationFilters,\n createSetOperations,\n createStandardClauses,\n createStandardLiterals,\n createSubqueries,\n decimalCoefficientPrecision,\n escapeGlobLiteral,\n rowValues,\n stringifyJson,\n} from \"../../shared/standard-sql\";\nimport { SQLITE_BINARY64_FORMAT } from \"./storage/json-number\";\n\nconst quoteIdent = createIdentifierQuoter('\"');\n\n/**\n * Every SQLite decimal expression is signed-int64 integer arithmetic on the\n * stored unscaled coefficient, so `/` IS truncating integer division and `%`\n * carries the dividend's sign. Neither is true once an operand becomes REAL or\n * TEXT, which is why every operand below arrives as an INTEGER column, an\n * integer literal, or a `CAST(... AS INTEGER)` bind.\n */\nconst SQLITE_INTEGERS: ExactIntegerArithmetic = {\n quotient: (n: Sql, d: Sql): Sql => sql`(${n} / ${d})`,\n remainder: (n: Sql, d: Sql): Sql => sql`(${n} % ${d})`,\n};\n\nconst SQLITE_INT64_NEGATIVE_MAGNITUDE = \"9223372036854775808\";\nconst SQLITE_INT64_MAX = \"9223372036854775807\";\n\n/** Admit the exact TEXT-to-INTEGER cast domain, including its 19-digit edges. */\nfunction sqliteIntegerPrecision(coefficient: string): number | undefined {\n const precision = decimalCoefficientPrecision(coefficient);\n if (precision < 19) return precision;\n if (precision > 19) return undefined;\n const isAdmitted = coefficient.startsWith(\"-\")\n ? coefficient.slice(1) <= SQLITE_INT64_NEGATIVE_MAGNITUDE\n : coefficient <= SQLITE_INT64_MAX;\n return isAdmitted ? precision : undefined;\n}\n\n/**\n * The widest intermediate the guarded arms will evaluate: 10^18.\n *\n * SQLite does not raise on an integer multiply that overflows — it converts the\n * expression to REAL, which is the one representation an exact decimal must\n * never touch. So the arms are GUARDED: the guard compares magnitudes by\n * DIVISION (`|x| <= LIMIT / |y|`, exact for integers) instead of computing the\n * product it is protecting, and a `CASE` evaluates only the branch it selects.\n *\n * 10^18 is not arbitrary, and it is not independent. `precision + scale <= 18`\n * is SQLite's declared field limit (plan 3.1), ENFORCED once when the schema is\n * bound (`schema/scalars/decimal/provider-limits.ts`), so every mathematically\n * in-range result has `|x * y| <= 10^(p+s) <= 10^18`: the guard never rejects\n * an answer that fits the field, and int64 keeps a factor of nine in reserve\n * for the `+/- 1` step and the `d - |r|` tie test.\n *\n * THE COUPLING IS LOAD-BEARING, in both directions. This constant is flat where\n * the per-descriptor bound would be `B = scale === 0 ? M : M*F + F/2 - 1`, and\n * that is only equivalent because no descriptor past `p + s = 18` can reach it:\n * a product in `(B, 10^18]` is admitted here and then refused by the range\n * CHECK instead of by the sentinel — the same loud, atomic failure by the other\n * mechanism. Remove the bind limit and the flat guard stops being a bound on\n * the FIELD at all, which is exactly what {@link overflowCoefficient} depends\n * on below.\n */\nconst SQLITE_INTERMEDIATE_LIMIT = sql.raw(\"1000000000000000000\");\n\n/**\n * The coefficient an unsafe or out-of-domain arithmetic result becomes: 10^p,\n * the smallest integer OUTSIDE a `precision: p` field's declared range.\n *\n * The DDL's range check refuses it, so the statement fails atomically and\n * nothing is written — which is the contract for an overflow that is only\n * knowable mid-statement.\n *\n * THE CLAMP DEPENDS ON THE BIND LIMIT, and is only correct because of it. At 19\n * digits and beyond, `10^p` is a REAL to SQLite's own parser, so the sentinel\n * would stop being an integer the CHECK can refuse — and `min(p, 18)` would put\n * it INSIDE the range of a `precision >= 19` column, which is a silently\n * written wrong value rather than a failure. No such column exists: plan 3.1's\n * `precision <= 18 && precision + scale <= 18` is proven once at schema bind\n * (`schema/scalars/decimal/provider-limits.ts`), before any I/O, so\n * `min(p, 18)` is `p` for every descriptor that ever reaches here. The clamp is\n * what an unreachable arm does when it is reached anyway, not a policy — and it\n * is why the bind limit is load-bearing rather than ergonomic.\n */\nconst overflowCoefficient = (descriptor: DecimalDescriptor): Sql =>\n sql.raw(`1${\"0\".repeat(Math.min(descriptor.precision, 18))}`);\n\n/**\n * `column = <exact coefficient arithmetic>`, or the constraint-breaking\n * coefficient when the intermediate would leave int64.\n *\n * A NULL column is safe by definition and takes the guarded arm, where every\n * operator is null-strict and the assignment stays NULL.\n */\nconst guardedCoefficientAssignment = (\n column: Sql,\n safe: Sql,\n value: Sql,\n descriptor: DecimalDescriptor\n): Sql =>\n sql`${column} = CASE WHEN ${column} IS NULL OR ${safe} THEN ${value} ELSE ${overflowCoefficient(descriptor)} END`;\n\nconst JSON_ARRAY_INDEX_SEGMENT = /^\\d+$/;\nconst JSON_UNADDRESSABLE_LABEL = /[\"\\\\]/;\n\n// Each path segment binds as its own single-leg JSONPath ('$[N]' for\n// array indices, '$.\"seg\"' otherwise) chained with -> , so segments can\n// never splice extra legs into the path. SQLite's path grammar has no\n// escape syntax inside quoted labels, so the portable query contract rejects\n// keys containing \" or \\ before adapter execution. This throw is defensive.\nconst jsonPathLeg = (segment: string): string => {\n if (JSON_ARRAY_INDEX_SEGMENT.test(segment)) {\n return `$[${segment}]`;\n }\n if (JSON_UNADDRESSABLE_LABEL.test(segment)) {\n throw new Error(\n 'SQLite JSON path segments containing \" or \\\\ must be rejected by the portable query contract.'\n );\n }\n return `$.\"${segment}\"`;\n};\n\n/** Chain one bound `-> '$leg'` per path segment ('$' alone = document root). */\nconst jsonExtract = (column: Sql, path: string[]): Sql => {\n let expr = sql`${column} -> '$'`;\n for (const segment of path) {\n expr = sql`${expr} -> ${jsonPathLeg(segment)}`;\n }\n return expr;\n};\n\n/** Same chain, but the final leg uses `->>` so strings come back unquoted. */\nconst jsonExtractText = (column: Sql, path: string[]): Sql => {\n if (path.length === 0) {\n return sql`${column} ->> '$'`;\n }\n const legs = path.map(jsonPathLeg);\n const last = legs.pop()!;\n let expr: Sql = column;\n for (const leg of legs) {\n expr = sql`${expr} -> ${leg}`;\n }\n return sql`${expr} ->> ${last}`;\n};\n\n/**\n * Concatenate two JSON array texts by string surgery: strip `left`'s closing\n * bracket and `right`'s opening bracket. SQLite has no JSON array-concat\n * function, and json_insert('$[#]') can only append one element per pair.\n * Both sides must be canonical JSON (json() output or JSON.stringify).\n */\nconst jsonArrayConcat = (left: Sql, right: Sql): Sql =>\n sql`(CASE WHEN ${left} = '[]' THEN ${right} WHEN ${right} = '[]' THEN ${left} ELSE substr(${left}, 1, length(${left}) - 1) || ',' || substr(${right}, 2) END)`;\n\n/** The one JSON list container every SQLite list value crosses as. */\nconst sqliteJsonListValue = (values: unknown[]): Sql =>\n sql`${stringifyJson(values)}`;\n\n/** A bare operand, and a decimal operand: its coefficient read as INTEGER. */\nconst PARAMETER = [\"\", \"\"];\nconst COEFFICIENT = [\"CAST(\", \" AS INTEGER)\"];\nconst LONE_SURROGATE = /\\p{Cs}/u;\nconst PARENTHESIZED_LIST = createStandardLiterals().list;\n/**\n * The longest list kept parenthesized. Without `sqlite_stat1` SQLite sizes an\n * `IN (SELECT …)` at 25 rows and a list at its length, so up to 25 members the\n * list is planned no worse: a key list beside another indexed equality still\n * seeks the key. It is also a quarter of D1's 100-value bind budget.\n */\nconst PLANNED_LIST = 25;\n\n/**\n * One member as JSON text that `json_each` reads back as the value its own\n * parameter binds, or `undefined`. A non-integer number is not one: SQLite\n * reparses JSON text with an error in the last place for some doubles; nor is\n * a string with a lone surrogate, which a driver binds as U+FFFD.\n */\nfunction jsonMember(value: unknown): string | undefined {\n if (typeof value === \"string\")\n return LONE_SURROGATE.test(value) ? undefined : JSON.stringify(value);\n if (value instanceof Uint8Array)\n return `\"${Array.from(value, (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\")}\"`;\n return typeof value === \"bigint\" ||\n typeof value === \"boolean\" ||\n Number.isSafeInteger(value)\n ? String(value)\n : undefined;\n}\n\n/**\n * engine-09: a list longer than {@link PLANNED_LIST} whose members are each one\n * parameter under one spelling — bare, or a decimal's coefficient cast — as\n * ONE parameter, a JSON array `json_each` reads back and spells per element as\n * each member was, so `IN` and `NOT IN` keep their answers, NULLs included.\n * Blobs travel as hex, read through `unhex` (SQLite 3.41). Any other list\n * keeps a parameter per member.\n */\nfunction sqliteList(members: Sql[]): Sql {\n if (members.length <= PLANNED_LIST) return PARENTHESIZED_LIST(members);\n const [first] = members;\n const spelling =\n first?.strings[0] === COEFFICIENT[0] ? COEFFICIENT : PARAMETER;\n const elements: string[] = [];\n let blobs = 0;\n for (const member of members) {\n const [head, tail, extra] = member.strings;\n const value = member.values[0];\n const element = jsonMember(value);\n if (\n element === undefined ||\n head !== spelling[0] ||\n tail !== spelling[1] ||\n extra !== undefined\n )\n return PARENTHESIZED_LIST(members);\n if (value instanceof Uint8Array) blobs++;\n elements.push(element);\n }\n // Blobs beside other values: nothing one spelling reads.\n if (blobs !== 0 && blobs !== members.length)\n return PARENTHESIZED_LIST(members);\n const read = new Sql(spelling, [\n sql.raw(blobs === 0 ? \"value\" : \"unhex(value)\"),\n ]);\n return sql`(SELECT ${read} FROM json_each(${`[${elements.join(\",\")}]`}))`;\n}\n\n/** Facts a SQLite driver states about its transport. */\nexport interface SQLiteAdapterOptions {\n /**\n * Whether the transport admits temporary objects (`CREATE TEMP TABLE`).\n * better-sqlite3, libSQL and bun:sqlite do; Cloudflare D1's authorizer\n * rejects them with `SQLITE_AUTH`, and rejects the whole batch with them.\n * Defaults to `true`.\n */\n readonly temporaryObjects?: boolean;\n /**\n * Whether the transport compiles deep expression trees. SQLite counts a\n * subquery's `WHERE` in the height of the expression that holds it, and sums\n * those heights again while it resolves names, so k nested relation filters\n * cost about k² of `SQLITE_MAX_EXPR_DEPTH`: SQLite's default (1000) admits\n * that; Cloudflare D1 compiles with 100 and refuses \"Expression tree is too\n * large\". Where it does not, each relation filter reads its rows from a\n * derived table, whose `WHERE` neither count reaches through the expression:\n * about four per level, the same plan (SQLite flattens it), one statement.\n * A conjunction of many members nests as a balanced tree where it does not,\n * as the engine already nests a disjunction: SQLite parses `a AND b AND …`\n * one level per member. A level's row domain, where the filter goes on\n * below it, is isolated the same way (`subqueries.isolated`), so a policy\n * costs its height once and not at every level (measured on D1: a\n * three-arm read policy 10 per level, failing at 9 levels; isolated, 5 per\n * level, 94 at the 15 levels admission takes).\n * Defaults to `true`.\n */\n readonly deepExpressions?: boolean;\n /**\n * Whether a statement states each relation filter body it repeats once\n * (`capabilities.sharesRelationBodies`), for a\n * transport that bounds statement text (Cloudflare D1: 100 KB). Defaults\n * to `false`.\n */\n readonly sharedRelationBodies?: boolean;\n}\n\n/**\n * The dialect's stateless SQL builders, built once per module. Each adapter\n * takes its own shallow copy of every group, so a driver that overrides one\n * hook (`driver.adapter.result.parseField = …`) changes only its own adapter,\n * as before, while a driver per request no longer rebuilds every closure.\n */\nconst SQLITE_LITERALS = {\n ...createStandardLiterals(),\n\n value: (value: unknown): Sql => {\n if (\n typeof value === \"bigint\" &&\n sqliteIntegerPrecision(String(value)) === undefined\n )\n throw new UnsupportedOperationError(\n \"SQLite bigint values must fit signed 64-bit integers.\"\n );\n return sql`${value}`;\n },\n\n // SQLite uses 1/0 for booleans\n true: (): Sql => sql.raw(\"1\"),\n\n false: (): Sql => sql.raw(\"0\"),\n\n // SQLite requires JSON values to be stringified\n json: (v: unknown): Sql => sql`${JSON.stringify(v)}`,\n\n // SQLite has no temporal type, so the field's declaration is what the column\n // physically holds and the operand has to be the same kind of value: an ISO\n // string bound against an epoch-millisecond INTEGER matches no row and,\n // written, stores text the typed read then refuses. A TEXT-declared or\n // undeclared field keeps the ISO spelling byte for byte. The string is a\n // validated ISO timestamp — the ISO boundary owns that — and every\n // four-digit public instant round-trips through the Julian-day double.\n dateTime: (iso: string, nativeType?: NativeTypeDeclaration): Sql =>\n sql`${encodePhysicalDateTime(iso, sqliteDateTimePhysicalForm(nativeType))}`,\n\n // SQLite has no exact decimal type, so a decimal column stores the UNSCALED\n // INTEGER COEFFICIENT and an operand becomes that same coefficient. Integer\n // comparison is then exact numeric comparison, and ordering, aggregation\n // and arithmetic are exact for the same reason.\n //\n // The digits bind as TEXT and `CAST(... AS INTEGER)` reads them, rather than\n // riding a JavaScript number (which rounds above 2^53) or a bigint (which\n // D1 will not bind). SQLite's TEXT-to-INTEGER cast is a decimal integer\n // parse, not a float one.\n decimal: (canonical: string, descriptor: DecimalDescriptor): Sql =>\n new Sql(COEFFICIENT, [\n encodePhysicalDecimal(canonical, descriptor, \"coefficient\"),\n ]),\n\n // Every compact domain is a `BLOB` here and takes the payload's bytes as\n // the ordinary binary parameter a blob scalar already binds; a text-stored\n // domain takes the public string unchanged.\n id: (physical: string | Uint8Array, _representation: IdRepresentation): Sql =>\n sql`${physical}`,\n\n list: sqliteList,\n};\n\nconst SQLITE_OPERATORS = {\n ...createComparisonOperators(),\n\n // Explicit ESCAPE '\\' pairs with wildcard escaping in the where-builder\n like: (column: Sql, pattern: Sql): Sql =>\n sql`${column} LIKE ${pattern} ESCAPE '\\\\'`,\n notLike: (column: Sql, pattern: Sql): Sql =>\n sql`${column} NOT LIKE ${pattern} ESCAPE '\\\\'`,\n ilike: (column: Sql, pattern: Sql): Sql =>\n sql`lower(${column}) LIKE lower(${pattern}) ESCAPE '\\\\'`,\n notIlike: (column: Sql, pattern: Sql): Sql =>\n sql`lower(${column}) NOT LIKE lower(${pattern}) ESCAPE '\\\\'`,\n containsText: (column: Sql, value: Sql): Sql =>\n sql`instr(${column}, ${value}) > 0`,\n startsWithText: (column: Sql, value: Sql): Sql =>\n sql`substr(${column}, 1, length(${value})) COLLATE BINARY = ${value}`,\n endsWithText: (column: Sql, value: Sql): Sql =>\n sql`substr(${column}, length(${column}) - length(${value}) + 1) COLLATE BINARY = ${value}`,\n // GLOB, not LIKE — and this is the one place the \"portable escaped LIKE\"\n // premise of Decision 7.3 does not survive contact with SQLite. Both of\n // SQLite's LIKE-optimization preconditions fail here: an ESCAPE clause\n // disqualifies the optimization outright, and with `case_sensitive_like`\n // off (the default, and connection-global, so not ours to flip) the\n // optimization additionally wants a NOCASE-collated index, while `push()`\n // only ever creates BINARY ones. Measured on better-sqlite3, 20k rows,\n // plain index: `col LIKE ? ESCAPE '\\'` is a SCAN — exactly what the\n // `substr` spelling above already costs — AND it answers case-insensitively,\n // which would break the case-sensitivity contract this operator holds.\n //\n // GLOB has neither problem. It compares bytes, so it is case- and\n // accent-sensitive by construction (that is what `COLLATE BINARY` buys\n // above, so nothing is lost by dropping it), and it ranges on the ordinary\n // BINARY index: the same probe plans this as a covering index SEARCH over\n // 111 rows against a 20000-row SCAN. Its wildcards are `*`/`?`/`[`, and it\n // has no ESCAPE clause, so `escapeGlobLiteral` quotes them as classes.\n startsWithPrefix: (column: Sql, value: string): Sql =>\n sql`${column} GLOB ${`${escapeGlobLiteral(value)}*`}`,\n\n // `COLLATE BINARY` names a COLLATION, not a function of the column, and\n // SQLite's ordinary index is a BINARY index — so the case-sensitive\n // spelling is already the index-usable one and there is nothing to add.\n // Byte-identical to what shipped before §10.2.\n exactTextEq: (column: Sql, value: Sql): Sql =>\n sql`${column} COLLATE BINARY = ${value}`,\n exactTextIn: (column: Sql, values: Sql): Sql =>\n sql`${column} COLLATE BINARY IN ${values}`,\n\n ...createMembershipOperators(),\n\n ...createNullOperators(),\n\n ...createRangeOperators(),\n\n // Logical (vacuous cases use SQLite's 1/0 booleans)\n ...createLogicalOperators(SQLITE_LITERALS.true, SQLITE_LITERALS.false),\n\n ...createExistenceOperators(),\n};\n\nconst SQLITE_EXPRESSIONS = {\n ...createCommonExpressions(),\n\n // SQLite lower() intentionally provides the portable ASCII-only contract.\n asciiCaseFold: (expr: Sql): Sql => sql`lower(${expr})`,\n caseSensitiveText: (expr: Sql): Sql => sql`${expr} COLLATE BINARY`,\n\n concat: (...parts: Sql[]): Sql => {\n if (parts.length === 0) return sql.raw(\"''\");\n if (parts.length === 1) return parts[0]!;\n return sql`(${sql.join(parts, \" || \")})`;\n },\n\n // SQLite has no GREATEST/LEAST; multi-arg MAX/MIN are the scalar forms\n greatest: (...exprs: Sql[]): Sql => sql`MAX(${sql.join(exprs, \", \")})`,\n least: (...exprs: Sql[]): Sql => sql`MIN(${sql.join(exprs, \", \")})`,\n\n // The expression form of `set.divide`'s integer arm, and for the same\n // reason: SQLite drivers bind JS numbers as REAL, so `x / ?` would run real\n // division. Casting the divisor to INTEGER makes it native INT/INT\n // division, truncating toward zero.\n integerDivide: (left: Sql, right: Sql): Sql =>\n sql`(${left} / CAST(${right} AS INTEGER))`,\n\n // A deferred SQLite decimal is already a captured coefficient. The\n // descriptor still travels through the common contract so no caller can\n // select this physical cast without naming the destination domain.\n decimalCast: (expr: Sql, _descriptor: DecimalDescriptor): Sql =>\n sql`CAST(${expr} AS INTEGER)`,\n\n idCast: (expr: Sql, representation: IdRepresentation): Sql =>\n representation === \"bytes\"\n ? sql`unhex(${expr})`\n : sql`CAST(${expr} AS TEXT)`,\n\n // SQLite type mappings\n cast: createCastExpression({\n text: \"TEXT\",\n integer: \"INTEGER\",\n bigint: \"INTEGER\",\n boolean: \"INTEGER\",\n numeric: \"NUMERIC\",\n }),\n\n blobToHex: (expr: Sql): Sql => sql`lower(hex(${expr}))`,\n};\n\nconst SQLITE_AGGREGATES = {\n ...createAggregateFunctions(\"9e999\"),\n\n // The average of a coefficient column IS the half-even integer quotient of\n // its exact sum by its non-null count: dividing both the sum and the count\n // of `logical x 10^s` values leaves `average x 10^s`, so no scale factor\n // appears at all. `COUNT(column)` is zero exactly when `SUM` is NULL, so\n // the null-strict operators answer NULL for an empty or all-null group and\n // the zero divisor is never reached with a value.\n decimalAvg: (column: Sql, _descriptor: DecimalDescriptor): Sql =>\n halfEvenQuotient(\n SQLITE_INTEGERS,\n sql`SUM(${column})`,\n sql`COUNT(${column})`\n ),\n\n // A SQLite decimal aggregate is an int64 `SUM` over coefficients. Exact\n // operand admission follows the signed range rather than digit count: some\n // 19-digit values fit, while the next value past either endpoint would make\n // `CAST(... AS INTEGER)` saturate. The sum itself is `integerSum`'s, exact\n // past that range.\n decimalSumOperandPrecision: sqliteIntegerPrecision,\n\n // `>>` is arithmetic, so an int64 member is exactly `(x >> 32) * 2^32` plus\n // its second part. That part stays REAL for a non-integer member, which the\n // reader refuses as it refused the plain `SUM`.\n // `low` sums non-negative 32-bit remainders: carrying its high bits into\n // `high` leaves a pair that sorts exactly as the total. `value` is that\n // total inside int64 and its nearest double outside, below -2^63 at most\n // `-2^63 - 2048`: SQLite compares an integer with a double exactly, so it\n // is exact against every int64 operand (a decimal coefficient's whole\n // domain), and a number operand past int64 is told apart from every total\n // but those that round to it.\n integerSum: (column: Sql) => {\n const high = sql`SUM(${column} >> 32)`;\n const low = sql`SUM(${column} - ((${column} >> 32) << 32))`;\n const carried = sql`(${high} + (${low} >> 32))`;\n const rest = sql`(${low} & 4294967295)`;\n const double = sql`${carried} * 4294967296.0 + ${rest}`;\n return {\n parts: [high, low] as const,\n value: sql`CASE WHEN ${carried} > 2147483647 THEN ${double} WHEN ${carried} >= -2147483648 THEN ${carried} * 4294967296 + ${rest} ELSE MIN(${double}, -9223372036854777856.0) END`,\n order: [carried, rest],\n };\n },\n};\n\n// Compare every node, including empty containers. Array indices remain part\n// of the path; object property insertion order does not. JSON numbers share\n// one domain, while booleans, strings and JSON null retain their distinct type.\nfunction sqliteJsonEquals(left: Sql, right: Sql): Sql {\n const nodes = (value: Sql) =>\n sql`SELECT fullkey, CASE WHEN type IN ('integer', 'real') THEN 'number' ELSE type END, atom FROM json_tree(${value})`;\n return sql`(CASE WHEN ${left} IS NULL OR ${right} IS NULL THEN NULL ELSE NOT EXISTS (${nodes(left)} EXCEPT ${nodes(right)}) AND NOT EXISTS (${nodes(right)} EXCEPT ${nodes(left)}) END)`;\n}\n\nconst sqliteJsonObject = (pairs: [string, Sql][]): Sql => {\n if (pairs.length === 0) return sql.raw(\"json_object()\");\n const args = pairs.flatMap(([key, value]) => [sql`${key}`, value]);\n return sql`json_object(${sql.join(args, \", \")})`;\n};\n\nconst SQLITE_JSON = {\n equals: sqliteJsonEquals,\n number: (expression: Sql): Sql =>\n sql`CASE WHEN ${expression} IS NULL THEN NULL ELSE printf(${sql.raw(`'${SQLITE_BINARY64_FORMAT}'`)}, ${expression}) END`,\n boolean: (condition: Sql): Sql =>\n sql`json(CASE WHEN ${condition} THEN 'true' ELSE 'false' END)`,\n // SQLite drops the JSON subtype across scalar-subquery boundaries. Restore it\n // before embedding the value in json_object/json_array, or an object becomes a\n // quoted JSON string inside the outer document.\n document: (expression: Sql): Sql => sql`json(${expression})`,\n\n object: sqliteJsonObject,\n\n array: (items: Sql[]): Sql => {\n if (items.length === 0) return sql.raw(\"json_array()\");\n return sql`json_array(${sql.join(items, \", \")})`;\n },\n\n emptyArray: (): Sql => sql.raw(\"json_array()\"),\n\n // Use json() to ensure the aggregated value is treated as JSON, not string\n // Without json(), json_group_array produces [\"{...}\"] instead of [{...}]\n agg: (expr: Sql): Sql =>\n sql`COALESCE(json_group_array(json(${expr})), json_array())`,\n\n objectFromColumns: sqliteJsonObject,\n\n // `->` returns the value as canonical JSON text ('\"str\"', '2', 'null'),\n // the same format json.value binds, so extracted values compare with\n // plain equality (json_extract would return native SQL values instead)\n extract: jsonExtract,\n\n // `->>` returns text with strings unquoted, for LIKE matching\n extractText: jsonExtractText,\n\n // json_type reads the chained `->` result (canonical JSON text), so it\n // sees 'integer'/'real' only for real JSON numbers; every other shape —\n // and an absent path, where `->` is NULL — falls through to NULL\n numberAtPath: (column: Sql, path: string[]): Sql =>\n sql`(CASE WHEN json_type(${jsonExtract(column, path)}) IN ('integer', 'real') THEN CAST(${jsonExtractText(column, path)} AS REAL) END)`,\n\n // COLLATE BINARY is SQLite's default for these columns; naming it keeps\n // the code-point ordering contract explicit alongside PG's COLLATE \"C\"\n stringAtPath: (column: Sql, path: string[]): Sql =>\n sql`((CASE WHEN json_type(${jsonExtract(column, path)}) = 'text' THEN ${jsonExtractText(column, path)} END) COLLATE BINARY)`,\n\n contains: (target: Sql, value: Sql): Sql =>\n sql`(json_type(${target}) = 'array' AND NOT EXISTS (SELECT 1 FROM json_each(${value}) AS required WHERE NOT EXISTS (SELECT 1 FROM json_each(${target}) AS candidate WHERE ${sqliteJsonEquals(sql`${target} -> candidate.fullkey`, sql`${value} -> required.fullkey`)})))`,\n\n lastElement: (target: Sql): Sql => sql`${target} -> '$[#-1]'`,\n\n value: (v: unknown): Sql => sql`${stringifyJson(v)}`,\n};\n\nconst SQLITE_ARRAYS = {\n // SQLite uses JSON arrays\n literal: (items: Sql[]): Sql => {\n if (items.length === 0) return sql.raw(\"json_array()\");\n return sql`json_array(${sql.join(items, \", \")})`;\n },\n\n value: sqliteJsonListValue,\n\n // Deliberately the same container, by identity: SQLite stores an enum LIST\n // as JSON like every other list, so its members are ordinary JSON strings\n // and there is no element type to spell. The `TEXT CHECK(col IN ...)`\n // describes one member.\n enumValue: sqliteJsonListValue,\n\n // Check if value exists in JSON array using json_each\n has: (column: Sql, value: Sql): Sql =>\n sql`EXISTS (SELECT 1 FROM json_each(${column}) WHERE value = ${value})`,\n\n hasEvery: (column: Sql, values: Sql): Sql =>\n sql`(SELECT COUNT(*) FROM json_each(${values}) WHERE value IN (SELECT value FROM json_each(${column}))) = json_array_length(${values})`,\n\n hasSome: (column: Sql, values: Sql): Sql =>\n sql`EXISTS (SELECT 1 FROM json_each(${column}) AS a, json_each(${values}) AS b WHERE a.value = b.value)`,\n\n isEmpty: (column: Sql): Sql =>\n sql`(json_array_length(${column}) = 0 OR ${column} IS NULL)`,\n\n // The column already stores the container as TEXT (its declared type is\n // TEXT, not JSON, precisely so the descriptor's CHECK can hold it). The\n // cast is what stops a JSON carrier from embedding it as a document and a\n // driver from handing back anything but the stored bytes.\n exactNumericProjection: (column: Sql): Sql => sql`CAST(${column} AS TEXT)`,\n\n length: (column: Sql): Sql => sql`json_array_length(${column})`,\n\n get: (column: Sql, index: Sql): Sql =>\n sql`json_extract(${column}, '$[' || ${index} || ']')`,\n\n push: (column: Sql, value: Sql): Sql =>\n sql`json_insert(${column}, '$[#]', ${value})`,\n\n set: (column: Sql, index: Sql, value: Sql): Sql =>\n sql`json_set(${column}, '$[' || ${index} || ']', ${value})`,\n};\n\nconst SQLITE_ORDER_BY = {\n ...createDirectionOrderBy(),\n nullsFirst: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n direction === \"desc\"\n ? sql`${column} DESC NULLS FIRST`\n : sql`${column} ASC NULLS FIRST`,\n nullsLast: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n direction === \"desc\"\n ? sql`${column} DESC NULLS LAST`\n : sql`${column} ASC NULLS LAST`,\n};\n\nconst SQLITE_SET = {\n ...createNumericSetOperations(),\n\n // `x * y / 10^s` in coefficient space, rounded half to even. The guard is\n // the multiply's own: `x * y` is the only intermediate here that can leave\n // int64, and it does so exactly when the result cannot fit the field.\n multiply: (column: Sql, by: Sql, target?: ArithmeticTarget): Sql => {\n const descriptor = target?.decimal;\n if (!descriptor) return sql`${column} = ${column} * ${by}`;\n return guardedCoefficientAssignment(\n column,\n sql`${by} = 0 OR ABS(${column}) <= ${SQLITE_INTERMEDIATE_LIMIT} / ABS(${by})`,\n halfEvenQuotient(\n SQLITE_INTEGERS,\n sql`(${column} * ${by})`,\n scaleFactorSql(descriptor.scale)\n ),\n descriptor\n );\n },\n\n // `x * 10^s / y` in coefficient space, rounded half to even; the divisor's\n // sign moves onto the numerator so the rule always sees a positive divisor.\n // `y` is never zero — division by canonical zero is refused before I/O.\n //\n // SQLite drivers bind JS numbers as REAL, so `col / ?` runs real division\n // and would persist a fractional value into an INTEGER column. Casting the\n // divisor to INTEGER makes it native INT/INT division (truncating toward\n // zero, matching Postgres) for integer columns; real columns keep real\n // division since the column itself carries REAL affinity.\n divide: (column: Sql, by: Sql, target?: ArithmeticTarget): Sql => {\n const descriptor = target?.decimal;\n if (descriptor) {\n const factor = scaleFactorSql(descriptor.scale);\n return guardedCoefficientAssignment(\n column,\n sql`ABS(${column}) <= ${SQLITE_INTERMEDIATE_LIMIT} / ${factor}`,\n halfEvenQuotient(\n SQLITE_INTEGERS,\n signedNumerator(sql`(${column} * ${factor})`, by),\n sql`ABS(${by})`\n ),\n descriptor\n );\n }\n return target?.integer\n ? sql`${column} = ${column} / CAST(${by} AS INTEGER)`\n : sql`${column} = ${column} / ${by}`;\n },\n\n push: (column: Sql, values: Sql): Sql =>\n sql`${column} = ${jsonArrayConcat(\n sql`json(COALESCE(${column}, '[]'))`,\n values\n )}`,\n\n unshift: (column: Sql, values: Sql): Sql =>\n sql`${column} = ${jsonArrayConcat(\n values,\n sql`json(COALESCE(${column}, '[]'))`\n )}`,\n};\n\nconst SQLITE_MUTATIONS = {\n skipDuplicatesStrategy: \"sql\" as const,\n insert: createInsertStatement(quoteIdent),\n insertDefault: (table: Sql): Sql => sql`INSERT INTO ${table} DEFAULT VALUES`,\n\n ...createMutationCommands(),\n\n // SQLite 3.35+ supports RETURNING\n returning: (columns: Sql): Sql => sql`RETURNING ${columns}`,\n\n // SQLite uses same ON CONFLICT syntax as PostgreSQL (3.24+/3.35+)\n ...createOnConflictBuilders(),\n};\n\nconst SQLITE_ASSERTIONS = {\n exists: (query: Sql): Sql =>\n sql`SELECT CASE WHEN EXISTS (${query}) THEN 1 ELSE json_extract('x', '$') END AS \"__viborm_assert__\"`,\n notExists: (query: Sql): Sql =>\n sql`SELECT CASE WHEN NOT EXISTS (${query}) THEN 1 ELSE json_extract('x', '$') END AS \"__viborm_assert__\"`,\n // The refusal names its sentinel (`bad JSON path: '__viborm_refused__'`).\n holds: (condition: Sql, from?: Sql): Sql =>\n sql`SELECT CASE WHEN ${condition} THEN 1 ELSE json_extract('{}', '__viborm_refused__') END AS \"__viborm_judged__\"${from ? sql` FROM ${from}` : sql``}`,\n};\n\nconst SQLITE_JOINS = {\n ...createCoreJoins(),\n\n // SQLite doesn't support RIGHT JOIN (before 3.39, and driver support varies).\n // Never silently downgrade: emitting LEFT JOIN without swapping operands\n // returns wrong rows. The query engine never calls this today.\n right: (_table: Sql, _condition: Sql): Sql => {\n throw new Error(\n \"SQLite does not support RIGHT JOIN. Restructure the query with joins.left and swapped operands.\"\n );\n },\n\n // SQLite doesn't support FULL OUTER JOIN (before 3.39, and driver support varies).\n full: (_table: Sql, _condition: Sql): Sql => {\n throw new Error(\n \"SQLite does not support FULL OUTER JOIN. Check adapter.capabilities.supportsFullOuterJoin before calling.\"\n );\n },\n\n // SQLite does NOT support LATERAL joins\n // These methods should never be called - query engine should check capability first\n lateral: (_subquery: Sql, _alias: string): Sql => {\n throw new Error(\n \"SQLite does not support LATERAL joins. Check adapter.capabilities.supportsLateralJoins before calling.\"\n );\n },\n\n lateralLeft: (_subquery: Sql, _alias: string): Sql => {\n throw new Error(\n \"SQLite does not support LATERAL joins. Check adapter.capabilities.supportsLateralJoins before calling.\"\n );\n },\n};\n\nconst SQLITE_CAPABILITIES = {\n supportsReturning: true, // SQLite 3.35+\n // FALSE IN FACT, and it read `true` until the Phase 8 fold gave the flag its\n // first reader (query-performance-plan Phase 10.1). SQLite's `WITH` grammar\n // admits a SELECT and nothing else: measured on SQLite 3.51.2, each of\n // `WITH x AS (UPDATE …/INSERT …/DELETE … RETURNING …) SELECT * FROM x` is a\n // parse error (`near \"UPDATE\": syntax error`). Kept as a capability rather\n // than deleted because Phase 8's `WITH u AS (UPDATE … RETURNING *) SELECT …`\n // fold reads it to decide whether it may emit at all.\n supportsCteWithMutations: false,\n supportsFullOuterJoin: false,\n supportsLateralJoins: false, // SQLite does not support LATERAL joins\n supportsVector: false,\n supportsUpsertWhere: true, // SQLite supports WHERE in ON CONFLICT (3.24+)\n supportsTargetedUpsert: true, // ON CONFLICT (cols) arbitrates on those cols\n supportsMutationTargetInSubquery: true,\n // UPDATE/DELETE ... LIMIT needs SQLITE_ENABLE_UPDATE_DELETE_LIMIT, which is\n // off in the builds this project targets (better-sqlite3, libSQL, D1).\n supportsMutationRowLimit: false,\n supportsRowLocks: false,\n};\n\nconst SQLITE_RESULT: AdapterResultParser = {\n // SQLite has no exact decimal type: a decimal column IS its unscaled\n // integer coefficient, and every projection casts it to text before a\n // driver turns an int64 into a double. The result boundary cannot tell the\n // two vocabularies apart by inspection, so the promise is declared here.\n decimalRepresentation: \"coefficient\",\n\n // A decimal LIST is TEXT holding a JSON array of those same coefficients,\n // stated separately because the two facts are separate: a dialect can spell\n // its scalar decimals exactly and still have no exact decimal inside JSON.\n decimalListRepresentation: \"coefficient\",\n\n // The same reading the `dateTime` literal above lowers through, so a column\n // is read back in the vocabulary it was written in.\n dateTimeRepresentation: sqliteDateTimePhysicalForm,\n\n // Derived from the ONE storage owner, so the column the migration creates\n // and the value this reads back cannot be two decisions.\n idRepresentation: (domain, nativeType) =>\n idStorageOf(domain, nativeType, \"sqlite\")?.representation ?? \"text\",\n\n parseResult: passThroughParseResult,\n\n parseRelation: (\n _value: unknown,\n next: (value?: unknown) => unknown\n ): unknown => next(),\n\n parseField: (\n _value: unknown,\n _scalarType: string,\n next: (value?: unknown) => unknown\n ): unknown => next(),\n};\n\nconst SQLITE_IDENTIFIERS = createIdentifiers(quoteIdent);\n\nconst SQLITE_CLAUSES = createStandardClauses();\n\nconst SQLITE_FILTERS = createRelationFilters();\n\nconst SQLITE_SUBQUERIES = createSubqueries(quoteIdent);\n\nconst SQLITE_CTE = createCteBuilders(quoteIdent);\n\n/**\n * A multi-row `VALUES` is the one compound SQLite does not count against\n * `SQLITE_MAX_COMPOUND_SELECT` (500 terms; measured on 3.53.2: 500 `UNION\n * ALL SELECT` arms refused, 10,922 `VALUES` rows read), so the produced rows\n * follow their typed head as one: the head's columns still type every row,\n * as an arm's did (affinity and collation measured equal).\n */\nconst SQLITE_SET_OPERATIONS = createSetOperations(\n quoteIdent,\n (typed, rows, alias) =>\n sql`(${typed.head} UNION ALL VALUES ${sql.join(rows.map(rowValues), \", \")}) AS ${sql.raw(quoteIdent(alias))}`\n);\n\nconst SQLITE_RAW = createRawSql();\n\n/**\n * `and` nesting its members as a balanced tree, about log2(n) levels for n\n * members, where `and` itself nests one level per member.\n */\nfunction balancedConjunction(\n and: (...conditions: Sql[]) => Sql\n): (...conditions: Sql[]) => Sql {\n const balanced = (...conditions: Sql[]): Sql => {\n if (conditions.length <= 2) return and(...conditions);\n const middle = Math.floor(conditions.length / 2);\n return and(\n balanced(...conditions.slice(0, middle)),\n balanced(...conditions.slice(middle))\n );\n };\n return balanced;\n}\n\nexport class SQLiteAdapter implements DatabaseAdapter {\n constructor({\n temporaryObjects = true,\n deepExpressions = true,\n sharedRelationBodies = false,\n }: SQLiteAdapterOptions = {}) {\n installGeoPointSql(this, this.geoPoint);\n if (!deepExpressions) {\n this.subqueries.existsCheck = (from, where) =>\n sql`SELECT 1 FROM (${SQLITE_SUBQUERIES.existsCheck(from, where)})`;\n // A derived table's `WHERE` is resolved on its own branch: a level's\n // row domain costs its height there, once, not at every level below.\n this.subqueries.isolated = (condition) =>\n sql`EXISTS (SELECT 1 FROM (SELECT 1 WHERE ${condition}))`;\n this.operators.and = balancedConjunction(SQLITE_OPERATORS.and);\n }\n if (sharedRelationBodies) this.capabilities.sharesRelationBodies = true;\n // Only batches read the reference-table SQL, so it is built on first use.\n let batchRefs: BatchReferenceSqlAdapter | undefined;\n const createBatchRefs = () => this.#createBatchRefs(temporaryObjects);\n installAdapterInternals(this, {\n get batchRefs() {\n batchRefs ??= createBatchRefs();\n return batchRefs;\n },\n constraints: sqliteConstraintIdentities,\n select: this.#assemble.select,\n });\n }\n\n raw = SQLITE_RAW;\n\n identifiers = { ...SQLITE_IDENTIFIERS };\n\n literals = { ...SQLITE_LITERALS };\n\n operators = { ...SQLITE_OPERATORS };\n\n expressions = { ...SQLITE_EXPRESSIONS };\n\n aggregates = { ...SQLITE_AGGREGATES };\n\n // SQLite 3.38+ JSON functions\n json = { ...SQLITE_JSON };\n\n arrays = { ...SQLITE_ARRAYS };\n\n // SQLite parses NULLS FIRST/LAST natively since 3.30 (2019-10-04), which is\n // below this adapter's documented 3.35+ floor. The `(col IS NULL)` emulation\n // this replaces was an extra leading sort key, and an index can never supply\n // a sort key that is an expression: on a 100,000-row table with an index over\n // the sort columns, the emulated spelling planned `SCAN t | USE TEMP B-TREE\n // FOR ORDER BY` at 3.356 ms per page and the native one plans `SCAN t USING\n // INDEX` at 0.005 ms. MySQL keeps the emulation — it has no native syntax at\n // any version.\n orderBy = { ...SQLITE_ORDER_BY };\n\n clauses = { ...SQLITE_CLAUSES };\n\n set = { ...SQLITE_SET };\n\n filters = { ...SQLITE_FILTERS };\n\n subqueries = { ...SQLITE_SUBQUERIES };\n\n // SQLite has no bare OFFSET; LIMIT -1 means \"no limit\"\n noLimitValue = sql.raw(\"-1\");\n\n readonly #assemble = {\n select: (parts: QueryParts): Sql => {\n // SQLite doesn't support DISTINCT ON natively\n // Simulate using ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...)\n if (parts.distinct) {\n return assembleDistinctOnEmulation(\n parts,\n parts.distinct,\n this.identifiers.escape,\n this.noLimitValue\n );\n }\n\n // SQLite uses database-level locking, so FOR UPDATE is a no-op\n // (ignoring parts.forUpdate intentionally)\n return assembleSelectQuery(sql`SELECT ${parts.columns}`, parts, {\n forUpdate: \"omit\",\n noLimitValue: this.noLimitValue,\n });\n },\n };\n\n cte = { ...SQLITE_CTE };\n\n mutations = { ...SQLITE_MUTATIONS };\n\n assertions = { ...SQLITE_ASSERTIONS };\n\n joins = { ...SQLITE_JOINS };\n\n setOperations = { ...SQLITE_SET_OPERATIONS };\n\n capabilities: DatabaseAdapter[\"capabilities\"] = { ...SQLITE_CAPABILITIES };\n\n lastInsertId = (): Sql => sql.raw(\"last_insert_rowid()\");\n\n // The scratch is a TEMP table wherever the transport admits one, so it never\n // enters the user's database file. Where it does not (D1), it is an ordinary\n // table in `main`: created once, kept, and EMPTY between batches — every\n // batch deletes the rows it stored, keyed by its own batch id, inside that\n // same batch, and a batch that fails rolls its rows back with it. The table\n // itself persists; SQLite migration introspection leaves it out of the\n // snapshot (`src/migrations/drivers/sqlite/introspect.ts`).\n #createBatchRefs(temporaryObjects: boolean): BatchReferenceSqlAdapter {\n const table = sql.raw(quoteIdent(BATCH_REFS_TABLE));\n const create = sql.raw(\n temporaryObjects\n ? \"CREATE TEMP TABLE IF NOT EXISTS\"\n : \"CREATE TABLE IF NOT EXISTS\"\n );\n return createOnConflictBatchRefs({\n table,\n batchIdColumn: sql.raw('\"batch_id\"'),\n keyColumn: sql.raw('\"ref_key\"'),\n valueColumn: sql.raw('\"ref_value\"'),\n createTable: sql`${create} ${table} (\"batch_id\" TEXT NOT NULL, \"ref_key\" TEXT NOT NULL, \"ref_value\" TEXT, PRIMARY KEY (\"batch_id\", \"ref_key\"))`,\n castValue: (valueSql) => sql`CAST((${valueSql}) AS TEXT)`,\n lastInsertId: () => this.lastInsertId(),\n });\n }\n\n vector = unsupportedVector;\n\n readonly geoPoint: GeoPointSql = (() => {\n const longitude = (point: Sql): Sql =>\n this.json.numberAtPath(point, [\"longitude\"]);\n const latitude = (point: Sql): Sql =>\n this.json.numberAtPath(point, [\"latitude\"]);\n return {\n value: (pointLongitude, pointLatitude) =>\n sql`json_object('longitude', ${this.json.document(this.json.number(pointLongitude))}, 'latitude', ${this.json.document(this.json.number(pointLatitude))})`,\n longitude,\n latitude,\n ...createGeoPointCoordinatePredicates(\n longitude,\n latitude,\n this.operators\n ),\n };\n })();\n\n result: AdapterResultParser = { ...SQLITE_RESULT };\n}\n"],"mappings":"qyBA0EA,MAAM,EAAa,GAAuB,IAAI,CASxC,EAA0C,CAC9C,UAAW,EAAQ,IAAgB,CAAG,IAAI,EAAE,KAAK,EAAE,GACnD,WAAY,EAAQ,IAAgB,CAAG,IAAI,EAAE,KAAK,EAAE,GACrD,CAMD,SAAS,uBAAuB,EAAyC,CACvE,IAAM,EAAY,EAA4B,EAAY,CAC1D,GAAI,EAAY,GAAI,OAAO,EACvB,OAAY,IAIhB,OAHmB,EAAY,WAAW,IAAI,CAC1C,EAAY,MAAM,EAAE,EAAI,sBACxB,GAAe,uBACC,EA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,GAChB,KAAK,KAAK,aAAa,EAAO,CAAC,WAAW,CAAC,CAC7C,MAAO,CACL,OAAQ,EAAgB,IACtB,CAAG,4BAA4B,KAAK,KAAK,SAAS,KAAK,KAAK,OAAO,EAAe,CAAC,CAAC,gBAAgB,KAAK,KAAK,SAAS,KAAK,KAAK,OAAO,EAAc,CAAC,CAAC,GAC1J,UACA,SACA,GAAG,EACD,UACA,SACA,KAAK,UACN,CACF,IACC,CAEJ,OAA8B,CAAE,GAAG,GAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard-sql-mJt0RHHE.mjs","names":["sql"],"sources":["../src/sql/identifiers.ts","../src/adapters/shared/standard-sql.ts"],"sourcesContent":["/**\n * Identifier text primitives.\n *\n * Quoting one name for a dialect, and composing a namespace-qualified object\n * name, are string concerns with no `Sql` involvement: runtime adapters wrap the\n * result in `Sql`, migration drivers splice it into DDL text. Both pass their\n * own quoter — the two differ in escape semantics and null handling — so what is\n * shared here is the composition rule alone, and it has one owner.\n */\n\n/** Quote a single identifier for the dialect: `\"name\"` or `` `name` ``. */\nexport type IdentifierQuoter = (name: string) => string;\n\n/** Build an identifier quoter that doubles embedded quote characters to prevent SQL injection. */\nexport const createIdentifierQuoter =\n (quoteChar: '\"' | \"`\"): IdentifierQuoter =>\n (name: string): string => {\n const escaped =\n name.indexOf(quoteChar) === -1\n ? name\n : name.replaceAll(quoteChar, quoteChar + quoteChar);\n return quoteChar + escaped + quoteChar;\n };\n\n/**\n * The one qualification rule. A present namespace contributes a quoted prefix;\n * an absent one contributes nothing, which is what unbound MySQL and every\n * SQLite adapter mean.\n */\nconst qualifiedPrefix = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string\n): string => `${quoteIdentifier(namespace)}.`;\n\n/**\n * Compose one namespace-qualified object name. The namespace must already be\n * normalized: this primitive validates nothing, holds nothing, and returns text\n * for exactly one object.\n */\nexport const renderQualifiedIdentifier = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string | undefined,\n object: string\n): string =>\n namespace === undefined\n ? quoteIdentifier(object)\n : qualifiedPrefix(quoteIdentifier, namespace) + quoteIdentifier(object);\n\n/**\n * Bind one namespace so its prefix is quoted once per adapter rather than once\n * per rendered statement. The returned function renders exactly what\n * `renderQualifiedIdentifier` would for the same namespace.\n */\nexport const createQualifiedIdentifierRenderer = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string | undefined\n): IdentifierQuoter => {\n if (namespace === undefined) {\n return quoteIdentifier;\n }\n const prefix = qualifiedPrefix(quoteIdentifier, namespace);\n return (object: string): string => prefix + quoteIdentifier(object);\n};\n","import { Sql, sql } from \"@sql\";\nimport {\n createQualifiedIdentifierRenderer,\n type IdentifierQuoter,\n} from \"../../sql/identifiers\";\nimport type { CastType, DatabaseAdapter } from \"../database-adapter\";\n\ntype StandardLiterals = Pick<\n DatabaseAdapter[\"literals\"],\n \"value\" | \"null\" | \"list\"\n>;\n\ntype ComparisonOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"eq\" | \"neq\" | \"lt\" | \"lte\" | \"gt\" | \"gte\"\n>;\n\ntype NullOperators = Pick<DatabaseAdapter[\"operators\"], \"isNull\" | \"isNotNull\">;\n\ntype RangeOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"between\" | \"notBetween\"\n>;\n\ntype ExistenceOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"exists\" | \"notExists\"\n>;\n\ntype DirectionOrderBy = Pick<DatabaseAdapter[\"orderBy\"], \"asc\" | \"desc\">;\n\ntype NumericSetOperations = Pick<\n DatabaseAdapter[\"set\"],\n \"assign\" | \"increment\" | \"decrement\"\n>;\n\ntype MutationCommands = Pick<DatabaseAdapter[\"mutations\"], \"update\" | \"delete\">;\n\nexport const createRawSql = (): DatabaseAdapter[\"raw\"] => {\n return (sqlString: string): Sql => sql.raw(sqlString);\n};\n\n/**\n * JSON-serialize a value for dialects that store lists/JSON as JSON text\n * (MySQL, SQLite). BigInt has no JSON representation, so it serializes as a\n * string; the result parser converts it back via the scalar's bigint type.\n */\nexport const stringifyJson = (value: unknown): string =>\n JSON.stringify(value, (_key, v) =>\n typeof v === \"bigint\" ? v.toString() : v\n );\n\nconst JSON_PATH_ARRAY_INDEX = /^\\d+$/;\n\n/**\n * Build a MySQL/SQLite JSONPath string from path segments: '$' plus `[N]`\n * for integer segments (array indices) and `.\"seg\"` for object keys.\n * Keys are JSON-string-escaped so quotes/dots/backslashes in a segment\n * cannot alter the path structure; the result is bound as a parameter.\n */\nexport const buildJsonPath = (path: string[]): string => {\n let jsonPath = \"$\";\n for (const segment of path) {\n jsonPath += JSON_PATH_ARRAY_INDEX.test(segment)\n ? `[${segment}]`\n : `.${JSON.stringify(segment)}`;\n }\n return jsonPath;\n};\n\nexport const createStandardLiterals = (): StandardLiterals => ({\n value: (v: unknown): Sql => sql`${v}`,\n null: (): Sql => sql.raw(\"NULL\"),\n list: (values: Sql[]): Sql => {\n if (values.length === 0) return sql.raw(\"()\");\n return sql`(${sql.join(values, \", \")})`;\n },\n});\n\nexport const createComparisonOperators = (): ComparisonOperators => ({\n eq: (left: Sql, right: Sql): Sql => sql`${left} = ${right}`,\n neq: (left: Sql, right: Sql): Sql => sql`${left} <> ${right}`,\n lt: (left: Sql, right: Sql): Sql => sql`${left} < ${right}`,\n lte: (left: Sql, right: Sql): Sql => sql`${left} <= ${right}`,\n gt: (left: Sql, right: Sql): Sql => sql`${left} > ${right}`,\n gte: (left: Sql, right: Sql): Sql => sql`${left} >= ${right}`,\n});\n\nexport const createNullOperators = (): NullOperators => ({\n isNull: (expr: Sql): Sql => sql`${expr} IS NULL`,\n isNotNull: (expr: Sql): Sql => sql`${expr} IS NOT NULL`,\n});\n\nexport const createRangeOperators = (): RangeOperators => ({\n between: (column: Sql, min: Sql, max: Sql): Sql =>\n sql`${column} BETWEEN ${min} AND ${max}`,\n notBetween: (column: Sql, min: Sql, max: Sql): Sql =>\n sql`${column} NOT BETWEEN ${min} AND ${max}`,\n});\n\nexport const createExistenceOperators = (): ExistenceOperators => ({\n exists: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n notExists: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n});\n\ntype StandardAggregates = Omit<\n DatabaseAdapter[\"aggregates\"],\n \"decimalAvg\" | \"decimalSumOperandPrecision\"\n>;\n\n/**\n * The aggregate functions every dialect spells identically. `decimalAvg` is\n * deliberately absent: an exact decimal average is derived from `SUM` and\n * `COUNT` in the column's own physical domain, which is the one thing the three\n * dialects do not agree on, so each adapter states it.\n * `decimalSumOperandPrecision` is absent because each dialect also owns exact\n * admission of an operand compared with a widened sum.\n *\n * `infinity` is the dialect's infinite double literal; MySQL has none.\n */\nexport const createAggregateFunctions = (\n infinity?: string\n): StandardAggregates => ({\n count: (expr?: Sql): Sql =>\n expr ? sql`COUNT(${expr})` : sql.raw(\"COUNT(*)\"),\n countDistinct: (expr: Sql): Sql => sql`COUNT(DISTINCT ${expr})`,\n sum: (expr: Sql): Sql => sql`SUM(${expr})`,\n numberSum: (expr: Sql) => {\n const high = sql`SUM(CASE WHEN ABS(${expr}) >= 1e-288 THEN ${expr} / 4294967296.0 / 4294967296.0 END)`;\n const low = sql`SUM(CASE WHEN ABS(${expr}) < 1e-288 THEN ${expr} END)`;\n // The reader's join in SQL: scaling `high` back by 2^64 is exact below\n // 2^960 and leaves the double range from there, where this multiplies\n // nothing — PostgreSQL and MySQL raise on an overflowing product. Without\n // an infinite double (MySQL) the overflow clamps to the largest finite\n // one, which a `having` operand of exactly that value cannot tell apart,\n // and `high` then sorts an infinite sum past a clamped one.\n const bound = sql.raw(infinity ?? \"1.7976931348623157e308\");\n const value = sql`CASE WHEN ${high} IS NULL THEN ${low} WHEN ABS(${high}) < 9.7453140114e288 THEN ${high} * 4294967296.0 * 4294967296.0 + COALESCE(${low}, 0) WHEN ${high} > 0 THEN ${bound} ELSE -${bound} END`;\n return {\n parts: [high, low] as const,\n value,\n order: infinity ? [value] : [value, high],\n };\n },\n avg: (expr: Sql): Sql => sql`AVG(${expr})`,\n min: (expr: Sql): Sql => sql`MIN(${expr})`,\n max: (expr: Sql): Sql => sql`MAX(${expr})`,\n});\n\n/** The widened precision carried by one trusted coefficient spelling. */\nexport function decimalCoefficientPrecision(coefficient: string): number {\n return coefficient.startsWith(\"-\")\n ? coefficient.length - 1\n : coefficient.length;\n}\n\n/** Exact-decimal aggregate operand admission for precision-bounded dialects. */\nexport function createDecimalSumOperandPrecision(\n maxPrecision: number\n): (coefficient: string) => number | undefined {\n return (coefficient) => {\n const precision = decimalCoefficientPrecision(coefficient);\n return precision <= maxPrecision ? precision : undefined;\n };\n}\n\nexport const createDirectionOrderBy = (): DirectionOrderBy => ({\n asc: (column: Sql): Sql => sql`${column} ASC`,\n desc: (column: Sql): Sql => sql`${column} DESC`,\n});\n\nconst directionKeyword = (direction: \"asc\" | \"desc\"): Sql =>\n direction === \"desc\" ? sql.raw(\"DESC\") : sql.raw(\"ASC\");\n\n/**\n * NULLS FIRST/LAST emulation for dialects without native support\n * (MySQL, SQLite): prepend an IS NULL sort key. IS NULL yields 1 for\n * NULL rows, so DESC puts them first and ASC puts them last.\n */\nexport const createEmulatedNullsOrderBy = (): Pick<\n DatabaseAdapter[\"orderBy\"],\n \"nullsFirst\" | \"nullsLast\"\n> => ({\n nullsFirst: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n sql`(${column} IS NULL) DESC, ${column} ${directionKeyword(direction)}`,\n nullsLast: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n sql`(${column} IS NULL) ASC, ${column} ${directionKeyword(direction)}`,\n});\n\nexport const createStandardClauses = (): DatabaseAdapter[\"clauses\"] => ({\n select: (columns: Sql): Sql => sql`SELECT ${columns}`,\n selectDistinct: (columns: Sql): Sql => sql`SELECT DISTINCT ${columns}`,\n from: (table: Sql): Sql => sql`FROM ${table}`,\n where: (condition: Sql): Sql => sql`WHERE ${condition}`,\n orderBy: (orders: Sql): Sql => sql`ORDER BY ${orders}`,\n limit: (count: Sql): Sql => sql`LIMIT ${count}`,\n offset: (count: Sql): Sql => sql`OFFSET ${count}`,\n groupBy: (columns: Sql): Sql => sql`GROUP BY ${columns}`,\n having: (condition: Sql): Sql => sql`HAVING ${condition}`,\n});\n\n/**\n * The native arithmetic every dialect shares.\n *\n * `increment`/`decrement` are complete here for EVERY scalar including decimal:\n * addition of two values already in the column's domain — logical decimals on\n * PostgreSQL/MySQL, unscaled coefficients at the same scale on SQLite — creates\n * no digit beyond that domain and therefore never rounds.\n *\n * `multiply` and `divide` do create such digits, so each adapter overrides them\n * to route a decimal target through the shared half-even rule.\n */\nexport const createNumericSetOperations = (): NumericSetOperations => ({\n assign: (column: Sql, value: Sql): Sql => sql`${column} = ${value}`,\n increment: (column: Sql, by: Sql): Sql => sql`${column} = ${column} + ${by}`,\n decrement: (column: Sql, by: Sql): Sql => sql`${column} = ${column} - ${by}`,\n});\n\nexport const createRelationFilters = (): DatabaseAdapter[\"filters\"] => ({\n some: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n every: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n none: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n is: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n isNot: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n});\n\nexport const createMutationCommands = (): MutationCommands => ({\n update: (table: Sql, sets: Sql, where?: Sql): Sql => {\n if (where) {\n return sql`UPDATE ${table} SET ${sets} WHERE ${where}`;\n }\n return sql`UPDATE ${table} SET ${sets}`;\n },\n delete: (table: Sql, where?: Sql): Sql => {\n if (where) {\n return sql`DELETE FROM ${table} WHERE ${where}`;\n }\n return sql`DELETE FROM ${table}`;\n },\n});\n\ntype TypedRows = DatabaseAdapter[\"setOperations\"][\"typedRows\"];\n\n/** One row's values, in order: `(a, b)`. */\nexport const rowValues = (row: readonly Sql[]): Sql =>\n sql`(${sql.join(row, \", \")})`;\n\n/**\n * `typedRows`' default form: the empty typed read, then one `UNION ALL\n * SELECT` per row, each typed against the arms before it.\n */\nconst unionTypedRows =\n (quoteIdent: IdentifierQuoter): TypedRows =>\n (typed, rows, alias) =>\n sql`(${sql.join(\n [typed.head, ...rows.map((row) => sql`SELECT ${sql.join(row, \", \")}`)],\n \" UNION ALL \"\n )}) AS ${sql.raw(quoteIdent(alias))}`;\n\nexport const createSetOperations = (\n quoteIdent: IdentifierQuoter,\n typedRows: TypedRows = unionTypedRows(quoteIdent)\n): DatabaseAdapter[\"setOperations\"] => ({\n union: (...queries: Sql[]): Sql => sql.join(queries, \" UNION \"),\n unionAll: (...queries: Sql[]): Sql => sql.join(queries, \" UNION ALL \"),\n intersect: (...queries: Sql[]): Sql => sql.join(queries, \" INTERSECT \"),\n except: (left: Sql, right: Sql): Sql => sql`${left} EXCEPT ${right}`,\n typedRows,\n});\n\n// ============================================================\n// Dialect-parameterized factories: identical grammar across\n// adapters, differing only in the identifier quote character.\n// ============================================================\n\n/**\n * `namespace` is the adapter's prevalidated database namespace, or `undefined`\n * for the unqualified dialects. It is quoted once here, at adapter\n * construction — `table()` runs once per persistent table per compiled\n * statement and must not re-quote it.\n */\nexport const createIdentifiers = (\n quoteIdent: IdentifierQuoter,\n namespace?: string\n): DatabaseAdapter[\"identifiers\"] => {\n const qualify = createQualifiedIdentifierRenderer(quoteIdent, namespace);\n return {\n escape: (name: string): Sql => sql.raw(quoteIdent(name)),\n\n column: (alias: string, field: string): Sql => {\n const identifier = alias\n ? `${quoteIdent(alias)}.${quoteIdent(field)}`\n : quoteIdent(field);\n return sql.raw(identifier);\n },\n\n table: (tableName: string, alias?: string): Sql => {\n const qualified = qualify(tableName);\n return sql.raw(\n alias === undefined ? qualified : `${qualified} AS ${quoteIdent(alias)}`\n );\n },\n\n aliased: (expression: Sql, alias: string): Sql =>\n new Sql([\"\", ` AS ${quoteIdent(alias)}`], [expression]),\n };\n};\n\nexport const createSubqueries = (\n quoteIdent: IdentifierQuoter\n): DatabaseAdapter[\"subqueries\"] => ({\n scalar: (query: Sql): Sql => sql`(${query})`,\n\n correlate: (query: Sql, alias: string): Sql =>\n sql`(${query}) AS ${sql.raw(quoteIdent(alias))}`,\n\n existsCheck: (from: Sql, where: Sql): Sql =>\n sql`SELECT 1 FROM ${from} WHERE ${where}`,\n\n isolated: (condition: Sql): Sql => condition,\n});\n\nexport const createCteBuilders = (\n quoteIdent: IdentifierQuoter\n): DatabaseAdapter[\"cte\"] => ({\n with: (definitions: { name: string; query: Sql }[]): Sql => {\n const defs = definitions.map(\n ({ name, query }) => sql`${sql.raw(quoteIdent(name))} AS (${query})`\n );\n return sql`WITH ${sql.join(defs, \", \")}`;\n },\n\n recursive: (\n name: string,\n anchor: Sql,\n recursive: Sql,\n union: \"all\" | \"distinct\" = \"all\"\n ): Sql => {\n const unionKeyword =\n union === \"all\" ? sql.raw(\"UNION ALL\") : sql.raw(\"UNION\");\n return sql`WITH RECURSIVE ${sql.raw(quoteIdent(name))} AS (\n ${anchor}\n ${unionKeyword}\n ${recursive}\n )`;\n },\n});\n\nexport const createInsertStatement =\n (quoteIdent: IdentifierQuoter): DatabaseAdapter[\"mutations\"][\"insert\"] =>\n (\n table: Sql,\n columns: string[],\n source: Sql[][] | { readonly select: Sql },\n prefix?: Sql\n ): Sql => {\n const cols = columns.map((c) => sql.raw(quoteIdent(c)));\n const body = Array.isArray(source)\n ? sql`VALUES ${sql.join(\n source.map((row) => sql`(${sql.join(row, \", \")})`),\n \", \"\n )}`\n : source.select;\n const prefixPart = prefix ? sql`${prefix} ` : sql``;\n return sql`INSERT ${prefixPart}INTO ${table} (${sql.join(\n cols,\n \", \"\n )}) ${body}`;\n };\n\n/**\n * Standard ON CONFLICT grammar shared by PostgreSQL and SQLite.\n * MySQL's ON DUPLICATE KEY UPDATE is a different grammar with different\n * semantics — it stays in the MySQL adapter.\n */\nexport const createOnConflictBuilders = (): Pick<\n DatabaseAdapter[\"mutations\"],\n \"onConflict\" | \"onConflictUpdate\" | \"skipDuplicates\"\n> => ({\n onConflict: (target: Sql | null, action: Sql, targetWhere?: Sql): Sql => {\n if (target) {\n if (targetWhere) {\n // ON CONFLICT (id) WHERE <targetWhere> DO UPDATE ...\n return sql`ON CONFLICT (${target}) WHERE ${targetWhere} DO ${action}`;\n }\n return sql`ON CONFLICT (${target}) DO ${action}`;\n }\n return sql`ON CONFLICT DO ${action}`;\n },\n\n onConflictUpdate: (sets: Sql, setWhere?: Sql): Sql => {\n if (setWhere) {\n // UPDATE SET x = y WHERE <setWhere>\n return sql`UPDATE SET ${sets} WHERE ${setWhere}`;\n }\n return sql`UPDATE SET ${sets}`;\n },\n\n // The UNTARGETED skip, and the only caller left is top-level `createMany`,\n // whose `skipDuplicates: true` means \"any unique constraint\". Junction\n // membership inserts want the opposite — only an exact repeat of the complete\n // membership key — and reach `onConflict` above with that key as the target.\n skipDuplicates: () => ({\n prefix: sql``,\n suffix: sql`ON CONFLICT DO NOTHING`,\n }),\n});\n\nexport const createMembershipOperators = (): Pick<\n DatabaseAdapter[\"operators\"],\n \"in\" | \"notIn\"\n> => ({\n in: (column: Sql, values: Sql): Sql => sql`${column} IN ${values}`,\n notIn: (column: Sql, values: Sql): Sql => sql`${column} NOT IN ${values}`,\n});\n\n/**\n * AND/OR/NOT with vacuous-case literals: the dialect's TRUE for an empty\n * AND and FALSE for an empty OR (pass the adapter's literals.true/false).\n */\nexport const createLogicalOperators = (\n vacuousTrue: () => Sql,\n vacuousFalse: () => Sql\n): Pick<DatabaseAdapter[\"operators\"], \"and\" | \"or\" | \"not\"> => ({\n and: (...conditions: Sql[]): Sql => {\n if (conditions.length === 0) return vacuousTrue();\n if (conditions.length === 1) return conditions[0]!;\n return sql`(${sql.join(conditions, \" AND \")})`;\n },\n\n or: (...conditions: Sql[]): Sql => {\n if (conditions.length === 0) return vacuousFalse();\n if (conditions.length === 1) return conditions[0]!;\n return sql`(${sql.join(conditions, \" OR \")})`;\n },\n\n not: (condition: Sql): Sql => sql`NOT (${condition})`,\n});\n\nexport const createCommonExpressions = (): Pick<\n DatabaseAdapter[\"expressions\"],\n | \"caseWhen\"\n | \"add\"\n | \"subtract\"\n | \"multiply\"\n | \"divide\"\n | \"upper\"\n | \"lower\"\n | \"coalesce\"\n> => ({\n caseWhen: (branches, otherwise): Sql =>\n branches.length === 0\n ? otherwise\n : sql`CASE ${sql.join(\n branches.map(\n (branch) => sql`WHEN ${branch.when} THEN ${branch.then}`\n ),\n \" \"\n )} ELSE ${otherwise} END`,\n add: (left: Sql, right: Sql): Sql => sql`(${left} + ${right})`,\n subtract: (left: Sql, right: Sql): Sql => sql`(${left} - ${right})`,\n multiply: (left: Sql, right: Sql): Sql => sql`(${left} * ${right})`,\n divide: (left: Sql, right: Sql): Sql => sql`(${left} / ${right})`,\n upper: (expr: Sql): Sql => sql`UPPER(${expr})`,\n lower: (expr: Sql): Sql => sql`LOWER(${expr})`,\n coalesce: (...exprs: Sql[]): Sql => sql`COALESCE(${sql.join(exprs, \", \")})`,\n});\n\nexport const createCastExpression =\n (typeMap: Record<CastType, string>): DatabaseAdapter[\"expressions\"][\"cast\"] =>\n (expr: Sql, type: CastType): Sql =>\n sql`CAST(${expr} AS ${sql.raw(typeMap[type])})`;\n\nexport const createCoreJoins = (): Pick<\n DatabaseAdapter[\"joins\"],\n \"inner\" | \"left\" | \"right\" | \"cross\"\n> => ({\n inner: (table: Sql, condition: Sql): Sql =>\n sql`INNER JOIN ${table} ON ${condition}`,\n\n left: (table: Sql, condition: Sql): Sql =>\n sql`LEFT JOIN ${table} ON ${condition}`,\n\n right: (table: Sql, condition: Sql): Sql =>\n sql`RIGHT JOIN ${table} ON ${condition}`,\n\n cross: (table: Sql): Sql => sql`CROSS JOIN ${table}`,\n});\n\nexport const createLateralJoins = (\n quoteIdent: IdentifierQuoter\n): Pick<DatabaseAdapter[\"joins\"], \"lateral\" | \"lateralLeft\"> => ({\n lateral: (subquery: Sql, alias: string): Sql =>\n sql`JOIN LATERAL (${subquery}) AS ${sql.raw(quoteIdent(alias))} ON TRUE`,\n\n lateralLeft: (subquery: Sql, alias: string): Sql =>\n sql`LEFT JOIN LATERAL (${subquery}) AS ${sql.raw(quoteIdent(alias))} ON TRUE`,\n});\n\n/**\n * Escape a user value so a SQL `LIKE` pattern matches it literally.\n *\n * `%`, `_` and the escape character itself become escaped; every other\n * character is left alone. The caller appends its own wildcard and must emit\n * a matching `ESCAPE` clause — backslash is only the escape character because\n * every `ESCAPE` clause in this codebase spells backslash.\n */\nexport const escapeLikeLiteral = (value: string): string =>\n value.replace(/[\\\\%_]/g, (char) => `\\\\${char}`);\n\n/**\n * Escape a user value so a SQLite `GLOB` pattern matches it literally.\n *\n * GLOB has no `ESCAPE` clause, so a metacharacter is quoted by wrapping it in\n * a one-character class: `*` becomes `[*]`. Only `*`, `?` and `[` need it —\n * a `]` outside a class is already literal in SQLite's GLOB, and backslash is\n * not a GLOB metacharacter at all.\n */\nexport const escapeGlobLiteral = (value: string): string =>\n value.replace(/[*?[]/g, (char) => `[${char}]`);\n"],"mappings":"uFAcA,MAAa,uBACV,GACA,GAKQ,GAHL,EAAK,QAAQ,EAAU,GAAK,GACxB,EACA,EAAK,WAAW,EAAW,EAAY,EAAU,EAC1B,EAQ3B,iBACJ,EACA,IACW,GAAG,EAAgB,EAAU,CAAC,GAO9B,2BACX,EACA,EACA,IAEA,IAAc,IAAA,GACV,EAAgB,EAAO,CACvB,gBAAgB,EAAiB,EAAU,CAAG,EAAgB,EAAO,CAO9D,mCACX,EACA,IACqB,CACrB,GAAI,IAAc,IAAA,GAChB,OAAO,EAET,IAAM,EAAS,gBAAgB,EAAiB,EAAU,CAC1D,MAAQ,IAA2B,EAAS,EAAgB,EAAO,ECvBxD,iBACH,GAA2BA,EAAI,IAAI,EAAU,CAQ1C,cAAiB,GAC5B,KAAK,UAAU,GAAQ,EAAM,IAC3B,OAAO,GAAM,SAAW,EAAE,UAAU,CAAG,EACxC,CAEG,EAAwB,QAQjB,cAAiB,GAA2B,CACvD,IAAI,EAAW,IACf,IAAK,IAAM,KAAW,EACpB,GAAY,EAAsB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I,EAAK,KAAK,EAAM,GACjE,UAAW,EAAW,IAAoB,CAAG,IAAI,EAAK,KAAK,EAAM,GACjE,QAAS,EAAW,IAAoB,CAAG,IAAI,EAAK,KAAK,EAAM,GAC/D,MAAQ,GAAmB,CAAG,SAAS,EAAK,GAC5C,MAAQ,GAAmB,CAAG,SAAS,EAAK,GAC5C,UAAW,GAAG,IAAsB,CAAG,YAAYA,EAAI,KAAK,EAAO,KAAK,CAAC,GAC1E,EAEY,qBACV,IACA,EAAW,IACV,CAAG,QAAQ,EAAK,MAAMA,EAAI,IAAI,EAAQ,GAAM,CAAC,GAEpC,qBAGP,CACJ,OAAQ,EAAY,IAClB,CAAG,cAAc,EAAM,MAAM,IAE/B,MAAO,EAAY,IACjB,CAAG,aAAa,EAAM,MAAM,IAE9B,OAAQ,EAAY,IAClB,CAAG,cAAc,EAAM,MAAM,IAE/B,MAAQ,GAAoB,CAAG,cAAc,IAC9C,EAEY,mBACX,IAC+D,CAC/D,SAAU,EAAe,IACvB,CAAG,iBAAiB,EAAS,OAAOA,EAAI,IAAI,EAAW,EAAM,CAAC,CAAC,UAEjE,aAAc,EAAe,IAC3B,CAAG,sBAAsB,EAAS,OAAOA,EAAI,IAAI,EAAW,EAAM,CAAC,CAAC,UACvE,EAUY,kBAAqB,GAChC,EAAM,QAAQ,UAAY,GAAS,KAAK,IAAO,CAUpC,kBAAqB,GAChC,EAAM,QAAQ,SAAW,GAAS,IAAI,EAAK,GAAG"}
@@ -1,2 +0,0 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t,t as n}from"./base-D3m1S7Uc.mjs";var ConnectionError=class extends n{static diagnosticName=`ConnectionError`;constructor(e,n){super(e,n?.code??t.CONNECTION_FAILED,n)}},ClientInitializationError=class extends n{static diagnosticName=`ClientInitializationError`;constructor(e,n){super(e,t.CLIENT_INITIALIZATION,n)}};function isClientInitializationError(e){return e instanceof ClientInitializationError}var QueryError=class extends n{static diagnosticName=`QueryError`;constructor(e,n){super(e,n?.code??t.QUERY_FAILED,n)}},NotFoundError=class extends n{static diagnosticName=`NotFoundError`;constructor(e,n,r){super(`No ${e} record found for ${n}`,t.RECORD_NOT_FOUND,{meta:{...r?.meta,model:e,operation:n}})}},ForbiddenError=class extends n{static diagnosticName=`ForbiddenError`;constructor(e,n,r){super(`The ${n} on ${e} is not permitted`,t.FORBIDDEN,{meta:{...r?.meta,model:e,operation:n}})}},NestedWriteError=class extends n{static diagnosticName=`NestedWriteError`;constructor(e,n,r){super(e,r?.code??t.NESTED_WRITE_FAILED,{cause:r?.cause,diagnostics:r?.diagnostics,meta:{...r?.meta,relation:n}})}};const r=`Nested write assertion failed: a batch precondition (e.g. a connect/disconnect target or ownership check) did not hold.`;var NestedWriteAssertionError=class extends n{static diagnosticName=`NestedWriteAssertionError`;constructor(e,n){super(e,t.NESTED_WRITE_ASSERTION_FAILED,n)}},FeatureNotSupportedError=class extends n{static diagnosticName=`FeatureNotSupportedError`;constructor(e,n,r){let i=r?`${e}.${n} is not supported. ${r}`:`${e}.${n} is not supported by this driver.`;super(i,t.FEATURE_NOT_SUPPORTED,{meta:{feature:e,method:n}})}},i=class PendingOperationError extends n{static diagnosticName=`PendingOperationError`;constructor(e,t,n){super(e,t,n)}static alreadyExecutedWithDriver(e,n){return new PendingOperationError(`Cannot await a PendingOperation that was already executed with executeWith(). The ${e}.${n}() operation was already executed in a transaction context. Create a new operation if you need to execute outside the transaction.`,t.OPERATION_ALREADY_EXECUTED,{meta:{model:e,operation:n}})}static alreadyExecutedDefault(e,n){return new PendingOperationError(`Cannot call executeWith() on a PendingOperation that was already awaited. The ${e}.${n}() operation was already executed outside a transaction. Create a new operation for transaction execution.`,t.OPERATION_EXECUTION_CONFLICT,{meta:{model:e,operation:n}})}static differentDriverConflict(e,n){return new PendingOperationError(`Cannot call executeWith() with a different driver. The ${e}.${n}() operation was already executed in another transaction context.`,t.OPERATION_EXECUTION_CONFLICT,{meta:{model:e,operation:n}})}static clientMismatch(e,n){return new PendingOperationError(`Cannot execute ${e}.${n}() in this transaction: the operation was created by a different client instance. All operations in \$transaction([...]) must come from the same client.`,t.OPERATION_CLIENT_MISMATCH,{meta:{model:e,operation:n}})}static scopeMismatch(e,n){return new PendingOperationError(`Cannot execute ${e}.${n}() in this transaction: the operation was created outside this transaction scope. Create the operation from the client provided to this transaction callback.`,t.OPERATION_SCOPE_MISMATCH,{meta:{model:e,operation:n}})}};function isPendingOperationError(e){return e instanceof i}var QueryEngineError=class extends n{static diagnosticName=`QueryEngineError`;constructor(e,n){super(e,n?.code??t.INTERNAL_ERROR,n)}},UnsupportedOperationError=class extends QueryEngineError{static diagnosticName=`UnsupportedOperationError`;constructor(e,n){super(e,{...n,code:t.UNSUPPORTED_OPERATION})}};function isUnsupportedOperationError(e){return e instanceof UnsupportedOperationError}function isNotFoundError(e){return e instanceof NotFoundError}function retainWriteOutcomeFailure(e,t,n=`Query execution and write-outcome publication both failed.`){let r=t instanceof AggregateError?[...t.errors]:[t];return AggregateError([e,...r],n,{cause:e})}const a={literal:()=>{throw new FeatureNotSupportedError(`vector`,`literal`,`Load the pgvector extension.`)},l2:()=>{throw new FeatureNotSupportedError(`vector`,`l2`,`Load the pgvector extension.`)},cosine:()=>{throw new FeatureNotSupportedError(`vector`,`cosine`,`Load the pgvector extension.`)}},o={createManyAndReturn:`createMany`,updateManyAndReturn:`updateMany`,deleteManyAndReturn:`deleteMany`};function publicOperationName(e){return o[e]??e}var ValidationError=class extends n{static diagnosticName=`ValidationError`;issues;source;operation;constructor(e,n,r){let i=n.length===1?[n[0].path,n[0].message].filter(Boolean).join(`: `):`${n.length} validation errors`,a=normalizeSource(e,r?.meta),o=a.kind===`operation`?a.operation:void 0,s=validationSubject(a);super(`Validation failed for ${s}: ${i}`,o?t.VALIDATION_FAILED:t.INVALID_INPUT,{cause:r?.cause,diagnostics:r?.diagnostics,validation:{source:a,issues:n},meta:o?{...r?.meta,operation:o}:{...r?.meta}}),this.issues=n,this.source=a,this.operation=o}};function normalizeSource(e,t){if(typeof e==`string`){let n=typeof t?.model==`string`?t.model:void 0;return Object.freeze({kind:`operation`,operation:publicOperationName(e),...n?{model:n}:{}})}return e.kind===`operation`?Object.freeze({...e,operation:publicOperationName(e.operation)}):Object.freeze({...e})}function validationSubject(e){return e.kind===`operation`?e.model?`${e.model}.${e.operation}`:e.operation:e.kind===`registry`?`schema registry`:e.kind===`schema-builder`?e.builder:`JSON Schema`}function isValidationError(e){return e instanceof ValidationError}export{isPendingOperationError as _,FeatureNotSupportedError as a,a as b,NestedWriteAssertionError as c,i as d,QueryEngineError as f,isNotFoundError as g,isClientInitializationError as h,ConnectionError as i,NestedWriteError as l,UnsupportedOperationError as m,isValidationError as n,ForbiddenError as o,QueryError as p,ClientInitializationError as r,r as s,ValidationError as t,NotFoundError as u,isUnsupportedOperationError as v,retainWriteOutcomeFailure as y};
2
- //# sourceMappingURL=validation-BamBwne9.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-BamBwne9.mjs","names":[],"sources":["../src/errors/query.ts","../src/errors/validation.ts"],"sourcesContent":["import {\n VibORMError,\n VibORMErrorCode,\n type VibORMErrorMeta,\n type VibORMErrorOptions,\n} from \"./base\";\n\n/**\n * Every code {@link ConnectionError} can carry. `CLIENT_INITIALIZATION` is NOT here — it has\n * its own class ({@link ClientInitializationError}).\n */\nexport type ConnectionErrorCode =\n | typeof VibORMErrorCode.CONNECTION_FAILED\n | typeof VibORMErrorCode.CONNECTION_TIMEOUT\n | typeof VibORMErrorCode.CONNECTION_CLOSED\n | typeof VibORMErrorCode.CONNECTION_CAPACITY;\n\n/**\n * Connection-related errors\n */\nexport class ConnectionError extends VibORMError {\n static override readonly diagnosticName = \"ConnectionError\";\n\n /** Discriminant: one of {@link ConnectionErrorCode}, never a code outside the family. */\n declare readonly code: ConnectionErrorCode;\n\n constructor(\n message: string,\n options?: VibORMErrorOptions & { code?: ConnectionErrorCode | undefined }\n ) {\n super(message, options?.code ?? VibORMErrorCode.CONNECTION_FAILED, options);\n }\n}\n\n/**\n * Client construction failures (Prisma P1012)\n *\n * Raised while a client is being built or while its schema-shaped surface is being resolved:\n * a missing driver, a schema that fails name hydration, or an access to a model the schema\n * does not define. These are configuration faults, not query faults — nothing has reached the\n * database yet.\n *\n * Prisma raises `PrismaClientInitializationError` for the same category and exposes its code\n * on `errorCode`; P1012 is Prisma's \"Schema validation error\", the closest documented code for\n * a client that cannot be constructed from the given schema and configuration. VibORM\n * publishes it through the shared `prismaCode` getter.\n */\nexport class ClientInitializationError extends VibORMError {\n static override readonly diagnosticName = \"ClientInitializationError\";\n\n /** Literal discriminant: this class always carries `CLIENT_INITIALIZATION`. */\n declare readonly code: typeof VibORMErrorCode.CLIENT_INITIALIZATION;\n\n constructor(message: string, options?: VibORMErrorOptions) {\n super(message, VibORMErrorCode.CLIENT_INITIALIZATION, options);\n }\n}\n\n/**\n * Type guard for client initialization errors\n */\nexport function isClientInitializationError(\n error: unknown\n): error is ClientInitializationError {\n return error instanceof ClientInitializationError;\n}\n\n/**\n * Every code {@link QueryError} can carry.\n *\n * The `V2xxx` query family plus `INVALID_INPUT`, which the raw-SQL helpers raise through this\n * class when a caller hands `$queryRaw` something that is neither a tagged template nor an\n * `Sql` fragment, or a raw/provider parameter boundary refuses an invalid\n * `Date` (`client/raw.ts`, `drivers/provider-parameter-snapshot.ts`) — measured\n * at the construction sites, not assumed.\n */\nexport type QueryErrorCode =\n | typeof VibORMErrorCode.QUERY_FAILED\n | typeof VibORMErrorCode.QUERY_TIMEOUT\n | typeof VibORMErrorCode.QUERY_SYNTAX\n | typeof VibORMErrorCode.QUERY_SCHEMA_MISMATCH\n | typeof VibORMErrorCode.QUERY_OUT_OF_RANGE\n | typeof VibORMErrorCode.QUERY_RESULT_INVALID\n | typeof VibORMErrorCode.INVALID_INPUT;\n\n/**\n * Query execution errors\n */\nexport class QueryError extends VibORMError {\n static override readonly diagnosticName = \"QueryError\";\n\n /** Discriminant: one of {@link QueryErrorCode}, never a code outside the family. */\n declare readonly code: QueryErrorCode;\n\n constructor(\n message: string,\n options?: VibORMErrorOptions & { code?: QueryErrorCode | undefined }\n ) {\n super(message, options?.code ?? VibORMErrorCode.QUERY_FAILED, options);\n }\n}\n\n/**\n * Record not found (for OrThrow operations)\n */\nexport class NotFoundError extends VibORMError {\n static override readonly diagnosticName = \"NotFoundError\";\n\n /** Literal discriminant: this class always carries `RECORD_NOT_FOUND`. */\n declare readonly code: typeof VibORMErrorCode.RECORD_NOT_FOUND;\n\n constructor(\n model: string,\n operation: string,\n options?: { meta?: VibORMErrorMeta }\n ) {\n super(\n `No ${model} record found for ${operation}`,\n VibORMErrorCode.RECORD_NOT_FOUND,\n {\n meta: { ...options?.meta, model, operation },\n }\n );\n }\n}\n\n/**\n * A policy refused the operation: the row a write would produce, or an explicit `assert`, is\n * not permitted to the caller. Like {@link NotFoundError}, it never says whether the row was\n * hidden or visible and not permitted, nor whether a referenced row is hidden or missing.\n */\nexport class ForbiddenError extends VibORMError {\n static override readonly diagnosticName = \"ForbiddenError\";\n\n /** Literal discriminant: this class always carries `FORBIDDEN`. */\n declare readonly code: typeof VibORMErrorCode.FORBIDDEN;\n\n constructor(\n model: string,\n operation: string,\n options?: { meta?: VibORMErrorMeta }\n ) {\n super(\n `The ${operation} on ${model} is not permitted`,\n VibORMErrorCode.FORBIDDEN,\n {\n meta: { ...options?.meta, model, operation },\n }\n );\n }\n}\n\n/**\n * Every code {@link NestedWriteError} can carry.\n *\n * `NESTED_WRITE_ASSERTION_FAILED` is in the union even though\n * {@link NestedWriteAssertionError} owns that code as a class: the un-attributable batch floor\n * (`OperationExecutor.attributeGuardFailure`, `query-engine/batch-error-attribution.ts`)\n * deliberately re-raises the V7006 floor as a `NestedWriteError` so the surfaced error carries\n * the assertion code without claiming the driver-mapped class. Measured at the construction\n * sites; the two are told apart by class, not by code.\n */\nexport type NestedWriteErrorCode =\n | typeof VibORMErrorCode.NESTED_WRITE_FAILED\n | typeof VibORMErrorCode.NESTED_CREATE_FAILED\n | typeof VibORMErrorCode.NESTED_UPDATE_FAILED\n | typeof VibORMErrorCode.NESTED_DELETE_FAILED\n | typeof VibORMErrorCode.NESTED_CONNECT_FAILED\n | typeof VibORMErrorCode.NESTED_WRITE_ASSERTION_FAILED;\n\n/**\n * Nested write operation errors\n */\nexport class NestedWriteError extends VibORMError {\n static override readonly diagnosticName = \"NestedWriteError\";\n\n /** Discriminant: one of {@link NestedWriteErrorCode}, never a code outside the family. */\n declare readonly code: NestedWriteErrorCode;\n\n constructor(\n message: string,\n relation: string,\n options?: VibORMErrorOptions & { code?: NestedWriteErrorCode | undefined }\n ) {\n super(message, options?.code ?? VibORMErrorCode.NESTED_WRITE_FAILED, {\n cause: options?.cause,\n diagnostics: options?.diagnostics,\n meta: { ...options?.meta, relation },\n });\n }\n}\n\n/**\n * The batch assertion-abort floor sentence — one home for the three layers that\n * say it: the executor's guard-free-ladder floor, merged-batch attribution's\n * un-attributable floor, and driver error mapping's assertion translation.\n * The wording matches V1's frozen runtime verbatim; edit it nowhere else.\n */\nexport const NESTED_WRITE_ASSERTION_FLOOR_MESSAGE =\n \"Nested write assertion failed: a batch precondition (e.g. a connect/disconnect target or ownership check) did not hold.\";\n\n/**\n * Batch-plan nested-write assertion failures\n *\n * Atomic batch plans encode preconditions (connect/disconnect targets must\n * exist, correlation checks) as SQL statements that error on purpose when the\n * precondition fails (adapter.assertions). Each dialect surfaces a different\n * raw error (PG: division by zero, MySQL/SQLite: invalid JSON); the driver\n * error mapping normalizes all of them to this type.\n */\nexport class NestedWriteAssertionError extends VibORMError {\n static override readonly diagnosticName = \"NestedWriteAssertionError\";\n\n /** Literal discriminant: this class always carries `NESTED_WRITE_ASSERTION_FAILED`. */\n declare readonly code: typeof VibORMErrorCode.NESTED_WRITE_ASSERTION_FAILED;\n\n constructor(message: string, options?: VibORMErrorOptions) {\n super(message, VibORMErrorCode.NESTED_WRITE_ASSERTION_FAILED, options);\n }\n}\n\n/**\n * Feature not supported errors\n */\nexport class FeatureNotSupportedError extends VibORMError {\n static override readonly diagnosticName = \"FeatureNotSupportedError\";\n\n /** Literal discriminant: this class always carries `FEATURE_NOT_SUPPORTED`. */\n declare readonly code: typeof VibORMErrorCode.FEATURE_NOT_SUPPORTED;\n\n constructor(feature: string, method: string, suggestion?: string) {\n const message = suggestion\n ? `${feature}.${method} is not supported. ${suggestion}`\n : `${feature}.${method} is not supported by this driver.`;\n super(message, VibORMErrorCode.FEATURE_NOT_SUPPORTED, {\n meta: { feature, method },\n });\n }\n}\n\n/**\n * Pending operation execution errors\n *\n * Thrown when attempting to execute a PendingOperation in an invalid way,\n * such as awaiting after executeWith() or calling executeWith() after await.\n */\n/** Every code {@link PendingOperationError} can carry. */\nexport type PendingOperationErrorCode =\n | typeof VibORMErrorCode.OPERATION_ALREADY_EXECUTED\n | typeof VibORMErrorCode.OPERATION_EXECUTION_CONFLICT\n | typeof VibORMErrorCode.OPERATION_CLIENT_MISMATCH\n | typeof VibORMErrorCode.OPERATION_SCOPE_MISMATCH;\n\nexport class PendingOperationError extends VibORMError {\n static override readonly diagnosticName = \"PendingOperationError\";\n\n /** Discriminant: one of {@link PendingOperationErrorCode}, never a code outside the family. */\n declare readonly code: PendingOperationErrorCode;\n\n // biome-ignore lint/complexity/noUselessConstructor: not a forwarder — it narrows the public signature, restricting `code` to PendingOperationErrorCode and `options` to `{ meta }`; deleting it would widen the constructor back to the base's VibORMErrorCode plus `cause`/`diagnostics`.\n constructor(\n message: string,\n code: PendingOperationErrorCode,\n options?: { meta?: VibORMErrorMeta }\n ) {\n super(message, code, options);\n }\n\n /**\n * Create error for attempting to await after executeWith()\n */\n static alreadyExecutedWithDriver(\n model: string,\n operation: string\n ): PendingOperationError {\n return new PendingOperationError(\n \"Cannot await a PendingOperation that was already executed with executeWith(). \" +\n `The ${model}.${operation}() operation was already executed in a transaction context. ` +\n \"Create a new operation if you need to execute outside the transaction.\",\n VibORMErrorCode.OPERATION_ALREADY_EXECUTED,\n { meta: { model, operation } }\n );\n }\n\n /**\n * Create error for attempting executeWith() after await\n */\n static alreadyExecutedDefault(\n model: string,\n operation: string\n ): PendingOperationError {\n return new PendingOperationError(\n \"Cannot call executeWith() on a PendingOperation that was already awaited. \" +\n `The ${model}.${operation}() operation was already executed outside a transaction. ` +\n \"Create a new operation for transaction execution.\",\n VibORMErrorCode.OPERATION_EXECUTION_CONFLICT,\n { meta: { model, operation } }\n );\n }\n\n /**\n * Create error for attempting executeWith() with a different driver\n */\n static differentDriverConflict(\n model: string,\n operation: string\n ): PendingOperationError {\n return new PendingOperationError(\n \"Cannot call executeWith() with a different driver. \" +\n `The ${model}.${operation}() operation was already executed in another transaction context.`,\n VibORMErrorCode.OPERATION_EXECUTION_CONFLICT,\n { meta: { model, operation } }\n );\n }\n\n /**\n * Create error for operations from different clients in $transaction\n */\n static clientMismatch(\n model: string,\n operation: string\n ): PendingOperationError {\n return new PendingOperationError(\n `Cannot execute ${model}.${operation}() in this transaction: ` +\n \"the operation was created by a different client instance. \" +\n \"All operations in $transaction([...]) must come from the same client.\",\n VibORMErrorCode.OPERATION_CLIENT_MISMATCH,\n { meta: { model, operation } }\n );\n }\n\n /** Create error for mixing root and transaction-bound operation scopes. */\n static scopeMismatch(\n model: string,\n operation: string\n ): PendingOperationError {\n return new PendingOperationError(\n `Cannot execute ${model}.${operation}() in this transaction: ` +\n \"the operation was created outside this transaction scope. \" +\n \"Create the operation from the client provided to this transaction callback.\",\n VibORMErrorCode.OPERATION_SCOPE_MISMATCH,\n { meta: { model, operation } }\n );\n }\n}\n\n/**\n * Type guard for pending operation errors\n */\nexport function isPendingOperationError(\n error: unknown\n): error is PendingOperationError {\n return error instanceof PendingOperationError;\n}\n\n/**\n * Internal query engine error\n */\n/**\n * Every code a {@link QueryEngineError} can carry — its own `INTERNAL_ERROR`, plus the\n * `UNSUPPORTED_OPERATION` its {@link UnsupportedOperationError} subclass narrows to. A wider\n * type here would be a lie about the class; a narrower one would make the subclass's `code`\n * an illegal override.\n */\nexport type QueryEngineErrorCode =\n | typeof VibORMErrorCode.INTERNAL_ERROR\n | typeof VibORMErrorCode.UNSUPPORTED_OPERATION;\n\nexport class QueryEngineError extends VibORMError {\n // Annotated `string` (not the literal) so a subclass may narrow it — the\n // pattern VibORMError itself uses for its subclasses.\n static override readonly diagnosticName: string = \"QueryEngineError\";\n\n /**\n * Discriminant. `INTERNAL_ERROR` for a bare engine error; the\n * {@link UnsupportedOperationError} subclass narrows it to `UNSUPPORTED_OPERATION`, which is\n * why this is the family and not a single literal — a code check alone cannot separate the\n * two, so {@link classifyFailure} separates them by class.\n */\n declare readonly code: QueryEngineErrorCode;\n\n constructor(\n message: string,\n options?: {\n cause?: Error | undefined;\n meta?: VibORMErrorMeta | undefined;\n /** Subclass seam: a distinct taxonomy code (default INTERNAL_ERROR). */\n code?: QueryEngineErrorCode | undefined;\n }\n ) {\n super(message, options?.code ?? VibORMErrorCode.INTERNAL_ERROR, options);\n }\n}\n\n/**\n * A payload SHAPE the query engine deliberately does not express — a documented\n * capability boundary (a compound key or non-literal fold past a proven surface,\n * an inexpressible sub-shape, a parity refusal), NOT an engine crash. Distinct\n * from {@link FeatureNotSupportedError} (a dialect/driver capability gap): this\n * is shape-capability. It extends {@link QueryEngineError} so pre-existing\n * `instanceof QueryEngineError` handling keeps working, but carries its own\n * name and code (`V8003 UNSUPPORTED_OPERATION`) so a deliberate refusal is\n * distinguishable from `V9001 INTERNAL_ERROR` programmatically and in logs.\n * Users can `instanceof UnsupportedOperationError` (exported from the package\n * root) to branch on it.\n */\nexport class UnsupportedOperationError extends QueryEngineError {\n static override readonly diagnosticName = \"UnsupportedOperationError\";\n\n /** Literal discriminant: this class always carries `UNSUPPORTED_OPERATION`. */\n declare readonly code: typeof VibORMErrorCode.UNSUPPORTED_OPERATION;\n\n constructor(\n message: string,\n options?: {\n cause?: Error | undefined;\n meta?: VibORMErrorMeta | undefined;\n }\n ) {\n super(message, {\n ...options,\n code: VibORMErrorCode.UNSUPPORTED_OPERATION,\n });\n }\n}\n\n/**\n * Type guard for unsupported-operation (shape-capability) refusals\n */\nexport function isUnsupportedOperationError(\n error: unknown\n): error is UnsupportedOperationError {\n return error instanceof UnsupportedOperationError;\n}\n\n/**\n * Type guard for not found errors\n */\nexport function isNotFoundError(error: unknown): error is NotFoundError {\n return error instanceof NotFoundError;\n}\n\n/**\n * Keep the execution failure primary while retaining every listener failure.\n *\n * ONE composition for the whole estate, stated at the boundary all three of its\n * consumers already depend on: the client (`client.ts`, `raw.ts`,\n * `array-transaction.ts`), the query engine's deferred operation\n * (`pending-operation.ts`) and the candidate engine's operation context. It is\n * pure — a primary, the listener failures flattened out of the publication\n * owner's aggregate, and the primary again as `cause` — so it belongs beside the\n * query failures it composes rather than inside the extension publication owner\n * that raises one half of it. The candidate engine takes no `@extensions`\n * import anywhere today, and importing that owner would add\n * `src/extensions/query.ts` and `src/query-engine/routed-operations.ts` to\n * `raptor3/shared/operation-context.ts`'s runtime closure (181 → 183). A\n * directory cycle is not what this placement avoids: the engine→extensions\n * runtime edge already exists — `query-engine/pending-operation.ts` holds it\n * for the shipped path — and is pre-existing. A second restatement inside the\n * engine was the duplication FC-05 deleted.\n */\nexport function retainWriteOutcomeFailure(\n primary: unknown,\n outcomeFailure: unknown,\n message = \"Query execution and write-outcome publication both failed.\"\n): AggregateError {\n const suppressed =\n outcomeFailure instanceof AggregateError\n ? [...outcomeFailure.errors]\n : [outcomeFailure];\n return new AggregateError([primary, ...suppressed], message, {\n cause: primary,\n });\n}\n\n/**\n * Unsupported vector operations\n *\n * Use this to override adapter.vector when pgvector is not available.\n */\nexport const unsupportedVector = {\n literal: (): never => {\n throw new FeatureNotSupportedError(\n \"vector\",\n \"literal\",\n \"Load the pgvector extension.\"\n );\n },\n l2: (): never => {\n throw new FeatureNotSupportedError(\n \"vector\",\n \"l2\",\n \"Load the pgvector extension.\"\n );\n },\n cosine: (): never => {\n throw new FeatureNotSupportedError(\n \"vector\",\n \"cosine\",\n \"Load the pgvector extension.\"\n );\n },\n};\n","import type { Operation } from \"../query-engine/types\";\nimport {\n VibORMError,\n VibORMErrorCode,\n type VibORMErrorMeta,\n type VibORMErrorOptions,\n} from \"./base\";\n\n/**\n * Validation issue details\n */\nexport interface ValidationIssue {\n path: string;\n message: string;\n}\n\n/** The boundary that rejected a value. */\nexport type ValidationErrorSource =\n | {\n readonly kind: \"operation\";\n readonly operation: Operation;\n readonly model?: string | undefined;\n }\n | {\n readonly kind: \"registry\";\n readonly model?: string | undefined;\n readonly property?: string | undefined;\n }\n | {\n readonly kind: \"schema-builder\";\n readonly builder: string;\n readonly path: string;\n }\n | {\n readonly kind: \"json-schema\";\n readonly target?: string | undefined;\n readonly schemaType?: string | undefined;\n };\n\n/**\n * The INTERNAL operation names that have no client spelling, mapped to the name\n * a caller can actually type.\n *\n * `createManyAndReturn` / `updateManyAndReturn` / `deleteManyAndReturn` name the\n * row-returning ARM of a bulk write inside the engine (maintainer decision D-1:\n * the public surface is `createMany` / `updateMany` / `deleteMany` with a\n * `select`). The client refuses those names outright — `pending-operation.ts`\n * answers `Unknown operation 'createManyAndReturn'` — so an error that named one\n * would send a caller to fix an operation the same client says does not exist.\n * Every user-facing name goes through {@link publicOperationName}; anything not\n * in this map is already its own public spelling.\n */\nconst PUBLIC_OPERATION_NAME: Readonly<Partial<Record<Operation, Operation>>> = {\n createManyAndReturn: \"createMany\",\n updateManyAndReturn: \"updateMany\",\n deleteManyAndReturn: \"deleteMany\",\n};\n\n/**\n * The client spelling of an operation — identity for every name a caller can\n * type, and the public family name for the three internal row-returning arms.\n */\nexport function publicOperationName(operation: Operation): Operation {\n return PUBLIC_OPERATION_NAME[operation] ?? operation;\n}\n\n/**\n * Input validation errors\n */\nexport class ValidationError extends VibORMError {\n static override readonly diagnosticName = \"ValidationError\";\n\n /** Operation failures use V4001; other validation boundaries use V4002. */\n declare readonly code:\n | typeof VibORMErrorCode.VALIDATION_FAILED\n | typeof VibORMErrorCode.INVALID_INPUT;\n\n /** Validation issues */\n readonly issues: ValidationIssue[];\n /** Boundary that rejected the value. */\n readonly source: ValidationErrorSource;\n /**\n * Operation that failed validation, in its CLIENT spelling — a bulk write\n * validated through its internal row-returning arm still reports the family\n * name the caller used (see {@link publicOperationName}).\n */\n readonly operation?: Operation | undefined;\n\n constructor(\n sourceOrOperation: Operation | ValidationErrorSource,\n issues: ValidationIssue[],\n options?: VibORMErrorOptions\n ) {\n const issuesSummary =\n issues.length === 1\n ? [issues[0]!.path, issues[0]!.message].filter(Boolean).join(\": \")\n : `${issues.length} validation errors`;\n const source = normalizeSource(sourceOrOperation, options?.meta);\n const operation =\n source.kind === \"operation\" ? source.operation : undefined;\n const subject = validationSubject(source);\n super(\n `Validation failed for ${subject}: ${issuesSummary}`,\n operation\n ? VibORMErrorCode.VALIDATION_FAILED\n : VibORMErrorCode.INVALID_INPUT,\n {\n cause: options?.cause,\n diagnostics: options?.diagnostics,\n validation: { source, issues },\n meta: operation\n ? { ...options?.meta, operation }\n : { ...options?.meta },\n }\n );\n this.issues = issues;\n this.source = source;\n this.operation = operation;\n }\n}\n\nfunction normalizeSource(\n sourceOrOperation: Operation | ValidationErrorSource,\n meta: VibORMErrorMeta | undefined\n): ValidationErrorSource {\n if (typeof sourceOrOperation === \"string\") {\n const model = typeof meta?.model === \"string\" ? meta.model : undefined;\n return Object.freeze({\n kind: \"operation\",\n operation: publicOperationName(sourceOrOperation),\n ...(model ? { model } : {}),\n });\n }\n\n if (sourceOrOperation.kind === \"operation\") {\n return Object.freeze({\n ...sourceOrOperation,\n operation: publicOperationName(sourceOrOperation.operation),\n });\n }\n\n return Object.freeze({ ...sourceOrOperation });\n}\n\nfunction validationSubject(source: ValidationErrorSource): string {\n if (source.kind === \"operation\")\n return source.model\n ? `${source.model}.${source.operation}`\n : source.operation;\n if (source.kind === \"registry\") return \"schema registry\";\n if (source.kind === \"schema-builder\") return source.builder;\n return \"JSON Schema\";\n}\n\n/**\n * Type guard for validation errors\n */\nexport function isValidationError(error: unknown): error is ValidationError {\n return error instanceof ValidationError;\n}\n"],"mappings":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