viborm 1.3.1 → 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 (206) hide show
  1. package/dist/{adapter-namespace-BpMbLKpL.mjs → adapter-namespace-CWLEmon2.mjs} +2 -2
  2. package/dist/{adapter-namespace-BpMbLKpL.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-B4zn-FAu.mjs → batch-refs-DGJPz8-G.mjs} +2 -2
  6. package/dist/{batch-refs-B4zn-FAu.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-s1ySUuMb.mjs → builder-D6Ug-zjM.mjs} +2 -2
  10. package/dist/{builder-s1ySUuMb.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/cache.mjs.map +1 -1
  22. package/dist/chain-B5IbqLGi.mjs +2 -0
  23. package/dist/chain-B5IbqLGi.mjs.map +1 -0
  24. package/dist/cli.mjs +1 -1
  25. package/dist/client-BmcHzDBa.mjs +2 -0
  26. package/dist/client-BmcHzDBa.mjs.map +1 -0
  27. package/dist/{client-70MrTq1E.d.mts → client-DR0vYetv.d.mts} +2 -2
  28. package/dist/{client-BgJ7Faln.mjs → client-DjtWangN.mjs} +3 -3
  29. package/dist/{client-BgJ7Faln.mjs.map → client-DjtWangN.mjs.map} +1 -1
  30. package/dist/client.d.mts +1 -1
  31. package/dist/client.mjs +1 -1
  32. package/dist/{clock-C24RcpwO.mjs → clock-YTLtjLFS.mjs} +1 -1
  33. package/dist/{clock-C24RcpwO.mjs.map → clock-YTLtjLFS.mjs.map} +1 -1
  34. package/dist/config.d.mts +1 -1
  35. package/dist/config.mjs +1 -1
  36. package/dist/d1.d.mts +1 -1
  37. package/dist/d1.mjs +1 -1
  38. package/dist/datetime-physical-codec-qKxFtI3B.mjs +2 -0
  39. package/dist/datetime-physical-codec-qKxFtI3B.mjs.map +1 -0
  40. package/dist/{driver-vn-9CN0y.mjs → driver-BvP7eW0A.mjs} +2 -2
  41. package/dist/{driver-vn-9CN0y.mjs.map → driver-BvP7eW0A.mjs.map} +1 -1
  42. package/dist/{driver-B9fIori_.mjs → driver-Bzc0GCQ4.mjs} +2 -2
  43. package/dist/{driver-B9fIori_.mjs.map → driver-Bzc0GCQ4.mjs.map} +1 -1
  44. package/dist/driver.d.mts +1 -1
  45. package/dist/driver.mjs +1 -1
  46. package/dist/{error-mapping-C9WgitPi.mjs → error-mapping-6op318w6.mjs} +2 -2
  47. package/dist/error-mapping-6op318w6.mjs.map +1 -0
  48. package/dist/every-WUr3mlvg.mjs +2 -0
  49. package/dist/{every-CcpKWCVo.mjs.map → every-WUr3mlvg.mjs.map} +1 -1
  50. package/dist/{fs-estate-i8Zlr1OQ.mjs → fs-estate-azK36i9V.mjs} +2 -2
  51. package/dist/{fs-estate-i8Zlr1OQ.mjs.map → fs-estate-azK36i9V.mjs.map} +1 -1
  52. package/dist/{geo-area-codec-CbkmFArQ.mjs → geo-area-codec-BmMmWgU_.mjs} +2 -2
  53. package/dist/{geo-area-codec-CbkmFArQ.mjs.map → geo-area-codec-BmMmWgU_.mjs.map} +1 -1
  54. package/dist/{geo-point-codec-DyEHMdJg.mjs → geo-point-codec-D95uXgDF.mjs} +2 -2
  55. package/dist/{geo-point-codec-DyEHMdJg.mjs.map → geo-point-codec-D95uXgDF.mjs.map} +1 -1
  56. package/dist/{hydration-BsPZI4jE.mjs → hydration-BflrXEIQ.mjs} +2 -2
  57. package/dist/{hydration-BsPZI4jE.mjs.map → hydration-BflrXEIQ.mjs.map} +1 -1
  58. package/dist/{identifier-conversion-BneQiLxQ.mjs → identifier-conversion-Bs7A2GGU.mjs} +2 -2
  59. package/dist/{identifier-conversion-BneQiLxQ.mjs.map → identifier-conversion-Bs7A2GGU.mjs.map} +1 -1
  60. package/dist/identity-Bj2EN6Ss.mjs +2 -0
  61. package/dist/identity-Bj2EN6Ss.mjs.map +1 -0
  62. package/dist/{index-VsM29vYN.d.mts → index-B_jh2oaQ.d.mts} +38 -11
  63. package/dist/index.d.mts +2 -2
  64. package/dist/index.mjs +1 -1
  65. package/dist/instrumentation.d.mts +1 -1
  66. package/dist/instrumentation.mjs +1 -1
  67. package/dist/{key-D9LtHxVK.mjs → key-B89Z4vxn.mjs} +2 -2
  68. package/dist/{key-D9LtHxVK.mjs.map → key-B89Z4vxn.mjs.map} +1 -1
  69. package/dist/{libsql-BlSBYwd_.mjs → libsql-C8dn4id0.mjs} +2 -2
  70. package/dist/{libsql-BlSBYwd_.mjs.map → libsql-C8dn4id0.mjs.map} +1 -1
  71. package/dist/libsql.d.mts +1 -1
  72. package/dist/libsql.mjs +1 -1
  73. package/dist/{memory-C0k-_S_n.mjs → memory-B7CcHS6I.mjs} +2 -2
  74. package/dist/{memory-C0k-_S_n.mjs.map → memory-B7CcHS6I.mjs.map} +1 -1
  75. package/dist/migrations/mysql.d.mts +4 -4
  76. package/dist/migrations/mysql.mjs +1 -1
  77. package/dist/migrations/postgres.d.mts +4 -4
  78. package/dist/migrations/postgres.mjs +1 -1
  79. package/dist/migrations/sqlite.d.mts +4 -4
  80. package/dist/migrations/sqlite.mjs +1 -1
  81. package/dist/migrations/storage/durable-object.mjs +1 -1
  82. package/dist/migrations/storage/fs.mjs +1 -1
  83. package/dist/migrations/storage/r2.mjs +1 -1
  84. package/dist/migrations/tenant.d.mts +2 -2
  85. package/dist/migrations/tenant.mjs +1 -1
  86. package/dist/migrations.d.mts +4 -4
  87. package/dist/migrations.mjs +1 -1
  88. package/dist/mysql-adapter-ABpgFB2N.mjs +2 -0
  89. package/dist/mysql-adapter-ABpgFB2N.mjs.map +1 -0
  90. package/dist/{mysql-DOLHwIM_.mjs → mysql-mUmhH9Cf.mjs} +2 -2
  91. package/dist/{mysql-DOLHwIM_.mjs.map → mysql-mUmhH9Cf.mjs.map} +1 -1
  92. package/dist/mysql2.d.mts +1 -1
  93. package/dist/mysql2.mjs +1 -1
  94. package/dist/neon-http.d.mts +1 -1
  95. package/dist/neon-http.mjs +1 -1
  96. package/dist/{object-store-ChYHlOMD.mjs → object-store-CZADAv4c.mjs} +2 -2
  97. package/dist/{object-store-ChYHlOMD.mjs.map → object-store-CZADAv4c.mjs.map} +1 -1
  98. package/dist/{object-store-D9mvOHP4.d.mts → object-store-Ds9NKRU6.d.mts} +3 -3
  99. package/dist/permissions.d.mts +2 -2
  100. package/dist/permissions.mjs +1 -1
  101. package/dist/permissions.mjs.map +1 -1
  102. package/dist/pg.d.mts +1 -1
  103. package/dist/pg.mjs +1 -1
  104. package/dist/pglite.d.mts +1 -1
  105. package/dist/pglite.mjs +1 -1
  106. package/dist/{physical-CAOaNM4R.mjs → physical-uJfmo4-Z.mjs} +2 -2
  107. package/dist/{physical-CAOaNM4R.mjs.map → physical-uJfmo4-Z.mjs.map} +1 -1
  108. package/dist/{pinned-session-BTplL3iZ.mjs → pinned-session-C79aDzOg.mjs} +2 -2
  109. package/dist/{pinned-session-BTplL3iZ.mjs.map → pinned-session-C79aDzOg.mjs.map} +1 -1
  110. package/dist/planetscale.d.mts +1 -1
  111. package/dist/planetscale.mjs +1 -1
  112. package/dist/{planner-C1NzLBge.d.mts → planner-DHZG9Vy7.d.mts} +1 -1
  113. package/dist/{postgres-DQVSTqVm.mjs → postgres-BACQ_wqF.mjs} +2 -2
  114. package/dist/{postgres-DQVSTqVm.mjs.map → postgres-BACQ_wqF.mjs.map} +1 -1
  115. package/dist/{postgres-adapter-CGthb5yh.mjs → postgres-adapter-Ci07rgh_.mjs} +2 -2
  116. package/dist/{postgres-adapter-CGthb5yh.mjs.map → postgres-adapter-Ci07rgh_.mjs.map} +1 -1
  117. package/dist/postgres-adapter-DaMvNOkx.mjs +2 -0
  118. package/dist/postgres-adapter-DaMvNOkx.mjs.map +1 -0
  119. package/dist/{postgres-result-KyBKBNJr.mjs → postgres-result-D403cLyA.mjs} +2 -2
  120. package/dist/{postgres-result-KyBKBNJr.mjs.map → postgres-result-D403cLyA.mjs.map} +1 -1
  121. package/dist/postgres.d.mts +1 -1
  122. package/dist/postgres.mjs +1 -1
  123. package/dist/{provider-limits-Da00ilvv.mjs → provider-limits-DSv2tYFr.mjs} +2 -2
  124. package/dist/{provider-limits-Da00ilvv.mjs.map → provider-limits-DSv2tYFr.mjs.map} +1 -1
  125. package/dist/result-shape-BKydBCsR.mjs +2 -0
  126. package/dist/result-shape-BKydBCsR.mjs.map +1 -0
  127. package/dist/rows-v1VuwOTa.mjs +2 -0
  128. package/dist/rows-v1VuwOTa.mjs.map +1 -0
  129. package/dist/{scalar-CpEwuJvn.mjs → scalar-Cm7nMFmO.mjs} +2 -2
  130. package/dist/{scalar-CpEwuJvn.mjs.map → scalar-Cm7nMFmO.mjs.map} +1 -1
  131. package/dist/schema/json.d.mts +1 -1
  132. package/dist/schema/json.mjs +1 -1
  133. package/dist/{schema-BnzGHn7k.mjs → schema-D3-ScVH6.mjs} +2 -2
  134. package/dist/{schema-BnzGHn7k.mjs.map → schema-D3-ScVH6.mjs.map} +1 -1
  135. package/dist/{schema-introspection-DZsdP6bi.mjs → schema-introspection-TdJrSaKd.mjs} +3 -3
  136. package/dist/{schema-introspection-DZsdP6bi.mjs.map → schema-introspection-TdJrSaKd.mjs.map} +1 -1
  137. package/dist/schema.d.mts +1 -1
  138. package/dist/schema.mjs +1 -1
  139. package/dist/{select-assembly-CkGe2ABs.mjs → select-assembly-uZfvbYjz.mjs} +2 -2
  140. package/dist/select-assembly-uZfvbYjz.mjs.map +1 -0
  141. package/dist/{settle-CS_k6Ztm.mjs → settle-etgtP1WM.mjs} +2 -2
  142. package/dist/{settle-CS_k6Ztm.mjs.map → settle-etgtP1WM.mjs.map} +1 -1
  143. package/dist/sha256-CEYo7k7R.mjs +2 -0
  144. package/dist/sha256-CEYo7k7R.mjs.map +1 -0
  145. package/dist/soft-delete.d.mts +1 -1
  146. package/dist/sql-BvHwL73I.mjs +2 -0
  147. package/dist/sql-BvHwL73I.mjs.map +1 -0
  148. package/dist/{sql-EsoN_7Et.d.mts → sql-Q_twK-wW.d.mts} +5 -0
  149. package/dist/{sql-statement-tokens-CFi1y3bK.mjs → sql-statement-tokens-BW7Q-rF-.mjs} +1 -1
  150. package/dist/{sql-statement-tokens-CFi1y3bK.mjs.map → sql-statement-tokens-BW7Q-rF-.mjs.map} +1 -1
  151. package/dist/sql.d.mts +1 -1
  152. package/dist/sql.mjs +1 -1
  153. package/dist/sqlite-adapter-DPc9T6Lh.mjs +2 -0
  154. package/dist/sqlite-adapter-DPc9T6Lh.mjs.map +1 -0
  155. package/dist/{sqlite-utils-D_cypcyW.mjs → sqlite-utils-BvSlEs5W.mjs} +2 -2
  156. package/dist/{sqlite-utils-D_cypcyW.mjs.map → sqlite-utils-BvSlEs5W.mjs.map} +1 -1
  157. package/dist/sqlite3.d.mts +1 -1
  158. package/dist/sqlite3.mjs +1 -1
  159. package/dist/{standard-sql-CoGqv-iX.mjs → standard-sql-CYdZ_KXH.mjs} +2 -2
  160. package/dist/standard-sql-CYdZ_KXH.mjs.map +1 -0
  161. package/dist/{to-many-C5RMZl05.mjs → to-many-Btc9X5Ga.mjs} +2 -2
  162. package/dist/{to-many-C5RMZl05.mjs.map → to-many-Btc9X5Ga.mjs.map} +1 -1
  163. package/dist/{utils-C3r4gO3Y.mjs → utils-Qr8ug94X.mjs} +2 -2
  164. package/dist/{utils-C3r4gO3Y.mjs.map → utils-Qr8ug94X.mjs.map} +1 -1
  165. package/dist/v-514RME2X.mjs +2 -0
  166. package/dist/v-514RME2X.mjs.map +1 -0
  167. package/dist/{validation-BQtO6srU.mjs → validation-CPnrLcjW.mjs} +2 -2
  168. package/dist/{validation-BQtO6srU.mjs.map → validation-CPnrLcjW.mjs.map} +1 -1
  169. package/dist/validation-gwZYm3Yn.mjs +2 -0
  170. package/dist/validation-gwZYm3Yn.mjs.map +1 -0
  171. package/dist/validation.d.mts +1 -1
  172. package/dist/validation.mjs +1 -1
  173. package/dist/{validator-CVSrhn0u.mjs → validator-CQOw7G3q.mjs} +2 -2
  174. package/dist/{validator-CVSrhn0u.mjs.map → validator-CQOw7G3q.mjs.map} +1 -1
  175. package/dist/version-0RVYpih5.mjs +2 -0
  176. package/dist/{version-C8QLCt1n.mjs.map → version-0RVYpih5.mjs.map} +1 -1
  177. package/package.json +15 -15
  178. package/dist/chain-7qiFSE8J.mjs +0 -2
  179. package/dist/chain-7qiFSE8J.mjs.map +0 -1
  180. package/dist/client-6YgGlXzN.mjs +0 -2
  181. package/dist/client-6YgGlXzN.mjs.map +0 -1
  182. package/dist/controls-KQ85SWfT.mjs +0 -2
  183. package/dist/controls-KQ85SWfT.mjs.map +0 -1
  184. package/dist/datetime-physical-codec-BEqQbIP_.mjs +0 -2
  185. package/dist/datetime-physical-codec-BEqQbIP_.mjs.map +0 -1
  186. package/dist/error-mapping-C9WgitPi.mjs.map +0 -1
  187. package/dist/every-CcpKWCVo.mjs +0 -2
  188. package/dist/identity-oQvIe7u8.mjs +0 -2
  189. package/dist/identity-oQvIe7u8.mjs.map +0 -1
  190. package/dist/mysql-adapter-C6c5govr.mjs +0 -2
  191. package/dist/mysql-adapter-C6c5govr.mjs.map +0 -1
  192. package/dist/postgres-adapter-CxEit2-v.mjs +0 -2
  193. package/dist/postgres-adapter-CxEit2-v.mjs.map +0 -1
  194. package/dist/result-shape-B6yWtnx_.mjs +0 -2
  195. package/dist/result-shape-B6yWtnx_.mjs.map +0 -1
  196. package/dist/select-assembly-CkGe2ABs.mjs.map +0 -1
  197. package/dist/sql-Bhxq9arK.mjs +0 -2
  198. package/dist/sql-Bhxq9arK.mjs.map +0 -1
  199. package/dist/sqlite-adapter-BXAJy3mI.mjs +0 -2
  200. package/dist/sqlite-adapter-BXAJy3mI.mjs.map +0 -1
  201. package/dist/standard-sql-CoGqv-iX.mjs.map +0 -1
  202. package/dist/v-DtLdBQYg.mjs +0 -2
  203. package/dist/v-DtLdBQYg.mjs.map +0 -1
  204. package/dist/validation-BamBwne9.mjs +0 -2
  205. package/dist/validation-BamBwne9.mjs.map +0 -1
  206. package/dist/version-C8QLCt1n.mjs +0 -2
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{Ft as t}from"./geo-point-codec-DyEHMdJg.mjs";function installAdapterNamespace(e,n,r){Object.defineProperty(e,`namespace`,{value:n===void 0?void 0:t(n,r),writable:!1,enumerable:!0,configurable:!1})}export{installAdapterNamespace as t};
2
- //# sourceMappingURL=adapter-namespace-BpMbLKpL.mjs.map
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{Ft as t}from"./geo-point-codec-D95uXgDF.mjs";function installAdapterNamespace(e,n,r){Object.defineProperty(e,`namespace`,{value:n===void 0?void 0:t(n,r),writable:!1,enumerable:!0,configurable:!1})}export{installAdapterNamespace as t};
2
+ //# sourceMappingURL=adapter-namespace-CWLEmon2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-namespace-BpMbLKpL.mjs","names":[],"sources":["../src/adapters/adapter-namespace.ts"],"sourcesContent":["// The adapter's namespace fact, installed once.\n//\n// `readonly` is a compile-time claim, and query rendering, migrations, cache\n// scope and instrumentation all read this one object at execution time. The\n// property is therefore installed as an own, non-writable, non-configurable\n// value: hostile JavaScript that binds a cache scope and then rewrites the\n// qualifier before the statement runs fails at the assignment instead.\n//\n// The whole adapter is deliberately NOT frozen — the existing vector test seam\n// remains mutable. GeoPoint is installed separately as another immutable fact.\n\nimport { type NamespaceDialect, normalizeNamespace } from \"@schema/identifier\";\n\n/**\n * Validate one constructor argument and install it. `undefined` installs an\n * immutable absence, which is what an unbound MySQL adapter means.\n */\nexport function installAdapterNamespace(\n adapter: object,\n namespace: unknown,\n dialect: NamespaceDialect\n): void {\n Object.defineProperty(adapter, \"namespace\", {\n value:\n namespace === undefined\n ? undefined\n : normalizeNamespace(namespace, dialect),\n writable: false,\n enumerable: true,\n configurable: false,\n });\n}\n"],"mappings":"6FAiBA,SAAgB,wBACd,EACA,EACA,EACM,CACN,OAAO,eAAe,EAAS,YAAa,CAC1C,MACE,IAAc,IAAA,GACV,IAAA,GACA,EAAmB,EAAW,EAAQ,CAC5C,SAAU,GACV,WAAY,GACZ,aAAc,GACf,CAAC"}
1
+ {"version":3,"file":"adapter-namespace-CWLEmon2.mjs","names":[],"sources":["../src/adapters/adapter-namespace.ts"],"sourcesContent":["// The adapter's namespace fact, installed once.\n//\n// `readonly` is a compile-time claim, and query rendering, migrations, cache\n// scope and instrumentation all read this one object at execution time. The\n// property is therefore installed as an own, non-writable, non-configurable\n// value: hostile JavaScript that binds a cache scope and then rewrites the\n// qualifier before the statement runs fails at the assignment instead.\n//\n// The whole adapter is deliberately NOT frozen — the existing vector test seam\n// remains mutable. GeoPoint is installed separately as another immutable fact.\n\nimport { type NamespaceDialect, normalizeNamespace } from \"@schema/identifier\";\n\n/**\n * Validate one constructor argument and install it. `undefined` installs an\n * immutable absence, which is what an unbound MySQL adapter means.\n */\nexport function installAdapterNamespace(\n adapter: object,\n namespace: unknown,\n dialect: NamespaceDialect\n): void {\n Object.defineProperty(adapter, \"namespace\", {\n value:\n namespace === undefined\n ? undefined\n : normalizeNamespace(namespace, dialect),\n writable: false,\n enumerable: true,\n configurable: false,\n });\n}\n"],"mappings":"6FAiBA,SAAgB,wBACd,EACA,EACA,EACM,CACN,OAAO,eAAe,EAAS,YAAa,CAC1C,MACE,IAAc,IAAA,GACV,IAAA,GACA,EAAmB,EAAW,EAAQ,CAC5C,SAAU,GACV,WAAY,GACZ,aAAc,GACf,CAAC"}
@@ -1,2 +1,2 @@
1
- import { a as PostgresAdapter, i as SQLiteAdapter, n as postgresAdapter, o as MySQLAdapter, r as sqliteAdapter, s as DatabaseAdapter, t as mysqlAdapter } from "./index-VsM29vYN.mjs";
1
+ import { a as PostgresAdapter, i as SQLiteAdapter, n as postgresAdapter, o as MySQLAdapter, r as sqliteAdapter, s as DatabaseAdapter, t as mysqlAdapter } from "./index-B_jh2oaQ.mjs";
2
2
  export { type DatabaseAdapter, MySQLAdapter, PostgresAdapter, SQLiteAdapter, mysqlAdapter, postgresAdapter, sqliteAdapter };
package/dist/adapters.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./postgres-adapter-CxEit2-v.mjs";import{t}from"./mysql-adapter-C6c5govr.mjs";import{t as n}from"./sqlite-adapter-BXAJy3mI.mjs";const r=new t,i=new e,a=new n;export{t as MySQLAdapter,e as PostgresAdapter,n as SQLiteAdapter,r as mysqlAdapter,i as postgresAdapter,a as sqliteAdapter};
1
+ import{t as e}from"./postgres-adapter-DaMvNOkx.mjs";import{t}from"./mysql-adapter-ABpgFB2N.mjs";import{t as n}from"./sqlite-adapter-DPc9T6Lh.mjs";const r=new t,i=new e,a=new n;export{t as MySQLAdapter,e as PostgresAdapter,n as SQLiteAdapter,r as mysqlAdapter,i as postgresAdapter,a as sqliteAdapter};
2
2
  //# sourceMappingURL=adapters.mjs.map
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t}from"./sql-Bhxq9arK.mjs";const n=`__viborm_batch_refs`;function createOnConflictBatchRefs(e){return createBatchRefs({...e,store:(n,r,i)=>{let a=e.castValue(i);return t`INSERT INTO ${e.table} (${e.batchIdColumn}, ${e.keyColumn}, ${e.valueColumn}) VALUES (${n}, ${r}, ${a}) ${t.raw`ON CONFLICT`} (${e.batchIdColumn}, ${e.keyColumn}) DO UPDATE SET ${e.valueColumn} = EXCLUDED.${e.valueColumn}`}})}function createMySqlBatchRefs(e){return createBatchRefs({...e,store:(n,r,i)=>{let a=e.castValue(i);return t`INSERT INTO ${e.table} (${e.batchIdColumn}, ${e.keyColumn}, ${e.valueColumn}) VALUES (${n}, ${r}, ${a}) ${t.raw`ON DUPLICATE KEY UPDATE`} ${e.valueColumn} = ${e.duplicateValue}`}})}function createBatchRefs(e){let n=e.lastInsertId,r=e.storeReturning,i=r?(e,t,n,i)=>[r(e,t,n,i)]:n?(t,r,i)=>[i,e.store(t,r,n())]:void 0;return{setup:t=>[e.createTable],cleanup:n=>t`DELETE FROM ${e.table} WHERE ${e.batchIdColumn} = ${n}`,store:e.store,read:(n,r)=>t`(SELECT ${e.valueColumn} FROM ${e.table} WHERE ${e.batchIdColumn} = ${n} AND ${e.keyColumn} = ${r} ${t.raw`LIMIT 1`})`,...n?{storeLastInsertId:(t,r)=>e.store(t,r,n())}:{},...r?{storeReturning:r}:{},...i?{storeInsertedKey:i}:{}}}export{createMySqlBatchRefs as n,createOnConflictBatchRefs as r,n as t};
2
- //# sourceMappingURL=batch-refs-B4zn-FAu.mjs.map
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t}from"./sql-BvHwL73I.mjs";const n=`__viborm_batch_refs`;function createOnConflictBatchRefs(e){return createBatchRefs({...e,store:(n,r,i)=>{let a=e.castValue(i);return t`INSERT INTO ${e.table} (${e.batchIdColumn}, ${e.keyColumn}, ${e.valueColumn}) VALUES (${n}, ${r}, ${a}) ${t.raw`ON CONFLICT`} (${e.batchIdColumn}, ${e.keyColumn}) DO UPDATE SET ${e.valueColumn} = EXCLUDED.${e.valueColumn}`}})}function createMySqlBatchRefs(e){return createBatchRefs({...e,store:(n,r,i)=>{let a=e.castValue(i);return t`INSERT INTO ${e.table} (${e.batchIdColumn}, ${e.keyColumn}, ${e.valueColumn}) VALUES (${n}, ${r}, ${a}) ${t.raw`ON DUPLICATE KEY UPDATE`} ${e.valueColumn} = ${e.duplicateValue}`}})}function createBatchRefs(e){let n=e.lastInsertId,r=e.storeReturning,i=r?(e,t,n,i)=>[r(e,t,n,i)]:n?(t,r,i)=>[i,e.store(t,r,n())]:void 0;return{setup:t=>[e.createTable],cleanup:n=>t`DELETE FROM ${e.table} WHERE ${e.batchIdColumn} = ${n}`,store:e.store,read:(n,r)=>t`(SELECT ${e.valueColumn} FROM ${e.table} WHERE ${e.batchIdColumn} = ${n} AND ${e.keyColumn} = ${r} ${t.raw`LIMIT 1`})`,...n?{storeLastInsertId:(t,r)=>e.store(t,r,n())}:{},...r?{storeReturning:r}:{},...i?{storeInsertedKey:i}:{}}}export{createMySqlBatchRefs as n,createOnConflictBatchRefs as r,n as t};
2
+ //# sourceMappingURL=batch-refs-DGJPz8-G.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-refs-B4zn-FAu.mjs","names":[],"sources":["../src/adapters/shared/batch-refs.ts"],"sourcesContent":["import { type Sql, sql } from \"@sql\";\nimport type { BatchReferenceSqlAdapter } from \"../adapter-core-types\";\n\n/**\n * The batch reference scratch table's name. The SQLite adapter spells it from\n * here, and SQLite migration introspection reads it to keep the scratch out of\n * a snapshot: on a transport without temporary objects (D1) the scratch is an\n * ordinary table in `main`.\n */\nexport const BATCH_REFS_TABLE = \"__viborm_batch_refs\";\n\ninterface OnConflictBatchRefsConfig {\n table: Sql;\n batchIdColumn: Sql;\n keyColumn: Sql;\n valueColumn: Sql;\n createTable: Sql;\n castValue: (valueSql: Sql) => Sql;\n lastInsertId?: () => Sql;\n /** The dialect's data-modifying CTE around an INSERT, storing its RETURNING. */\n storeReturning?: BatchReferenceSqlAdapter[\"storeReturning\"];\n}\n\ninterface MySqlBatchRefsConfig extends OnConflictBatchRefsConfig {\n duplicateValue: Sql;\n}\n\nexport function createOnConflictBatchRefs(\n config: OnConflictBatchRefsConfig\n): BatchReferenceSqlAdapter {\n return createBatchRefs({\n ...config,\n store: (batchId, key, valueSql) => {\n const value = config.castValue(valueSql);\n return sql`INSERT INTO ${config.table} (${config.batchIdColumn}, ${config.keyColumn}, ${config.valueColumn}) VALUES (${batchId}, ${key}, ${value}) ${sql.raw`ON CONFLICT`} (${config.batchIdColumn}, ${config.keyColumn}) DO UPDATE SET ${config.valueColumn} = EXCLUDED.${config.valueColumn}`;\n },\n });\n}\n\nexport function createMySqlBatchRefs(\n config: MySqlBatchRefsConfig\n): BatchReferenceSqlAdapter {\n return createBatchRefs({\n ...config,\n store: (batchId, key, valueSql) => {\n const value = config.castValue(valueSql);\n return sql`INSERT INTO ${config.table} (${config.batchIdColumn}, ${config.keyColumn}, ${config.valueColumn}) VALUES (${batchId}, ${key}, ${value}) ${sql.raw`ON DUPLICATE KEY UPDATE`} ${config.valueColumn} = ${config.duplicateValue}`;\n },\n });\n}\n\nfunction createBatchRefs(\n config: OnConflictBatchRefsConfig & {\n store: (batchId: string, key: string, valueSql: Sql) => Sql;\n }\n): BatchReferenceSqlAdapter {\n const lastInsertId = config.lastInsertId;\n const storeReturning = config.storeReturning;\n // One owner of \"how a generated increment key is stored\": the CTE store is\n // the INSERT itself; the last insert id is a second statement after it.\n const storeInsertedKey: BatchReferenceSqlAdapter[\"storeInsertedKey\"] =\n storeReturning\n ? (batchId, key, insert, column) => [\n storeReturning(batchId, key, insert, column),\n ]\n : lastInsertId\n ? (batchId, key, insert) => [\n insert,\n config.store(batchId, key, lastInsertId()),\n ]\n : undefined;\n\n return {\n setup: (_batchId) => [config.createTable],\n cleanup: (batchId) =>\n sql`DELETE FROM ${config.table} WHERE ${config.batchIdColumn} = ${batchId}`,\n store: config.store,\n read: (batchId, key) =>\n sql`(SELECT ${config.valueColumn} FROM ${config.table} WHERE ${config.batchIdColumn} = ${batchId} AND ${config.keyColumn} = ${key} ${sql.raw`LIMIT 1`})`,\n ...(lastInsertId\n ? {\n storeLastInsertId: (batchId: string, key: string) =>\n config.store(batchId, key, lastInsertId()),\n }\n : {}),\n ...(storeReturning ? { storeReturning } : {}),\n ...(storeInsertedKey ? { storeInsertedKey } : {}),\n };\n}\n"],"mappings":"gFASA,MAAa,EAAmB,sBAkBhC,SAAgB,0BACd,EAC0B,CAC1B,OAAO,gBAAgB,CACrB,GAAG,EACH,OAAQ,EAAS,EAAK,IAAa,CACjC,IAAM,EAAQ,EAAO,UAAU,EAAS,CACxC,MAAO,EAAG,eAAe,EAAO,MAAM,IAAI,EAAO,cAAc,IAAI,EAAO,UAAU,IAAI,EAAO,YAAY,YAAY,EAAQ,IAAI,EAAI,IAAI,EAAM,IAAI,EAAI,GAAG,cAAc,IAAI,EAAO,cAAc,IAAI,EAAO,UAAU,kBAAkB,EAAO,YAAY,cAAc,EAAO,eAErR,CAAC,CAGJ,SAAgB,qBACd,EAC0B,CAC1B,OAAO,gBAAgB,CACrB,GAAG,EACH,OAAQ,EAAS,EAAK,IAAa,CACjC,IAAM,EAAQ,EAAO,UAAU,EAAS,CACxC,MAAO,EAAG,eAAe,EAAO,MAAM,IAAI,EAAO,cAAc,IAAI,EAAO,UAAU,IAAI,EAAO,YAAY,YAAY,EAAQ,IAAI,EAAI,IAAI,EAAM,IAAI,EAAI,GAAG,0BAA0B,GAAG,EAAO,YAAY,KAAK,EAAO,kBAE3N,CAAC,CAGJ,SAAS,gBACP,EAG0B,CAC1B,IAAM,EAAe,EAAO,aACtB,EAAiB,EAAO,eAGxB,EACJ,GACK,EAAS,EAAK,EAAQ,IAAW,CAChC,EAAe,EAAS,EAAK,EAAQ,EAAO,CAC7C,CACD,GACG,EAAS,EAAK,IAAW,CACxB,EACA,EAAO,MAAM,EAAS,EAAK,GAAc,CAAC,CAC3C,CACD,IAAA,GAER,MAAO,CACL,MAAQ,GAAa,CAAC,EAAO,YAAY,CACzC,QAAU,GACR,CAAG,eAAe,EAAO,MAAM,SAAS,EAAO,cAAc,KAAK,IACpE,MAAO,EAAO,MACd,MAAO,EAAS,IACd,CAAG,WAAW,EAAO,YAAY,QAAQ,EAAO,MAAM,SAAS,EAAO,cAAc,KAAK,EAAQ,OAAO,EAAO,UAAU,KAAK,EAAI,GAAG,EAAI,GAAG,UAAU,GACxJ,GAAI,EACA,CACE,mBAAoB,EAAiB,IACnC,EAAO,MAAM,EAAS,EAAK,GAAc,CAAC,CAC7C,CACD,EAAE,CACN,GAAI,EAAiB,CAAE,iBAAgB,CAAG,EAAE,CAC5C,GAAI,EAAmB,CAAE,mBAAkB,CAAG,EAAE,CACjD"}
1
+ {"version":3,"file":"batch-refs-DGJPz8-G.mjs","names":[],"sources":["../src/adapters/shared/batch-refs.ts"],"sourcesContent":["import { type Sql, sql } from \"@sql\";\nimport type { BatchReferenceSqlAdapter } from \"../adapter-core-types\";\n\n/**\n * The batch reference scratch table's name. The SQLite adapter spells it from\n * here, and SQLite migration introspection reads it to keep the scratch out of\n * a snapshot: on a transport without temporary objects (D1) the scratch is an\n * ordinary table in `main`.\n */\nexport const BATCH_REFS_TABLE = \"__viborm_batch_refs\";\n\ninterface OnConflictBatchRefsConfig {\n table: Sql;\n batchIdColumn: Sql;\n keyColumn: Sql;\n valueColumn: Sql;\n createTable: Sql;\n castValue: (valueSql: Sql) => Sql;\n lastInsertId?: () => Sql;\n /** The dialect's data-modifying CTE around an INSERT, storing its RETURNING. */\n storeReturning?: BatchReferenceSqlAdapter[\"storeReturning\"];\n}\n\ninterface MySqlBatchRefsConfig extends OnConflictBatchRefsConfig {\n duplicateValue: Sql;\n}\n\nexport function createOnConflictBatchRefs(\n config: OnConflictBatchRefsConfig\n): BatchReferenceSqlAdapter {\n return createBatchRefs({\n ...config,\n store: (batchId, key, valueSql) => {\n const value = config.castValue(valueSql);\n return sql`INSERT INTO ${config.table} (${config.batchIdColumn}, ${config.keyColumn}, ${config.valueColumn}) VALUES (${batchId}, ${key}, ${value}) ${sql.raw`ON CONFLICT`} (${config.batchIdColumn}, ${config.keyColumn}) DO UPDATE SET ${config.valueColumn} = EXCLUDED.${config.valueColumn}`;\n },\n });\n}\n\nexport function createMySqlBatchRefs(\n config: MySqlBatchRefsConfig\n): BatchReferenceSqlAdapter {\n return createBatchRefs({\n ...config,\n store: (batchId, key, valueSql) => {\n const value = config.castValue(valueSql);\n return sql`INSERT INTO ${config.table} (${config.batchIdColumn}, ${config.keyColumn}, ${config.valueColumn}) VALUES (${batchId}, ${key}, ${value}) ${sql.raw`ON DUPLICATE KEY UPDATE`} ${config.valueColumn} = ${config.duplicateValue}`;\n },\n });\n}\n\nfunction createBatchRefs(\n config: OnConflictBatchRefsConfig & {\n store: (batchId: string, key: string, valueSql: Sql) => Sql;\n }\n): BatchReferenceSqlAdapter {\n const lastInsertId = config.lastInsertId;\n const storeReturning = config.storeReturning;\n // One owner of \"how a generated increment key is stored\": the CTE store is\n // the INSERT itself; the last insert id is a second statement after it.\n const storeInsertedKey: BatchReferenceSqlAdapter[\"storeInsertedKey\"] =\n storeReturning\n ? (batchId, key, insert, column) => [\n storeReturning(batchId, key, insert, column),\n ]\n : lastInsertId\n ? (batchId, key, insert) => [\n insert,\n config.store(batchId, key, lastInsertId()),\n ]\n : undefined;\n\n return {\n setup: (_batchId) => [config.createTable],\n cleanup: (batchId) =>\n sql`DELETE FROM ${config.table} WHERE ${config.batchIdColumn} = ${batchId}`,\n store: config.store,\n read: (batchId, key) =>\n sql`(SELECT ${config.valueColumn} FROM ${config.table} WHERE ${config.batchIdColumn} = ${batchId} AND ${config.keyColumn} = ${key} ${sql.raw`LIMIT 1`})`,\n ...(lastInsertId\n ? {\n storeLastInsertId: (batchId: string, key: string) =>\n config.store(batchId, key, lastInsertId()),\n }\n : {}),\n ...(storeReturning ? { storeReturning } : {}),\n ...(storeInsertedKey ? { storeInsertedKey } : {}),\n };\n}\n"],"mappings":"gFASA,MAAa,EAAmB,sBAkBhC,SAAgB,0BACd,EAC0B,CAC1B,OAAO,gBAAgB,CACrB,GAAG,EACH,OAAQ,EAAS,EAAK,IAAa,CACjC,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EAAiB,CAAE,iBAAgB,CAAG,EAAE,CAC5C,GAAI,EAAmB,CAAE,mBAAkB,CAAG,EAAE,CACjD"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{r as t}from"./value-guards-CK9guf2Z.mjs";import{n}from"./base-D3m1S7Uc.mjs";import{m as r,p as i}from"./validation-BamBwne9.mjs";import{t as a}from"./sql-Bhxq9arK.mjs";const o=typeof Symbol.asyncDispose==`symbol`?Symbol.asyncDispose:void 0,s=Symbol(`viborm.verbatimBatchQuery`);function markVerbatimBatchQuery(e){return Object.defineProperty(e,s,{configurable:!1,enumerable:!1,value:!0,writable:!1}),e}function isVerbatimBatchQuery(e){return Reflect.get(e,s)===!0}const c=new WeakMap;function registerPreparedStatement(e,t){c.set(e,t)}function transferPreparedStatement(e,t){let n=c.get(e);return n!==void 0&&c.set(t,n),t}function snapshotPreparedStatement(e,t,n){let r=c.get(e);return r!==void 0&&c.set(t,new a([...r.strings],[...n])),t}function readPreparedStatement(e){return c.get(e)}const l=/^(?:0|[1-9]\d*)$/;function captureBuiltinPrototype(e){let t=[];for(let n of Reflect.ownKeys(e)){let r=Object.getOwnPropertyDescriptor(e,n);r&&t.push({descriptor:r,key:n})}return Object.freeze(t)}const u=captureBuiltinPrototype(Object.prototype),d=captureBuiltinPrototype(Array.prototype);function isArrayIndex(e){if(typeof e!=`string`||!l.test(e))return!1;let t=Number(e);return t<=4294967294&&String(t)===e}function functionSource(e){if(typeof e==`function`)try{return Function.prototype.toString.call(e)}catch{return}}function sameInertRecord(e,t){if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return Object.is(e,t);try{if(Object.getPrototypeOf(e)!==null||Object.getPrototypeOf(t)!==null)return!1;let n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(let i=0;i<r.length;i+=1){let a=n[i],o=r[i];if(a!==o||o===void 0)return!1;let s=Object.getOwnPropertyDescriptor(e,o),c=Object.getOwnPropertyDescriptor(t,o);if(s===void 0||c===void 0||!(`value`in s)||!(`value`in c)||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable||!Object.is(s.value,c.value))return!1}return!0}catch{return!1}}function sameBuiltinDescriptor(e,t){if(e.configurable!==t.configurable||e.enumerable!==t.enumerable||`value`in e!=`value`in t)return!1;if(`value`in e&&`value`in t){if(e.writable!==t.writable)return!1;let n=functionSource(t.value);return n===void 0?sameInertRecord(e.value,t.value):functionSource(e.value)===n}return functionSource(e.get)===functionSource(t.get)&&functionSource(e.set)===functionSource(t.set)}function hasBuiltinPrototypeShape(e,t){try{let n=Reflect.ownKeys(e);if(n.length!==t.length)return!1;for(let r=0;r<t.length;r+=1){let i=t[r];if(i===void 0||n[r]!==i.key)return!1;let a=Object.getOwnPropertyDescriptor(e,i.key);if(a===void 0||!sameBuiltinDescriptor(a,i.descriptor))return!1}return!0}catch{return!1}}function isObjectPrototype(e){try{return Object.getPrototypeOf(e)===null&&hasBuiltinPrototypeShape(e,u)}catch{return!1}}function isArrayPrototype(e){try{let t=Object.getPrototypeOf(e);return t!==null&&isObjectPrototype(t)&&hasBuiltinPrototypeShape(e,d)}catch{return!1}}function rawParameterNodeShape(e){let t=!1;try{t=Array.isArray(e);let n=Object.getPrototypeOf(e);if(t&&n!==null&&!isArrayPrototype(n)||!t&&n!==null&&!isObjectPrototype(n))return{kind:t?`unsupported-array`:`opaque`};let r=[],i=[];for(let n of Reflect.ownKeys(e)){let a=Object.getOwnPropertyDescriptor(e,n);if(a!==void 0&&(i.push({descriptor:a,key:n}),t?isArrayIndex(n):a.enumerable&&typeof n==`string`)){if(!(`value`in a))return{kind:t?`unsupported-array`:`opaque`};r.push({descriptor:a,key:n,value:a.value})}}let a=i.find(e=>e.key===`toJSON`);return a&&(!(`value`in a.descriptor)||typeof a.descriptor.value==`function`)?{kind:t?`unsupported-array`:`opaque`}:{kind:`node`,shape:{edges:r,isArray:t,properties:i,prototype:n}}}catch{return{kind:t?`unsupported-array`:`opaque`}}}function rawDateTime(e,n,r){if(!t(e))return;let i=Date.prototype.getTime.call(e);if(Number.isNaN(i))throw r(n);return i}function analyzeRawParameterGraph(e,t){let n=new WeakMap,r=new WeakMap,i=[],a=Array(e.length),discover=(e,a)=>{let o=rawDateTime(e,a,t.invalidDate);if(o!==void 0&&typeof e==`object`&&e){r.set(e,o);return}if(typeof e!=`object`||!e)return;let s=n.get(e);if(s)return s;let c=rawParameterNodeShape(e);if(c.kind===`unsupported-array`)throw t.unsupportedArray(a);if(c.kind===`opaque`)return;let l={...c.shape,source:e};return n.set(e,l),i.push(l),l};for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let o=e[n];a[n]=o;let s=rawDateTime(o,n,t.invalidDate);if(s!==void 0&&typeof o==`object`&&o){r.set(o,s);continue}let c=discover(o,n);if(!c)continue;let l=[c],u=0;for(;u<l.length;){let e=l[u];if(u+=1,e)for(let t of e.edges){let e=i.length,r=discover(t.value,n);r&&i.length>e&&l.push(r)}}}return{dateTimes:r,nodes:i,roots:a}}function validateRawParameters(e,t){analyzeRawParameterGraph(e,t)}function snapshotRawParameterGraph(e,t){let n=analyzeRawParameterGraph(e,t),r=new WeakMap,i=new WeakMap;for(let e of n.nodes){let t=e.isArray?[]:{};e.prototype===null&&Object.setPrototypeOf(t,null),r.set(e.source,t)}let copiedValue=e=>{if(typeof e!=`object`||!e)return e;let t=n.dateTimes.get(e);if(t!==void 0){let n=i.get(e);if(n)return n;let r=new Date(t);return i.set(e,r),r}return r.get(e)??e};for(let e of n.nodes){let t=r.get(e.source);if(t){for(let n of e.properties){if(e.isArray&&n.key===`length`)continue;let r=n.descriptor;Object.defineProperty(t,n.key,`value`in r&&(e.isArray?isArrayIndex(n.key):r.enumerable&&typeof n.key==`string`)?{...r,value:copiedValue(r.value)}:r)}if(e.isArray){let n=e.properties.find(e=>e.key===`length`);n&&Object.defineProperty(t,`length`,n.descriptor)}}}let a=Array(n.roots.length);for(let e=0;e<n.roots.length;e++)Object.hasOwn(n.roots,e)&&(a[e]=copiedValue(n.roots[e]));return a}function invalidProviderDateError(e,t){return new i(`Operation "${e.operation??`statement`}" received an invalid Date as bound parameter ${t}. An invalid Date names no instant, so a provider either refuses the statement after dispatch or binds it as null.`,{code:n.INVALID_INPUT,meta:{parameterIndex:t,model:e.model,operation:e.operation,correlationId:e.correlationId}})}function unsupportedProviderArrayError(e,t){return new i(`Operation "${e.operation??`statement`}" received raw array parameter ${t} with custom inherited or accessor behavior. VibORM cannot validate that behavior without invoking caller code before dispatch.`,{code:n.INVALID_INPUT,meta:{parameterIndex:t,model:e.model,operation:e.operation,correlationId:e.correlationId}})}function snapshotProviderParameters(e,t){return t.model===`$raw`?snapshotRawParameterGraph(e,{invalidDate:e=>invalidProviderDateError(t,e),unsupportedArray:e=>unsupportedProviderArrayError(t,e)}):[...e]}function createNormalizedResultMeta(e){return{driver:e.provider,operation:e.operation,...e.model?{model:e.model}:{},...e.correlationId?{correlationId:e.correlationId}:{}}}const f=/^(?:0|[1-9]\d*)$/;function normalizeProviderRowCount(e,t,n){let r=e===null?n?.nullValue:e;if(n?.allowDecimalString===!0&&typeof r==`string`&&f.test(r)&&(r=Number(r)),typeof r!=`number`||!Number.isSafeInteger(r)||r<0)throw new i(`Driver "${t.provider}" returned a malformed row count for operation "${t.operation}".`,{meta:createNormalizedResultMeta(t)});return r}function normalizeProviderInsertId(e,t,n){if(typeof e==`string`){if(!f.test(e))throw malformedInsertId(t);return e===`0`?void 0:BigInt(e)}if(n?.allowNumber===!0&&typeof e==`number`){if(!Number.isSafeInteger(e)||e<0)throw malformedInsertId(t);return e===0?void 0:e}throw malformedInsertId(t)}function malformedInsertId(e){return new i(`Driver "${e.provider}" returned a malformed insert id for operation "${e.operation}".`,{meta:createNormalizedResultMeta(e)})}function malformedNormalizedResult(e,t){let n=t===void 0?``:` at batch result index ${t}`;return new i(`Driver "${e.provider}" returned a malformed normalized result for operation "${e.operation}"${n}; expected { rows: object[], rowCount: safe non-negative integer }.`,{meta:{...createNormalizedResultMeta(e),...t===void 0?{}:{resultIndex:t}}})}function isNormalizedResultRow(e){return typeof e==`object`&&!!e&&Object.prototype.toString.call(e)===`[object Object]`}function hasNormalizedRows(e){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t+=1)if(!(Object.hasOwn(e,t)&&isNormalizedResultRow(e[t])))return!1;return!0}function assertNormalizedQueryResult(e,t,n){let r=e?.insertId===void 0||typeof e.insertId==`bigint`&&e.insertId>=0n||typeof e.insertId==`number`&&Number.isFinite(e.insertId)&&Number.isSafeInteger(e.insertId)&&e.insertId>=0;if(!(isNormalizedResultRow(e)&&hasNormalizedRows(e.rows))||typeof e.rowCount!=`number`||!Number.isFinite(e.rowCount)||!Number.isSafeInteger(e.rowCount)||e.rowCount<0||!r)throw malformedNormalizedResult(t,n)}function assertNormalizedBatchResults(e,t,n){if(!Array.isArray(e)||e.length!==t){let r=Array.isArray(e)?e.length:0;throw new i(`Driver "${n.provider}" returned ${r} results for operation "${n.operation}"; expected ${t}, one per statement.`,{meta:{...createNormalizedResultMeta(n),expectedStatementCount:t,actualResultCount:r}})}for(let t=0;t<e.length;t+=1)assertNormalizedQueryResult(e[t],n,t)}function normalizedBindParameterLimit(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}function assertStatementBindParameterCapacity(e,t,n,i){if(!(n===void 0||e.values.length<=n))throw new r(`Driver '${t}' cannot execute this ${i} because one indivisible statement needs ${e.values.length} bound values, above the verified limit of ${n}.`)}export{o as _,createNormalizedResultMeta as a,normalizeProviderRowCount as c,readPreparedStatement as d,registerPreparedStatement as f,markVerbatimBatchQuery as g,isVerbatimBatchQuery as h,assertNormalizedQueryResult as i,snapshotProviderParameters as l,transferPreparedStatement as m,normalizedBindParameterLimit as n,isNormalizedResultRow as o,snapshotPreparedStatement as p,assertNormalizedBatchResults as r,normalizeProviderInsertId as s,assertStatementBindParameterCapacity as t,validateRawParameters as u};
2
- //# sourceMappingURL=bind-parameter-capacity-qfEejeOX.mjs.map
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{r as t}from"./value-guards-CK9guf2Z.mjs";import{n}from"./base-D3m1S7Uc.mjs";import{m as r,p as i}from"./validation-gwZYm3Yn.mjs";import{t as a}from"./sql-BvHwL73I.mjs";const o=typeof Symbol.asyncDispose==`symbol`?Symbol.asyncDispose:void 0,s=Symbol(`viborm.verbatimBatchQuery`);function markVerbatimBatchQuery(e){return Object.defineProperty(e,s,{configurable:!1,enumerable:!1,value:!0,writable:!1}),e}function isVerbatimBatchQuery(e){return Reflect.get(e,s)===!0}const c=new WeakMap;function registerPreparedStatement(e,t){c.set(e,t)}function transferPreparedStatement(e,t){let n=c.get(e);return n!==void 0&&c.set(t,n),t}function snapshotPreparedStatement(e,t,n){let r=c.get(e);return r!==void 0&&c.set(t,new a([...r.strings],[...n])),t}function readPreparedStatement(e){return c.get(e)}const l=/^(?:0|[1-9]\d*)$/;function captureBuiltinPrototype(e){let t=[];for(let n of Reflect.ownKeys(e)){let r=Object.getOwnPropertyDescriptor(e,n);r&&t.push({descriptor:r,key:n})}return Object.freeze(t)}const u=captureBuiltinPrototype(Object.prototype),d=captureBuiltinPrototype(Array.prototype);function isArrayIndex(e){if(typeof e!=`string`||!l.test(e))return!1;let t=Number(e);return t<=4294967294&&String(t)===e}function functionSource(e){if(typeof e==`function`)try{return Function.prototype.toString.call(e)}catch{return}}function sameInertRecord(e,t){if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return Object.is(e,t);try{if(Object.getPrototypeOf(e)!==null||Object.getPrototypeOf(t)!==null)return!1;let n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(let i=0;i<r.length;i+=1){let a=n[i],o=r[i];if(a!==o||o===void 0)return!1;let s=Object.getOwnPropertyDescriptor(e,o),c=Object.getOwnPropertyDescriptor(t,o);if(s===void 0||c===void 0||!(`value`in s)||!(`value`in c)||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable||!Object.is(s.value,c.value))return!1}return!0}catch{return!1}}function sameBuiltinDescriptor(e,t){if(e.configurable!==t.configurable||e.enumerable!==t.enumerable||`value`in e!=`value`in t)return!1;if(`value`in e&&`value`in t){if(e.writable!==t.writable)return!1;let n=functionSource(t.value);return n===void 0?sameInertRecord(e.value,t.value):functionSource(e.value)===n}return functionSource(e.get)===functionSource(t.get)&&functionSource(e.set)===functionSource(t.set)}function hasBuiltinPrototypeShape(e,t){try{let n=Reflect.ownKeys(e);if(n.length!==t.length)return!1;for(let r=0;r<t.length;r+=1){let i=t[r];if(i===void 0||n[r]!==i.key)return!1;let a=Object.getOwnPropertyDescriptor(e,i.key);if(a===void 0||!sameBuiltinDescriptor(a,i.descriptor))return!1}return!0}catch{return!1}}function isObjectPrototype(e){try{return Object.getPrototypeOf(e)===null&&hasBuiltinPrototypeShape(e,u)}catch{return!1}}function isArrayPrototype(e){try{let t=Object.getPrototypeOf(e);return t!==null&&isObjectPrototype(t)&&hasBuiltinPrototypeShape(e,d)}catch{return!1}}function rawParameterNodeShape(e){let t=!1;try{t=Array.isArray(e);let n=Object.getPrototypeOf(e);if(t&&n!==null&&!isArrayPrototype(n)||!t&&n!==null&&!isObjectPrototype(n))return{kind:t?`unsupported-array`:`opaque`};let r=[],i=[];for(let n of Reflect.ownKeys(e)){let a=Object.getOwnPropertyDescriptor(e,n);if(a!==void 0&&(i.push({descriptor:a,key:n}),t?isArrayIndex(n):a.enumerable&&typeof n==`string`)){if(!(`value`in a))return{kind:t?`unsupported-array`:`opaque`};r.push({descriptor:a,key:n,value:a.value})}}let a=i.find(e=>e.key===`toJSON`);return a&&(!(`value`in a.descriptor)||typeof a.descriptor.value==`function`)?{kind:t?`unsupported-array`:`opaque`}:{kind:`node`,shape:{edges:r,isArray:t,properties:i,prototype:n}}}catch{return{kind:t?`unsupported-array`:`opaque`}}}function rawDateTime(e,n,r){if(!t(e))return;let i=Date.prototype.getTime.call(e);if(Number.isNaN(i))throw r(n);return i}function analyzeRawParameterGraph(e,t){let n=new WeakMap,r=new WeakMap,i=[],a=Array(e.length),discover=(e,a)=>{let o=rawDateTime(e,a,t.invalidDate);if(o!==void 0&&typeof e==`object`&&e){r.set(e,o);return}if(typeof e!=`object`||!e)return;let s=n.get(e);if(s)return s;let c=rawParameterNodeShape(e);if(c.kind===`unsupported-array`)throw t.unsupportedArray(a);if(c.kind===`opaque`)return;let l={...c.shape,source:e};return n.set(e,l),i.push(l),l};for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let o=e[n];a[n]=o;let s=rawDateTime(o,n,t.invalidDate);if(s!==void 0&&typeof o==`object`&&o){r.set(o,s);continue}let c=discover(o,n);if(!c)continue;let l=[c],u=0;for(;u<l.length;){let e=l[u];if(u+=1,e)for(let t of e.edges){let e=i.length,r=discover(t.value,n);r&&i.length>e&&l.push(r)}}}return{dateTimes:r,nodes:i,roots:a}}function validateRawParameters(e,t){analyzeRawParameterGraph(e,t)}function snapshotRawParameterGraph(e,t){let n=analyzeRawParameterGraph(e,t),r=new WeakMap,i=new WeakMap;for(let e of n.nodes){let t=e.isArray?[]:{};e.prototype===null&&Object.setPrototypeOf(t,null),r.set(e.source,t)}let copiedValue=e=>{if(typeof e!=`object`||!e)return e;let t=n.dateTimes.get(e);if(t!==void 0){let n=i.get(e);if(n)return n;let r=new Date(t);return i.set(e,r),r}return r.get(e)??e};for(let e of n.nodes){let t=r.get(e.source);if(t){for(let n of e.properties){if(e.isArray&&n.key===`length`)continue;let r=n.descriptor;Object.defineProperty(t,n.key,`value`in r&&(e.isArray?isArrayIndex(n.key):r.enumerable&&typeof n.key==`string`)?{...r,value:copiedValue(r.value)}:r)}if(e.isArray){let n=e.properties.find(e=>e.key===`length`);n&&Object.defineProperty(t,`length`,n.descriptor)}}}let a=Array(n.roots.length);for(let e=0;e<n.roots.length;e++)Object.hasOwn(n.roots,e)&&(a[e]=copiedValue(n.roots[e]));return a}function invalidProviderDateError(e,t){return new i(`Operation "${e.operation??`statement`}" received an invalid Date as bound parameter ${t}. An invalid Date names no instant, so a provider either refuses the statement after dispatch or binds it as null.`,{code:n.INVALID_INPUT,meta:{parameterIndex:t,model:e.model,operation:e.operation,correlationId:e.correlationId}})}function unsupportedProviderArrayError(e,t){return new i(`Operation "${e.operation??`statement`}" received raw array parameter ${t} with custom inherited or accessor behavior. VibORM cannot validate that behavior without invoking caller code before dispatch.`,{code:n.INVALID_INPUT,meta:{parameterIndex:t,model:e.model,operation:e.operation,correlationId:e.correlationId}})}function snapshotProviderParameters(e,t){return t.model===`$raw`?snapshotRawParameterGraph(e,{invalidDate:e=>invalidProviderDateError(t,e),unsupportedArray:e=>unsupportedProviderArrayError(t,e)}):[...e]}function createNormalizedResultMeta(e){return{driver:e.provider,operation:e.operation,...e.model?{model:e.model}:{},...e.correlationId?{correlationId:e.correlationId}:{}}}const f=/^(?:0|[1-9]\d*)$/;function normalizeProviderRowCount(e,t,n){let r=e===null?n?.nullValue:e;if(n?.allowDecimalString===!0&&typeof r==`string`&&f.test(r)&&(r=Number(r)),typeof r!=`number`||!Number.isSafeInteger(r)||r<0)throw new i(`Driver "${t.provider}" returned a malformed row count for operation "${t.operation}".`,{meta:createNormalizedResultMeta(t)});return r}function normalizeProviderInsertId(e,t,n){if(typeof e==`string`){if(!f.test(e))throw malformedInsertId(t);return e===`0`?void 0:BigInt(e)}if(n?.allowNumber===!0&&typeof e==`number`){if(!Number.isSafeInteger(e)||e<0)throw malformedInsertId(t);return e===0?void 0:e}throw malformedInsertId(t)}function malformedInsertId(e){return new i(`Driver "${e.provider}" returned a malformed insert id for operation "${e.operation}".`,{meta:createNormalizedResultMeta(e)})}function malformedNormalizedResult(e,t){let n=t===void 0?``:` at batch result index ${t}`;return new i(`Driver "${e.provider}" returned a malformed normalized result for operation "${e.operation}"${n}; expected { rows: object[], rowCount: safe non-negative integer }.`,{meta:{...createNormalizedResultMeta(e),...t===void 0?{}:{resultIndex:t}}})}function isNormalizedResultRow(e){return typeof e==`object`&&!!e&&Object.prototype.toString.call(e)===`[object Object]`}function hasNormalizedRows(e){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t+=1)if(!(Object.hasOwn(e,t)&&isNormalizedResultRow(e[t])))return!1;return!0}function assertNormalizedQueryResult(e,t,n){let r=e?.insertId===void 0||typeof e.insertId==`bigint`&&e.insertId>=0n||typeof e.insertId==`number`&&Number.isFinite(e.insertId)&&Number.isSafeInteger(e.insertId)&&e.insertId>=0;if(!(isNormalizedResultRow(e)&&hasNormalizedRows(e.rows))||typeof e.rowCount!=`number`||!Number.isFinite(e.rowCount)||!Number.isSafeInteger(e.rowCount)||e.rowCount<0||!r)throw malformedNormalizedResult(t,n)}function assertNormalizedBatchResults(e,t,n){if(!Array.isArray(e)||e.length!==t){let r=Array.isArray(e)?e.length:0;throw new i(`Driver "${n.provider}" returned ${r} results for operation "${n.operation}"; expected ${t}, one per statement.`,{meta:{...createNormalizedResultMeta(n),expectedStatementCount:t,actualResultCount:r}})}for(let t=0;t<e.length;t+=1)assertNormalizedQueryResult(e[t],n,t)}function normalizedBindParameterLimit(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}function assertStatementBindParameterCapacity(e,t,n,i){if(!(n===void 0||e.values.length<=n))throw new r(`Driver '${t}' cannot execute this ${i} because one indivisible statement needs ${e.values.length} bound values, above the verified limit of ${n}.`)}export{o as _,createNormalizedResultMeta as a,normalizeProviderRowCount as c,readPreparedStatement as d,registerPreparedStatement as f,markVerbatimBatchQuery as g,isVerbatimBatchQuery as h,assertNormalizedQueryResult as i,snapshotProviderParameters as l,transferPreparedStatement as m,normalizedBindParameterLimit as n,isNormalizedResultRow as o,snapshotPreparedStatement as p,assertNormalizedBatchResults as r,normalizeProviderInsertId as s,assertStatementBindParameterCapacity as t,validateRawParameters as u};
2
+ //# sourceMappingURL=bind-parameter-capacity-DiwRmZ1h.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind-parameter-capacity-qfEejeOX.mjs","names":[],"sources":["../src/drivers/async-dispose.ts","../src/drivers/driver-batch-query-kind.ts","../src/drivers/prepared-statement-provenance.ts","../src/drivers/provider-parameter-snapshot.ts","../src/drivers/normalized-result.ts","../src/drivers/bind-parameter-capacity.ts"],"sourcesContent":["/**\n * The platform's async-disposal protocol — as much of it as the runtime and the\n * consumer's type declarations actually provide.\n *\n * `Symbol.asyncDispose` (explicit resource management, TypeScript 5.2+) can be\n * missing in two independent ways, and each one is handled here so that no\n * caller has to think about it:\n *\n * 1. **The runtime symbol** is absent on engines that predate the proposal.\n * {@link ASYNC_DISPOSE} resolves it once; every definition site guards on it\n * rather than writing a bare `[Symbol.asyncDispose]` computed key, which\n * would otherwise install a method under the string key `\"undefined\"`.\n *\n * 2. **The type declaration** is absent from a consumer's `lib` / `@types`.\n * That is why the disposal member is carried by {@link AsyncDisposeMember}\n * instead of being written literally: a consumer who never writes\n * `await using` must not be forced to widen `lib` just to compile the\n * published `.d.mts`. See `docs/architecture/typed-kernel-without-effect-plan.md`\n * (Phase T6) and the consumer-floor probe in\n * `scripts/consumer-type-floor.mjs` for the measured floor.\n */\n\n/**\n * The runtime's async-disposal key, or `undefined` on engines that predate\n * explicit resource management.\n */\nexport const ASYNC_DISPOSE: typeof Symbol.asyncDispose | undefined =\n typeof Symbol.asyncDispose === \"symbol\" ? Symbol.asyncDispose : undefined;\n\n/**\n * `Symbol.asyncDispose`'s type where the ambient declarations define it, and\n * `never` where they do not.\n *\n * `never` is the load-bearing half: it turns {@link AsyncDisposeMember} into the\n * empty object, so the member simply is not there for a consumer whose `lib`\n * and `@types` never declared the symbol in the first place.\n */\nexport type AsyncDisposeKey = SymbolConstructor extends {\n readonly asyncDispose: infer Key extends symbol;\n}\n ? Key\n : never;\n\n/**\n * `{ [Symbol.asyncDispose](): Promise<void> }` where the symbol is typed, and\n * `{}` where it is not — the graceful-degradation carrier for every viborm type\n * that participates in `await using`.\n */\nexport type AsyncDisposeMember = {\n [Key in AsyncDisposeKey]: () => Promise<void>;\n};\n","/** Internal execution-kind metadata for prepared batch queries. */\n\nconst VERBATIM_BATCH_QUERY = Symbol(\"viborm.verbatimBatchQuery\");\n\n/** Mark a prepared raw statement that must retain verbatim driver semantics. */\nexport function markVerbatimBatchQuery<T extends object>(query: T): T {\n Object.defineProperty(query, VERBATIM_BATCH_QUERY, {\n configurable: false,\n enumerable: false,\n value: true,\n writable: false,\n });\n return query;\n}\n\n/** Whether a prepared statement came from an unsafe or legacy raw call. */\nexport function isVerbatimBatchQuery(query: object): boolean {\n return Reflect.get(query, VERBATIM_BATCH_QUERY) === true;\n}\n","import { Sql } from \"@sql\";\n\nconst preparedStatements = new WeakMap<object, Sql>();\n\n/** Retain the typed Sql behind a rendered batch query without publishing it. */\nexport function registerPreparedStatement(query: object, statement: Sql): void {\n preparedStatements.set(query, statement);\n}\n\n/** Preserve private provenance when an internal owner snapshots a batch query. */\nexport function transferPreparedStatement<Output extends object>(\n source: object,\n output: Output\n): Output {\n const statement = preparedStatements.get(source);\n if (statement !== undefined) preparedStatements.set(output, statement);\n return output;\n}\n\n/** Preserve provenance with the exact detached values a batch will execute. */\nexport function snapshotPreparedStatement<Output extends object>(\n source: object,\n output: Output,\n values: readonly unknown[]\n): Output {\n const statement = preparedStatements.get(source);\n if (statement !== undefined) {\n preparedStatements.set(\n output,\n new Sql([...statement.strings], [...values])\n );\n }\n return output;\n}\n\n/** Read provenance only at the trusted typed-statement execution boundary. */\nexport function readPreparedStatement(query: object): Sql | undefined {\n return preparedStatements.get(query);\n}\n","import { QueryError, VibORMErrorCode } from \"@errors\";\nimport { isDate } from \"@validation/value-guards\";\nimport type { QueryExecutionContext } from \"./types\";\n\ntype InvalidRawDateError = (parameterIndex: number) => Error;\ntype UnsupportedRawArrayError = (parameterIndex: number) => Error;\n\ninterface RawParameterErrors {\n readonly invalidDate: InvalidRawDateError;\n readonly unsupportedArray: UnsupportedRawArrayError;\n}\n\ninterface RawParameterEdge {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n readonly value: unknown;\n}\n\ninterface RawParameterNode {\n readonly edges: readonly RawParameterEdge[];\n readonly isArray: boolean;\n readonly properties: readonly RawParameterProperty[];\n readonly prototype: object | null;\n readonly source: object;\n}\n\ninterface RawParameterProperty {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n}\n\ninterface RawParameterGraph {\n readonly dateTimes: WeakMap<object, number>;\n readonly nodes: readonly RawParameterNode[];\n readonly roots: readonly unknown[];\n}\n\ntype RawParameterNodeAnalysis =\n | { readonly kind: \"node\"; readonly shape: Omit<RawParameterNode, \"source\"> }\n | { readonly kind: \"opaque\" }\n | { readonly kind: \"unsupported-array\" };\n\nconst arrayIndex = /^(?:0|[1-9]\\d*)$/;\nconst maximumArrayIndex = 4_294_967_294;\n\ninterface BuiltinPrototypeProperty {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n}\n\nfunction captureBuiltinPrototype(\n prototype: object\n): readonly BuiltinPrototypeProperty[] {\n const properties: BuiltinPrototypeProperty[] = [];\n for (const key of Reflect.ownKeys(prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, key);\n if (descriptor) properties.push({ descriptor, key });\n }\n return Object.freeze(properties);\n}\n\nconst objectPrototypeShape = captureBuiltinPrototype(Object.prototype);\nconst arrayPrototypeShape = captureBuiltinPrototype(Array.prototype);\n\nfunction isArrayIndex(key: PropertyKey): boolean {\n if (typeof key !== \"string\" || !arrayIndex.test(key)) return false;\n const index = Number(key);\n return index <= maximumArrayIndex && String(index) === key;\n}\n\nfunction functionSource(value: unknown): string | undefined {\n if (typeof value !== \"function\") return;\n try {\n return Function.prototype.toString.call(value);\n } catch {\n return;\n }\n}\n\nfunction sameInertRecord(left: unknown, right: unknown): boolean {\n if (\n left === null ||\n right === null ||\n typeof left !== \"object\" ||\n typeof right !== \"object\"\n ) {\n return Object.is(left, right);\n }\n try {\n if (\n Object.getPrototypeOf(left) !== null ||\n Object.getPrototypeOf(right) !== null\n ) {\n return false;\n }\n const leftKeys = Reflect.ownKeys(left);\n const rightKeys = Reflect.ownKeys(right);\n if (leftKeys.length !== rightKeys.length) return false;\n for (let index = 0; index < rightKeys.length; index += 1) {\n const leftKey = leftKeys[index];\n const rightKey = rightKeys[index];\n if (leftKey !== rightKey || rightKey === undefined) return false;\n const leftDescriptor = Object.getOwnPropertyDescriptor(left, rightKey);\n const rightDescriptor = Object.getOwnPropertyDescriptor(right, rightKey);\n if (\n leftDescriptor === undefined ||\n rightDescriptor === undefined ||\n !(\"value\" in leftDescriptor) ||\n !(\"value\" in rightDescriptor) ||\n leftDescriptor.configurable !== rightDescriptor.configurable ||\n leftDescriptor.enumerable !== rightDescriptor.enumerable ||\n leftDescriptor.writable !== rightDescriptor.writable ||\n !Object.is(leftDescriptor.value, rightDescriptor.value)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n }\n}\n\nfunction sameBuiltinDescriptor(\n actual: PropertyDescriptor,\n expected: PropertyDescriptor\n): boolean {\n if (\n actual.configurable !== expected.configurable ||\n actual.enumerable !== expected.enumerable ||\n \"value\" in actual !== \"value\" in expected\n ) {\n return false;\n }\n if (\"value\" in actual && \"value\" in expected) {\n if (actual.writable !== expected.writable) return false;\n const expectedSource = functionSource(expected.value);\n if (expectedSource !== undefined) {\n return functionSource(actual.value) === expectedSource;\n }\n return sameInertRecord(actual.value, expected.value);\n }\n return (\n functionSource(actual.get) === functionSource(expected.get) &&\n functionSource(actual.set) === functionSource(expected.set)\n );\n}\n\nfunction hasBuiltinPrototypeShape(\n prototype: object,\n shape: readonly BuiltinPrototypeProperty[]\n): boolean {\n try {\n const keys = Reflect.ownKeys(prototype);\n if (keys.length !== shape.length) return false;\n for (let index = 0; index < shape.length; index += 1) {\n const expected = shape[index];\n if (expected === undefined || keys[index] !== expected.key) return false;\n const actual = Object.getOwnPropertyDescriptor(prototype, expected.key);\n if (\n actual === undefined ||\n !sameBuiltinDescriptor(actual, expected.descriptor)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isObjectPrototype(prototype: object): boolean {\n try {\n return (\n Object.getPrototypeOf(prototype) === null &&\n hasBuiltinPrototypeShape(prototype, objectPrototypeShape)\n );\n } catch {\n return false;\n }\n}\n\nfunction isArrayPrototype(prototype: object): boolean {\n try {\n const parent = Object.getPrototypeOf(prototype);\n return (\n parent !== null &&\n isObjectPrototype(parent) &&\n hasBuiltinPrototypeShape(prototype, arrayPrototypeShape)\n );\n } catch {\n return false;\n }\n}\n\n/** Only arrays and records with inert inherited behavior are interpreted. */\nfunction rawParameterNodeShape(value: object): RawParameterNodeAnalysis {\n let isArray = false;\n try {\n isArray = Array.isArray(value);\n const prototype = Object.getPrototypeOf(value);\n if (\n (isArray && prototype !== null && !isArrayPrototype(prototype)) ||\n (!isArray && prototype !== null && !isObjectPrototype(prototype))\n ) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n\n const edges: RawParameterEdge[] = [];\n const properties: RawParameterProperty[] = [];\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined) continue;\n properties.push({ descriptor, key });\n const isProviderVisible = isArray\n ? isArrayIndex(key)\n : descriptor.enumerable && typeof key === \"string\";\n if (!isProviderVisible) continue;\n if (!(\"value\" in descriptor)) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n edges.push({ descriptor, key, value: descriptor.value });\n }\n const toJSON = properties.find((property) => property.key === \"toJSON\");\n if (\n toJSON &&\n (!(\"value\" in toJSON.descriptor) ||\n typeof toJSON.descriptor.value === \"function\")\n ) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n return {\n kind: \"node\",\n shape: { edges, isArray, properties, prototype },\n };\n } catch {\n // An exotic record owns its traversal semantics. If reflection refuses an\n // array shape, it cannot safely reach provider array semantics.\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n}\n\nfunction rawDateTime(\n value: unknown,\n parameterIndex: number,\n invalidDateError: InvalidRawDateError\n): number | undefined {\n if (!isDate(value)) return;\n const time = Date.prototype.getTime.call(value);\n if (Number.isNaN(time)) throw invalidDateError(parameterIndex);\n return time;\n}\n\nfunction analyzeRawParameterGraph(\n params: readonly unknown[],\n errors: RawParameterErrors\n): RawParameterGraph {\n const nodesBySource = new WeakMap<object, RawParameterNode>();\n const dateTimes = new WeakMap<object, number>();\n const nodes: RawParameterNode[] = [];\n const roots = new Array<unknown>(params.length);\n\n const discover = (\n value: unknown,\n parameterIndex: number\n ): RawParameterNode | undefined => {\n const time = rawDateTime(value, parameterIndex, errors.invalidDate);\n if (time !== undefined && typeof value === \"object\" && value !== null) {\n dateTimes.set(value, time);\n return;\n }\n if (typeof value !== \"object\" || value === null) return;\n\n const known = nodesBySource.get(value);\n if (known) return known;\n const analysis = rawParameterNodeShape(value);\n if (analysis.kind === \"unsupported-array\") {\n throw errors.unsupportedArray(parameterIndex);\n }\n if (analysis.kind === \"opaque\") return;\n const node: RawParameterNode = {\n ...analysis.shape,\n source: value,\n };\n nodesBySource.set(value, node);\n nodes.push(node);\n return node;\n };\n\n for (\n let parameterIndex = 0;\n parameterIndex < params.length;\n parameterIndex++\n ) {\n if (!Object.hasOwn(params, parameterIndex)) continue;\n const root = params[parameterIndex];\n roots[parameterIndex] = root;\n const rootTime = rawDateTime(root, parameterIndex, errors.invalidDate);\n if (rootTime !== undefined && typeof root === \"object\" && root !== null) {\n dateTimes.set(root, rootTime);\n continue;\n }\n const rootNode = discover(root, parameterIndex);\n if (!rootNode) continue;\n\n const pending = [rootNode];\n let cursor = 0;\n while (cursor < pending.length) {\n const node = pending[cursor];\n cursor += 1;\n if (!node) continue;\n for (const edge of node.edges) {\n const before = nodes.length;\n const child = discover(edge.value, parameterIndex);\n if (child && nodes.length > before) pending.push(child);\n }\n }\n }\n\n return { dateTimes, nodes, roots };\n}\n\n/** Validate every interpreted raw parameter before query interception. */\nexport function validateRawParameters(\n params: readonly unknown[],\n errors: RawParameterErrors\n): void {\n analyzeRawParameterGraph(params, errors);\n}\n\n/**\n * Snapshot every admitted data-descriptor JSON container, preserving aliases,\n * cycles, and property descriptors. Foreign built-in containers normalize to\n * local prototypes. Custom record carriers and provider-native objects remain\n * opaque; arrays with custom provider-visible behavior are refused. A Proxy\n * can run reflection traps while presenting an admitted container shape; the\n * captured descriptor view, never the later mutable Proxy, reaches dispatch.\n */\nfunction snapshotRawParameterGraph(\n params: readonly unknown[],\n errors: RawParameterErrors\n): unknown[] {\n const graph = analyzeRawParameterGraph(params, errors);\n const copies = new WeakMap<object, object>();\n const copiedDates = new WeakMap<object, Date>();\n\n for (const node of graph.nodes) {\n const copy: object = node.isArray ? [] : {};\n if (node.prototype === null) Object.setPrototypeOf(copy, null);\n copies.set(node.source, copy);\n }\n\n const copiedValue = (value: unknown): unknown => {\n if (typeof value !== \"object\" || value === null) return value;\n const time = graph.dateTimes.get(value);\n if (time !== undefined) {\n const known = copiedDates.get(value);\n if (known) return known;\n const copy = new Date(time);\n copiedDates.set(value, copy);\n return copy;\n }\n return copies.get(value) ?? value;\n };\n\n for (const node of graph.nodes) {\n const copy = copies.get(node.source);\n if (!copy) continue;\n for (const property of node.properties) {\n if (node.isArray && property.key === \"length\") continue;\n const descriptor = property.descriptor;\n Object.defineProperty(\n copy,\n property.key,\n \"value\" in descriptor &&\n (node.isArray\n ? isArrayIndex(property.key)\n : descriptor.enumerable && typeof property.key === \"string\")\n ? { ...descriptor, value: copiedValue(descriptor.value) }\n : descriptor\n );\n }\n if (node.isArray) {\n const length = node.properties.find(\n (property) => property.key === \"length\"\n );\n if (length) Object.defineProperty(copy, \"length\", length.descriptor);\n }\n }\n\n const snapshot = new Array<unknown>(graph.roots.length);\n for (let index = 0; index < graph.roots.length; index++) {\n if (!Object.hasOwn(graph.roots, index)) continue;\n snapshot[index] = copiedValue(graph.roots[index]);\n }\n return snapshot;\n}\n\nfunction invalidProviderDateError(\n context: QueryExecutionContext,\n parameterIndex: number\n): QueryError {\n return new QueryError(\n `Operation \"${context.operation ?? \"statement\"}\" received an invalid Date as bound parameter ${parameterIndex}. An invalid Date names no instant, so a provider either refuses the statement after dispatch or binds it as null.`,\n {\n code: VibORMErrorCode.INVALID_INPUT,\n meta: {\n parameterIndex,\n model: context.model,\n operation: context.operation,\n correlationId: context.correlationId,\n },\n }\n );\n}\n\nfunction unsupportedProviderArrayError(\n context: QueryExecutionContext,\n parameterIndex: number\n): QueryError {\n return new QueryError(\n `Operation \"${context.operation ?? \"statement\"}\" received raw array parameter ${parameterIndex} with custom inherited or accessor behavior. VibORM cannot validate that behavior without invoking caller code before dispatch.`,\n {\n code: VibORMErrorCode.INVALID_INPUT,\n meta: {\n parameterIndex,\n model: context.model,\n operation: context.operation,\n correlationId: context.correlationId,\n },\n }\n );\n}\n\n/**\n * Preserve the raw Date admission invariant after the last trusted statement\n * transform. Non-raw statements keep the old shallow-copy path: their typed\n * inputs were validated upstream, and statement transforms are trusted. Raw\n * Date leaves are revalidated and every admitted data-descriptor array or\n * ordinary JSON record is detached. Reflection does not invoke accessors,\n * iterators, or `toJSON`; a Proxy may run its reflection traps, so its captured\n * descriptor view is the stable provider value. Arrays with custom inherited\n * or accessor behavior are refused. Custom record and provider-native carriers\n * remain opaque and are not traversed.\n */\nexport function snapshotProviderParameters(\n params: readonly unknown[],\n context: QueryExecutionContext\n): unknown[] {\n if (context.model !== \"$raw\") return [...params];\n return snapshotRawParameterGraph(params, {\n invalidDate: (parameterIndex) =>\n invalidProviderDateError(context, parameterIndex),\n unsupportedArray: (parameterIndex) =>\n unsupportedProviderArrayError(context, parameterIndex),\n });\n}\n","import { QueryError } from \"@errors\";\nimport type { QueryResult } from \"./types\";\n\nexport interface NormalizedResultContext {\n provider: string;\n operation: string;\n model?: string;\n correlationId?: string;\n}\n\nexport function createNormalizedResultMeta(\n context: NormalizedResultContext\n): Record<string, unknown> {\n return {\n driver: context.provider,\n operation: context.operation,\n ...(context.model ? { model: context.model } : {}),\n ...(context.correlationId ? { correlationId: context.correlationId } : {}),\n };\n}\n\nconst NON_NEGATIVE_DECIMAL_REGEX = /^(?:0|[1-9]\\d*)$/;\n\nexport function normalizeProviderRowCount(\n value: unknown,\n context: NormalizedResultContext,\n options?: { allowDecimalString?: boolean; nullValue?: number }\n): number {\n let normalized = value === null ? options?.nullValue : value;\n if (\n options?.allowDecimalString === true &&\n typeof normalized === \"string\" &&\n NON_NEGATIVE_DECIMAL_REGEX.test(normalized)\n ) {\n normalized = Number(normalized);\n }\n if (\n typeof normalized !== \"number\" ||\n !Number.isSafeInteger(normalized) ||\n normalized < 0\n ) {\n throw new QueryError(\n `Driver \"${context.provider}\" returned a malformed row count for operation \"${context.operation}\".`,\n {\n meta: createNormalizedResultMeta(context),\n }\n );\n }\n return normalized;\n}\n\nexport function normalizeProviderInsertId(\n value: unknown,\n context: NormalizedResultContext,\n options?: { allowNumber?: boolean }\n): number | bigint | undefined {\n if (typeof value === \"string\") {\n if (!NON_NEGATIVE_DECIMAL_REGEX.test(value)) {\n throw malformedInsertId(context);\n }\n return value === \"0\" ? undefined : BigInt(value);\n }\n if (options?.allowNumber === true && typeof value === \"number\") {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw malformedInsertId(context);\n }\n return value === 0 ? undefined : value;\n }\n throw malformedInsertId(context);\n}\n\nfunction malformedInsertId(context: NormalizedResultContext): QueryError {\n return new QueryError(\n `Driver \"${context.provider}\" returned a malformed insert id for operation \"${context.operation}\".`,\n {\n meta: createNormalizedResultMeta(context),\n }\n );\n}\n\nfunction malformedNormalizedResult(\n context: NormalizedResultContext,\n resultIndex?: number\n): QueryError {\n const position =\n resultIndex === undefined ? \"\" : ` at batch result index ${resultIndex}`;\n return new QueryError(\n `Driver \"${context.provider}\" returned a malformed normalized result for operation \"${context.operation}\"${position}; expected { rows: object[], rowCount: safe non-negative integer }.`,\n {\n meta: {\n ...createNormalizedResultMeta(context),\n ...(resultIndex === undefined ? {} : { resultIndex }),\n },\n }\n );\n}\n\nexport function isNormalizedResultRow(\n value: unknown\n): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Object.prototype.toString.call(value) === \"[object Object]\"\n );\n}\n\nfunction hasNormalizedRows(value: unknown): value is Record<string, unknown>[] {\n if (!Array.isArray(value)) return false;\n for (let index = 0; index < value.length; index += 1) {\n if (!(Object.hasOwn(value, index) && isNormalizedResultRow(value[index]))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Assert the single cross-driver success contract. Empty row arrays and a\n * rowCount of zero are valid; missing fields, non-record rows, and invented\n * counts are not.\n */\nexport function assertNormalizedQueryResult(\n result: QueryResult<unknown> | undefined,\n context: NormalizedResultContext,\n resultIndex?: number\n): void {\n const hasValidInsertId =\n result?.insertId === undefined ||\n (typeof result.insertId === \"bigint\" && result.insertId >= 0n) ||\n (typeof result.insertId === \"number\" &&\n Number.isFinite(result.insertId) &&\n Number.isSafeInteger(result.insertId) &&\n result.insertId >= 0);\n if (\n !(isNormalizedResultRow(result) && hasNormalizedRows(result.rows)) ||\n typeof result.rowCount !== \"number\" ||\n !Number.isFinite(result.rowCount) ||\n !Number.isSafeInteger(result.rowCount) ||\n result.rowCount < 0 ||\n !hasValidInsertId\n ) {\n throw malformedNormalizedResult(context, resultIndex);\n }\n}\n\n/**\n * Native and planned batches must return one normalized result for each\n * submitted statement, in the same order.\n */\nexport function assertNormalizedBatchResults(\n results: readonly QueryResult<unknown>[],\n expectedStatementCount: number,\n context: NormalizedResultContext\n): void {\n if (!Array.isArray(results) || results.length !== expectedStatementCount) {\n const actualResultCount = Array.isArray(results) ? results.length : 0;\n throw new QueryError(\n `Driver \"${context.provider}\" returned ${actualResultCount} results for operation \"${context.operation}\"; expected ${expectedStatementCount}, one per statement.`,\n {\n meta: {\n ...createNormalizedResultMeta(context),\n expectedStatementCount,\n actualResultCount,\n },\n }\n );\n }\n\n for (let resultIndex = 0; resultIndex < results.length; resultIndex += 1) {\n assertNormalizedQueryResult(results[resultIndex], context, resultIndex);\n }\n}\n","import { UnsupportedOperationError } from \"@errors\";\nimport type { Sql } from \"@sql\";\n\n/** Normalize one driver's optional bind declaration into verified capacity. */\nexport function normalizedBindParameterLimit(\n limit: unknown\n): number | undefined {\n return typeof limit === \"number\" && Number.isInteger(limit) && limit > 0\n ? limit\n : undefined;\n}\n\n/** Refuse one materialized statement before it reaches provider I/O. */\nexport function assertStatementBindParameterCapacity(\n statement: Sql,\n driverName: string,\n limit: number | undefined,\n subject: string\n): void {\n if (limit === undefined || statement.values.length <= limit) return;\n throw new UnsupportedOperationError(\n `Driver '${driverName}' cannot execute this ${subject} because one indivisible statement needs ${statement.values.length} bound values, above the verified limit of ${limit}.`\n );\n}\n"],"mappings":"wNA0BA,MAAa,EACX,OAAO,OAAO,cAAiB,SAAW,OAAO,aAAe,IAAA,GCzB5D,EAAuB,OAAO,4BAA4B,CAGhE,SAAgB,uBAAyC,EAAa,CAOpE,OANA,OAAO,eAAe,EAAO,EAAsB,CACjD,aAAc,GACd,WAAY,GACZ,MAAO,GACP,SAAU,GACX,CAAC,CACK,EAIT,SAAgB,qBAAqB,EAAwB,CAC3D,OAAO,QAAQ,IAAI,EAAO,EAAqB,GAAK,GCftD,MAAM,EAAqB,IAAI,QAG/B,SAAgB,0BAA0B,EAAe,EAAsB,CAC7E,EAAmB,IAAI,EAAO,EAAU,CAI1C,SAAgB,0BACd,EACA,EACQ,CACR,IAAM,EAAY,EAAmB,IAAI,EAAO,CAEhD,OADI,IAAc,IAAA,IAAW,EAAmB,IAAI,EAAQ,EAAU,CAC/D,EAIT,SAAgB,0BACd,EACA,EACA,EACQ,CACR,IAAM,EAAY,EAAmB,IAAI,EAAO,CAOhD,OANI,IAAc,IAAA,IAChB,EAAmB,IACjB,EACA,IAAI,EAAI,CAAC,GAAG,EAAU,QAAQ,CAAE,CAAC,GAAG,EAAO,CAAC,CAC7C,CAEI,EAIT,SAAgB,sBAAsB,EAAgC,CACpE,OAAO,EAAmB,IAAI,EAAM,CCKtC,MAAM,EAAa,mBAQnB,SAAS,wBACP,EACqC,CACrC,IAAM,EAAyC,EAAE,CACj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,OAAO,EAAO,UAAa,UAAY,EAAO,UAAY,IAC1D,OAAO,EAAO,UAAa,UAC1B,OAAO,SAAS,EAAO,SAAS,EAChC,OAAO,cAAc,EAAO,SAAS,EACrC,EAAO,UAAY,EACvB,GACE,EAAE,sBAAsB,EAAO,EAAI,kBAAkB,EAAO,KAAK,GACjE,OAAO,EAAO,UAAa,UAC3B,CAAC,OAAO,SAAS,EAAO,SAAS,EACjC,CAAC,OAAO,cAAc,EAAO,SAAS,EACtC,EAAO,SAAW,GAClB,CAAC,EAED,MAAM,0BAA0B,EAAS,EAAY,CAQzD,SAAgB,6BACd,EACA,EACA,EACM,CACN,GAAI,CAAC,MAAM,QAAQ,EAAQ,EAAI,EAAQ,SAAW,EAAwB,CACxE,IAAM,EAAoB,MAAM,QAAQ,EAAQ,CAAG,EAAQ,OAAS,EACpE,MAAM,IAAI,EACR,WAAW,EAAQ,SAAS,aAAa,EAAkB,0BAA0B,EAAQ,UAAU,cAAc,EAAuB,sBAC5I,CACE,KAAM,CACJ,GAAG,2BAA2B,EAAQ,CACtC,yBACA,oBACD,CACF,CACF,CAGH,IAAK,IAAI,EAAc,EAAG,EAAc,EAAQ,OAAQ,GAAe,EACrE,4BAA4B,EAAQ,GAAc,EAAS,EAAY,CCtK3E,SAAgB,6BACd,EACoB,CACpB,OAAO,OAAO,GAAU,UAAY,OAAO,UAAU,EAAM,EAAI,EAAQ,EACnE,EACA,IAAA,GAIN,SAAgB,qCACd,EACA,EACA,EACA,EACM,CACF,SAAU,IAAA,IAAa,EAAU,OAAO,QAAU,GACtD,MAAM,IAAI,EACR,WAAW,EAAW,wBAAwB,EAAQ,2CAA2C,EAAU,OAAO,OAAO,6CAA6C,EAAM,GAC7K"}
1
+ {"version":3,"file":"bind-parameter-capacity-DiwRmZ1h.mjs","names":[],"sources":["../src/drivers/async-dispose.ts","../src/drivers/driver-batch-query-kind.ts","../src/drivers/prepared-statement-provenance.ts","../src/drivers/provider-parameter-snapshot.ts","../src/drivers/normalized-result.ts","../src/drivers/bind-parameter-capacity.ts"],"sourcesContent":["/**\n * The platform's async-disposal protocol — as much of it as the runtime and the\n * consumer's type declarations actually provide.\n *\n * `Symbol.asyncDispose` (explicit resource management, TypeScript 5.2+) can be\n * missing in two independent ways, and each one is handled here so that no\n * caller has to think about it:\n *\n * 1. **The runtime symbol** is absent on engines that predate the proposal.\n * {@link ASYNC_DISPOSE} resolves it once; every definition site guards on it\n * rather than writing a bare `[Symbol.asyncDispose]` computed key, which\n * would otherwise install a method under the string key `\"undefined\"`.\n *\n * 2. **The type declaration** is absent from a consumer's `lib` / `@types`.\n * That is why the disposal member is carried by {@link AsyncDisposeMember}\n * instead of being written literally: a consumer who never writes\n * `await using` must not be forced to widen `lib` just to compile the\n * published `.d.mts`. See `docs/architecture/typed-kernel-without-effect-plan.md`\n * (Phase T6) and the consumer-floor probe in\n * `scripts/consumer-type-floor.mjs` for the measured floor.\n */\n\n/**\n * The runtime's async-disposal key, or `undefined` on engines that predate\n * explicit resource management.\n */\nexport const ASYNC_DISPOSE: typeof Symbol.asyncDispose | undefined =\n typeof Symbol.asyncDispose === \"symbol\" ? Symbol.asyncDispose : undefined;\n\n/**\n * `Symbol.asyncDispose`'s type where the ambient declarations define it, and\n * `never` where they do not.\n *\n * `never` is the load-bearing half: it turns {@link AsyncDisposeMember} into the\n * empty object, so the member simply is not there for a consumer whose `lib`\n * and `@types` never declared the symbol in the first place.\n */\nexport type AsyncDisposeKey = SymbolConstructor extends {\n readonly asyncDispose: infer Key extends symbol;\n}\n ? Key\n : never;\n\n/**\n * `{ [Symbol.asyncDispose](): Promise<void> }` where the symbol is typed, and\n * `{}` where it is not — the graceful-degradation carrier for every viborm type\n * that participates in `await using`.\n */\nexport type AsyncDisposeMember = {\n [Key in AsyncDisposeKey]: () => Promise<void>;\n};\n","/** Internal execution-kind metadata for prepared batch queries. */\n\nconst VERBATIM_BATCH_QUERY = Symbol(\"viborm.verbatimBatchQuery\");\n\n/** Mark a prepared raw statement that must retain verbatim driver semantics. */\nexport function markVerbatimBatchQuery<T extends object>(query: T): T {\n Object.defineProperty(query, VERBATIM_BATCH_QUERY, {\n configurable: false,\n enumerable: false,\n value: true,\n writable: false,\n });\n return query;\n}\n\n/** Whether a prepared statement came from an unsafe or legacy raw call. */\nexport function isVerbatimBatchQuery(query: object): boolean {\n return Reflect.get(query, VERBATIM_BATCH_QUERY) === true;\n}\n","import { Sql } from \"@sql\";\n\nconst preparedStatements = new WeakMap<object, Sql>();\n\n/** Retain the typed Sql behind a rendered batch query without publishing it. */\nexport function registerPreparedStatement(query: object, statement: Sql): void {\n preparedStatements.set(query, statement);\n}\n\n/** Preserve private provenance when an internal owner snapshots a batch query. */\nexport function transferPreparedStatement<Output extends object>(\n source: object,\n output: Output\n): Output {\n const statement = preparedStatements.get(source);\n if (statement !== undefined) preparedStatements.set(output, statement);\n return output;\n}\n\n/** Preserve provenance with the exact detached values a batch will execute. */\nexport function snapshotPreparedStatement<Output extends object>(\n source: object,\n output: Output,\n values: readonly unknown[]\n): Output {\n const statement = preparedStatements.get(source);\n if (statement !== undefined) {\n preparedStatements.set(\n output,\n new Sql([...statement.strings], [...values])\n );\n }\n return output;\n}\n\n/** Read provenance only at the trusted typed-statement execution boundary. */\nexport function readPreparedStatement(query: object): Sql | undefined {\n return preparedStatements.get(query);\n}\n","import { QueryError, VibORMErrorCode } from \"@errors\";\nimport { isDate } from \"@validation/value-guards\";\nimport type { QueryExecutionContext } from \"./types\";\n\ntype InvalidRawDateError = (parameterIndex: number) => Error;\ntype UnsupportedRawArrayError = (parameterIndex: number) => Error;\n\ninterface RawParameterErrors {\n readonly invalidDate: InvalidRawDateError;\n readonly unsupportedArray: UnsupportedRawArrayError;\n}\n\ninterface RawParameterEdge {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n readonly value: unknown;\n}\n\ninterface RawParameterNode {\n readonly edges: readonly RawParameterEdge[];\n readonly isArray: boolean;\n readonly properties: readonly RawParameterProperty[];\n readonly prototype: object | null;\n readonly source: object;\n}\n\ninterface RawParameterProperty {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n}\n\ninterface RawParameterGraph {\n readonly dateTimes: WeakMap<object, number>;\n readonly nodes: readonly RawParameterNode[];\n readonly roots: readonly unknown[];\n}\n\ntype RawParameterNodeAnalysis =\n | { readonly kind: \"node\"; readonly shape: Omit<RawParameterNode, \"source\"> }\n | { readonly kind: \"opaque\" }\n | { readonly kind: \"unsupported-array\" };\n\nconst arrayIndex = /^(?:0|[1-9]\\d*)$/;\nconst maximumArrayIndex = 4_294_967_294;\n\ninterface BuiltinPrototypeProperty {\n readonly descriptor: PropertyDescriptor;\n readonly key: PropertyKey;\n}\n\nfunction captureBuiltinPrototype(\n prototype: object\n): readonly BuiltinPrototypeProperty[] {\n const properties: BuiltinPrototypeProperty[] = [];\n for (const key of Reflect.ownKeys(prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, key);\n if (descriptor) properties.push({ descriptor, key });\n }\n return Object.freeze(properties);\n}\n\nconst objectPrototypeShape = captureBuiltinPrototype(Object.prototype);\nconst arrayPrototypeShape = captureBuiltinPrototype(Array.prototype);\n\nfunction isArrayIndex(key: PropertyKey): boolean {\n if (typeof key !== \"string\" || !arrayIndex.test(key)) return false;\n const index = Number(key);\n return index <= maximumArrayIndex && String(index) === key;\n}\n\nfunction functionSource(value: unknown): string | undefined {\n if (typeof value !== \"function\") return;\n try {\n return Function.prototype.toString.call(value);\n } catch {\n return;\n }\n}\n\nfunction sameInertRecord(left: unknown, right: unknown): boolean {\n if (\n left === null ||\n right === null ||\n typeof left !== \"object\" ||\n typeof right !== \"object\"\n ) {\n return Object.is(left, right);\n }\n try {\n if (\n Object.getPrototypeOf(left) !== null ||\n Object.getPrototypeOf(right) !== null\n ) {\n return false;\n }\n const leftKeys = Reflect.ownKeys(left);\n const rightKeys = Reflect.ownKeys(right);\n if (leftKeys.length !== rightKeys.length) return false;\n for (let index = 0; index < rightKeys.length; index += 1) {\n const leftKey = leftKeys[index];\n const rightKey = rightKeys[index];\n if (leftKey !== rightKey || rightKey === undefined) return false;\n const leftDescriptor = Object.getOwnPropertyDescriptor(left, rightKey);\n const rightDescriptor = Object.getOwnPropertyDescriptor(right, rightKey);\n if (\n leftDescriptor === undefined ||\n rightDescriptor === undefined ||\n !(\"value\" in leftDescriptor) ||\n !(\"value\" in rightDescriptor) ||\n leftDescriptor.configurable !== rightDescriptor.configurable ||\n leftDescriptor.enumerable !== rightDescriptor.enumerable ||\n leftDescriptor.writable !== rightDescriptor.writable ||\n !Object.is(leftDescriptor.value, rightDescriptor.value)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n }\n}\n\nfunction sameBuiltinDescriptor(\n actual: PropertyDescriptor,\n expected: PropertyDescriptor\n): boolean {\n if (\n actual.configurable !== expected.configurable ||\n actual.enumerable !== expected.enumerable ||\n \"value\" in actual !== \"value\" in expected\n ) {\n return false;\n }\n if (\"value\" in actual && \"value\" in expected) {\n if (actual.writable !== expected.writable) return false;\n const expectedSource = functionSource(expected.value);\n if (expectedSource !== undefined) {\n return functionSource(actual.value) === expectedSource;\n }\n return sameInertRecord(actual.value, expected.value);\n }\n return (\n functionSource(actual.get) === functionSource(expected.get) &&\n functionSource(actual.set) === functionSource(expected.set)\n );\n}\n\nfunction hasBuiltinPrototypeShape(\n prototype: object,\n shape: readonly BuiltinPrototypeProperty[]\n): boolean {\n try {\n const keys = Reflect.ownKeys(prototype);\n if (keys.length !== shape.length) return false;\n for (let index = 0; index < shape.length; index += 1) {\n const expected = shape[index];\n if (expected === undefined || keys[index] !== expected.key) return false;\n const actual = Object.getOwnPropertyDescriptor(prototype, expected.key);\n if (\n actual === undefined ||\n !sameBuiltinDescriptor(actual, expected.descriptor)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isObjectPrototype(prototype: object): boolean {\n try {\n return (\n Object.getPrototypeOf(prototype) === null &&\n hasBuiltinPrototypeShape(prototype, objectPrototypeShape)\n );\n } catch {\n return false;\n }\n}\n\nfunction isArrayPrototype(prototype: object): boolean {\n try {\n const parent = Object.getPrototypeOf(prototype);\n return (\n parent !== null &&\n isObjectPrototype(parent) &&\n hasBuiltinPrototypeShape(prototype, arrayPrototypeShape)\n );\n } catch {\n return false;\n }\n}\n\n/** Only arrays and records with inert inherited behavior are interpreted. */\nfunction rawParameterNodeShape(value: object): RawParameterNodeAnalysis {\n let isArray = false;\n try {\n isArray = Array.isArray(value);\n const prototype = Object.getPrototypeOf(value);\n if (\n (isArray && prototype !== null && !isArrayPrototype(prototype)) ||\n (!isArray && prototype !== null && !isObjectPrototype(prototype))\n ) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n\n const edges: RawParameterEdge[] = [];\n const properties: RawParameterProperty[] = [];\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined) continue;\n properties.push({ descriptor, key });\n const isProviderVisible = isArray\n ? isArrayIndex(key)\n : descriptor.enumerable && typeof key === \"string\";\n if (!isProviderVisible) continue;\n if (!(\"value\" in descriptor)) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n edges.push({ descriptor, key, value: descriptor.value });\n }\n const toJSON = properties.find((property) => property.key === \"toJSON\");\n if (\n toJSON &&\n (!(\"value\" in toJSON.descriptor) ||\n typeof toJSON.descriptor.value === \"function\")\n ) {\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n return {\n kind: \"node\",\n shape: { edges, isArray, properties, prototype },\n };\n } catch {\n // An exotic record owns its traversal semantics. If reflection refuses an\n // array shape, it cannot safely reach provider array semantics.\n return { kind: isArray ? \"unsupported-array\" : \"opaque\" };\n }\n}\n\nfunction rawDateTime(\n value: unknown,\n parameterIndex: number,\n invalidDateError: InvalidRawDateError\n): number | undefined {\n if (!isDate(value)) return;\n const time = Date.prototype.getTime.call(value);\n if (Number.isNaN(time)) throw invalidDateError(parameterIndex);\n return time;\n}\n\nfunction analyzeRawParameterGraph(\n params: readonly unknown[],\n errors: RawParameterErrors\n): RawParameterGraph {\n const nodesBySource = new WeakMap<object, RawParameterNode>();\n const dateTimes = new WeakMap<object, number>();\n const nodes: RawParameterNode[] = [];\n const roots = new Array<unknown>(params.length);\n\n const discover = (\n value: unknown,\n parameterIndex: number\n ): RawParameterNode | undefined => {\n const time = rawDateTime(value, parameterIndex, errors.invalidDate);\n if (time !== undefined && typeof value === \"object\" && value !== null) {\n dateTimes.set(value, time);\n return;\n }\n if (typeof value !== \"object\" || value === null) return;\n\n const known = nodesBySource.get(value);\n if (known) return known;\n const analysis = rawParameterNodeShape(value);\n if (analysis.kind === \"unsupported-array\") {\n throw errors.unsupportedArray(parameterIndex);\n }\n if (analysis.kind === \"opaque\") return;\n const node: RawParameterNode = {\n ...analysis.shape,\n source: value,\n };\n nodesBySource.set(value, node);\n nodes.push(node);\n return node;\n };\n\n for (\n let parameterIndex = 0;\n parameterIndex < params.length;\n parameterIndex++\n ) {\n if (!Object.hasOwn(params, parameterIndex)) continue;\n const root = params[parameterIndex];\n roots[parameterIndex] = root;\n const rootTime = rawDateTime(root, parameterIndex, errors.invalidDate);\n if (rootTime !== undefined && typeof root === \"object\" && root !== null) {\n dateTimes.set(root, rootTime);\n continue;\n }\n const rootNode = discover(root, parameterIndex);\n if (!rootNode) continue;\n\n const pending = [rootNode];\n let cursor = 0;\n while (cursor < pending.length) {\n const node = pending[cursor];\n cursor += 1;\n if (!node) continue;\n for (const edge of node.edges) {\n const before = nodes.length;\n const child = discover(edge.value, parameterIndex);\n if (child && nodes.length > before) pending.push(child);\n }\n }\n }\n\n return { dateTimes, nodes, roots };\n}\n\n/** Validate every interpreted raw parameter before query interception. */\nexport function validateRawParameters(\n params: readonly unknown[],\n errors: RawParameterErrors\n): void {\n analyzeRawParameterGraph(params, errors);\n}\n\n/**\n * Snapshot every admitted data-descriptor JSON container, preserving aliases,\n * cycles, and property descriptors. Foreign built-in containers normalize to\n * local prototypes. Custom record carriers and provider-native objects remain\n * opaque; arrays with custom provider-visible behavior are refused. A Proxy\n * can run reflection traps while presenting an admitted container shape; the\n * captured descriptor view, never the later mutable Proxy, reaches dispatch.\n */\nfunction snapshotRawParameterGraph(\n params: readonly unknown[],\n errors: RawParameterErrors\n): unknown[] {\n const graph = analyzeRawParameterGraph(params, errors);\n const copies = new WeakMap<object, object>();\n const copiedDates = new WeakMap<object, Date>();\n\n for (const node of graph.nodes) {\n const copy: object = node.isArray ? [] : {};\n if (node.prototype === null) Object.setPrototypeOf(copy, null);\n copies.set(node.source, copy);\n }\n\n const copiedValue = (value: unknown): unknown => {\n if (typeof value !== \"object\" || value === null) return value;\n const time = graph.dateTimes.get(value);\n if (time !== undefined) {\n const known = copiedDates.get(value);\n if (known) return known;\n const copy = new Date(time);\n copiedDates.set(value, copy);\n return copy;\n }\n return copies.get(value) ?? value;\n };\n\n for (const node of graph.nodes) {\n const copy = copies.get(node.source);\n if (!copy) continue;\n for (const property of node.properties) {\n if (node.isArray && property.key === \"length\") continue;\n const descriptor = property.descriptor;\n Object.defineProperty(\n copy,\n property.key,\n \"value\" in descriptor &&\n (node.isArray\n ? isArrayIndex(property.key)\n : descriptor.enumerable && typeof property.key === \"string\")\n ? { ...descriptor, value: copiedValue(descriptor.value) }\n : descriptor\n );\n }\n if (node.isArray) {\n const length = node.properties.find(\n (property) => property.key === \"length\"\n );\n if (length) Object.defineProperty(copy, \"length\", length.descriptor);\n }\n }\n\n const snapshot = new Array<unknown>(graph.roots.length);\n for (let index = 0; index < graph.roots.length; index++) {\n if (!Object.hasOwn(graph.roots, index)) continue;\n snapshot[index] = copiedValue(graph.roots[index]);\n }\n return snapshot;\n}\n\nfunction invalidProviderDateError(\n context: QueryExecutionContext,\n parameterIndex: number\n): QueryError {\n return new QueryError(\n `Operation \"${context.operation ?? \"statement\"}\" received an invalid Date as bound parameter ${parameterIndex}. An invalid Date names no instant, so a provider either refuses the statement after dispatch or binds it as null.`,\n {\n code: VibORMErrorCode.INVALID_INPUT,\n meta: {\n parameterIndex,\n model: context.model,\n operation: context.operation,\n correlationId: context.correlationId,\n },\n }\n );\n}\n\nfunction unsupportedProviderArrayError(\n context: QueryExecutionContext,\n parameterIndex: number\n): QueryError {\n return new QueryError(\n `Operation \"${context.operation ?? \"statement\"}\" received raw array parameter ${parameterIndex} with custom inherited or accessor behavior. VibORM cannot validate that behavior without invoking caller code before dispatch.`,\n {\n code: VibORMErrorCode.INVALID_INPUT,\n meta: {\n parameterIndex,\n model: context.model,\n operation: context.operation,\n correlationId: context.correlationId,\n },\n }\n );\n}\n\n/**\n * Preserve the raw Date admission invariant after the last trusted statement\n * transform. Non-raw statements keep the old shallow-copy path: their typed\n * inputs were validated upstream, and statement transforms are trusted. Raw\n * Date leaves are revalidated and every admitted data-descriptor array or\n * ordinary JSON record is detached. Reflection does not invoke accessors,\n * iterators, or `toJSON`; a Proxy may run its reflection traps, so its captured\n * descriptor view is the stable provider value. Arrays with custom inherited\n * or accessor behavior are refused. Custom record and provider-native carriers\n * remain opaque and are not traversed.\n */\nexport function snapshotProviderParameters(\n params: readonly unknown[],\n context: QueryExecutionContext\n): unknown[] {\n if (context.model !== \"$raw\") return [...params];\n return snapshotRawParameterGraph(params, {\n invalidDate: (parameterIndex) =>\n invalidProviderDateError(context, parameterIndex),\n unsupportedArray: (parameterIndex) =>\n unsupportedProviderArrayError(context, parameterIndex),\n });\n}\n","import { QueryError } from \"@errors\";\nimport type { QueryResult } from \"./types\";\n\nexport interface NormalizedResultContext {\n provider: string;\n operation: string;\n model?: string;\n correlationId?: string;\n}\n\nexport function createNormalizedResultMeta(\n context: NormalizedResultContext\n): Record<string, unknown> {\n return {\n driver: context.provider,\n operation: context.operation,\n ...(context.model ? { model: context.model } : {}),\n ...(context.correlationId ? { correlationId: context.correlationId } : {}),\n };\n}\n\nconst NON_NEGATIVE_DECIMAL_REGEX = /^(?:0|[1-9]\\d*)$/;\n\nexport function normalizeProviderRowCount(\n value: unknown,\n context: NormalizedResultContext,\n options?: { allowDecimalString?: boolean; nullValue?: number }\n): number {\n let normalized = value === null ? options?.nullValue : value;\n if (\n options?.allowDecimalString === true &&\n typeof normalized === \"string\" &&\n NON_NEGATIVE_DECIMAL_REGEX.test(normalized)\n ) {\n normalized = Number(normalized);\n }\n if (\n typeof normalized !== \"number\" ||\n !Number.isSafeInteger(normalized) ||\n normalized < 0\n ) {\n throw new QueryError(\n `Driver \"${context.provider}\" returned a malformed row count for operation \"${context.operation}\".`,\n {\n meta: createNormalizedResultMeta(context),\n }\n );\n }\n return normalized;\n}\n\nexport function normalizeProviderInsertId(\n value: unknown,\n context: NormalizedResultContext,\n options?: { allowNumber?: boolean }\n): number | bigint | undefined {\n if (typeof value === \"string\") {\n if (!NON_NEGATIVE_DECIMAL_REGEX.test(value)) {\n throw malformedInsertId(context);\n }\n return value === \"0\" ? undefined : BigInt(value);\n }\n if (options?.allowNumber === true && typeof value === \"number\") {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw malformedInsertId(context);\n }\n return value === 0 ? undefined : value;\n }\n throw malformedInsertId(context);\n}\n\nfunction malformedInsertId(context: NormalizedResultContext): QueryError {\n return new QueryError(\n `Driver \"${context.provider}\" returned a malformed insert id for operation \"${context.operation}\".`,\n {\n meta: createNormalizedResultMeta(context),\n }\n );\n}\n\nfunction malformedNormalizedResult(\n context: NormalizedResultContext,\n resultIndex?: number\n): QueryError {\n const position =\n resultIndex === undefined ? \"\" : ` at batch result index ${resultIndex}`;\n return new QueryError(\n `Driver \"${context.provider}\" returned a malformed normalized result for operation \"${context.operation}\"${position}; expected { rows: object[], rowCount: safe non-negative integer }.`,\n {\n meta: {\n ...createNormalizedResultMeta(context),\n ...(resultIndex === undefined ? {} : { resultIndex }),\n },\n }\n );\n}\n\nexport function isNormalizedResultRow(\n value: unknown\n): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Object.prototype.toString.call(value) === \"[object Object]\"\n );\n}\n\nfunction hasNormalizedRows(value: unknown): value is Record<string, unknown>[] {\n if (!Array.isArray(value)) return false;\n for (let index = 0; index < value.length; index += 1) {\n if (!(Object.hasOwn(value, index) && isNormalizedResultRow(value[index]))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Assert the single cross-driver success contract. Empty row arrays and a\n * rowCount of zero are valid; missing fields, non-record rows, and invented\n * counts are not.\n */\nexport function assertNormalizedQueryResult(\n result: QueryResult<unknown> | undefined,\n context: NormalizedResultContext,\n resultIndex?: number\n): void {\n const hasValidInsertId =\n result?.insertId === undefined ||\n (typeof result.insertId === \"bigint\" && result.insertId >= 0n) ||\n (typeof result.insertId === \"number\" &&\n Number.isFinite(result.insertId) &&\n Number.isSafeInteger(result.insertId) &&\n result.insertId >= 0);\n if (\n !(isNormalizedResultRow(result) && hasNormalizedRows(result.rows)) ||\n typeof result.rowCount !== \"number\" ||\n !Number.isFinite(result.rowCount) ||\n !Number.isSafeInteger(result.rowCount) ||\n result.rowCount < 0 ||\n !hasValidInsertId\n ) {\n throw malformedNormalizedResult(context, resultIndex);\n }\n}\n\n/**\n * Native and planned batches must return one normalized result for each\n * submitted statement, in the same order.\n */\nexport function assertNormalizedBatchResults(\n results: readonly QueryResult<unknown>[],\n expectedStatementCount: number,\n context: NormalizedResultContext\n): void {\n if (!Array.isArray(results) || results.length !== expectedStatementCount) {\n const actualResultCount = Array.isArray(results) ? results.length : 0;\n throw new QueryError(\n `Driver \"${context.provider}\" returned ${actualResultCount} results for operation \"${context.operation}\"; expected ${expectedStatementCount}, one per statement.`,\n {\n meta: {\n ...createNormalizedResultMeta(context),\n expectedStatementCount,\n actualResultCount,\n },\n }\n );\n }\n\n for (let resultIndex = 0; resultIndex < results.length; resultIndex += 1) {\n assertNormalizedQueryResult(results[resultIndex], context, resultIndex);\n }\n}\n","import { UnsupportedOperationError } from \"@errors\";\nimport type { Sql } from \"@sql\";\n\n/** Normalize one driver's optional bind declaration into verified capacity. */\nexport function normalizedBindParameterLimit(\n limit: unknown\n): number | undefined {\n return typeof limit === \"number\" && Number.isInteger(limit) && limit > 0\n ? limit\n : undefined;\n}\n\n/** Refuse one materialized statement before it reaches provider I/O. */\nexport function assertStatementBindParameterCapacity(\n statement: Sql,\n driverName: string,\n limit: number | undefined,\n subject: string\n): void {\n if (limit === undefined || statement.values.length <= limit) return;\n throw new UnsupportedOperationError(\n `Driver '${driverName}' cannot execute this ${subject} because one indivisible statement needs ${statement.values.length} bound values, above the verified limit of ${limit}.`\n );\n}\n"],"mappings":"wNA0BA,MAAa,EACX,OAAO,OAAO,cAAiB,SAAW,OAAO,aAAe,IAAA,GCzB5D,EAAuB,OAAO,4BAA4B,CAGhE,SAAgB,uBAAyC,EAAa,CAOpE,OANA,OAAO,eAAe,EAAO,EAAsB,CACjD,aAAc,GACd,WAAY,GACZ,MAAO,GACP,SAAU,GACX,CAAC,CACK,EAIT,SAAgB,qBAAqB,EAAwB,CAC3D,OAAO,QAAQ,IAAI,EAAO,EAAqB,GAAK,GCftD,MAAM,EAAqB,IAAI,QAG/B,SAAgB,0BAA0B,EAAe,EAAsB,CAC7E,EAAmB,IAAI,EAAO,EAAU,CAI1C,SAAgB,0BACd,EACA,EACQ,CACR,IAAM,EAAY,EAAmB,IAAI,EAAO,CAEhD,OADI,IAAc,IAAA,IAAW,EAAmB,IAAI,EAAQ,EAAU,CAC/D,EAIT,SAAgB,0BACd,EACA,EACA,EACQ,CACR,IAAM,EAAY,EAAmB,IAAI,EAAO,CAOhD,OANI,IAAc,IAAA,IAChB,EAAmB,IACjB,EACA,IAAI,EAAI,CAAC,GAAG,EAAU,QAAQ,CAAE,CAAC,GAAG,EAAO,CAAC,CAC7C,CAEI,EAIT,SAAgB,sBAAsB,EAAgC,CACpE,OAAO,EAAmB,IAAI,EAAM,CCKtC,MAAM,EAAa,mBAQnB,SAAS,wBACP,EACqC,CACrC,IAAM,EAAyC,EAAE,CACjD,IAAK,IAAM,KAAO,QAAQ,QAAQ,EAAU,CAAE,CAC5C,IAAM,EAAa,OAAO,yBAAyB,EAAW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