viborm 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/dist/{adapter-internals-DULbfdmQ.mjs → adapter-internals-DNY4JWFC.mjs} +1 -1
  2. package/dist/{adapter-internals-DULbfdmQ.mjs.map → adapter-internals-DNY4JWFC.mjs.map} +1 -1
  3. package/dist/{adapter-namespace-CFtC8LbT.mjs → adapter-namespace-BMss0hKo.mjs} +2 -2
  4. package/dist/{adapter-namespace-CFtC8LbT.mjs.map → adapter-namespace-BMss0hKo.mjs.map} +1 -1
  5. package/dist/{adapter-result-parser-C0vW9am8.mjs → adapter-result-parser-Bz3WtMBa.mjs} +1 -1
  6. package/dist/{adapter-result-parser-C0vW9am8.mjs.map → adapter-result-parser-Bz3WtMBa.mjs.map} +1 -1
  7. package/dist/adapters.d.mts +1 -1
  8. package/dist/adapters.mjs +1 -1
  9. package/dist/{array-literal-Dohoq5rT.mjs → array-literal-DfgmVxKI.mjs} +1 -1
  10. package/dist/{array-literal-Dohoq5rT.mjs.map → array-literal-DfgmVxKI.mjs.map} +1 -1
  11. package/dist/{batch-refs-cBYAKzaE.mjs → batch-refs-ZHBzfoBC.mjs} +2 -2
  12. package/dist/{batch-refs-cBYAKzaE.mjs.map → batch-refs-ZHBzfoBC.mjs.map} +1 -1
  13. package/dist/{bind-parameter-capacity-4OU6feZG.mjs → bind-parameter-capacity-Bjgx1lMC.mjs} +1 -1
  14. package/dist/{bind-parameter-capacity-4OU6feZG.mjs.map → bind-parameter-capacity-Bjgx1lMC.mjs.map} +1 -1
  15. package/dist/builder-Ct1qPFc8.mjs +2 -0
  16. package/dist/{builder-D0GQK-fA.mjs.map → builder-Ct1qPFc8.mjs.map} +1 -1
  17. package/dist/bun-sql.d.mts +1 -1
  18. package/dist/bun-sql.mjs +1 -1
  19. package/dist/bun-sqlite.d.mts +1 -1
  20. package/dist/bun-sqlite.mjs +1 -1
  21. package/dist/cache/cloudflare-kv.d.mts +1 -1
  22. package/dist/cache/cloudflare-kv.mjs +1 -1
  23. package/dist/cache/memory.d.mts +1 -1
  24. package/dist/cache/memory.mjs +1 -1
  25. package/dist/cache.d.mts +1 -1
  26. package/dist/cache.mjs +1 -1
  27. package/dist/cache.mjs.map +1 -1
  28. package/dist/{canonical-json-D_FgOt4S.mjs → canonical-json-B6J5VbLv.mjs} +1 -1
  29. package/dist/{canonical-json-D_FgOt4S.mjs.map → canonical-json-B6J5VbLv.mjs.map} +1 -1
  30. package/dist/chain--uZ0O7_Y.mjs +2 -0
  31. package/dist/chain--uZ0O7_Y.mjs.map +1 -0
  32. package/dist/cli.mjs +1 -1
  33. package/dist/client-BAxU6jnw.mjs +2 -0
  34. package/dist/client-BAxU6jnw.mjs.map +1 -0
  35. package/dist/{client-C5BGyg5n.d.mts → client-DP6gM_tf.d.mts} +3 -3
  36. package/dist/{client-BCcIdDl8.mjs → client-mQcOvDdK.mjs} +12 -12
  37. package/dist/client-mQcOvDdK.mjs.map +1 -0
  38. package/dist/client.d.mts +1 -1
  39. package/dist/client.mjs +1 -1
  40. package/dist/{clock-QtW83Dcm.mjs → clock-DXbsDHLj.mjs} +1 -1
  41. package/dist/{clock-QtW83Dcm.mjs.map → clock-DXbsDHLj.mjs.map} +1 -1
  42. package/dist/config.d.mts +2 -2
  43. package/dist/config.mjs +1 -1
  44. package/dist/{current-CEWlNJcP.mjs → current-nScH-oH5.mjs} +1 -1
  45. package/dist/{current-CEWlNJcP.mjs.map → current-nScH-oH5.mjs.map} +1 -1
  46. package/dist/d1.d.mts +1 -1
  47. package/dist/d1.mjs +1 -1
  48. package/dist/{datetime-physical-codec-Bl6M6vF5.mjs → datetime-physical-codec-DTdvABny.mjs} +2 -2
  49. package/dist/{datetime-physical-codec-Bl6M6vF5.mjs.map → datetime-physical-codec-DTdvABny.mjs.map} +1 -1
  50. package/dist/{driver-Dv2GJyGs.mjs → driver-NtekjA3W.mjs} +2 -2
  51. package/dist/{driver-Dv2GJyGs.mjs.map → driver-NtekjA3W.mjs.map} +1 -1
  52. package/dist/{driver-szWYBmjD.mjs → driver-XlmOJFRH.mjs} +2 -2
  53. package/dist/{driver-szWYBmjD.mjs.map → driver-XlmOJFRH.mjs.map} +1 -1
  54. package/dist/driver.d.mts +1 -1
  55. package/dist/driver.mjs +1 -1
  56. package/dist/{error-mapping-DRY49A3C.mjs → error-mapping-D--MVRCY.mjs} +2 -2
  57. package/dist/{error-mapping-DRY49A3C.mjs.map → error-mapping-D--MVRCY.mjs.map} +1 -1
  58. package/dist/every-Xql4tHDz.mjs +2 -0
  59. package/dist/{every-DIG9CPly.mjs.map → every-Xql4tHDz.mjs.map} +1 -1
  60. package/dist/{fs-estate-DNCM7hYC.mjs → fs-estate-CfvH8Fxa.mjs} +2 -2
  61. package/dist/{fs-estate-DNCM7hYC.mjs.map → fs-estate-CfvH8Fxa.mjs.map} +1 -1
  62. package/dist/{geo-area-codec-H50rrGiF.mjs → geo-area-codec-DvHcWF3g.mjs} +2 -2
  63. package/dist/{geo-area-codec-H50rrGiF.mjs.map → geo-area-codec-DvHcWF3g.mjs.map} +1 -1
  64. package/dist/geo-point-codec-CIZxuIvE.mjs +2 -0
  65. package/dist/geo-point-codec-CIZxuIvE.mjs.map +1 -0
  66. package/dist/{hydration-BQ7tYLtA.mjs → hydration-BNEFeV5v.mjs} +2 -2
  67. package/dist/{hydration-BQ7tYLtA.mjs.map → hydration-BNEFeV5v.mjs.map} +1 -1
  68. package/dist/identifier-conversion-C_XCo9es.mjs +2 -0
  69. package/dist/{identifier-conversion-DV63mwKG.mjs.map → identifier-conversion-C_XCo9es.mjs.map} +1 -1
  70. package/dist/{identity-B75EaVTM.mjs → identity-BtuwgqhS.mjs} +2 -2
  71. package/dist/{identity-B75EaVTM.mjs.map → identity-BtuwgqhS.mjs.map} +1 -1
  72. package/dist/{index-DRX_LLQM.d.mts → index-DBhpNR0X.d.mts} +94 -14
  73. package/dist/index.d.mts +3 -3
  74. package/dist/index.mjs +1 -1
  75. package/dist/instrumentation.d.mts +1 -1
  76. package/dist/instrumentation.mjs +1 -1
  77. package/dist/{invariant-B5znICP_.mjs → invariant-Dw9UB49x.mjs} +1 -1
  78. package/dist/{invariant-B5znICP_.mjs.map → invariant-Dw9UB49x.mjs.map} +1 -1
  79. package/dist/{json-number-DoseUwuo.mjs → json-number-ChtP7ZeY.mjs} +1 -1
  80. package/dist/{json-number-DoseUwuo.mjs.map → json-number-ChtP7ZeY.mjs.map} +1 -1
  81. package/dist/{key-rszcmZdB.mjs → key-QgLg2Kve.mjs} +2 -2
  82. package/dist/{key-rszcmZdB.mjs.map → key-QgLg2Kve.mjs.map} +1 -1
  83. package/dist/keys-D5hv9EaJ.mjs +2 -0
  84. package/dist/keys-D5hv9EaJ.mjs.map +1 -0
  85. package/dist/{libsql-CAZVcr9G.mjs → libsql-BsJdPDES.mjs} +3 -3
  86. package/dist/{libsql-CAZVcr9G.mjs.map → libsql-BsJdPDES.mjs.map} +1 -1
  87. package/dist/libsql.d.mts +1 -1
  88. package/dist/libsql.mjs +1 -1
  89. package/dist/{memory-CqWRO6-3.mjs → memory-BEaJ0-FU.mjs} +2 -2
  90. package/dist/{memory-CqWRO6-3.mjs.map → memory-BEaJ0-FU.mjs.map} +1 -1
  91. package/dist/migrations/mysql.d.mts +5 -5
  92. package/dist/migrations/mysql.mjs +1 -1
  93. package/dist/migrations/postgres.d.mts +5 -5
  94. package/dist/migrations/postgres.mjs +1 -1
  95. package/dist/migrations/sqlite.d.mts +5 -5
  96. package/dist/migrations/sqlite.mjs +1 -1
  97. package/dist/migrations/storage/durable-object.d.mts +1 -1
  98. package/dist/migrations/storage/durable-object.mjs +1 -1
  99. package/dist/migrations/storage/fs.d.mts +1 -1
  100. package/dist/migrations/storage/fs.mjs +1 -1
  101. package/dist/migrations/storage/r2.d.mts +1 -1
  102. package/dist/migrations/storage/r2.mjs +1 -1
  103. package/dist/migrations/tenant.d.mts +3 -3
  104. package/dist/migrations/tenant.mjs +1 -1
  105. package/dist/migrations.d.mts +5 -5
  106. package/dist/migrations.mjs +1 -1
  107. package/dist/model-D94xU8jq.mjs +2 -0
  108. package/dist/model-D94xU8jq.mjs.map +1 -0
  109. package/dist/{mysql-BPPBSJzl.mjs → mysql-DT_dTWDi.mjs} +6 -6
  110. package/dist/{mysql-BPPBSJzl.mjs.map → mysql-DT_dTWDi.mjs.map} +1 -1
  111. package/dist/{mysql-adapter-Dbo7l0lI.mjs → mysql-adapter-BUwzKlbt.mjs} +2 -2
  112. package/dist/{mysql-adapter-Dbo7l0lI.mjs.map → mysql-adapter-BUwzKlbt.mjs.map} +1 -1
  113. package/dist/mysql2.d.mts +1 -1
  114. package/dist/mysql2.mjs +1 -1
  115. package/dist/{native-types-6wCGP1a1.mjs → native-types-CQH05hcr.mjs} +1 -1
  116. package/dist/{native-types-6wCGP1a1.mjs.map → native-types-CQH05hcr.mjs.map} +1 -1
  117. package/dist/neon-http.d.mts +1 -1
  118. package/dist/neon-http.mjs +1 -1
  119. package/dist/{normalized-result-23DWxZVY.mjs → normalized-result-ByvlIQqa.mjs} +2 -2
  120. package/dist/{normalized-result-23DWxZVY.mjs.map → normalized-result-ByvlIQqa.mjs.map} +1 -1
  121. package/dist/{object-store-Cs3AueG5.d.mts → object-store-35LjwOS-.d.mts} +4 -4
  122. package/dist/{object-store-DmnlQy7V.mjs → object-store-DdgcT8d9.mjs} +2 -2
  123. package/dist/{object-store-DmnlQy7V.mjs.map → object-store-DdgcT8d9.mjs.map} +1 -1
  124. package/dist/on.d.mts +1 -1
  125. package/dist/on.mjs +1 -1
  126. package/dist/ordering.d.mts +123 -0
  127. package/dist/ordering.mjs +11 -0
  128. package/dist/ordering.mjs.map +1 -0
  129. package/dist/permissions.d.mts +1 -1
  130. package/dist/permissions.mjs +1 -1
  131. package/dist/pg.d.mts +1 -1
  132. package/dist/pg.mjs +1 -1
  133. package/dist/pglite.d.mts +1 -1
  134. package/dist/pglite.mjs +1 -1
  135. package/dist/{physical-DT6C54w7.mjs → physical-t_gDjUCD.mjs} +2 -2
  136. package/dist/{physical-DT6C54w7.mjs.map → physical-t_gDjUCD.mjs.map} +1 -1
  137. package/dist/{pinned-session-BdON2d0V.mjs → pinned-session-De2rDjdO.mjs} +2 -2
  138. package/dist/{pinned-session-BdON2d0V.mjs.map → pinned-session-De2rDjdO.mjs.map} +1 -1
  139. package/dist/planetscale.d.mts +1 -1
  140. package/dist/planetscale.mjs +1 -1
  141. package/dist/{planner-BxCcoO8s.d.mts → planner-CmDw5jPb.d.mts} +1 -1
  142. package/dist/{postgres-BK_aOx_C.mjs → postgres-Do0nq95P.mjs} +4 -4
  143. package/dist/{postgres-BK_aOx_C.mjs.map → postgres-Do0nq95P.mjs.map} +1 -1
  144. package/dist/{postgres-adapter-CVazEDVI.mjs → postgres-adapter-DFzjbAP7.mjs} +2 -2
  145. package/dist/{postgres-adapter-CVazEDVI.mjs.map → postgres-adapter-DFzjbAP7.mjs.map} +1 -1
  146. package/dist/{postgres-adapter-DxhZu7Qw.mjs → postgres-adapter-Dvt16rbl.mjs} +2 -2
  147. package/dist/{postgres-adapter-DxhZu7Qw.mjs.map → postgres-adapter-Dvt16rbl.mjs.map} +1 -1
  148. package/dist/{postgres-result-DYeVeHuT.mjs → postgres-result-ehQiy2H-.mjs} +2 -2
  149. package/dist/{postgres-result-DYeVeHuT.mjs.map → postgres-result-ehQiy2H-.mjs.map} +1 -1
  150. package/dist/postgres.d.mts +1 -1
  151. package/dist/postgres.mjs +1 -1
  152. package/dist/{provider-limits-zLe7S_0W.mjs → provider-limits-kO9B3KCF.mjs} +2 -2
  153. package/dist/{provider-limits-zLe7S_0W.mjs.map → provider-limits-kO9B3KCF.mjs.map} +1 -1
  154. package/dist/{relation-bound-Bj7X-EUE.mjs → relation-bound-5hindjxU.mjs} +1 -1
  155. package/dist/{relation-bound-Bj7X-EUE.mjs.map → relation-bound-5hindjxU.mjs.map} +1 -1
  156. package/dist/{result-parsing-C2044903.mjs → result-parsing-Dkgy-xcy.mjs} +1 -1
  157. package/dist/{result-parsing-C2044903.mjs.map → result-parsing-Dkgy-xcy.mjs.map} +1 -1
  158. package/dist/result-shape-DwoSyWnq.mjs +2 -0
  159. package/dist/{result-shape-C8QFUuIt.mjs.map → result-shape-DwoSyWnq.mjs.map} +1 -1
  160. package/dist/rows-ig1gjVRb.mjs +2 -0
  161. package/dist/rows-ig1gjVRb.mjs.map +1 -0
  162. package/dist/rows-of-Djavcb19.mjs +2 -0
  163. package/dist/rows-of-Djavcb19.mjs.map +1 -0
  164. package/dist/scalar-BgxfbRLw.mjs +4 -0
  165. package/dist/scalar-BgxfbRLw.mjs.map +1 -0
  166. package/dist/schema/json.d.mts +1 -1
  167. package/dist/schema/json.mjs +1 -1
  168. package/dist/schema/json.mjs.map +1 -1
  169. package/dist/schema-CT57uls5.mjs +2 -0
  170. package/dist/{schema-CY9kOwJ-.mjs.map → schema-CT57uls5.mjs.map} +1 -1
  171. package/dist/{schema-introspection-CfqmM3Cz.mjs → schema-introspection-BFDAX5Ol.mjs} +2 -2
  172. package/dist/{schema-introspection-CfqmM3Cz.mjs.map → schema-introspection-BFDAX5Ol.mjs.map} +1 -1
  173. package/dist/schema.d.mts +1 -1
  174. package/dist/schema.mjs +1 -1
  175. package/dist/{select-assembly-D7FEenz2.mjs → select-assembly-Dcaqm09G.mjs} +2 -2
  176. package/dist/{select-assembly-D7FEenz2.mjs.map → select-assembly-Dcaqm09G.mjs.map} +1 -1
  177. package/dist/{settle-CObilv26.mjs → settle-v6QhvFkm.mjs} +2 -2
  178. package/dist/{settle-CObilv26.mjs.map → settle-v6QhvFkm.mjs.map} +1 -1
  179. package/dist/{sha256-Da07rzvR.mjs → sha256-D_fCV62w.mjs} +1 -1
  180. package/dist/{sha256-Da07rzvR.mjs.map → sha256-D_fCV62w.mjs.map} +1 -1
  181. package/dist/soft-delete.d.mts +116 -14
  182. package/dist/soft-delete.mjs +1 -1
  183. package/dist/soft-delete.mjs.map +1 -1
  184. package/dist/sql-BsBoKwaf.mjs +2 -0
  185. package/dist/sql-BsBoKwaf.mjs.map +1 -0
  186. package/dist/{sql-CF5Xi6z-.d.mts → sql-D7JnXgUh.d.mts} +5 -0
  187. package/dist/{sql-statement-tokens-DL3ooNs7.mjs → sql-statement-tokens-CV2qkIKN.mjs} +1 -1
  188. package/dist/{sql-statement-tokens-DL3ooNs7.mjs.map → sql-statement-tokens-CV2qkIKN.mjs.map} +1 -1
  189. package/dist/sql.d.mts +1 -1
  190. package/dist/sql.mjs +1 -1
  191. package/dist/{sqlite-adapter-DqT6HeDs.mjs → sqlite-adapter-eGsbASDR.mjs} +2 -2
  192. package/dist/{sqlite-adapter-DqT6HeDs.mjs.map → sqlite-adapter-eGsbASDR.mjs.map} +1 -1
  193. package/dist/{sqlite-utils-DeDlMJKj.mjs → sqlite-utils-DztTzv08.mjs} +2 -2
  194. package/dist/{sqlite-utils-DeDlMJKj.mjs.map → sqlite-utils-DztTzv08.mjs.map} +1 -1
  195. package/dist/sqlite3.d.mts +1 -1
  196. package/dist/sqlite3.mjs +1 -1
  197. package/dist/{standard-sql-BErrm6AV.mjs → standard-sql-BtzSzrof.mjs} +2 -2
  198. package/dist/standard-sql-BtzSzrof.mjs.map +1 -0
  199. package/dist/{suppressed-failure-3C4sFXvH.mjs → suppressed-failure-DO0ej03b.mjs} +1 -1
  200. package/dist/{suppressed-failure-3C4sFXvH.mjs.map → suppressed-failure-DO0ej03b.mjs.map} +1 -1
  201. package/dist/to-many-CJ-8_caR.mjs +2 -0
  202. package/dist/{to-many-DqYv9-vp.mjs.map → to-many-CJ-8_caR.mjs.map} +1 -1
  203. package/dist/{transaction-operation-Co3hw8yz.mjs → transaction-operation-Km-Gr-a3.mjs} +1 -1
  204. package/dist/{transaction-operation-Co3hw8yz.mjs.map → transaction-operation-Km-Gr-a3.mjs.map} +1 -1
  205. package/dist/{types-CJgtjXtu.mjs → types-C4v6iAmY.mjs} +1 -1
  206. package/dist/{types-CJgtjXtu.mjs.map → types-C4v6iAmY.mjs.map} +1 -1
  207. package/dist/{utils-DooFtO1V.mjs → utils-DYz-Xm59.mjs} +2 -2
  208. package/dist/{utils-DooFtO1V.mjs.map → utils-DYz-Xm59.mjs.map} +1 -1
  209. package/dist/v-C2XN11Gy.mjs +2 -0
  210. package/dist/{v-yKivkoka.mjs.map → v-C2XN11Gy.mjs.map} +1 -1
  211. package/dist/validation-BSpO4DjI.mjs +2 -0
  212. package/dist/{validation-u-sZDdfD.mjs.map → validation-BSpO4DjI.mjs.map} +1 -1
  213. package/dist/validation.d.mts +1 -1
  214. package/dist/validation.mjs +1 -1
  215. package/dist/validator-DqI5RlVU.mjs +2 -0
  216. package/dist/validator-DqI5RlVU.mjs.map +1 -0
  217. package/dist/version-DyH_HopX.mjs +2 -0
  218. package/dist/{version-WvqPqZJ4.mjs.map → version-DyH_HopX.mjs.map} +1 -1
  219. package/dist/write-sinks-3IKCDF-S.mjs +2 -0
  220. package/dist/{write-sinks-CoB5PPw9.mjs.map → write-sinks-3IKCDF-S.mjs.map} +1 -1
  221. package/dist/{writes-CD0mNS5-.mjs → writes-BX5fLiw5.mjs} +1 -1
  222. package/dist/{writes-CD0mNS5-.mjs.map → writes-BX5fLiw5.mjs.map} +1 -1
  223. package/package.json +36 -17
  224. package/dist/builder-D0GQK-fA.mjs +0 -2
  225. package/dist/chain-BQoDfo80.mjs +0 -2
  226. package/dist/chain-BQoDfo80.mjs.map +0 -1
  227. package/dist/client-BCcIdDl8.mjs.map +0 -1
  228. package/dist/client-BqgVSbk0.mjs +0 -2
  229. package/dist/client-BqgVSbk0.mjs.map +0 -1
  230. package/dist/every-DIG9CPly.mjs +0 -2
  231. package/dist/geo-point-codec-mjROsQX-.mjs +0 -2
  232. package/dist/geo-point-codec-mjROsQX-.mjs.map +0 -1
  233. package/dist/identifier-conversion-DV63mwKG.mjs +0 -2
  234. package/dist/result-shape-C8QFUuIt.mjs +0 -2
  235. package/dist/rows-D7ns2l0U.mjs +0 -2
  236. package/dist/rows-D7ns2l0U.mjs.map +0 -1
  237. package/dist/scalar-D6QmJ22_.mjs +0 -4
  238. package/dist/scalar-D6QmJ22_.mjs.map +0 -1
  239. package/dist/schema-CY9kOwJ-.mjs +0 -2
  240. package/dist/sql-DGtEeP8z.mjs +0 -2
  241. package/dist/sql-DGtEeP8z.mjs.map +0 -1
  242. package/dist/standard-sql-BErrm6AV.mjs.map +0 -1
  243. package/dist/to-many-DqYv9-vp.mjs +0 -2
  244. package/dist/v-yKivkoka.mjs +0 -2
  245. package/dist/validation-u-sZDdfD.mjs +0 -2
  246. package/dist/validator-XVm02V0K.mjs +0 -2
  247. package/dist/validator-XVm02V0K.mjs.map +0 -1
  248. package/dist/version-WvqPqZJ4.mjs +0 -2
  249. package/dist/write-sinks-CoB5PPw9.mjs +0 -2
  250. /package/dist/{contract-H_WiAUaR.d.mts → contract-CYl0OzhZ.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hydration-BQ7tYLtA.mjs","names":[],"sources":["../src/schema/hydration.ts"],"sourcesContent":["/**\n * Schema Hydration\n *\n * Hydrates schema name slots (tsName, sqlName) for models and scalars.\n * This is called once at client initialization when the full schema context is available.\n *\n * - tsName: The TypeScript key name in the schema (e.g., \"email\", \"User\")\n * - sqlName: The resolved database name (e.g., \"email_column\", \"users\")\n *\n * Names are stored in the model's nameRegistry, not on the scalar instances.\n * This allows the same scalar to be reused across multiple models with different keys.\n */\n\nimport { isValidSchemaIdentifier } from \"./identifier\";\nimport type { Model, NameRegistry } from \"./model\";\nimport { preflightModelRegistrationIdentity } from \"./registration-preflight\";\nimport type { Scalar } from \"./scalars/base\";\nimport type { SchemaNames } from \"./scalars/common\";\nimport { SchemaValidationError } from \"./validation/error\";\n\n/**\n * Schema type - record of model names to Model instances\n */\nexport type Schema = Record<string, Model<any>>;\n\n/**\n * Hydrate name slots for all models and scalars in a schema.\n *\n * This function populates the model's nameRegistry:\n * - model[\"~\"].names.ts = schema key (e.g., \"User\")\n * - model[\"~\"].names.sql = tableName ?? schema key (e.g., \"users\")\n * - model[\"~\"].nameRegistry.fields.get(fieldKey) = {ts, sql}\n *\n * Operation schemas are registry-owned; hydration only binds reusable schema\n * definitions to model-local names and relation sources.\n *\n * @param schema - The schema object mapping model names to Model instances\n */\nexport function hydrateSchemaNames(schema: Schema, checked = false): void {\n const registrations = Object.entries(schema);\n // A schema `viborm check` validated binds its names without re-proving them.\n if (checked) {\n for (const [modelKey, model] of registrations)\n bindModelNames(modelKey, model);\n return;\n }\n // TWO ordered phases. The preflight proves every model's identity and name\n // stability BEFORE a single registry write, so a schema that fails validation\n // never leaves models 0..N-1 bound while model N is refused.\n const identityIssue = preflightModelRegistrationIdentity(registrations);\n if (identityIssue) throw new SchemaValidationError([identityIssue]);\n for (const [modelKey, model] of registrations) {\n preflightModelIdentifiers(modelKey, model);\n }\n for (const [modelKey, model] of registrations) {\n bindModelNames(modelKey, model);\n }\n}\n\n/**\n * Prove one model's identity: its identifiers are legal, and its schema key is\n * the one this model object is already bound to.\n *\n * A model object binds ONE schema key for its lifetime. Re-registering the same\n * object under the same key is idempotent — the same schema composed twice, or\n * a second client over the same models, is a normal thing to do — while a second\n * key is refused, because every derived name, junction table, index and\n * constraint in the estate is generated from the schema key and two keys would\n * make one model object mean two different tables.\n */\nfunction preflightModelIdentifiers(modelKey: string, model: Model<any>): void {\n const state = model[\"~\"].state;\n\n assertValidIdentifier(\"Model\", modelKey);\n if (state.tableName !== undefined) {\n assertValidIdentifier(\"Mapped table\", state.tableName, modelKey);\n }\n for (const fieldKey of Object.keys(state.shape)) {\n assertValidIdentifier(\"Field\", fieldKey, modelKey);\n }\n for (const scalar of Object.values(state.scalars as Record<string, Scalar>)) {\n if (scalar[\"~\"].state.columnName !== undefined) {\n assertValidIdentifier(\n \"Mapped column\",\n scalar[\"~\"].state.columnName,\n modelKey\n );\n }\n }\n}\n\n/**\n * Bind one model's names and its scalar name registry.\n *\n * A relation has no name entry — its key is its only name, with no column to\n * map — and no relation is given a source model: `.extends()` may reuse one\n * relation object under more than one model or key, so a contextual operation\n * carries its own slot identity instead.\n */\nfunction bindModelNames(modelKey: string, model: Model<any>): void {\n const names = model[\"~\"].names as SchemaNames;\n const state = model[\"~\"].state;\n const registry = model[\"~\"].nameRegistry as NameRegistry;\n\n names.ts = modelKey;\n names.sql = state.tableName ?? modelKey;\n\n for (const [fieldKey, scalar] of Object.entries(\n state.scalars as Record<string, Scalar>\n )) {\n const fieldNames: SchemaNames = {\n ts: fieldKey,\n sql: scalar[\"~\"].state.columnName ?? fieldKey,\n };\n registry.fields.set(fieldKey, fieldNames);\n }\n\n // Operation schemas are built by SchemaRegistry, not during name hydration.\n}\n\nfunction assertValidIdentifier(\n kind: \"Field\" | \"Mapped column\" | \"Mapped table\" | \"Model\",\n identifier: unknown,\n modelName?: string\n): void {\n if (isValidSchemaIdentifier(identifier)) return;\n const location = modelName ? ` in '${modelName}'` : \"\";\n const renderedIdentifier = String(identifier);\n throw new Error(\n `${kind} '${renderedIdentifier}'${location} is invalid identifier; identifiers must be ASCII, at most 63 bytes, and must not collide with Object.prototype properties`\n );\n}\n\n/**\n * Check if a schema has been hydrated\n */\nexport function isSchemaHydrated(schema: Schema): boolean {\n const firstModel = Object.values(schema)[0];\n if (!firstModel) {\n return true;\n } // Empty schema is considered hydrated\n return firstModel[\"~\"].names.ts !== undefined;\n}\n\n/**\n * Get the SQL name for a model (throws if not hydrated)\n */\nexport function getModelSqlName(model: Model<any>): string {\n const sqlName = model[\"~\"].names.sql;\n if (!sqlName) {\n throw new Error(\n \"Schema not hydrated. Call hydrateSchemaNames() or create a client first.\"\n );\n }\n return sqlName;\n}\n\n/**\n * Get the SQL name for a scalar field key.\n * Delegates to model[\"~\"].getFieldName().\n */\nexport function getFieldSqlName(model: Model<any>, fieldKey: string): string {\n return model[\"~\"].getFieldName(fieldKey).sql;\n}\n"],"mappings":"8IAsCA,SAAgB,mBAAmB,EAAgB,EAAU,GAAa,CACxE,IAAM,EAAgB,OAAO,QAAQ,EAAO,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NEFeV5v.mjs","names":[],"sources":["../src/schema/hydration.ts"],"sourcesContent":["/**\n * Schema Hydration\n *\n * Hydrates schema name slots (tsName, sqlName) for models and scalars.\n * This is called once at client initialization when the full schema context is available.\n *\n * - tsName: The TypeScript key name in the schema (e.g., \"email\", \"User\")\n * - sqlName: The resolved database name (e.g., \"email_column\", \"users\")\n *\n * Names are stored in the model's nameRegistry, not on the scalar instances.\n * This allows the same scalar to be reused across multiple models with different keys.\n */\n\nimport { isValidSchemaIdentifier } from \"./identifier\";\nimport type { Model, NameRegistry } from \"./model\";\nimport { preflightModelRegistrationIdentity } from \"./registration-preflight\";\nimport type { Scalar } from \"./scalars/base\";\nimport type { SchemaNames } from \"./scalars/common\";\nimport { SchemaValidationError } from \"./validation/error\";\n\n/**\n * Schema type - record of model names to Model instances\n */\nexport type Schema = Record<string, Model<any>>;\n\n/**\n * Hydrate name slots for all models and scalars in a schema.\n *\n * This function populates the model's nameRegistry:\n * - model[\"~\"].names.ts = schema key (e.g., \"User\")\n * - model[\"~\"].names.sql = tableName ?? schema key (e.g., \"users\")\n * - model[\"~\"].nameRegistry.fields.get(fieldKey) = {ts, sql}\n *\n * Operation schemas are registry-owned; hydration only binds reusable schema\n * definitions to model-local names and relation sources.\n *\n * @param schema - The schema object mapping model names to Model instances\n */\nexport function hydrateSchemaNames(schema: Schema, checked = false): void {\n const registrations = Object.entries(schema);\n // A schema `viborm check` validated binds its names without re-proving them.\n if (checked) {\n for (const [modelKey, model] of registrations)\n bindModelNames(modelKey, model);\n return;\n }\n // TWO ordered phases. The preflight proves every model's identity and name\n // stability BEFORE a single registry write, so a schema that fails validation\n // never leaves models 0..N-1 bound while model N is refused.\n const identityIssue = preflightModelRegistrationIdentity(registrations);\n if (identityIssue) throw new SchemaValidationError([identityIssue]);\n for (const [modelKey, model] of registrations) {\n preflightModelIdentifiers(modelKey, model);\n }\n for (const [modelKey, model] of registrations) {\n bindModelNames(modelKey, model);\n }\n}\n\n/**\n * Prove one model's identity: its identifiers are legal, and its schema key is\n * the one this model object is already bound to.\n *\n * A model object binds ONE schema key for its lifetime. Re-registering the same\n * object under the same key is idempotent — the same schema composed twice, or\n * a second client over the same models, is a normal thing to do — while a second\n * key is refused, because every derived name, junction table, index and\n * constraint in the estate is generated from the schema key and two keys would\n * make one model object mean two different tables.\n */\nfunction preflightModelIdentifiers(modelKey: string, model: Model<any>): void {\n const state = model[\"~\"].state;\n\n assertValidIdentifier(\"Model\", modelKey);\n if (state.tableName !== undefined) {\n assertValidIdentifier(\"Mapped table\", state.tableName, modelKey);\n }\n for (const fieldKey of Object.keys(state.shape)) {\n assertValidIdentifier(\"Field\", fieldKey, modelKey);\n }\n for (const scalar of Object.values(state.scalars as Record<string, Scalar>)) {\n if (scalar[\"~\"].state.columnName !== undefined) {\n assertValidIdentifier(\n \"Mapped column\",\n scalar[\"~\"].state.columnName,\n modelKey\n );\n }\n }\n}\n\n/**\n * Bind one model's names and its scalar name registry.\n *\n * A relation has no name entry — its key is its only name, with no column to\n * map — and no relation is given a source model: `.extends()` may reuse one\n * relation object under more than one model or key, so a contextual operation\n * carries its own slot identity instead.\n */\nfunction bindModelNames(modelKey: string, model: Model<any>): void {\n const names = model[\"~\"].names as SchemaNames;\n const state = model[\"~\"].state;\n const registry = model[\"~\"].nameRegistry as NameRegistry;\n\n names.ts = modelKey;\n names.sql = state.tableName ?? modelKey;\n\n for (const [fieldKey, scalar] of Object.entries(\n state.scalars as Record<string, Scalar>\n )) {\n const fieldNames: SchemaNames = {\n ts: fieldKey,\n sql: scalar[\"~\"].state.columnName ?? fieldKey,\n };\n registry.fields.set(fieldKey, fieldNames);\n }\n\n // Operation schemas are built by SchemaRegistry, not during name hydration.\n}\n\nfunction assertValidIdentifier(\n kind: \"Field\" | \"Mapped column\" | \"Mapped table\" | \"Model\",\n identifier: unknown,\n modelName?: string\n): void {\n if (isValidSchemaIdentifier(identifier)) return;\n const location = modelName ? ` in '${modelName}'` : \"\";\n const renderedIdentifier = String(identifier);\n throw new Error(\n `${kind} '${renderedIdentifier}'${location} is invalid identifier; identifiers must be ASCII, at most 63 bytes, and must not collide with Object.prototype properties`\n );\n}\n\n/**\n * Check if a schema has been hydrated\n */\nexport function isSchemaHydrated(schema: Schema): boolean {\n const firstModel = Object.values(schema)[0];\n if (!firstModel) {\n return true;\n } // Empty schema is considered hydrated\n return firstModel[\"~\"].names.ts !== undefined;\n}\n\n/**\n * Get the SQL name for a model (throws if not hydrated)\n */\nexport function getModelSqlName(model: Model<any>): string {\n const sqlName = model[\"~\"].names.sql;\n if (!sqlName) {\n throw new Error(\n \"Schema not hydrated. Call hydrateSchemaNames() or create a client first.\"\n );\n }\n return sqlName;\n}\n\n/**\n * Get the SQL name for a scalar field key.\n * Delegates to model[\"~\"].getFieldName().\n */\nexport function getFieldSqlName(model: Model<any>, fieldKey: string): string {\n return model[\"~\"].getFieldName(fieldKey).sql;\n}\n"],"mappings":"8IAsCA,SAAgB,mBAAmB,EAAgB,EAAU,GAAa,CACxE,IAAM,EAAgB,OAAO,QAAQ,EAAO,CAE5C,GAAI,EAAS,CACX,IAAK,GAAM,CAAC,EAAU,KAAU,EAC9B,eAAe,EAAU,EAAM,CACjC,OAKF,IAAM,EAAgB,EAAmC,EAAc,CACvE,GAAI,EAAe,MAAM,IAAI,EAAsB,CAAC,EAAc,CAAC,CACnE,IAAK,GAAM,CAAC,EAAU,KAAU,EAC9B,0BAA0B,EAAU,EAAM,CAE5C,IAAK,GAAM,CAAC,EAAU,KAAU,EAC9B,eAAe,EAAU,EAAM,CAenC,SAAS,0BAA0B,EAAkB,EAAyB,CAC5E,IAAM,EAAQ,EAAM,KAAK,MAEzB,sBAAsB,QAAS,EAAS,CACpC,EAAM,YAAc,IAAA,IACtB,sBAAsB,eAAgB,EAAM,UAAW,EAAS,CAElE,IAAK,IAAM,KAAY,OAAO,KAAK,EAAM,MAAM,CAC7C,sBAAsB,QAAS,EAAU,EAAS,CAEpD,IAAK,IAAM,KAAU,OAAO,OAAO,EAAM,QAAkC,CACrE,EAAO,KAAK,MAAM,aAAe,IAAA,IACnC,sBACE,gBACA,EAAO,KAAK,MAAM,WAClB,EACD,CAaP,SAAS,eAAe,EAAkB,EAAyB,CACjE,IAAM,EAAQ,EAAM,KAAK,MACnB,EAAQ,EAAM,KAAK,MACnB,EAAW,EAAM,KAAK,aAE5B,EAAM,GAAK,EACX,EAAM,IAAM,EAAM,WAAa,EAE/B,IAAK,GAAM,CAAC,EAAU,KAAW,OAAO,QACtC,EAAM,QACP,CAAE,CACD,IAAM,EAA0B,CAC9B,GAAI,EACJ,IAAK,EAAO,KAAK,MAAM,YAAc,EACtC,CACD,EAAS,OAAO,IAAI,EAAU,EAAW,EAM7C,SAAS,sBACP,EACA,EACA,EACM,CACN,GAAI,EAAwB,EAAW,CAAE,OACzC,IAAM,EAAW,EAAY,QAAQ,EAAU,GAAK,GAC9C,EAAqB,OAAO,EAAW,CAC7C,MAAU,MACR,GAAG,EAAK,IAAI,EAAmB,GAAG,EAAS,4HAC5C"}
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-wlv81COV.mjs";import{t as n}from"./migrations-OE5D32qo.mjs";import{it as r,st as i}from"./geo-point-codec-CIZxuIvE.mjs";import{o as a}from"./sql-BsBoKwaf.mjs";import{n as o,r as s}from"./model-D94xU8jq.mjs";import{i as c}from"./keys-D5hv9EaJ.mjs";import{t as l}from"./hydration-BNEFeV5v.mjs";import{l as u,n as d,u as f}from"./validator-DqI5RlVU.mjs";import{N as p}from"./standard-sql-BtzSzrof.mjs";function mapReferentialAction(e){switch(e.toUpperCase()){case`CASCADE`:return`cascade`;case`SET NULL`:return`setNull`;case`RESTRICT`:return`restrict`;case`SET DEFAULT`:return`setDefault`;default:return`noAction`}}function groupBy(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function groupByNested(e,t,n){let r=new Map;for(let i of e){let e=t(i),a=n(i),o=r.get(e);o||(o=new Map,r.set(e,o));let s=o.get(a);s?s.push(i):o.set(a,[i])}return r}const m=`[0-9a-fA-F]`,h=`[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]`,g=`[0-9A-Za-z]`,_={uuid:{length:36,regex:`^${m}{8}-${m}{4}-${m}{4}-${m}{4}-${m}{12}$`,glob:`${m.repeat(8)}-${m.repeat(4)}-${m.repeat(4)}-${m.repeat(4)}-${m.repeat(12)}`,fold:`lower`,max:void 0},ulid:{length:26,regex:`^[0-7]${h}{25}$`,glob:`[0-7]${h.repeat(25)}`,fold:`upper`,max:void 0},ksuid:{length:27,regex:`^${g}{27}$`,glob:g.repeat(27),fold:void 0,max:i}};function patternOf(e){return e.format===`ulid`?_.ulid:e.format===`ksuid`?_.ksuid:_.uuid}const int=e=>a.raw(String(e));function fromSql(e,t,n,r){let i=p(t===`mysql`?"`":`"`),o=t===`postgresql`&&n?`${i(n)}.`:``;return a.raw(`${o+i(s(e))} AS ${r}`)}function columnSql(e,t,n,r){let i=p(n===`mysql`?"`":`"`);return a.raw(`${r}.${i(o(e,t))}`)}function payloadSql(e,t){let n=t.prefix;return n?a`substr(${e}, ${int(n.length+2)})`:e}function bytesSql(e,t){return t===`mysql`?a`CAST(${e} AS BINARY)`:e}function orderedSql(e,t){return t===`postgresql`?a`CAST(${e} AS text) COLLATE "C"`:bytesSql(e,t)}function admitsSql(e,t,n){let r=patternOf(t),i=payloadSql(e,t),o=n===`postgresql`?a`${i} ~ ${r.regex}`:n===`mysql`?a`${i} REGEXP ${r.regex}`:a`${i} GLOB ${r.glob}`,s=a`${a.raw(n===`mysql`?`CHAR_LENGTH`:`length`)}(${i}) = ${int(r.length)} AND ${o}`,c=r.max===void 0?s:a`${s} AND ${orderedSql(i,n)} <= ${r.max}`,l=t.prefix;return l?a`${bytesSql(a`substr(${e}, 1, ${int(l.length+1)})`,n)} = ${`${l}-`} AND ${c}`:c}function foldSql(e,t,n){let r=patternOf(t).fold,i=payloadSql(e,t);return bytesSql(r===void 0?i:a`${a.raw(r)}(${i})`,n)}function foldCollisionCheck(e,t,n,r){return{kind:`trusted-read`,query:a`SELECT COUNT(${t}) = COUNT(DISTINCT ${foldSql(t,n,r)}) AS ok FROM ${e}`,equals:!0}}function isSingleColumnKey(e,t){return c(e).referenceableKeys.some(e=>e.length===1&&e[0]===t)}const noRowWhere=(e,t)=>({kind:`trusted-read`,query:a`SELECT NOT EXISTS (SELECT 1 FROM ${e} WHERE ${t}) AS ok`,equals:!0});function referencingColumns(e,t){let n=[];for(let r of u(t))if(r.kind===`foreignKey`&&(r.endpoints[0]===r.owner?r.endpoints[1]:r.endpoints[0]).source===e.model)for(let t of r.reference.members)t.referencedField===e.field&&n.push({model:r.owner.source,field:t.foreignField});return n}function identifierConversionChecks(e){let{model:i,field:c,dialect:u,namespace:p}=e;l(e.schema);let m=d(e.schema),h=f(i,c,m);if(h===void 0||!r(h.format))throw new n(`'${s(i)}.${o(i,c)}' has no compactly stored identifier domain, so it has no text conversion to check: only uuid, uuidv7, ulid and ksuid change storage.`,t.INVALID_INPUT);let g=fromSql(i,u,p,`p`),_=columnSql(i,c,u,`p`),v=[noRowWhere(g,a`${_} IS NOT NULL AND NOT (${admitsSql(_,h,u)})`)],y=patternOf(h).fold!==void 0;y&&v.push(foldCollisionCheck(g,_,h,u));for(let t of referencingColumns(e,m)){let e=fromSql(t.model,u,p,`c`),n=columnSql(t.model,t.field,u,`c`);v.push(noRowWhere(e,a`${n} IS NOT NULL AND NOT (${admitsSql(n,h,u)})`)),y&&isSingleColumnKey(t.model,t.field)&&v.push(foldCollisionCheck(e,n,h,u)),v.push(noRowWhere(e,a`${n} IS NOT NULL AND NOT EXISTS (SELECT 1 FROM ${g} WHERE ${foldSql(_,h,u)} = ${foldSql(n,h,u)})`))}return v}const v=/^(?:text|citext|varchar\(\d+\)|character varying.*)$/i,literal=e=>`'${e.replaceAll(`'`,`''`)}'`;function postgresTextToUuidGuard(e,t){let n=`${e}.${t}`;return`DO \$viborm\$ DECLARE invalid bigint; BEGIN SELECT count(*) INTO invalid FROM ${e} WHERE ${t} IS NOT NULL AND ${t} !~ ${literal(_.uuid.regex)}; IF invalid > 0 THEN RAISE EXCEPTION ${literal(`VibORM: % row(s) of ${n} are not canonical uuid text, so this conversion would abort on them. A prefixed identifier is one of the shapes that fails here: only the payload is stored, and no generated statement strips a prefix. Convert the rows yourself — add the uuid column, write the payloads into it, drop the old column and rename — or keep the column as it is with a text-family native type, which validates the domain without changing storage.`)}, invalid; END IF; END \$viborm\$`}function isPostgresTextToUuid(e,t){return t.toLowerCase()===`uuid`&&v.test(e.trim())}export{groupByNested as a,groupBy as i,isPostgresTextToUuid as n,mapReferentialAction as o,postgresTextToUuidGuard as r,identifierConversionChecks as t};
2
+ //# sourceMappingURL=identifier-conversion-C_XCo9es.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"identifier-conversion-DV63mwKG.mjs","names":["sql"],"sources":["../src/migrations/drivers/utils.ts","../src/migrations/identifier-conversion.ts"],"sourcesContent":["/**\n * Migration Driver Utilities\n *\n * Shared helper functions used across multiple migration drivers.\n */\n\nimport type { ReferentialAction } from \"../types\";\n\n/** A catalog's `ON DELETE` / `ON UPDATE` spelling, as a ReferentialAction. */\nexport function mapReferentialAction(rule: string): ReferentialAction {\n switch (rule.toUpperCase()) {\n case \"CASCADE\":\n return \"cascade\";\n case \"SET NULL\":\n return \"setNull\";\n case \"RESTRICT\":\n return \"restrict\";\n case \"SET DEFAULT\":\n return \"setDefault\";\n default:\n return \"noAction\";\n }\n}\n\n/**\n * Groups items by a key function.\n *\n * @param items - Array of items to group\n * @param keyFn - Function to extract the grouping key\n * @returns Map from key to array of items\n */\nexport function groupBy<T>(\n items: T[],\n keyFn: (item: T) => string\n): Map<string, T[]> {\n const map = new Map<string, T[]>();\n for (const item of items) {\n const key = keyFn(item);\n const existing = map.get(key);\n if (existing) {\n existing.push(item);\n } else {\n map.set(key, [item]);\n }\n }\n return map;\n}\n\n/**\n * Groups items by two levels of keys (nested grouping).\n *\n * @param items - Array of items to group\n * @param primaryKeyFn - Function to extract the primary grouping key\n * @param secondaryKeyFn - Function to extract the secondary grouping key\n * @returns Nested Map structure\n */\nexport function groupByNested<T>(\n items: T[],\n primaryKeyFn: (item: T) => string,\n secondaryKeyFn: (item: T) => string\n): Map<string, Map<string, T[]>> {\n const map = new Map<string, Map<string, T[]>>();\n for (const item of items) {\n const pk = primaryKeyFn(item);\n const sk = secondaryKeyFn(item);\n\n let secondary = map.get(pk);\n if (!secondary) {\n secondary = new Map();\n map.set(pk, secondary);\n }\n\n const existing = secondary.get(sk);\n if (existing) {\n existing.push(item);\n } else {\n secondary.set(sk, [item]);\n }\n }\n return map;\n}\n","/**\n * The three questions an EXISTING text column has to answer before it can\n * become an identifier column — asked as SQL, against the live database, by\n * the person doing the conversion.\n *\n * VibORM does not convert a populated text column on its own: the generated\n * `alterColumn` into a binary column is refused outright\n * ({@link file://./binary-conversion.ts}), and PostgreSQL's one automated leg,\n * `text` → `uuid`, is a per-value cast that either succeeds for the whole table\n * or aborts it. Both routes leave the same work to the author, and this module\n * is the part of that work a machine can state exactly:\n *\n * 1. **Every row is a value of the domain.** Prefix matched whole, payload in\n * the format's own grammar and width — and, for a KSUID, at most the text\n * of the largest value its 20 bytes hold. A row that is not is a row no\n * route can carry.\n * 2. **No two rows fold together.** `uuid` admits uppercase and `ulid`\n * lowercase as ALIASES, so a text column may hold two spellings of one\n * identifier. Compact storage holds the canonical one, so those two rows\n * become one value — violating a unique key, or silently merging two rows\n * where there is none. `ksuid` has no aliases and gets no such check. Asked\n * of the key AND of every referencing column that is a complete key of its\n * own model, because that column carries its own unique constraint through\n * the same fold; a non-unique foreign key holds repeats by design and is\n * never asked.\n * 3. **Every foreign key still finds its parent after the fold.** The FK\n * column converts with its own normalization, so agreement has to be proven\n * against the NORMALIZED sets rather than the stored text.\n *\n * Each check is one row and one boolean column, so each is exactly a\n * {@link MigrationCheckInput} — the `trusted-read` shape `generate()` already\n * accepts as `originChecks` on a manual transition. Run them by hand, or put\n * them in front of your own conversion migration; they are the same SQL either\n * way.\n *\n * Every IDENTITY comparison these checks make is asked of BYTES, because the\n * column they are about answers in bytes. MySQL 8's default collation is\n * `utf8mb4_0900_ai_ci`, where `=` folds case and accents: a bare\n * `p.id = c.userId` there answers TRUE for a KSUID pair that a `BINARY(20)`\n * column will hold as two different values, so an estate certified ready came\n * out of the conversion with a foreign key naming no parent. `CAST(… AS BINARY)`\n * pins it, and it pins across character sets where `COLLATE utf8mb4_bin` raises\n * on a `latin1` column. The grammar match is deliberately NOT cast: MySQL's\n * `REGEXP` refuses a binary operand outright, and every pattern here already\n * spells both cases, so nothing is lost.\n *\n * Pure and connection-free, like every other module in this layer: it renders\n * SQL, it never executes it.\n *\n * What it does NOT cover, deliberately: a junction table's own columns and a\n * polymorphic row carrier's id column. Those hold a key's values too and\n * convert by the same recipe, but they are private storage with no (model,\n * field) to name them by, so the migration guide lists them rather than this\n * module guessing at them.\n */\n\nimport { type Sql, sql } from \"@sql\";\nimport { MigrationError, VibORMErrorCode } from \"../errors\";\nimport { hydrateSchemaNames } from \"../schema/hydration\";\nimport {\n type AnyModel,\n getColumnName,\n getModelKeyCatalog,\n getTableName,\n} from \"../schema/model\";\nimport { idDomainOf } from \"../schema/validation/id-domains\";\nimport {\n type ResolvedRelationIndex,\n resolvedEdges,\n} from \"../schema/validation/relation-resolution\";\nimport { resolveSchemaOrThrow } from \"../schema/validation/validator\";\nimport { createIdentifierQuoter } from \"../sql/identifiers\";\nimport {\n type IdDomain,\n isCompactIdFormat,\n} from \"../validation/primitives/id-codec\";\nimport { KSUID_MAX_TEXT } from \"../validation/primitives/id-formats\";\nimport type { Dialect } from \"./drivers/types\";\nimport type { MigrationCheckInput } from \"./v1-types\";\n\n/** The key whose text column is being converted, and the schema it lives in. */\nexport interface IdentifierConversionRequest {\n /**\n * The WHOLE schema, not just the model: a foreign key's domain is derived\n * from the resolved topology, and so is the list of columns that reference\n * this key. Resolved here, exactly as `serializeModels` resolves it.\n */\n readonly schema: Record<string, AnyModel>;\n readonly model: AnyModel;\n readonly field: string;\n readonly dialect: Dialect;\n /** PostgreSQL's target namespace, when the estate is bound to one. */\n readonly namespace?: string | undefined;\n}\n\n/** One character class, spelled once for both pattern languages. */\nconst HEX = \"[0-9a-fA-F]\";\nconst CROCKFORD = \"[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]\";\nconst BASE62 = \"[0-9A-Za-z]\";\n\n/**\n * The payload grammar of each compact format, as a regex and as a GLOB, and\n * the largest payload text when the grammar alone admits more than the bytes\n * hold.\n *\n * A ULID's grammar carries its own bound — the leading `[0-7]` — but 27 base62\n * characters express more than 2^160 values, and no character class can say\n * where 2^160 falls. So a KSUID is bounded by comparison against the codec's\n * own maximum text, read from `id-formats.ts` rather than spelled here.\n */\nconst PATTERNS = {\n uuid: {\n length: 36,\n regex: `^${HEX}{8}-${HEX}{4}-${HEX}{4}-${HEX}{4}-${HEX}{12}$`,\n glob: `${HEX.repeat(8)}-${HEX.repeat(4)}-${HEX.repeat(4)}-${HEX.repeat(4)}-${HEX.repeat(12)}`,\n fold: \"lower\",\n max: undefined,\n },\n ulid: {\n length: 26,\n regex: `^[0-7]${CROCKFORD}{25}$`,\n glob: `[0-7]${CROCKFORD.repeat(25)}`,\n fold: \"upper\",\n max: undefined,\n },\n ksuid: {\n length: 27,\n regex: `^${BASE62}{27}$`,\n glob: BASE62.repeat(27),\n fold: undefined,\n max: KSUID_MAX_TEXT,\n },\n} as const;\n\n/** `uuidv7` shares a uuid's grammar: the version nibble is not a storage fact. */\nfunction patternOf(domain: IdDomain) {\n if (domain.format === \"ulid\") return PATTERNS.ulid;\n if (domain.format === \"ksuid\") return PATTERNS.ksuid;\n return PATTERNS.uuid;\n}\n\n/** A literal integer: a width, never caller text, so it is text and not a bind. */\nconst int = (value: number): Sql => sql.raw(String(value));\n\n/** One quoted, optionally qualified table name, bound to a one-letter alias. */\nfunction fromSql(\n model: AnyModel,\n dialect: Dialect,\n namespace: string | undefined,\n alias: string\n): Sql {\n const quote = createIdentifierQuoter(dialect === \"mysql\" ? \"`\" : '\"');\n const qualifier =\n dialect === \"postgresql\" && namespace ? `${quote(namespace)}.` : \"\";\n return sql.raw(`${qualifier + quote(getTableName(model))} AS ${alias}`);\n}\n\n/**\n * One column, always written through its table's alias.\n *\n * The FK checks correlate two tables, and a one-to-one child whose primary key\n * IS its foreign key names both columns `id` — an unqualified reference there\n * binds to the inner table and compares a value with itself.\n */\nfunction columnSql(\n model: AnyModel,\n field: string,\n dialect: Dialect,\n alias: string\n): Sql {\n const quote = createIdentifierQuoter(dialect === \"mysql\" ? \"`\" : '\"');\n return sql.raw(`${alias}.${quote(getColumnName(model, field))}`);\n}\n\n/** The payload of a stored value: the whole column, or what follows the prefix. */\nfunction payloadSql(column: Sql, domain: IdDomain): Sql {\n const prefix = domain.prefix;\n if (!prefix) return column;\n return sql`substr(${column}, ${int(prefix.length + 2)})`;\n}\n\n/**\n * One comparison operand, asked as the bytes the compact column will hold.\n *\n * Only MySQL needs it, and only because its default collation answers a\n * different question than the column will: see the module note above. Not\n * applied to `REGEXP`, which refuses a binary operand.\n */\nfunction bytesSql(expression: Sql, dialect: Dialect): Sql {\n return dialect === \"mysql\" ? sql`CAST(${expression} AS BINARY)` : expression;\n}\n\n/**\n * One ORDERING operand, compared byte by byte on every dialect.\n *\n * Fixed-width base62 text sorts as its number only under byte order: every\n * database default here that is not bytes folds case, and there `a` sorts\n * before `V`. MySQL takes the byte pin `bytesSql` already applies; PostgreSQL\n * takes `COLLATE \"C\"`, after a cast to `text` because `citext` — a text-family\n * type a KSUID column may hold — lowercases before any collation is consulted;\n * SQLite's default collation is already `BINARY`, as every identity\n * comparison in this module already relies on.\n */\nfunction orderedSql(expression: Sql, dialect: Dialect): Sql {\n if (dialect === \"postgresql\") {\n return sql`CAST(${expression} AS text) COLLATE \"C\"`;\n }\n return bytesSql(expression, dialect);\n}\n\n/** Whether one stored value is a value of the domain. */\nfunction admitsSql(column: Sql, domain: IdDomain, dialect: Dialect): Sql {\n const pattern = patternOf(domain);\n const payload = payloadSql(column, domain);\n const matches =\n dialect === \"postgresql\"\n ? sql`${payload} ~ ${pattern.regex}`\n : dialect === \"mysql\"\n ? sql`${payload} REGEXP ${pattern.regex}`\n : sql`${payload} GLOB ${pattern.glob}`;\n const width = sql.raw(dialect === \"mysql\" ? \"CHAR_LENGTH\" : \"length\");\n const grammar = sql`${width}(${payload}) = ${int(pattern.length)} AND ${matches}`;\n const sized =\n pattern.max === undefined\n ? grammar\n : sql`${grammar} AND ${orderedSql(payload, dialect)} <= ${pattern.max}`;\n const prefix = domain.prefix;\n if (!prefix) return sized;\n const spelled = bytesSql(\n sql`substr(${column}, 1, ${int(prefix.length + 1)})`,\n dialect\n );\n return sql`${spelled} = ${`${prefix}-`} AND ${sized}`;\n}\n\n/**\n * The canonical spelling of one stored value, as the bytes it will become:\n * the alias fold for a format that has one, then the dialect's byte pin.\n */\nfunction foldSql(column: Sql, domain: IdDomain, dialect: Dialect): Sql {\n const fold = patternOf(domain).fold;\n const payload = payloadSql(column, domain);\n return bytesSql(\n fold === undefined ? payload : sql`${sql.raw(fold)}(${payload})`,\n dialect\n );\n}\n\n/**\n * `COUNT(col) = COUNT(DISTINCT fold(col))`: the question a UNIQUE column has to\n * answer before its aliases collapse into one another.\n */\nfunction foldCollisionCheck(\n from: Sql,\n column: Sql,\n domain: IdDomain,\n dialect: Dialect\n): MigrationCheckInput {\n return {\n kind: \"trusted-read\",\n query: sql`SELECT COUNT(${column}) = COUNT(DISTINCT ${foldSql(column, domain, dialect)}) AS ok FROM ${from}`,\n equals: true,\n };\n}\n\n/**\n * Whether this column is, BY ITSELF, a complete key of its own model.\n *\n * The fold question belongs to every column that carries a uniqueness\n * constraint through it, and a referencing column often does: the one-to-one\n * child whose primary key IS its foreign key is the ordinary shape, and a\n * `.unique()` foreign key is the other. Asking it of a plain many-side foreign\n * key would refuse every healthy estate on earth — repeats there are the\n * relation — so the catalog decides, not the fact of being a reference.\n *\n * `referenceableKeys` is the right catalog rather than the addressable one: a\n * total unique INDEX no selector can name still refuses a duplicate.\n */\nfunction isSingleColumnKey(model: AnyModel, field: string): boolean {\n return getModelKeyCatalog(model).referenceableKeys.some(\n (key) => key.length === 1 && key[0] === field\n );\n}\n\n/** `SELECT NOT EXISTS (…)`, the shape every row check takes. */\nconst noRowWhere = (from: Sql, predicate: Sql): MigrationCheckInput => ({\n kind: \"trusted-read\",\n query: sql`SELECT NOT EXISTS (SELECT 1 FROM ${from} WHERE ${predicate}) AS ok`,\n equals: true,\n});\n\n/** Every foreign-key column that holds this key's values. */\nfunction referencingColumns(\n request: IdentifierConversionRequest,\n index: ResolvedRelationIndex\n): { model: AnyModel; field: string }[] {\n const columns: { model: AnyModel; field: string }[] = [];\n for (const edge of resolvedEdges(index)) {\n if (edge.kind !== \"foreignKey\") continue;\n const other =\n edge.endpoints[0] === edge.owner ? edge.endpoints[1] : edge.endpoints[0];\n if (other.source !== request.model) continue;\n for (const member of edge.reference.members) {\n if (member.referencedField !== request.field) continue;\n columns.push({ model: edge.owner.source, field: member.foreignField });\n }\n }\n return columns;\n}\n\n/**\n * The pre-checks for converting one key's text column into its identifier\n * column, in the order a conversion needs them.\n *\n * Refuses a field with no compactly stored identifier domain rather than\n * answering with an empty list: an empty list reads as \"this estate is ready\",\n * and that is the one answer a caller who named the wrong field must not get.\n */\nexport function identifierConversionChecks(\n request: IdentifierConversionRequest\n): readonly MigrationCheckInput[] {\n const { model, field, dialect, namespace } = request;\n hydrateSchemaNames(request.schema);\n const index = resolveSchemaOrThrow(request.schema);\n const domain = idDomainOf(model, field, index);\n if (domain === undefined || !isCompactIdFormat(domain.format)) {\n throw new MigrationError(\n `'${getTableName(model)}.${getColumnName(model, field)}' has no compactly stored identifier domain, so it has no text conversion to check: only uuid, uuidv7, ulid and ksuid change storage.`,\n VibORMErrorCode.INVALID_INPUT\n );\n }\n const parent = fromSql(model, dialect, namespace, \"p\");\n const key = columnSql(model, field, dialect, \"p\");\n const checks: MigrationCheckInput[] = [\n noRowWhere(\n parent,\n sql`${key} IS NOT NULL AND NOT (${admitsSql(key, domain, dialect)})`\n ),\n ];\n const folds = patternOf(domain).fold !== undefined;\n if (folds) {\n checks.push(foldCollisionCheck(parent, key, domain, dialect));\n }\n for (const reference of referencingColumns(request, index)) {\n const child = fromSql(reference.model, dialect, namespace, \"c\");\n const fk = columnSql(reference.model, reference.field, dialect, \"c\");\n checks.push(\n noRowWhere(\n child,\n sql`${fk} IS NOT NULL AND NOT (${admitsSql(fk, domain, dialect)})`\n )\n );\n if (folds && isSingleColumnKey(reference.model, reference.field)) {\n checks.push(foldCollisionCheck(child, fk, domain, dialect));\n }\n checks.push(\n noRowWhere(\n child,\n sql`${fk} IS NOT NULL AND NOT EXISTS (SELECT 1 FROM ${parent} WHERE ${foldSql(key, domain, dialect)} = ${foldSql(fk, domain, dialect)})`\n )\n );\n }\n return checks;\n}\n\n// =============================================================================\n// THE ONE AUTOMATED LEG\n// =============================================================================\n\n/** The text column spellings PostgreSQL can hold an identifier in. */\nconst PG_TEXT_COLUMN = /^(?:text|citext|varchar\\(\\d+\\)|character varying.*)$/i;\n\n/** A SQL string literal: the only escape a quoted name needs inside one. */\nconst literal = (text: string): string => `'${text.replaceAll(\"'\", \"''\")}'`;\n\n/**\n * The message PostgreSQL's own `col::uuid` does not give.\n *\n * `ALTER COLUMN … TYPE uuid USING col::uuid` converts value by value: it\n * succeeds for an estate of canonical uuids and raises\n * `invalid input syntax for type uuid: \"…\"` on the first row that is not one,\n * aborting the transaction and leaving the column as it was. The outcome is\n * right; the message names one offending row and nothing about the choice the\n * author actually has. This runs FIRST, inside the same transaction, and says\n * how many rows are in the way and what the two routes are.\n *\n * A PREFIXED domain fails here too, and deliberately: `usr-a0ee…` is not uuid\n * text, and no `USING substring(col from 5)::uuid` is emitted for it, because\n * the snapshot carries the column TYPE and not the domain — the prefix is a\n * fact of the declaration that no migration artifact has ever held. Converting\n * a prefixed column is a manual route, and this says so before anything runs.\n *\n * It is not a second refusal: without it the conversion fails anyway. Its whole\n * and only coverage is the message.\n */\nexport function postgresTextToUuidGuard(\n qualifiedTable: string,\n quotedColumn: string\n): string {\n const marker = `${qualifiedTable}.${quotedColumn}`;\n return (\n \"DO $viborm$ DECLARE invalid bigint; BEGIN \" +\n `SELECT count(*) INTO invalid FROM ${qualifiedTable} WHERE ${quotedColumn} IS NOT NULL AND ${quotedColumn} !~ ${literal(PATTERNS.uuid.regex)}; ` +\n \"IF invalid > 0 THEN RAISE EXCEPTION \" +\n `${literal(`VibORM: % row(s) of ${marker} are not canonical uuid text, so this conversion would abort on them. A prefixed identifier is one of the shapes that fails here: only the payload is stored, and no generated statement strips a prefix. Convert the rows yourself — add the uuid column, write the payloads into it, drop the old column and rename — or keep the column as it is with a text-family native type, which validates the domain without changing storage.`)}, invalid; ` +\n \"END IF; END $viborm$\"\n );\n}\n\n/** Whether this alteration is the one text→identifier conversion pg performs. */\nexport function isPostgresTextToUuid(\n fromType: string,\n toType: string\n): boolean {\n return (\n toType.toLowerCase() === \"uuid\" && PG_TEXT_COLUMN.test(fromType.trim())\n );\n}\n"],"mappings":"6aASA,SAAgB,qBAAqB,EAAiC,CACpE,OAAQ,EAAK,aAAa,CAA1B,CACE,IAAK,UACH,MAAO,UACT,IAAK,WACH,MAAO,UACT,IAAK,WACH,MAAO,WACT,IAAK,cACH,MAAO,aACT,QACE,MAAO,YAWb,SAAgB,QACd,EACA,EACkB,CAClB,IAAM,EAAM,IAAI,IAChB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAM,EAAK,CACjB,EAAW,EAAI,IAAI,EAAI,CACzB,EACF,EAAS,KAAK,EAAK,CAEnB,EAAI,IAAI,EAAK,CAAC,EAAK,CAAC,CAGxB,OAAO,EAWT,SAAgB,cACd,EACA,EACA,EAC+B,CAC/B,IAAM,EAAM,IAAI,IAChB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAK,EAAa,EAAK,CACvB,EAA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AgC,CACpC,WACE,EACA,CAAG,GAAG,EAAI,wBAAwB,UAAU,EAAK,EAAQ,EAAQ,CAAC,GACnE,CACF,CACK,EAAQ,UAAU,EAAO,CAAC,OAAS,IAAA,GACrC,GACF,EAAO,KAAK,mBAAmB,EAAQ,EAAK,EAAQ,EAAQ,CAAC,CAE/D,IAAK,IAAM,KAAa,mBAAmB,EAAS,EAAM,CAAE,CAC1D,IAAM,EAAQ,QAAQ,EAAU,MAAO,EAAS,EAAW,IAAI,CACzD,EAAK,UAAU,EAAU,MAAO,EAAU,MAAO,EAAS,IAAI,CACpE,EAAO,KACL,WACE,EACA,CAAG,GAAG,EAAG,wBAAwB,UAAU,EAAI,EAAQ,EAAQ,CAAC,GACjE,CACF,CACG,GAAS,kBAAkB,EAAU,MAAO,EAAU,MAAM,EAC9D,EAAO,KAAK,mBAAmB,EAAO,EAAI,EAAQ,EAAQ,CAAC,CAE7D,EAAO,KACL,WACE,EACA,CAAG,GAAG,EAAG,6CAA6C,EAAO,SAAS,QAAQ,EAAK,EAAQ,EAAQ,CAAC,KAAK,QAAQ,EAAI,EAAQ,EAAQ,CAAC,GACvI,CACF,CAEH,OAAO,EAQT,MAAM,EAAiB,wDAGjB,QAAW,GAAyB,IAAI,EAAK,WAAW,IAAK,KAAK,CAAC,GAsBzE,SAAgB,wBACd,EACA,EACQ,CACR,IAAM,EAAS,GAAG,EAAe,GAAG,IACpC,MACE,iFACqC,EAAe,SAAS,EAAa,mBAAmB,EAAa,MAAM,QAAQ,EAAS,KAAK,MAAM,CAAC,wCAE1I,QAAQ,uBAAuB,EAAO,0aAA0a,CAAC,mCAMxd,SAAgB,qBACd,EACA,EACS,CACT,OACE,EAAO,aAAa,GAAK,QAAU,EAAe,KAAK,EAAS,MAAM,CAAC"}
1
+ {"version":3,"file":"identifier-conversion-C_XCo9es.mjs","names":["sql"],"sources":["../src/migrations/drivers/utils.ts","../src/migrations/identifier-conversion.ts"],"sourcesContent":["/**\n * Migration Driver Utilities\n *\n * Shared helper functions used across multiple migration drivers.\n */\n\nimport type { ReferentialAction } from \"../types\";\n\n/** A catalog's `ON DELETE` / `ON UPDATE` spelling, as a ReferentialAction. */\nexport function mapReferentialAction(rule: string): ReferentialAction {\n switch (rule.toUpperCase()) {\n case \"CASCADE\":\n return \"cascade\";\n case \"SET NULL\":\n return \"setNull\";\n case \"RESTRICT\":\n return \"restrict\";\n case \"SET DEFAULT\":\n return \"setDefault\";\n default:\n return \"noAction\";\n }\n}\n\n/**\n * Groups items by a key function.\n *\n * @param items - Array of items to group\n * @param keyFn - Function to extract the grouping key\n * @returns Map from key to array of items\n */\nexport function groupBy<T>(\n items: T[],\n keyFn: (item: T) => string\n): Map<string, T[]> {\n const map = new Map<string, T[]>();\n for (const item of items) {\n const key = keyFn(item);\n const existing = map.get(key);\n if (existing) {\n existing.push(item);\n } else {\n map.set(key, [item]);\n }\n }\n return map;\n}\n\n/**\n * Groups items by two levels of keys (nested grouping).\n *\n * @param items - Array of items to group\n * @param primaryKeyFn - Function to extract the primary grouping key\n * @param secondaryKeyFn - Function to extract the secondary grouping key\n * @returns Nested Map structure\n */\nexport function groupByNested<T>(\n items: T[],\n primaryKeyFn: (item: T) => string,\n secondaryKeyFn: (item: T) => string\n): Map<string, Map<string, T[]>> {\n const map = new Map<string, Map<string, T[]>>();\n for (const item of items) {\n const pk = primaryKeyFn(item);\n const sk = secondaryKeyFn(item);\n\n let secondary = map.get(pk);\n if (!secondary) {\n secondary = new Map();\n map.set(pk, secondary);\n }\n\n const existing = secondary.get(sk);\n if (existing) {\n existing.push(item);\n } else {\n secondary.set(sk, [item]);\n }\n }\n return map;\n}\n","/**\n * The three questions an EXISTING text column has to answer before it can\n * become an identifier column — asked as SQL, against the live database, by\n * the person doing the conversion.\n *\n * VibORM does not convert a populated text column on its own: the generated\n * `alterColumn` into a binary column is refused outright\n * ({@link file://./binary-conversion.ts}), and PostgreSQL's one automated leg,\n * `text` → `uuid`, is a per-value cast that either succeeds for the whole table\n * or aborts it. Both routes leave the same work to the author, and this module\n * is the part of that work a machine can state exactly:\n *\n * 1. **Every row is a value of the domain.** Prefix matched whole, payload in\n * the format's own grammar and width — and, for a KSUID, at most the text\n * of the largest value its 20 bytes hold. A row that is not is a row no\n * route can carry.\n * 2. **No two rows fold together.** `uuid` admits uppercase and `ulid`\n * lowercase as ALIASES, so a text column may hold two spellings of one\n * identifier. Compact storage holds the canonical one, so those two rows\n * become one value — violating a unique key, or silently merging two rows\n * where there is none. `ksuid` has no aliases and gets no such check. Asked\n * of the key AND of every referencing column that is a complete key of its\n * own model, because that column carries its own unique constraint through\n * the same fold; a non-unique foreign key holds repeats by design and is\n * never asked.\n * 3. **Every foreign key still finds its parent after the fold.** The FK\n * column converts with its own normalization, so agreement has to be proven\n * against the NORMALIZED sets rather than the stored text.\n *\n * Each check is one row and one boolean column, so each is exactly a\n * {@link MigrationCheckInput} — the `trusted-read` shape `generate()` already\n * accepts as `originChecks` on a manual transition. Run them by hand, or put\n * them in front of your own conversion migration; they are the same SQL either\n * way.\n *\n * Every IDENTITY comparison these checks make is asked of BYTES, because the\n * column they are about answers in bytes. MySQL 8's default collation is\n * `utf8mb4_0900_ai_ci`, where `=` folds case and accents: a bare\n * `p.id = c.userId` there answers TRUE for a KSUID pair that a `BINARY(20)`\n * column will hold as two different values, so an estate certified ready came\n * out of the conversion with a foreign key naming no parent. `CAST(… AS BINARY)`\n * pins it, and it pins across character sets where `COLLATE utf8mb4_bin` raises\n * on a `latin1` column. The grammar match is deliberately NOT cast: MySQL's\n * `REGEXP` refuses a binary operand outright, and every pattern here already\n * spells both cases, so nothing is lost.\n *\n * Pure and connection-free, like every other module in this layer: it renders\n * SQL, it never executes it.\n *\n * What it does NOT cover, deliberately: a junction table's own columns and a\n * polymorphic row carrier's id column. Those hold a key's values too and\n * convert by the same recipe, but they are private storage with no (model,\n * field) to name them by, so the migration guide lists them rather than this\n * module guessing at them.\n */\n\nimport { type Sql, sql } from \"@sql\";\nimport { MigrationError, VibORMErrorCode } from \"../errors\";\nimport { hydrateSchemaNames } from \"../schema/hydration\";\nimport {\n type AnyModel,\n getColumnName,\n getModelKeyCatalog,\n getTableName,\n} from \"../schema/model\";\nimport { idDomainOf } from \"../schema/validation/id-domains\";\nimport {\n type ResolvedRelationIndex,\n resolvedEdges,\n} from \"../schema/validation/relation-resolution\";\nimport { resolveSchemaOrThrow } from \"../schema/validation/validator\";\nimport { createIdentifierQuoter } from \"../sql/identifiers\";\nimport {\n type IdDomain,\n isCompactIdFormat,\n} from \"../validation/primitives/id-codec\";\nimport { KSUID_MAX_TEXT } from \"../validation/primitives/id-formats\";\nimport type { Dialect } from \"./drivers/types\";\nimport type { MigrationCheckInput } from \"./v1-types\";\n\n/** The key whose text column is being converted, and the schema it lives in. */\nexport interface IdentifierConversionRequest {\n /**\n * The WHOLE schema, not just the model: a foreign key's domain is derived\n * from the resolved topology, and so is the list of columns that reference\n * this key. Resolved here, exactly as `serializeModels` resolves it.\n */\n readonly schema: Record<string, AnyModel>;\n readonly model: AnyModel;\n readonly field: string;\n readonly dialect: Dialect;\n /** PostgreSQL's target namespace, when the estate is bound to one. */\n readonly namespace?: string | undefined;\n}\n\n/** One character class, spelled once for both pattern languages. */\nconst HEX = \"[0-9a-fA-F]\";\nconst CROCKFORD = \"[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]\";\nconst BASE62 = \"[0-9A-Za-z]\";\n\n/**\n * The payload grammar of each compact format, as a regex and as a GLOB, and\n * the largest payload text when the grammar alone admits more than the bytes\n * hold.\n *\n * A ULID's grammar carries its own bound — the leading `[0-7]` — but 27 base62\n * characters express more than 2^160 values, and no character class can say\n * where 2^160 falls. So a KSUID is bounded by comparison against the codec's\n * own maximum text, read from `id-formats.ts` rather than spelled here.\n */\nconst PATTERNS = {\n uuid: {\n length: 36,\n regex: `^${HEX}{8}-${HEX}{4}-${HEX}{4}-${HEX}{4}-${HEX}{12}$`,\n glob: `${HEX.repeat(8)}-${HEX.repeat(4)}-${HEX.repeat(4)}-${HEX.repeat(4)}-${HEX.repeat(12)}`,\n fold: \"lower\",\n max: undefined,\n },\n ulid: {\n length: 26,\n regex: `^[0-7]${CROCKFORD}{25}$`,\n glob: `[0-7]${CROCKFORD.repeat(25)}`,\n fold: \"upper\",\n max: undefined,\n },\n ksuid: {\n length: 27,\n regex: `^${BASE62}{27}$`,\n glob: BASE62.repeat(27),\n fold: undefined,\n max: KSUID_MAX_TEXT,\n },\n} as const;\n\n/** `uuidv7` shares a uuid's grammar: the version nibble is not a storage fact. */\nfunction patternOf(domain: IdDomain) {\n if (domain.format === \"ulid\") return PATTERNS.ulid;\n if (domain.format === \"ksuid\") return PATTERNS.ksuid;\n return PATTERNS.uuid;\n}\n\n/** A literal integer: a width, never caller text, so it is text and not a bind. */\nconst int = (value: number): Sql => sql.raw(String(value));\n\n/** One quoted, optionally qualified table name, bound to a one-letter alias. */\nfunction fromSql(\n model: AnyModel,\n dialect: Dialect,\n namespace: string | undefined,\n alias: string\n): Sql {\n const quote = createIdentifierQuoter(dialect === \"mysql\" ? \"`\" : '\"');\n const qualifier =\n dialect === \"postgresql\" && namespace ? `${quote(namespace)}.` : \"\";\n return sql.raw(`${qualifier + quote(getTableName(model))} AS ${alias}`);\n}\n\n/**\n * One column, always written through its table's alias.\n *\n * The FK checks correlate two tables, and a one-to-one child whose primary key\n * IS its foreign key names both columns `id` — an unqualified reference there\n * binds to the inner table and compares a value with itself.\n */\nfunction columnSql(\n model: AnyModel,\n field: string,\n dialect: Dialect,\n alias: string\n): Sql {\n const quote = createIdentifierQuoter(dialect === \"mysql\" ? \"`\" : '\"');\n return sql.raw(`${alias}.${quote(getColumnName(model, field))}`);\n}\n\n/** The payload of a stored value: the whole column, or what follows the prefix. */\nfunction payloadSql(column: Sql, domain: IdDomain): Sql {\n const prefix = domain.prefix;\n if (!prefix) return column;\n return sql`substr(${column}, ${int(prefix.length + 2)})`;\n}\n\n/**\n * One comparison operand, asked as the bytes the compact column will hold.\n *\n * Only MySQL needs it, and only because its default collation answers a\n * different question than the column will: see the module note above. Not\n * applied to `REGEXP`, which refuses a binary operand.\n */\nfunction bytesSql(expression: Sql, dialect: Dialect): Sql {\n return dialect === \"mysql\" ? sql`CAST(${expression} AS BINARY)` : expression;\n}\n\n/**\n * One ORDERING operand, compared byte by byte on every dialect.\n *\n * Fixed-width base62 text sorts as its number only under byte order: every\n * database default here that is not bytes folds case, and there `a` sorts\n * before `V`. MySQL takes the byte pin `bytesSql` already applies; PostgreSQL\n * takes `COLLATE \"C\"`, after a cast to `text` because `citext` — a text-family\n * type a KSUID column may hold — lowercases before any collation is consulted;\n * SQLite's default collation is already `BINARY`, as every identity\n * comparison in this module already relies on.\n */\nfunction orderedSql(expression: Sql, dialect: Dialect): Sql {\n if (dialect === \"postgresql\") {\n return sql`CAST(${expression} AS text) COLLATE \"C\"`;\n }\n return bytesSql(expression, dialect);\n}\n\n/** Whether one stored value is a value of the domain. */\nfunction admitsSql(column: Sql, domain: IdDomain, dialect: Dialect): Sql {\n const pattern = patternOf(domain);\n const payload = payloadSql(column, domain);\n const matches =\n dialect === \"postgresql\"\n ? sql`${payload} ~ ${pattern.regex}`\n : dialect === \"mysql\"\n ? sql`${payload} REGEXP ${pattern.regex}`\n : sql`${payload} GLOB ${pattern.glob}`;\n const width = sql.raw(dialect === \"mysql\" ? \"CHAR_LENGTH\" : \"length\");\n const grammar = sql`${width}(${payload}) = ${int(pattern.length)} AND ${matches}`;\n const sized =\n pattern.max === undefined\n ? grammar\n : sql`${grammar} AND ${orderedSql(payload, dialect)} <= ${pattern.max}`;\n const prefix = domain.prefix;\n if (!prefix) return sized;\n const spelled = bytesSql(\n sql`substr(${column}, 1, ${int(prefix.length + 1)})`,\n dialect\n );\n return sql`${spelled} = ${`${prefix}-`} AND ${sized}`;\n}\n\n/**\n * The canonical spelling of one stored value, as the bytes it will become:\n * the alias fold for a format that has one, then the dialect's byte pin.\n */\nfunction foldSql(column: Sql, domain: IdDomain, dialect: Dialect): Sql {\n const fold = patternOf(domain).fold;\n const payload = payloadSql(column, domain);\n return bytesSql(\n fold === undefined ? payload : sql`${sql.raw(fold)}(${payload})`,\n dialect\n );\n}\n\n/**\n * `COUNT(col) = COUNT(DISTINCT fold(col))`: the question a UNIQUE column has to\n * answer before its aliases collapse into one another.\n */\nfunction foldCollisionCheck(\n from: Sql,\n column: Sql,\n domain: IdDomain,\n dialect: Dialect\n): MigrationCheckInput {\n return {\n kind: \"trusted-read\",\n query: sql`SELECT COUNT(${column}) = COUNT(DISTINCT ${foldSql(column, domain, dialect)}) AS ok FROM ${from}`,\n equals: true,\n };\n}\n\n/**\n * Whether this column is, BY ITSELF, a complete key of its own model.\n *\n * The fold question belongs to every column that carries a uniqueness\n * constraint through it, and a referencing column often does: the one-to-one\n * child whose primary key IS its foreign key is the ordinary shape, and a\n * `.unique()` foreign key is the other. Asking it of a plain many-side foreign\n * key would refuse every healthy estate on earth — repeats there are the\n * relation — so the catalog decides, not the fact of being a reference.\n *\n * `referenceableKeys` is the right catalog rather than the addressable one: a\n * total unique INDEX no selector can name still refuses a duplicate.\n */\nfunction isSingleColumnKey(model: AnyModel, field: string): boolean {\n return getModelKeyCatalog(model).referenceableKeys.some(\n (key) => key.length === 1 && key[0] === field\n );\n}\n\n/** `SELECT NOT EXISTS (…)`, the shape every row check takes. */\nconst noRowWhere = (from: Sql, predicate: Sql): MigrationCheckInput => ({\n kind: \"trusted-read\",\n query: sql`SELECT NOT EXISTS (SELECT 1 FROM ${from} WHERE ${predicate}) AS ok`,\n equals: true,\n});\n\n/** Every foreign-key column that holds this key's values. */\nfunction referencingColumns(\n request: IdentifierConversionRequest,\n index: ResolvedRelationIndex\n): { model: AnyModel; field: string }[] {\n const columns: { model: AnyModel; field: string }[] = [];\n for (const edge of resolvedEdges(index)) {\n if (edge.kind !== \"foreignKey\") continue;\n const other =\n edge.endpoints[0] === edge.owner ? edge.endpoints[1] : edge.endpoints[0];\n if (other.source !== request.model) continue;\n for (const member of edge.reference.members) {\n if (member.referencedField !== request.field) continue;\n columns.push({ model: edge.owner.source, field: member.foreignField });\n }\n }\n return columns;\n}\n\n/**\n * The pre-checks for converting one key's text column into its identifier\n * column, in the order a conversion needs them.\n *\n * Refuses a field with no compactly stored identifier domain rather than\n * answering with an empty list: an empty list reads as \"this estate is ready\",\n * and that is the one answer a caller who named the wrong field must not get.\n */\nexport function identifierConversionChecks(\n request: IdentifierConversionRequest\n): readonly MigrationCheckInput[] {\n const { model, field, dialect, namespace } = request;\n hydrateSchemaNames(request.schema);\n const index = resolveSchemaOrThrow(request.schema);\n const domain = idDomainOf(model, field, index);\n if (domain === undefined || !isCompactIdFormat(domain.format)) {\n throw new MigrationError(\n `'${getTableName(model)}.${getColumnName(model, field)}' has no compactly stored identifier domain, so it has no text conversion to check: only uuid, uuidv7, ulid and ksuid change storage.`,\n VibORMErrorCode.INVALID_INPUT\n );\n }\n const parent = fromSql(model, dialect, namespace, \"p\");\n const key = columnSql(model, field, dialect, \"p\");\n const checks: MigrationCheckInput[] = [\n noRowWhere(\n parent,\n sql`${key} IS NOT NULL AND NOT (${admitsSql(key, domain, dialect)})`\n ),\n ];\n const folds = patternOf(domain).fold !== undefined;\n if (folds) {\n checks.push(foldCollisionCheck(parent, key, domain, dialect));\n }\n for (const reference of referencingColumns(request, index)) {\n const child = fromSql(reference.model, dialect, namespace, \"c\");\n const fk = columnSql(reference.model, reference.field, dialect, \"c\");\n checks.push(\n noRowWhere(\n child,\n sql`${fk} IS NOT NULL AND NOT (${admitsSql(fk, domain, dialect)})`\n )\n );\n if (folds && isSingleColumnKey(reference.model, reference.field)) {\n checks.push(foldCollisionCheck(child, fk, domain, dialect));\n }\n checks.push(\n noRowWhere(\n child,\n sql`${fk} IS NOT NULL AND NOT EXISTS (SELECT 1 FROM ${parent} WHERE ${foldSql(key, domain, dialect)} = ${foldSql(fk, domain, dialect)})`\n )\n );\n }\n return checks;\n}\n\n// =============================================================================\n// THE ONE AUTOMATED LEG\n// =============================================================================\n\n/** The text column spellings PostgreSQL can hold an identifier in. */\nconst PG_TEXT_COLUMN = /^(?:text|citext|varchar\\(\\d+\\)|character varying.*)$/i;\n\n/** A SQL string literal: the only escape a quoted name needs inside one. */\nconst literal = (text: string): string => `'${text.replaceAll(\"'\", \"''\")}'`;\n\n/**\n * The message PostgreSQL's own `col::uuid` does not give.\n *\n * `ALTER COLUMN … TYPE uuid USING col::uuid` converts value by value: it\n * succeeds for an estate of canonical uuids and raises\n * `invalid input syntax for type uuid: \"…\"` on the first row that is not one,\n * aborting the transaction and leaving the column as it was. The outcome is\n * right; the message names one offending row and nothing about the choice the\n * author actually has. This runs FIRST, inside the same transaction, and says\n * how many rows are in the way and what the two routes are.\n *\n * A PREFIXED domain fails here too, and deliberately: `usr-a0ee…` is not uuid\n * text, and no `USING substring(col from 5)::uuid` is emitted for it, because\n * the snapshot carries the column TYPE and not the domain — the prefix is a\n * fact of the declaration that no migration artifact has ever held. Converting\n * a prefixed column is a manual route, and this says so before anything runs.\n *\n * It is not a second refusal: without it the conversion fails anyway. Its whole\n * and only coverage is the message.\n */\nexport function postgresTextToUuidGuard(\n qualifiedTable: string,\n quotedColumn: string\n): string {\n const marker = `${qualifiedTable}.${quotedColumn}`;\n return (\n \"DO $viborm$ DECLARE invalid bigint; BEGIN \" +\n `SELECT count(*) INTO invalid FROM ${qualifiedTable} WHERE ${quotedColumn} IS NOT NULL AND ${quotedColumn} !~ ${literal(PATTERNS.uuid.regex)}; ` +\n \"IF invalid > 0 THEN RAISE EXCEPTION \" +\n `${literal(`VibORM: % row(s) of ${marker} are not canonical uuid text, so this conversion would abort on them. A prefixed identifier is one of the shapes that fails here: only the payload is stored, and no generated statement strips a prefix. Convert the rows yourself — add the uuid column, write the payloads into it, drop the old column and rename — or keep the column as it is with a text-family native type, which validates the domain without changing storage.`)}, invalid; ` +\n \"END IF; END $viborm$\"\n );\n}\n\n/** Whether this alteration is the one text→identifier conversion pg performs. */\nexport function isPostgresTextToUuid(\n fromType: string,\n toType: string\n): boolean {\n return (\n toType.toLower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,EAAQ,CAAC,KAAK,QAAQ,EAAI,EAAQ,EAAQ,CAAC,GACvI,CACF,CAEH,OAAO,EAQT,MAAM,EAAiB,wDAGjB,QAAW,GAAyB,IAAI,EAAK,WAAW,IAAK,KAAK,CAAC,GAsBzE,SAAgB,wBACd,EACA,EACQ,CACR,IAAM,EAAS,GAAG,EAAe,GAAG,IACpC,MACE,iFACqC,EAAe,SAAS,EAAa,mBAAmB,EAAa,MAAM,QAAQ,EAAS,KAAK,MAAM,CAAC,wCAE1I,QAAQ,uBAAuB,EAAO,0aAA0a,CAAC,mCAMxd,SAAgB,qBACd,EACA,EACS,CACT,OACE,EAAO,aAAa,GAAK,QAAU,EAAe,KAAK,EAAS,MAAM,CAAC"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-wlv81COV.mjs";import{t as n}from"./migrations-OE5D32qo.mjs";import{t as r}from"./sha256-Da07rzvR.mjs";const i=`sha256`,a={estate:`viborm.migration.estate.v1`,snapshot:`viborm.migration.snapshot.v1`,snapshotDelta:`viborm.migration.snapshot-delta.v1`,sql:`viborm.migration.sql.v1`,dispatch:`viborm.migration.dispatch.v1`,transition:`viborm.migration.transition.v1`,state:`viborm.migration.state.v1`,path:`viborm.migration.path.v1`,plan:`viborm.migration.plan.v1`,resetPlan:`viborm.migration.reset-plan.v1`,event:`viborm.migration.event.v1`},o=/^[0-9a-f]{64}$/,s=new TextEncoder;function isSha256(e){return typeof e==`string`&&o.test(e)}function parseSha256(e,r){if(!isSha256(e))throw new n(`${r} is not a lowercase 64-hex SHA-256 digest`,t.MIGRATION_INVALID_ESTATE);return e}function sha256Hex(e){let t=``;for(let n of r(e))t+=n.toString(16).padStart(2,`0`);return t}function domainHash(e,t){let n=s.encode(e),r=new Uint8Array(n.length+1+t.length);return r.set(n,0),r[n.length]=0,r.set(t,n.length+1),sha256Hex(r)}function utf8Bytes(e){return s.encode(e)}function decodeUtf8(e){return new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(e)}export{isSha256 as a,utf8Bytes as c,domainHash as i,a as n,parseSha256 as o,decodeUtf8 as r,sha256Hex as s,i as t};
2
- //# sourceMappingURL=identity-B75EaVTM.mjs.map
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-wlv81COV.mjs";import{t as n}from"./migrations-OE5D32qo.mjs";import{t as r}from"./sha256-D_fCV62w.mjs";const i=`sha256`,a={estate:`viborm.migration.estate.v1`,snapshot:`viborm.migration.snapshot.v1`,snapshotDelta:`viborm.migration.snapshot-delta.v1`,sql:`viborm.migration.sql.v1`,dispatch:`viborm.migration.dispatch.v1`,transition:`viborm.migration.transition.v1`,state:`viborm.migration.state.v1`,path:`viborm.migration.path.v1`,plan:`viborm.migration.plan.v1`,resetPlan:`viborm.migration.reset-plan.v1`,event:`viborm.migration.event.v1`},o=/^[0-9a-f]{64}$/,s=new TextEncoder;function isSha256(e){return typeof e==`string`&&o.test(e)}function parseSha256(e,r){if(!isSha256(e))throw new n(`${r} is not a lowercase 64-hex SHA-256 digest`,t.MIGRATION_INVALID_ESTATE);return e}function sha256Hex(e){let t=``;for(let n of r(e))t+=n.toString(16).padStart(2,`0`);return t}function domainHash(e,t){let n=s.encode(e),r=new Uint8Array(n.length+1+t.length);return r.set(n,0),r[n.length]=0,r.set(t,n.length+1),sha256Hex(r)}function utf8Bytes(e){return s.encode(e)}function decodeUtf8(e){return new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(e)}export{isSha256 as a,utf8Bytes as c,domainHash as i,a as n,parseSha256 as o,decodeUtf8 as r,sha256Hex as s,i as t};
2
+ //# sourceMappingURL=identity-BtuwgqhS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity-B75EaVTM.mjs","names":[],"sources":["../src/migrations/identity.ts"],"sourcesContent":["/**\n * Content-addressed identity for Migration V1.\n *\n * One hash owner: SHA-256 over a frozen ASCII domain label, 0x00, then the\n * exact bytes being authenticated. Filenames and stored hex digests are the\n * lowercase 64-hex form of that digest. There is no self-referential checksum\n * header and no second hasher.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../errors\";\nimport { sha256 } from \"../validation/primitives/sha256\";\n\nexport type Sha256 = string;\n\nexport const HASH_ALGORITHM = \"sha256\";\n\nexport const HASH_DOMAIN = {\n estate: \"viborm.migration.estate.v1\",\n snapshot: \"viborm.migration.snapshot.v1\",\n snapshotDelta: \"viborm.migration.snapshot-delta.v1\",\n sql: \"viborm.migration.sql.v1\",\n dispatch: \"viborm.migration.dispatch.v1\",\n transition: \"viborm.migration.transition.v1\",\n state: \"viborm.migration.state.v1\",\n path: \"viborm.migration.path.v1\",\n plan: \"viborm.migration.plan.v1\",\n resetPlan: \"viborm.migration.reset-plan.v1\",\n event: \"viborm.migration.event.v1\",\n} as const;\n\nexport type HashDomain = (typeof HASH_DOMAIN)[keyof typeof HASH_DOMAIN];\n\nconst HEX64 = /^[0-9a-f]{64}$/;\nconst UTF8 = new TextEncoder();\n\nexport function isSha256(value: unknown): value is Sha256 {\n return typeof value === \"string\" && HEX64.test(value);\n}\n\nexport function parseSha256(value: unknown, label: string): Sha256 {\n if (!isSha256(value)) {\n throw new MigrationError(\n `${label} is not a lowercase 64-hex SHA-256 digest`,\n VibORMErrorCode.MIGRATION_INVALID_ESTATE\n );\n }\n return value;\n}\n\nexport function sha256Hex(bytes: Uint8Array): Sha256 {\n let hex = \"\";\n for (const byte of sha256(bytes)) hex += byte.toString(16).padStart(2, \"0\");\n return hex;\n}\n\nexport function domainHash(domain: HashDomain, bytes: Uint8Array): Sha256 {\n const prefix = UTF8.encode(domain);\n const input = new Uint8Array(prefix.length + 1 + bytes.length);\n input.set(prefix, 0);\n input[prefix.length] = 0;\n input.set(bytes, prefix.length + 1);\n return sha256Hex(input);\n}\n\nexport function utf8Bytes(text: string): Uint8Array {\n return UTF8.encode(text);\n}\n\n/**\n * Exactly the characters the bytes encode — a leading U+FEFF among them.\n *\n * These bytes are a VALUE (a catalog default, a blob's text), not a document\n * with a byte-order mark: the decoder's default of swallowing a leading U+FEFF\n * would report a value its source does not hold. A caller that refuses a BOM\n * refuses it as a byte, before this (`validateSqlRanges`).\n */\nexport function decodeUtf8(bytes: Uint8Array): string {\n return new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true }).decode(\n bytes\n );\n}\n"],"mappings":"yKAcA,MAAa,EAAiB,SAEjB,EAAc,CACzB,OAAQ,6BACR,SAAU,+BACV,cAAe,qCACf,IAAK,0BACL,SAAU,+BACV,WAAY,iCACZ,MAAO,4BACP,KAAM,2BACN,KAAM,2BACN,UAAW,iCACX,MAAO,4BACR,CAIK,EAAQ,iBACR,EAAO,IAAI,YAEjB,SAAgB,SAAS,EAAiC,CACxD,OAAO,OAAO,GAAU,UAAY,EAAM,KAAK,EAAM,CAGvD,SAAgB,YAAY,EAAgB,EAAuB,CACjE,GAAI,CAAC,SAAS,EAAM,CAClB,MAAM,IAAI,EACR,GAAG,EAAM,2CACT,EAAgB,yBACjB,CAEH,OAAO,EAGT,SAAgB,UAAU,EAA2B,CACnD,IAAI,EAAM,GACV,IAAK,IAAM,KAAQ,EAAO,EAAM,CAAE,GAAO,EAAK,SAAS,GAAG,CAAC,SAAS,EAAG,IAAI,CAC3E,OAAO,EAGT,SAAgB,WAAW,EAAoB,EAA2B,CACxE,IAAM,EAAS,EAAK,OAAO,EAAO,CAC5B,EAAQ,IAAI,WAAW,EAAO,OAAS,EAAI,EAAM,OAAO,CAI9D,OAHA,EAAM,IAAI,EAAQ,EAAE,CACpB,EAAM,EAAO,QAAU,EACvB,EAAM,IAAI,EAAO,EAAO,OAAS,EAAE,CAC5B,UAAU,EAAM,CAGzB,SAAgB,UAAU,EAA0B,CAClD,OAAO,EAAK,OAAO,EAAK,CAW1B,SAAgB,WAAW,EAA2B,CACpD,OAAO,IAAI,YAAY,QAAS,CAAE,MAAO,GAAM,UAAW,GAAM,CAAC,CAAC,OAChE,EACD"}
1
+ {"version":3,"file":"identity-BtuwgqhS.mjs","names":[],"sources":["../src/migrations/identity.ts"],"sourcesContent":["/**\n * Content-addressed identity for Migration V1.\n *\n * One hash owner: SHA-256 over a frozen ASCII domain label, 0x00, then the\n * exact bytes being authenticated. Filenames and stored hex digests are the\n * lowercase 64-hex form of that digest. There is no self-referential checksum\n * header and no second hasher.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../errors\";\nimport { sha256 } from \"../validation/primitives/sha256\";\n\nexport type Sha256 = string;\n\nexport const HASH_ALGORITHM = \"sha256\";\n\nexport const HASH_DOMAIN = {\n estate: \"viborm.migration.estate.v1\",\n snapshot: \"viborm.migration.snapshot.v1\",\n snapshotDelta: \"viborm.migration.snapshot-delta.v1\",\n sql: \"viborm.migration.sql.v1\",\n dispatch: \"viborm.migration.dispatch.v1\",\n transition: \"viborm.migration.transition.v1\",\n state: \"viborm.migration.state.v1\",\n path: \"viborm.migration.path.v1\",\n plan: \"viborm.migration.plan.v1\",\n resetPlan: \"viborm.migration.reset-plan.v1\",\n event: \"viborm.migration.event.v1\",\n} as const;\n\nexport type HashDomain = (typeof HASH_DOMAIN)[keyof typeof HASH_DOMAIN];\n\nconst HEX64 = /^[0-9a-f]{64}$/;\nconst UTF8 = new TextEncoder();\n\nexport function isSha256(value: unknown): value is Sha256 {\n return typeof value === \"string\" && HEX64.test(value);\n}\n\nexport function parseSha256(value: unknown, label: string): Sha256 {\n if (!isSha256(value)) {\n throw new MigrationError(\n `${label} is not a lowercase 64-hex SHA-256 digest`,\n VibORMErrorCode.MIGRATION_INVALID_ESTATE\n );\n }\n return value;\n}\n\nexport function sha256Hex(bytes: Uint8Array): Sha256 {\n let hex = \"\";\n for (const byte of sha256(bytes)) hex += byte.toString(16).padStart(2, \"0\");\n return hex;\n}\n\nexport function domainHash(domain: HashDomain, bytes: Uint8Array): Sha256 {\n const prefix = UTF8.encode(domain);\n const input = new Uint8Array(prefix.length + 1 + bytes.length);\n input.set(prefix, 0);\n input[prefix.length] = 0;\n input.set(bytes, prefix.length + 1);\n return sha256Hex(input);\n}\n\nexport function utf8Bytes(text: string): Uint8Array {\n return UTF8.encode(text);\n}\n\n/**\n * Exactly the characters the bytes encode — a leading U+FEFF among them.\n *\n * These bytes are a VALUE (a catalog default, a blob's text), not a document\n * with a byte-order mark: the decoder's default of swallowing a leading U+FEFF\n * would report a value its source does not hold. A caller that refuses a BOM\n * refuses it as a byte, before this (`validateSqlRanges`).\n */\nexport function decodeUtf8(bytes: Uint8Array): string {\n return new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true }).decode(\n bytes\n );\n}\n"],"mappings":"yKAcA,MAAa,EAAiB,SAEjB,EAAc,CACzB,OAAQ,6BACR,SAAU,+BACV,cAAe,qCACf,IAAK,0BACL,SAAU,+BACV,WAAY,iCACZ,MAAO,4BACP,KAAM,2BACN,KAAM,2BACN,UAAW,iCACX,MAAO,4BACR,CAIK,EAAQ,iBACR,EAAO,IAAI,YAEjB,SAAgB,SAAS,EAAiC,CACxD,OAAO,OAAO,GAAU,UAAY,EAAM,KAAK,EAAM,CAGvD,SAAgB,YAAY,EAAgB,EAAuB,CACjE,GAAI,CAAC,SAAS,EAAM,CAClB,MAAM,IAAI,EACR,GAAG,EAAM,2CACT,EAAgB,yBACjB,CAEH,OAAO,EAGT,SAAgB,UAAU,EAA2B,CACnD,IAAI,EAAM,GACV,IAAK,IAAM,KAAQ,EAAO,EAAM,CAAE,GAAO,EAAK,SAAS,GAAG,CAAC,SAAS,EAAG,IAAI,CAC3E,OAAO,EAGT,SAAgB,WAAW,EAAoB,EAA2B,CACxE,IAAM,EAAS,EAAK,OAAO,EAAO,CAC5B,EAAQ,IAAI,WAAW,EAAO,OAAS,EAAI,EAAM,OAAO,CAI9D,OAHA,EAAM,IAAI,EAAQ,EAAE,CACpB,EAAM,EAAO,QAAU,EACvB,EAAM,IAAI,EAAO,EAAO,OAAS,EAAE,CAC5B,UAAU,EAAM,CAGzB,SAAgB,UAAU,EAA0B,CAClD,OAAO,EAAK,OAAO,EAAK,CAW1B,SAAgB,WAAW,EAA2B,CACpD,OAAO,IAAI,YAAY,QAAS,CAAE,MAAO,GAAM,UAAW,GAAM,CAAC,CAAC,OAChE,EACD"}
@@ -1,4 +1,4 @@
1
- import { c as sqlTag, n as Sql } from "./sql-CF5Xi6z-.mjs";
1
+ import { c as sqlTag, n as Sql } from "./sql-D7JnXgUh.mjs";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/schema/scalars/native-types.d.ts
@@ -5454,13 +5454,33 @@ type EnableExtensionCache<X$1 extends ExtensionStateConstraint> = ClientExtensio
5454
5454
  }>, X$1["rows"], X$1["data"], X$1["result"]>;
5455
5455
  /** Whether an earlier extension was typed against result-bearing delegates. */
5456
5456
  type HasResultConsumingExtension<X$1 extends ExtensionStateConstraint> = [X$1["resultConsumer"]] extends [undefined] ? false : [X$1["resultConsumer"]] extends [ExtensionResultConsumerState] ? true : false;
5457
+ declare const delegateState: unique symbol;
5458
+ /**
5459
+ * Declaration-only: what a result read on a delegate of a chain that adds
5460
+ * model methods depends on (its client's config, the models the chain's
5461
+ * `rows` can hide, its computed fields, the model), so a method typed with a
5462
+ * `this` parameter reads its result from the client it is called on
5463
+ * (`DelegateOperationResult`), whatever the chain added after it. Nothing
5464
+ * else of the extension state: a later step that changes none of these (the
5465
+ * cache) keeps the client assignable to the one before it. No property is
5466
+ * installed at runtime.
5467
+ */
5468
+ interface DelegateState<C$1, Rows$1, Result$1, ModelName$1> {
5469
+ readonly [delegateState]?: readonly [C$1, Rows$1, Result$1, ModelName$1];
5470
+ }
5457
5471
  type MethodsForModel<X$1 extends ExtensionStateConstraint, ModelName$1 extends PropertyKey> = ModelName$1 extends keyof X$1["models"] ? X$1["models"][ModelName$1] : NoMethods;
5472
+ /**
5473
+ * The link, on every delegate of a chain that adds model methods: decided by
5474
+ * the extension state alone, so a client generic over its schema without
5475
+ * them (the empty state) compares as before.
5476
+ */
5477
+ type DelegateLink<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint, ModelName$1 extends PropertyKey> = [keyof X$1["models"]] extends [never] ? unknown : DelegateState<C$1, X$1["rows"], X$1["result"], ModelName$1>;
5458
5478
  /**
5459
5479
  * One model's delegate after the chain's methods and controls. On a chain
5460
5480
  * that declares create `data`, its writes may leave out the fields the chain
5461
5481
  * writes on a create.
5462
5482
  */
5463
- type ExtensionModelDelegate<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint, ModelName$1 extends keyof ClientSchema<C$1>> = ([X$1["data"]] extends [never] ? Client<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"]>[ModelName$1] : Omit<Client<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"]>[ModelName$1], StampedOperation> & StampedOperations<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"], X$1["data"], ModelName$1>) & MethodsForModel<X$1, ModelName$1>;
5483
+ type ExtensionModelDelegate<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint, ModelName$1 extends keyof ClientSchema<C$1>> = ([X$1["data"]] extends [never] ? Client<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"]>[ModelName$1] : Omit<Client<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"]>[ModelName$1], StampedOperation> & StampedOperations<C$1, ClientRowsContext<C$1, X$1["rows"]>, X$1["controls"], X$1["data"], ModelName$1>) & MethodsForModel<X$1, ModelName$1> & DelegateLink<C$1, X$1, ModelName$1>;
5464
5484
  /**
5465
5485
  * One model's delegate on a chain that declares `result`: its projecting
5466
5486
  * operations rebuilt so `select` and `omit` name the computed fields and the
@@ -5531,11 +5551,30 @@ type ModelMethodsOf<Definition$1> = Definition$1 extends {
5531
5551
  readonly model: infer Factories;
5532
5552
  } ? Factories extends object ? { readonly [ModelName in keyof Factories]: Factories[ModelName] extends ((...args: never[]) => infer Methods) ? Methods extends object ? Methods : NoMethods : NoMethods } : NoMethods : NoMethods;
5533
5553
  type MergeModelMethods<Left extends object, Right extends object> = { readonly [ModelName in keyof Left | keyof Right]: (ModelName extends keyof Left ? Left[ModelName] : NoMethods) & (ModelName extends keyof Right ? Right[ModelName] : NoMethods) };
5534
- type ResultConsumerContextOf<Definition$1> = Definition$1 extends {
5535
- readonly client: unknown;
5536
- } | {
5537
- readonly model: unknown;
5538
- } ? "result-consuming" : Definition$1 extends {
5554
+ /** Whether one parameter list holds an argument typed other than `never` or `unknown` (`any` counts as typed). */
5555
+ type TypedParameters<Given extends readonly unknown[]> = true extends { [Index in keyof Given]: 0 extends 1 & Given[Index] ? true : [Given[Index]] extends [never] ? false : unknown extends Given[Index] ? false : true }[number] ? true : false;
5556
+ /**
5557
+ * Whether a client or model factory is typed against the client it is
5558
+ * applied to: one of its signatures takes an argument typed other than
5559
+ * `never` or `unknown`. A factory that takes none reads nothing typed at its
5560
+ * step, so a later `rows` or `defaultOmit` cannot make its types lie: its
5561
+ * methods type their results from the client they are called on (a `this`
5562
+ * parameter), and it is no result consumer. Matched against four
5563
+ * signatures, so an overloaded factory is read by its last four (one
5564
+ * signature repeats).
5565
+ */
5566
+ type ReadsTyped<Factory$1> = Factory$1 extends {
5567
+ (...args: infer First): unknown;
5568
+ (...args: infer Second): unknown;
5569
+ (...args: infer Third): unknown;
5570
+ (...args: infer Fourth): unknown;
5571
+ } ? true extends TypedParameters<First> | TypedParameters<Second> | TypedParameters<Third> | TypedParameters<Fourth> ? true : false : true;
5572
+ type TypedFactories<Definition$1> = (Definition$1 extends {
5573
+ readonly client: infer Factory;
5574
+ } ? ReadsTyped<Factory> : false) | (Definition$1 extends {
5575
+ readonly model: infer Factories;
5576
+ } ? Factories extends object ? { [ModelName in keyof Factories]: ReadsTyped<Factories[ModelName]> }[keyof Factories] : true : false);
5577
+ type ResultConsumerContextOf<Definition$1> = true extends TypedFactories<Definition$1> ? "result-consuming" : Definition$1 extends {
5539
5578
  readonly query: infer Query;
5540
5579
  } ? Query extends CallableFunction ? "result-independent" : "result-consuming" : "result-independent";
5541
5580
  /** Incoming facts keep their nominal bit derivation inside this named state. */
@@ -5642,8 +5681,8 @@ type ExtensionConfig<S$1 extends Schema$1> = {
5642
5681
  * it extends (`(delegate: M[K & keyof M]) => …`, generic over that client) is
5643
5682
  * compared in either direction rather than only contravariantly.
5644
5683
  */
5645
- type ModelMethodFactory<Delegate> = {
5646
- factory(delegate: Delegate): ExtensionMethodRecord;
5684
+ type ModelMethodFactory<Delegate, Scope> = {
5685
+ factory(delegate: Delegate, scope: Scope): ExtensionMethodRecord;
5647
5686
  }["factory"];
5648
5687
  /**
5649
5688
  * One factory per schema model. A definition's model key is looked up here by
@@ -5652,7 +5691,7 @@ type ModelMethodFactory<Delegate> = {
5652
5691
  * client is substituted rather than deferred, so a plugin generic over `C`
5653
5692
  * type-checks and meets the schema check when it is applied.
5654
5693
  */
5655
- type ModelFactoryTable<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = { readonly [ModelName in keyof ClientSchema<C$1>]: ModelMethodFactory<ExtensionModelDelegate<C$1, X$1, ModelName>> };
5694
+ type ModelFactoryTable<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = { readonly [ModelName in keyof ClientSchema<C$1>]: ModelMethodFactory<ExtensionModelDelegate<C$1, X$1, ModelName>, ExtensionClientScope<C$1, X$1>> };
5656
5695
  /** The model keys a definition's own `model` map names. */
5657
5696
  type DefinitionModelKeys<Self> = Self extends {
5658
5697
  readonly model?: infer Factories;
@@ -5663,7 +5702,7 @@ type DefinitionModelKeys<Self> = Self extends {
5663
5702
  */
5664
5703
  type ContextualExtensionDefinition<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint, Self = unknown> = ExtensionMembers<C$1, X$1> & {
5665
5704
  readonly result?: ResultDefinition<C$1>;
5666
- readonly model?: unknown extends Self ? { readonly [ModelName in keyof ClientSchema<C$1>]?: ModelMethodFactory<ExtensionModelDelegate<C$1, X$1, ModelName>> } : { readonly [ModelName in DefinitionModelKeys<Self>]?: ModelFactoryTable<C$1, X$1>[ModelName & keyof ClientSchema<C$1>] };
5705
+ readonly model?: unknown extends Self ? { readonly [ModelName in keyof ClientSchema<C$1>]?: ModelMethodFactory<ExtensionModelDelegate<C$1, X$1, ModelName>, ExtensionClientScope<C$1, X$1>> } : { readonly [ModelName in DefinitionModelKeys<Self>]?: ModelFactoryTable<C$1, X$1>[ModelName & keyof ClientSchema<C$1>] };
5667
5706
  };
5668
5707
  type ExtensionMembers<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = {
5669
5708
  readonly name: string;
@@ -5675,6 +5714,7 @@ type ExtensionMembers<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstr
5675
5714
  readonly rows?: RowsContribution;
5676
5715
  readonly deletion?: DeletionContribution;
5677
5716
  readonly data?: DataContribution;
5717
+ readonly order?: OrderContribution;
5678
5718
  readonly client?: (scope: ExtensionClientScope<C$1, X$1>) => ExtensionMethodRecord;
5679
5719
  };
5680
5720
  type SchemaGenericExtensionDefinition = Omit<ContextualExtensionDefinition<ExtensionConfig<Schema$1>, EmptyClientExtensionState>, "request" | "query"> & {
@@ -5706,13 +5746,13 @@ type SchemaBoundExtensionAdmission<Definition$1, C$1 extends VibORMConfig> = Def
5706
5746
  type OperationMapGuard<Map$1, S$1 extends Schema$1> = Map$1 extends CallableFunction ? unknown : Map$1 extends object ? Record<Exclude<keyof Map$1, keyof S$1>, never> & { readonly [ModelName in keyof Map$1]: ModelName extends keyof S$1 ? Map$1[ModelName] extends object ? Record<Exclude<keyof Map$1[ModelName], Operations>, never> : never : never } : never;
5707
5747
  type ComponentMapGuard<Definition$1, Key$1 extends "request" | "query", S$1 extends Schema$1> = Definition$1 extends { readonly [K in Key$1]: infer Component } ? { readonly [K in Key$1]: OperationMapGuard<Component, S$1> } : unknown;
5708
5748
  /** Policy model keys must be a subset of a concrete bound schema. */
5709
- type PolicyModelsGuard<Definition$1, S$1 extends Schema$1, Key$1 extends "data" | "rows" | "deletion"> = Definition$1 extends { readonly [K in Key$1]: {
5749
+ type PolicyModelsGuard<Definition$1, S$1 extends Schema$1, Key$1 extends "data" | "rows" | "deletion" | "order"> = Definition$1 extends { readonly [K in Key$1]: {
5710
5750
  readonly models: infer Models;
5711
5751
  } } ? string extends keyof S$1 ? unknown : [keyof Models] extends [keyof S$1] ? unknown : { readonly [K in Key$1]: {
5712
5752
  readonly models: Record<keyof Models, never>;
5713
5753
  } } : unknown;
5714
5754
  /** Structural refusal for non-fresh extension definitions and contributions. */
5715
- type ExactExtensionDefinition<Definition$1, C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = UnknownDefinitionKeys<Definition$1> & ComponentMapGuard<Definition$1, "request", C$1["schema"]> & ComponentMapGuard<Definition$1, "query", C$1["schema"]> & PolicyModelsGuard<Definition$1, C$1["schema"], "data"> & PolicyModelsGuard<Definition$1, C$1["schema"], "rows"> & PolicyModelsGuard<Definition$1, C$1["schema"], "deletion"> & ExtensionMethodDefinitionGuard<Definition$1, C$1, X$1>;
5755
+ type ExactExtensionDefinition<Definition$1, C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = UnknownDefinitionKeys<Definition$1> & ComponentMapGuard<Definition$1, "request", C$1["schema"]> & ComponentMapGuard<Definition$1, "query", C$1["schema"]> & PolicyModelsGuard<Definition$1, C$1["schema"], "data"> & PolicyModelsGuard<Definition$1, C$1["schema"], "rows"> & PolicyModelsGuard<Definition$1, C$1["schema"], "deletion"> & PolicyModelsGuard<Definition$1, C$1["schema"], "order"> & ExtensionMethodDefinitionGuard<Definition$1, C$1, X$1>;
5716
5756
  type DefineExtensionBinder<S$1 extends Schema$1> = <const Definition$1, Fields$1 = unknown>(definition: Definition$1 & ContextualExtensionDefinition<ExtensionConfig<S$1>, EmptyClientExtensionState> & ExactExtensionDefinition<Definition$1, ExtensionConfig<S$1>, EmptyClientExtensionState> & ResultInference<ExtensionConfig<S$1>, Record<never, never>, Fields$1>) => SchemaBoundExtension<NoInfer<Definition$1>>;
5717
5757
  declare function defineExtension<const Definition$1 extends SchemaGenericExtensionDefinition>(definition: Definition$1 & ExactExtensionDefinition<Definition$1, ExtensionConfig<Schema$1>, EmptyClientExtensionState>): NoInfer<Definition$1>;
5718
5758
  declare function defineExtension<S$1 extends Schema$1>(): DefineExtensionBinder<S$1>;
@@ -5878,6 +5918,23 @@ type DataContribution = {
5878
5918
  };
5879
5919
  };
5880
5920
  };
5921
+ /** One `order` term: a scalar field and its direction. */
5922
+ type OrderTerm = {
5923
+ readonly [field: string]: "asc" | "desc";
5924
+ };
5925
+ /**
5926
+ * Per model, the order its reads take when the caller gives no `orderBy`: a
5927
+ * root `findMany` or `findFirst`, a to-many relation read at any depth
5928
+ * (`include`, `select`, recursive), and the window of a paged aggregate. An
5929
+ * explicit `orderBy` replaces it (`orderBy: []` reads in key order). The
5930
+ * model's key always ends the order. A later extension's entry for a model
5931
+ * replaces an earlier one's.
5932
+ */
5933
+ type OrderContribution = {
5934
+ readonly models: {
5935
+ readonly [model: string]: OrderTerm | readonly OrderTerm[];
5936
+ };
5937
+ };
5881
5938
  /** Operations that select candidates: where a rows control is accepted. */
5882
5939
  type CandidateOperations = Exclude<Operations, "create" | "createMany">;
5883
5940
  /** One declared control as the delegates see it. */
@@ -6426,6 +6483,20 @@ type ExtensionState = ExtensionStateConstraint;
6426
6483
  * `M[K & keyof M]` in a plugin generic over it.
6427
6484
  */
6428
6485
  type ExtendedOperationResult<Client$1, ModelName$1, O$1 extends Operations, Args> = typeof clientTypeState extends keyof Client$1 ? Client$1 extends ClientTypeState<infer C, infer X> ? Client$1 extends VibORMClient<C, X> ? ContextualOperationResult<C, ModelName$1 & keyof ClientSchema<C>, O$1, Args, ClientRowsContext<C, X["rows"]>> : never : never : never;
6486
+ /**
6487
+ * One operation's result on the model delegate `Delegate` it would run on,
6488
+ * as `ExtendedOperationResult` types it for that delegate's client. A model
6489
+ * method declared with a `this` parameter types its result with it, so the
6490
+ * result follows every extension applied after the method's own:
6491
+ * `restore<Self, A>(this: Self, args: A): PendingOperation<
6492
+ * DelegateOperationResult<Self, "update", A>>`.
6493
+ */
6494
+ type DelegateOperationResult<Delegate, O$1 extends Operations, Args> = Delegate extends DelegateState<infer C extends VibORMConfig, infer Rows extends string, infer Result extends object, infer K> ? [keyof Result] extends [never] ? DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args> : O$1 extends Exclude<Operations, ComputedOperation> ? DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args> : WithComputedResult<DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args>, ClientSchema<C>[K & keyof ClientSchema<C>], Args, ComputedResultContext<Result, ClientSchema<C>, K>> : unknown;
6495
+ type DelegateRow<C$1 extends VibORMConfig, Rows$1 extends string, K$1 extends keyof ClientSchema<C$1>, O$1 extends Operations, Args> = ContextualOperationResult<C$1, K$1, O$1, Args, ClientRowsContext<C$1, Rows$1>>;
6496
+ /**
6497
+ * VibORM Client
6498
+ */
6499
+
6429
6500
  /**
6430
6501
  * Create a VibORM client
6431
6502
  *
@@ -13351,6 +13422,12 @@ interface DatabaseAdapter {
13351
13422
  insertDefault: (table: Sql) => Sql;
13352
13423
  /** UPDATE table SET ... WHERE ... */
13353
13424
  update: (table: Sql, sets: Sql, where?: Sql) => Sql;
13425
+ /**
13426
+ * UPDATE table SET ... from `source` (a derived table, aliased) joined
13427
+ * `on` the row written, WHERE ...: `UPDATE … FROM` (PostgreSQL, SQLite),
13428
+ * `UPDATE … JOIN` (MySQL).
13429
+ */
13430
+ updateFrom: (table: Sql, sets: Sql, source: Sql, on: Sql, where?: Sql) => Sql;
13354
13431
  /** DELETE FROM table WHERE ... */
13355
13432
  delete: (table: Sql, where?: Sql) => Sql;
13356
13433
  /** RETURNING clause (PG/SQLite) or empty (MySQL) */
@@ -13695,6 +13772,7 @@ declare class MySQLAdapter implements DatabaseAdapter {
13695
13772
  recursive: (name: string, anchor: Sql, recursive: Sql, union?: "all" | "distinct") => Sql;
13696
13773
  };
13697
13774
  mutations: {
13775
+ updateFrom: (table: any, sets: any, source: any, on: any, where: any) => Sql;
13698
13776
  returning: (_columns: Sql) => Sql;
13699
13777
  onConflict: (_target: Sql | null, action: Sql, _targetWhere?: Sql) => Sql;
13700
13778
  onConflictUpdate: (sets: Sql, _setWhere?: Sql) => Sql;
@@ -13948,6 +14026,7 @@ declare class PostgresAdapter implements DatabaseAdapter {
13948
14026
  upserted: Sql;
13949
14027
  update: (table: Sql, sets: Sql, where?: Sql) => Sql;
13950
14028
  delete: (table: Sql, where?: Sql) => Sql;
14029
+ updateFrom: (table: Sql, sets: Sql, source: Sql, on: Sql, where?: Sql) => Sql;
13951
14030
  skipDuplicatesStrategy: "sql";
13952
14031
  insert: (table: Sql, columns: string[], source: Sql[][] | {
13953
14032
  readonly select: Sql;
@@ -14263,6 +14342,7 @@ declare class SQLiteAdapter implements DatabaseAdapter {
14263
14342
  returning: (columns: Sql) => Sql;
14264
14343
  update: (table: Sql, sets: Sql, where?: Sql) => Sql;
14265
14344
  delete: (table: Sql, where?: Sql) => Sql;
14345
+ updateFrom: (table: Sql, sets: Sql, source: Sql, on: Sql, where?: Sql) => Sql;
14266
14346
  skipDuplicatesStrategy: "sql";
14267
14347
  insert: (table: Sql, columns: string[], source: Sql[][] | {
14268
14348
  readonly select: Sql;
@@ -14312,4 +14392,4 @@ declare const mysqlAdapter: MySQLAdapter;
14312
14392
  declare const postgresAdapter: PostgresAdapter;
14313
14393
  declare const sqliteAdapter: SQLiteAdapter;
14314
14394
  //#endregion
14315
- export { ModelOperationInput as $, SQLITE as $i, DecimalSchema as $n, ValidationError as $r, ExtensionContributionState as $t, Schema$1 as A, isValueTooLongError as Ai, TransactionOptionSupport as An, BooleanSchema as Ar, DriverConfig as At, VariantToOneRelation as B, toPrismaErrorCode as Bi, FieldRef as Bn, DbNull as Br, WriteOutcome as Bt, Client as C, NotNullConstraintError as Ci, CacheSetOptions as Cn, BaseIsoTimestampSchema as Cr, s as Ct, OperationPayloadSchema as D, isForeignKeyError as Di, sqliteResultParser as Dn, BaseEnumSchema as Dr, renderSchemaType as Dt, OperationPayload as E, isCheckConstraintError as Ei, WithCacheOptions as En, IsoTimestampSchema as Er, renderOperationResultType as Et, LinkedClientConfig as F, PrismaErrorCode as Fi, QueryResult as Fn, createJsonSchemaConverter as Fr, VibORMClient as Ft, ParseResult as G, GeoPoint as Gi, IndexDefinition as Gn, JsonSchema$1 as Gr, ClientExtension as Gt, BigIntScalar as H, DiagnosticDisclosure as Hi, createModelFieldRefs as Hn, JsonNullKind as Hr, NoControls as Ht, Links$1 as I, VibORMError as Ii, V$1 as In, toJsonSchema as Ir, VibORMConfig as It, SchemaRegistryOperation as J, Decimal as Ji, InitialModelState as Jn, Getter as Jr, StatementHandler as Jt, Prettify as K, GeoPolygon as Ki, IndexOptions as Kn, inferred as Kr, defineExtension as Kt, RelationLinks as L, VibORMErrorCode as Li, v as Ln, createSchemaRegistry as Lr, createClient as Lt, ClientSchema as M, CacheInvalidKeyError as Mi, CommittedBatchNotification as Mn, BlobSchema as Mr, ExtendedOperationResult as Mt, FlatSchema as N, CacheInvalidTTLError as Ni, Dialect as Nn, BaseBigIntSchema as Nr, ExtensionState as Nt, OperationResult as O, isNotNullConstraintError as Oi, BatchTransactionOptions as On, EnumSchema as Or, validateOperationPayload as Ot, Linked as P, CacheOperationNotCacheableError as Pi, QueryExecutionContext as Pn, BigIntSchema as Pr, NoExtraDriverConfigKeys as Pt, ModelCoreSchemas as Q, PG as Qi, UpdateState as Qn, RelationSlot as Qr, ExtensionCacheState as Qt, ModelShape as R, isRetryableError as Ri, StringSchema as Rn, AnyJsonNullSentinel as Rr, defaultOmit as Rt, CachedClient as S, ForeignKeyError as Si, CacheEntry as Sn, BaseIsoTimeSchema as Sr, ModelToManyRelation as St, MutationOperations as T, ValueTooLongError as Ti, CacheInvalidationOptions as Tn, IsoTimeSchema as Tr, getOperationPayloadSchema as Tt, InferInput as U, GeoArea as Ui, isFieldRef as Un, JsonNullSentinel as Ur, PlacedControl as Ut, type Scalar as V, wrapError as Vi, ModelFieldRefs as Vn, JsonNull as Vr, DefinitionControls as Vt, InferOutput as W, GeoBounds as Wi, AnyModel as Wn, isJsonNullSentinel as Wr, RowsVerbs as Wt, ModelArgsSchemas as X, NativeType as Xi, ModelInternal as Xn, ReferentialAction as Xr, ClientExtensionState as Xt, VibSchema as Y, MYSQL as Yi, Model$1 as Yn, JunctionReferentialAction as Yr, AccumulatedExtensionState as Yt, ModelCoreInput as Z, NativeTypeMap as Zi, ModelState as Zn, RelationCardinality as Zr, EmptyClientExtensionState as Zt, ObservationCompletion as _, isPendingOperationError as _i, PendingOperation as _n, BaseJsonSchema as _r, DateScalar as _t, PostgresAdapter as a, ConnectionError as ai, GroupByResultType as an, ScalarType as ar, CoreSchemas as at, OFFICIAL_INSTRUMENTATION_NAME as b, isMigrationError as bi, isPendingOperation as bn, JsonValue as br, ModelToOneRelation as bt, Operation as c, NestedWriteAssertionError as ci, validateSchema as cn, BaseVectorSchema as cr, StringScalar as ct, MigrationSessionAttestation as d, PendingOperationError as di, isSchemaValidationError as dn, PointSchema as dr, JsonScalar as dt, ValidationErrorSource as ei, ExtensionResultConsumerState as en, AutoGenerate as er, ModelRelationNestedInput as et, SQLITE_MIGRATION_CAPABILITY as f, QueryEngineError as fi, SchemaValidationIssue as fn, ObjectSchema as fr, IntScalar as ft, MigrationNamespaceAttestation as g, isNotFoundError as gi, Schema$3 as gn, NumberSchema as gr, DateTimeScalar as gt, DriverResultParser as h, isClientInitializationError as hi, DateTimePhysicalForm as hn, IntegerSchema as hr, TimeScalar as ht, SQLiteAdapter as i, ClientInitializationError as ii, CountResultType as in, ScalarState as ir, ArgsSchemas as it, ValidatedOperationPayload as j, CacheConfigurationError as ji, BatchQuery as jn, BaseBlobSchema as jr, ExtendedClient as jt, Operations as k, isUniqueConstraintError as ki, DriverTransactionOptions as kn, BaseBooleanSchema as kr, ClientTypeState as kt, AnyDriver as l, NestedWriteError as li, validateSchemaOrThrow as ln, VectorSchema as lr, PointScalar as lt, PinnedSessionReservation as m, UnsupportedOperationError as mi, ValidationResult$1 as mn, BaseNumberSchema as mr, DecimalScalar as mt, postgresAdapter as n, InvalidTransactionInputError as ni, AggregateResultType as nn, GeneratorDefaultBrand as nr, ModelStateSchemas as nt, MySQLAdapter as o, FeatureNotSupportedError as oi, InferSelectInclude as on, UpdateState$1 as or, NumericScalar as ot, SqliteMigrationCapability as p, QueryError as pi, Severity as pn, BaseIntegerSchema as pr, EnumScalar as pt, SchemaRegistryLookup as q, DecimalDescriptor as qi, IndexType as qn, AnyRelation as qr, StatementContext as qt, sqliteAdapter as r, TransactionError as ri, BatchPayload as rn, InitialScalarState as rr, ScalarSchemas as rt, DatabaseAdapter as s, ForbiddenError as si, RawOperation as sn, parse as sr, VectorScalar as st, mysqlAdapter as t, isValidationError as ti, MergeExtensionState as tn, AutoGenerateType as tr, ModelSchemas as tt, Driver as u, NotFoundError as ui, SchemaValidationError as un, BasePointSchema as ur, NumberScalar as ut, ObservationUnit as v, isUnsupportedOperationError as vi, UnwrapPendingOperation as vn, InputJsonValue as vr, BooleanScalar as vt, InferDatabase as w, UniqueConstraintError as wi, WaitUntilFn as wn, IsoDateSchema as wr, getSchemas as wt, CacheableOperations as x, CheckConstraintError as xi, CacheDriver as xn, BaseIsoDateSchema as xr, ReferencesStage as xt, ObserveHandler as y, MigrationError as yi, UnwrapPendingOperations as yn, JsonSchema as yr, BlobScalar as yt, VariantToManyRelation as z, isVibORMError as zi, AnyFieldRef as zn, AnyNull as zr, OfficialCacheExtension as zt };
14395
+ export { ModelOperationInput as $, MYSQL as $i, Model$1 as $n, JunctionReferentialAction as $r, ClientExtensionState as $t, Schema$1 as A, isCheckConstraintError as Ai, WithCacheOptions as An, IsoTimestampSchema as Ar, DelegateOperationResult as At, VariantToOneRelation as B, VibORMError as Bi, V$1 as Bn, toJsonSchema as Br, OfficialCacheExtension as Bt, Client as C, MigrationError as Ci, UnwrapPendingOperations as Cn, JsonSchema as Cr, s as Ct, OperationPayloadSchema as D, NotNullConstraintError as Di, CacheSetOptions as Dn, BaseIsoTimestampSchema as Dr, renderSchemaType as Dt, OperationPayload as E, ForeignKeyError as Ei, CacheEntry as En, BaseIsoTimeSchema as Er, renderOperationResultType as Et, LinkedClientConfig as F, CacheConfigurationError as Fi, BatchQuery as Fn, BaseBlobSchema as Fr, NoExtraDriverConfigKeys as Ft, ParseResult as G, wrapError as Gi, ModelFieldRefs as Gn, JsonNull as Gr, PlacedControl as Gt, BigIntScalar as H, isRetryableError as Hi, StringSchema as Hn, AnyJsonNullSentinel as Hr, DefinitionControls as Ht, Links$1 as I, CacheInvalidKeyError as Ii, CommittedBatchNotification as In, BlobSchema as Ir, VibORMClient as It, SchemaRegistryOperation as J, GeoBounds as Ji, AnyModel as Jn, isJsonNullSentinel as Jr, ClientExtension as Jt, Prettify as K, DiagnosticDisclosure as Ki, createModelFieldRefs as Kn, JsonNullKind as Kr, RowsVerbs as Kt, RelationLinks as L, CacheInvalidTTLError as Li, Dialect as Ln, BaseBigIntSchema as Lr, VibORMConfig as Lt, ClientSchema as M, isNotNullConstraintError as Mi, BatchTransactionOptions as Mn, EnumSchema as Mr, ExtendedClient as Mt, FlatSchema as N, isUniqueConstraintError as Ni, DriverTransactionOptions as Nn, BaseBooleanSchema as Nr, ExtendedOperationResult as Nt, OperationResult as O, UniqueConstraintError as Oi, WaitUntilFn as On, IsoDateSchema as Or, validateOperationPayload as Ot, Linked as P, isValueTooLongError as Pi, TransactionOptionSupport as Pn, BooleanSchema as Pr, ExtensionState as Pt, ModelCoreSchemas as Q, Decimal as Qi, InitialModelState as Qn, Getter as Qr, AccumulatedExtensionState as Qt, ModelShape as R, CacheOperationNotCacheableError as Ri, QueryExecutionContext as Rn, BigIntSchema as Rr, createClient as Rt, CachedClient as S, isUnsupportedOperationError as Si, UnwrapPendingOperation as Sn, InputJsonValue as Sr, ModelToManyRelation as St, MutationOperations as T, CheckConstraintError as Ti, CacheDriver as Tn, BaseIsoDateSchema as Tr, getOperationPayloadSchema as Tt, InferInput as U, isVibORMError as Ui, AnyFieldRef as Un, AnyNull as Ur, NoControls as Ut, type Scalar as V, VibORMErrorCode as Vi, v as Vn, createSchemaRegistry as Vr, WriteOutcome as Vt, InferOutput as W, toPrismaErrorCode as Wi, FieldRef as Wn, DbNull as Wr, OrderTerm as Wt, ModelArgsSchemas as X, GeoPolygon as Xi, IndexOptions as Xn, inferred as Xr, StatementContext as Xt, VibSchema as Y, GeoPoint as Yi, IndexDefinition as Yn, JsonSchema$1 as Yr, defineExtension as Yt, ModelCoreInput as Z, DecimalDescriptor as Zi, IndexType as Zn, AnyRelation as Zr, StatementHandler as Zt, ObservationCompletion as _, QueryError as _i, Severity as _n, BaseIntegerSchema as _r, DateScalar as _t, PostgresAdapter as a, isValidationError as ai, ResultConsumerContextOf as an, AutoGenerateType as ar, CoreSchemas as at, OFFICIAL_INSTRUMENTATION_NAME as b, isNotFoundError as bi, Schema$3 as bn, NumberSchema as br, ModelToOneRelation as bt, Operation as c, ClientInitializationError as ci, CountResultType as cn, ScalarState as cr, StringScalar as ct, MigrationSessionAttestation as d, ForbiddenError as di, RawOperation as dn, parse as dr, JsonScalar as dt, NativeType as ea, ReferentialAction as ei, EmptyClientExtensionState as en, ModelInternal as er, ModelRelationNestedInput as et, SQLITE_MIGRATION_CAPABILITY as f, NestedWriteAssertionError as fi, validateSchema as fn, BaseVectorSchema as fr, IntScalar as ft, MigrationNamespaceAttestation as g, QueryEngineError as gi, SchemaValidationIssue as gn, ObjectSchema as gr, DateTimeScalar as gt, DriverResultParser as h, PendingOperationError as hi, isSchemaValidationError as hn, PointSchema as hr, TimeScalar as ht, SQLiteAdapter as i, ValidationErrorSource as ii, MergeExtensionState as in, AutoGenerate as ir, ArgsSchemas as it, ValidatedOperationPayload as j, isForeignKeyError as ji, sqliteResultParser as jn, BaseEnumSchema as jr, DriverConfig as jt, Operations as k, ValueTooLongError as ki, CacheInvalidationOptions as kn, IsoTimeSchema as kr, ClientTypeState as kt, AnyDriver as l, ConnectionError as li, GroupByResultType as ln, ScalarType as lr, PointScalar as lt, PinnedSessionReservation as m, NotFoundError as mi, SchemaValidationError as mn, BasePointSchema as mr, DecimalScalar as mt, postgresAdapter as n, PG as na, RelationSlot as ni, ExtensionContributionState as nn, UpdateState as nr, ModelStateSchemas as nt, MySQLAdapter as o, InvalidTransactionInputError as oi, AggregateResultType as on, GeneratorDefaultBrand as or, NumericScalar as ot, SqliteMigrationCapability as p, NestedWriteError as pi, validateSchemaOrThrow as pn, VectorSchema as pr, EnumScalar as pt, SchemaRegistryLookup as q, GeoArea as qi, isFieldRef as qn, JsonNullSentinel as qr, StampedFields as qt, sqliteAdapter as r, SQLITE as ra, ValidationError as ri, ExtensionResultConsumerState as rn, DecimalSchema as rr, ScalarSchemas as rt, DatabaseAdapter as s, TransactionError as si, BatchPayload as sn, InitialScalarState as sr, VectorScalar as st, mysqlAdapter as t, NativeTypeMap as ta, RelationCardinality as ti, ExtensionCacheState as tn, ModelState as tr, ModelSchemas as tt, Driver as u, FeatureNotSupportedError as ui, InferSelectInclude as un, UpdateState$1 as ur, NumberScalar as ut, ObservationUnit as v, UnsupportedOperationError as vi, ValidationResult$1 as vn, BaseNumberSchema as vr, BooleanScalar as vt, InferDatabase as w, isMigrationError as wi, isPendingOperation as wn, JsonValue as wr, getSchemas as wt, CacheableOperations as x, isPendingOperationError as xi, PendingOperation as xn, BaseJsonSchema as xr, ReferencesStage as xt, ObserveHandler as y, isClientInitializationError as yi, DateTimePhysicalForm as yn, IntegerSchema as yr, BlobScalar as yt, VariantToManyRelation as z, PrismaErrorCode as zi, QueryResult as zn, createJsonSchemaConverter as zr, defaultOmit as zt };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $n as DecimalSchema, $r as ValidationError, $t as ExtensionContributionState, Ai as isValueTooLongError, Ar as BooleanSchema, B as VariantToOneRelation, Bi as toPrismaErrorCode, Bn as FieldRef, Br as DbNull, Ci as NotNullConstraintError, Ct as s, Di as isForeignKeyError, Dt as renderSchemaType, Ei as isCheckConstraintError, Er as IsoTimestampSchema, Et as renderOperationResultType, F as LinkedClientConfig, Fi as PrismaErrorCode, Ft as VibORMClient, Gi as GeoPoint, Gn as IndexDefinition, Gt as ClientExtension, H as BigIntScalar, Hi as DiagnosticDisclosure, Hn as createModelFieldRefs, Hr as JsonNullKind, Ht as NoControls, I as Links, Ii as VibORMError, It as VibORMConfig, Ji as Decimal, Jn as InitialModelState, Jr as Getter, Jt as StatementHandler, Ki as GeoPolygon, Kn as IndexOptions, Kt as defineExtension, L as RelationLinks, Li as VibORMErrorCode, Lt as createClient, M as ClientSchema, Mi as CacheInvalidKeyError, Mr as BlobSchema, Mt as ExtendedOperationResult, N as FlatSchema, Ni as CacheInvalidTTLError, Nt as ExtensionState, Oi as isNotNullConstraintError, Or as EnumSchema, Ot as validateOperationPayload, P as Linked, Pi as CacheOperationNotCacheableError, Pr as BigIntSchema, Qn as UpdateState, Qr as RelationSlot, Qt as ExtensionCacheState, R as ModelShape, Ri as isRetryableError, Rn as StringSchema, Rr as AnyJsonNullSentinel, Si as ForeignKeyError, St as ModelToManyRelation, Ti as ValueTooLongError, Tr as IsoTimeSchema, Tt as getOperationPayloadSchema, Ui as GeoArea, Un as isFieldRef, Ur as JsonNullSentinel, Ut as PlacedControl, V as Scalar, Vi as wrapError, Vn as ModelFieldRefs, Vr as JsonNull, Wi as GeoBounds, Wn as AnyModel, Wr as isJsonNullSentinel, Xn as ModelInternal, Xr as ReferentialAction, Xt as ClientExtensionState, Y as VibSchema, Yn as Model, Yt as AccumulatedExtensionState, Zn as ModelState, Zr as RelationCardinality, Zt as EmptyClientExtensionState, _ as ObservationCompletion, _i as isPendingOperationError, _n as PendingOperation, _t as DateScalar, ai as ConnectionError, bi as isMigrationError, bn as isPendingOperation, br as JsonValue, bt as ModelToOneRelation, ci as NestedWriteAssertionError, cn as validateSchema, ct as StringScalar, di as PendingOperationError, dn as isSchemaValidationError, dr as PointSchema, dt as JsonScalar, ei as ValidationErrorSource, en as ExtensionResultConsumerState, er as AutoGenerate, fi as QueryEngineError, fn as SchemaValidationIssue, fr as ObjectSchema, ft as IntScalar, gi as isNotFoundError, gr as NumberSchema, gt as DateTimeScalar, hi as isClientInitializationError, hr as IntegerSchema, ht as TimeScalar, ii as ClientInitializationError, ir as ScalarState, ji as CacheConfigurationError, jt as ExtendedClient, ki as isUniqueConstraintError, kt as ClientTypeState, li as NestedWriteError, ln as validateSchemaOrThrow, lr as VectorSchema, lt as PointScalar, mi as UnsupportedOperationError, mn as ValidationResult, mt as DecimalScalar, ni as InvalidTransactionInputError, nr as GeneratorDefaultBrand, oi as FeatureNotSupportedError, or as UpdateState$1, ot as NumericScalar, pi as QueryError, pn as Severity, pt as EnumScalar, qi as DecimalDescriptor, qr as AnyRelation, qt as StatementContext, ri as TransactionError, rr as InitialScalarState, si as ForbiddenError, sn as RawOperation, st as VectorScalar, ti as isValidationError, tn as MergeExtensionState, ui as NotFoundError, un as SchemaValidationError, ut as NumberScalar, v as ObservationUnit, vi as isUnsupportedOperationError, vn as UnwrapPendingOperation, vr as InputJsonValue, vt as BooleanScalar, wi as UniqueConstraintError, wr as IsoDateSchema, wt as getSchemas, xi as CheckConstraintError, xt as ReferencesStage, y as ObserveHandler, yi as MigrationError, yn as UnwrapPendingOperations, yr as JsonSchema, yt as BlobScalar, z as VariantToManyRelation, zi as isVibORMError, zn as AnyFieldRef, zr as AnyNull } from "./index-DRX_LLQM.mjs";
2
- import { a as isSql, c as sqlTag, i as empty, n as Sql, o as join, r as Value, s as raw, t as RawValue } from "./sql-CF5Xi6z-.mjs";
3
- export { type AccumulatedExtensionState, type AnyFieldRef, type AnyJsonNullSentinel, type AnyModel, AnyNull, type AnyRelation, type AutoGenerate, type BigIntScalar, type BigIntSchema, type BlobScalar, type BlobSchema, type BooleanScalar, type BooleanSchema, CacheConfigurationError, CacheInvalidKeyError, CacheInvalidTTLError, CacheOperationNotCacheableError, CheckConstraintError, type ClientExtension, type ClientExtensionState, ClientInitializationError, type ClientSchema, type ClientTypeState, ConnectionError, type DateScalar, type DateTimeScalar, DbNull, Decimal, type DecimalDescriptor, type DecimalScalar, type DecimalSchema, type DiagnosticDisclosure, type EmptyClientExtensionState, type EnumScalar, type EnumSchema, type ExtendedClient, type ExtendedOperationResult, type ExtensionCacheState, type ExtensionContributionState, type ExtensionResultConsumerState, type ExtensionState, FeatureNotSupportedError, type FieldRef, type FlatSchema, ForbiddenError, ForeignKeyError, type GeneratorDefaultBrand, type GeoArea, type GeoBounds, type GeoPoint, type GeoPolygon, type Getter, type IndexDefinition, type IndexOptions, type InitialModelState, type InitialScalarState, type InputJsonValue, type IntScalar, type IntegerSchema, InvalidTransactionInputError, type IsoDateSchema, type IsoTimeSchema, type IsoTimestampSchema, JsonNull, type JsonNullKind, JsonNullSentinel, type JsonScalar, type JsonValue, type JsonSchema as JsonValueSchema, type Linked, type LinkedClientConfig, type Links, type MergeExtensionState, MigrationError, type Model, type ModelFieldRefs, type ModelInternal, type ModelShape, type ModelState, type ModelToManyRelation, type ModelToOneRelation, type UpdateState as ModelUpdateState, NestedWriteAssertionError, NestedWriteError, type NoControls, NotFoundError, NotNullConstraintError, type NumberScalar, type NumberSchema, type NumericScalar, type ObjectSchema, type ObservationCompletion, type ObservationUnit, type ObserveHandler, PendingOperation, PendingOperationError, type PlacedControl, type PointScalar, type PointSchema, type PrismaErrorCode, QueryEngineError, QueryError, type RawOperation, type RawValue, type ReferencesStage, type ReferentialAction, type RelationCardinality, type RelationLinks, type RelationSlot, type Scalar, type ScalarState, type UpdateState$1 as ScalarUpdateState, SchemaValidationError, type SchemaValidationIssue, type Severity, Sql, type StatementContext, type StatementHandler, type StringScalar, type StringSchema, type TimeScalar, TransactionError, UniqueConstraintError, UnsupportedOperationError, type UnwrapPendingOperation, type UnwrapPendingOperations, ValidationError, type ValidationErrorSource, type ValidationResult, type Value, ValueTooLongError, type VariantToManyRelation, type VariantToOneRelation, type VectorScalar, type VectorSchema, type VibORMClient, type VibORMConfig, VibORMError, VibORMErrorCode, type VibSchema, createClient, createModelFieldRefs, defineExtension, empty, getOperationPayloadSchema, getSchemas, isCheckConstraintError, isClientInitializationError, isFieldRef, isForeignKeyError, isJsonNullSentinel, isMigrationError, isNotFoundError, isNotNullConstraintError, isPendingOperation, isPendingOperationError, isRetryableError, isSchemaValidationError, isSql, isUniqueConstraintError, isUnsupportedOperationError, isValidationError, isValueTooLongError, isVibORMError, join, raw, renderOperationResultType, renderSchemaType, s, sqlTag as sql, toPrismaErrorCode, validateOperationPayload, validateSchema, validateSchemaOrThrow, wrapError };
1
+ import { $n as Model, $t as ClientExtensionState, Ai as isCheckConstraintError, Ar as IsoTimestampSchema, At as DelegateOperationResult, B as VariantToOneRelation, Bi as VibORMError, Ci as MigrationError, Cn as UnwrapPendingOperations, Cr as JsonSchema, Ct as s, Di as NotNullConstraintError, Dt as renderSchemaType, Ei as ForeignKeyError, Et as renderOperationResultType, F as LinkedClientConfig, Fi as CacheConfigurationError, Gi as wrapError, Gn as ModelFieldRefs, Gr as JsonNull, Gt as PlacedControl, H as BigIntScalar, Hi as isRetryableError, Hn as StringSchema, Hr as AnyJsonNullSentinel, I as Links, Ii as CacheInvalidKeyError, Ir as BlobSchema, It as VibORMClient, Ji as GeoBounds, Jn as AnyModel, Jr as isJsonNullSentinel, Jt as ClientExtension, Ki as DiagnosticDisclosure, Kn as createModelFieldRefs, Kr as JsonNullKind, L as RelationLinks, Li as CacheInvalidTTLError, Lt as VibORMConfig, M as ClientSchema, Mi as isNotNullConstraintError, Mr as EnumSchema, Mt as ExtendedClient, N as FlatSchema, Ni as isUniqueConstraintError, Nt as ExtendedOperationResult, Oi as UniqueConstraintError, Or as IsoDateSchema, Ot as validateOperationPayload, P as Linked, Pi as isValueTooLongError, Pr as BooleanSchema, Pt as ExtensionState, Qi as Decimal, Qn as InitialModelState, Qr as Getter, Qt as AccumulatedExtensionState, R as ModelShape, Ri as CacheOperationNotCacheableError, Rr as BigIntSchema, Rt as createClient, Si as isUnsupportedOperationError, Sn as UnwrapPendingOperation, Sr as InputJsonValue, St as ModelToManyRelation, Ti as CheckConstraintError, Tt as getOperationPayloadSchema, Ui as isVibORMError, Un as AnyFieldRef, Ur as AnyNull, Ut as NoControls, V as Scalar, Vi as VibORMErrorCode, Wi as toPrismaErrorCode, Wn as FieldRef, Wr as DbNull, Xi as GeoPolygon, Xn as IndexOptions, Xt as StatementContext, Y as VibSchema, Yi as GeoPoint, Yn as IndexDefinition, Yt as defineExtension, Zi as DecimalDescriptor, Zr as AnyRelation, Zt as StatementHandler, _ as ObservationCompletion, _i as QueryError, _n as Severity, _t as DateScalar, ai as isValidationError, bi as isNotFoundError, br as NumberSchema, bt as ModelToOneRelation, ci as ClientInitializationError, cr as ScalarState, ct as StringScalar, di as ForbiddenError, dn as RawOperation, dt as JsonScalar, ei as ReferentialAction, en as EmptyClientExtensionState, er as ModelInternal, fi as NestedWriteAssertionError, fn as validateSchema, ft as IntScalar, gi as QueryEngineError, gn as SchemaValidationIssue, gr as ObjectSchema, gt as DateTimeScalar, hi as PendingOperationError, hn as isSchemaValidationError, hr as PointSchema, ht as TimeScalar, ii as ValidationErrorSource, in as MergeExtensionState, ir as AutoGenerate, ji as isForeignKeyError, ki as ValueTooLongError, kr as IsoTimeSchema, kt as ClientTypeState, li as ConnectionError, lt as PointScalar, mi as NotFoundError, mn as SchemaValidationError, mt as DecimalScalar, ni as RelationSlot, nn as ExtensionContributionState, nr as UpdateState, oi as InvalidTransactionInputError, or as GeneratorDefaultBrand, ot as NumericScalar, pi as NestedWriteError, pn as validateSchemaOrThrow, pr as VectorSchema, pt as EnumScalar, qi as GeoArea, qn as isFieldRef, qr as JsonNullSentinel, ri as ValidationError, rn as ExtensionResultConsumerState, rr as DecimalSchema, si as TransactionError, sr as InitialScalarState, st as VectorScalar, ti as RelationCardinality, tn as ExtensionCacheState, tr as ModelState, ui as FeatureNotSupportedError, ur as UpdateState$1, ut as NumberScalar, v as ObservationUnit, vi as UnsupportedOperationError, vn as ValidationResult, vt as BooleanScalar, wi as isMigrationError, wn as isPendingOperation, wr as JsonValue, wt as getSchemas, xi as isPendingOperationError, xn as PendingOperation, xt as ReferencesStage, y as ObserveHandler, yi as isClientInitializationError, yr as IntegerSchema, yt as BlobScalar, z as VariantToManyRelation, zi as PrismaErrorCode } from "./index-DBhpNR0X.mjs";
2
+ import { a as isSql, c as sqlTag, i as empty, n as Sql, o as join, r as Value, s as raw, t as RawValue } from "./sql-D7JnXgUh.mjs";
3
+ export { type AccumulatedExtensionState, type AnyFieldRef, type AnyJsonNullSentinel, type AnyModel, AnyNull, type AnyRelation, type AutoGenerate, type BigIntScalar, type BigIntSchema, type BlobScalar, type BlobSchema, type BooleanScalar, type BooleanSchema, CacheConfigurationError, CacheInvalidKeyError, CacheInvalidTTLError, CacheOperationNotCacheableError, CheckConstraintError, type ClientExtension, type ClientExtensionState, ClientInitializationError, type ClientSchema, type ClientTypeState, ConnectionError, type DateScalar, type DateTimeScalar, DbNull, Decimal, type DecimalDescriptor, type DecimalScalar, type DecimalSchema, type DelegateOperationResult, type DiagnosticDisclosure, type EmptyClientExtensionState, type EnumScalar, type EnumSchema, type ExtendedClient, type ExtendedOperationResult, type ExtensionCacheState, type ExtensionContributionState, type ExtensionResultConsumerState, type ExtensionState, FeatureNotSupportedError, type FieldRef, type FlatSchema, ForbiddenError, ForeignKeyError, type GeneratorDefaultBrand, type GeoArea, type GeoBounds, type GeoPoint, type GeoPolygon, type Getter, type IndexDefinition, type IndexOptions, type InitialModelState, type InitialScalarState, type InputJsonValue, type IntScalar, type IntegerSchema, InvalidTransactionInputError, type IsoDateSchema, type IsoTimeSchema, type IsoTimestampSchema, JsonNull, type JsonNullKind, JsonNullSentinel, type JsonScalar, type JsonValue, type JsonSchema as JsonValueSchema, type Linked, type LinkedClientConfig, type Links, type MergeExtensionState, MigrationError, type Model, type ModelFieldRefs, type ModelInternal, type ModelShape, type ModelState, type ModelToManyRelation, type ModelToOneRelation, type UpdateState as ModelUpdateState, NestedWriteAssertionError, NestedWriteError, type NoControls, NotFoundError, NotNullConstraintError, type NumberScalar, type NumberSchema, type NumericScalar, type ObjectSchema, type ObservationCompletion, type ObservationUnit, type ObserveHandler, PendingOperation, PendingOperationError, type PlacedControl, type PointScalar, type PointSchema, type PrismaErrorCode, QueryEngineError, QueryError, type RawOperation, type RawValue, type ReferencesStage, type ReferentialAction, type RelationCardinality, type RelationLinks, type RelationSlot, type Scalar, type ScalarState, type UpdateState$1 as ScalarUpdateState, SchemaValidationError, type SchemaValidationIssue, type Severity, Sql, type StatementContext, type StatementHandler, type StringScalar, type StringSchema, type TimeScalar, TransactionError, UniqueConstraintError, UnsupportedOperationError, type UnwrapPendingOperation, type UnwrapPendingOperations, ValidationError, type ValidationErrorSource, type ValidationResult, type Value, ValueTooLongError, type VariantToManyRelation, type VariantToOneRelation, type VectorScalar, type VectorSchema, type VibORMClient, type VibORMConfig, VibORMError, VibORMErrorCode, type VibSchema, createClient, createModelFieldRefs, defineExtension, empty, getOperationPayloadSchema, getSchemas, isCheckConstraintError, isClientInitializationError, isFieldRef, isForeignKeyError, isJsonNullSentinel, isMigrationError, isNotFoundError, isNotNullConstraintError, isPendingOperation, isPendingOperationError, isRetryableError, isSchemaValidationError, isSql, isUniqueConstraintError, isUnsupportedOperationError, isValidationError, isValueTooLongError, isVibORMError, join, raw, renderOperationResultType, renderSchemaType, s, sqlTag as sql, toPrismaErrorCode, validateOperationPayload, validateSchema, validateSchemaOrThrow, wrapError };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{a as t}from"./chain-BQoDfo80.mjs";import{a as n,i as r,n as i,o as a,r as o,t as s}from"./base-wlv81COV.mjs";import{g as c,h as l,m as u,p as d}from"./observation-BcT8Cs3d.mjs";import{C as f,D as p,E as m,O as h,S as g,T as _,b as v,w as y,x as b,y as x}from"./error-mapping-DRY49A3C.mjs";import{n as S,t as C}from"./migrations-OE5D32qo.mjs";import{c as w,d as T,f as E,g as D,h as O,i as k,l as A,m as j,n as M,o as N,p as P,r as F,s as I,t as L,u as R}from"./query-CTna5P9o.mjs";import{n as z,t as B}from"./transaction-D5LHYn-r.mjs";import{n as V,t as H}from"./validation-pfpKPPZ_.mjs";import{D as U,E as W,O as G,P as K,T as q,j as J,k as Y}from"./v-yKivkoka.mjs";import{F as X}from"./geo-point-codec-mjROsQX-.mjs";import{a as Z,i as Q,n as $,o as ee,r as te,t as ne}from"./sql-DGtEeP8z.mjs";import{C as re,S as ie}from"./scalar-D6QmJ22_.mjs";import{a as ae,i as oe}from"./validator-XVm02V0K.mjs";import{n as se}from"./builder-D0GQK-fA.mjs";import{d as ce,m as le}from"./result-shape-C8QFUuIt.mjs";import{t as ue}from"./client-BqgVSbk0.mjs";import{i as de,n as fe,r as pe,t as me}from"./schema-introspection-CfqmM3Cz.mjs";import{t as he}from"./schema-CY9kOwJ-.mjs";const getSchemas=e=>se(e).proxy;export{q as AnyNull,d as CacheConfigurationError,u as CacheInvalidKeyError,l as CacheInvalidTTLError,c as CacheOperationNotCacheableError,x as CheckConstraintError,L as ClientInitializationError,M as ConnectionError,W as DbNull,X as Decimal,F as FeatureNotSupportedError,k as ForbiddenError,v as ForeignKeyError,B as InvalidTransactionInputError,U as JsonNull,G as JsonNullSentinel,C as MigrationError,N as NestedWriteAssertionError,I as NestedWriteError,w as NotFoundError,b as NotNullConstraintError,ce as PendingOperation,A as PendingOperationError,R as QueryEngineError,T as QueryError,ie as SchemaValidationError,ne as Sql,z as TransactionError,g as UniqueConstraintError,E as UnsupportedOperationError,H as ValidationError,f as ValueTooLongError,s as VibORMError,i as VibORMErrorCode,ue as createClient,J as createModelFieldRefs,t as defineExtension,$ as empty,me as getOperationPayloadSchema,getSchemas,y as isCheckConstraintError,P as isClientInitializationError,K as isFieldRef,_ as isForeignKeyError,Y as isJsonNullSentinel,S as isMigrationError,j as isNotFoundError,m as isNotNullConstraintError,le as isPendingOperation,O as isPendingOperationError,o as isRetryableError,re as isSchemaValidationError,te as isSql,p as isUniqueConstraintError,D as isUnsupportedOperationError,V as isValidationError,h as isValueTooLongError,r as isVibORMError,Q as join,Z as raw,fe as renderOperationResultType,pe as renderSchemaType,he as s,ee as sql,n as toPrismaErrorCode,de as validateOperationPayload,oe as validateSchema,ae as validateSchemaOrThrow,a as wrapError};
1
+ import{n as e}from"./chunk-BuuaeEvq.mjs";import{a as t}from"./chain--uZ0O7_Y.mjs";import{a as n,i as r,n as i,o as a,r as o,t as s}from"./base-wlv81COV.mjs";import{g as c,h as l,m as u,p as d}from"./observation-BcT8Cs3d.mjs";import{C as f,D as p,E as m,O as h,S as g,T as _,b as v,w as y,x as b,y as x}from"./error-mapping-D--MVRCY.mjs";import{n as S,t as C}from"./migrations-OE5D32qo.mjs";import{c as w,d as T,f as E,g as D,h as O,i as k,l as A,m as j,n as M,o as N,p as P,r as F,s as I,t as L,u as R}from"./query-CTna5P9o.mjs";import{n as z,t as B}from"./transaction-D5LHYn-r.mjs";import{n as V,t as H}from"./validation-pfpKPPZ_.mjs";import{D as U,E as W,O as G,P as K,T as q,j as J,k as Y}from"./v-C2XN11Gy.mjs";import{L as X}from"./geo-point-codec-CIZxuIvE.mjs";import{a as Z,i as Q,n as $,o as ee,r as te,t as ne}from"./sql-BsBoKwaf.mjs";import{d as re,f as ie}from"./scalar-BgxfbRLw.mjs";import{a as ae,i as oe}from"./validator-DqI5RlVU.mjs";import{n as se}from"./builder-Ct1qPFc8.mjs";import{d as ce,m as le}from"./result-shape-DwoSyWnq.mjs";import{t as ue}from"./client-BAxU6jnw.mjs";import{i as de,n as fe,r as pe,t as me}from"./schema-introspection-BFDAX5Ol.mjs";import{t as he}from"./schema-CT57uls5.mjs";const getSchemas=e=>se(e).proxy;export{q as AnyNull,d as CacheConfigurationError,u as CacheInvalidKeyError,l as CacheInvalidTTLError,c as CacheOperationNotCacheableError,x as CheckConstraintError,L as ClientInitializationError,M as ConnectionError,W as DbNull,X as Decimal,F as FeatureNotSupportedError,k as ForbiddenError,v as ForeignKeyError,B as InvalidTransactionInputError,U as JsonNull,G as JsonNullSentinel,C as MigrationError,N as NestedWriteAssertionError,I as NestedWriteError,w as NotFoundError,b as NotNullConstraintError,ce as PendingOperation,A as PendingOperationError,R as QueryEngineError,T as QueryError,re as SchemaValidationError,ne as Sql,z as TransactionError,g as UniqueConstraintError,E as UnsupportedOperationError,H as ValidationError,f as ValueTooLongError,s as VibORMError,i as VibORMErrorCode,ue as createClient,J as createModelFieldRefs,t as defineExtension,$ as empty,me as getOperationPayloadSchema,getSchemas,y as isCheckConstraintError,P as isClientInitializationError,K as isFieldRef,_ as isForeignKeyError,Y as isJsonNullSentinel,S as isMigrationError,j as isNotFoundError,m as isNotNullConstraintError,le as isPendingOperation,O as isPendingOperationError,o as isRetryableError,ie as isSchemaValidationError,te as isSql,p as isUniqueConstraintError,D as isUnsupportedOperationError,V as isValidationError,h as isValueTooLongError,r as isVibORMError,Q as join,Z as raw,fe as renderOperationResultType,pe as renderSchemaType,he as s,ee as sql,n as toPrismaErrorCode,de as validateOperationPayload,oe as validateSchema,ae as validateSchemaOrThrow,a as wrapError};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import { Hi as DiagnosticDisclosure, Ii as VibORMError, b as OFFICIAL_INSTRUMENTATION_NAME, c as Operation, y as ObserveHandler } from "./index-DRX_LLQM.mjs";
1
+ import { Bi as VibORMError, Ki as DiagnosticDisclosure, b as OFFICIAL_INSTRUMENTATION_NAME, c as Operation, y as ObserveHandler } from "./index-DBhpNR0X.mjs";
2
2
 
3
3
  //#region src/instrumentation/types.d.ts
4
4