viborm 1.14.2 → 1.16.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 (483) hide show
  1. package/dist/adapter-namespace-DwFnfpED.mjs +2 -0
  2. package/dist/{adapter-namespace-DaRiTIIf.mjs.map → adapter-namespace-DwFnfpED.mjs.map} +1 -1
  3. package/dist/adapters.d.mts +26 -10
  4. package/dist/adapters.mjs +1 -1
  5. package/dist/args-7WgBFd_f.mjs +2 -0
  6. package/dist/{args-764KdWMr.mjs.map → args-7WgBFd_f.mjs.map} +1 -1
  7. package/dist/array-literal-BOzj0E2u.mjs +2 -0
  8. package/dist/{array-literal-DHinAnVs.mjs.map → array-literal-BOzj0E2u.mjs.map} +1 -1
  9. package/dist/base-17NSFtrA.mjs +2 -0
  10. package/dist/base-17NSFtrA.mjs.map +1 -0
  11. package/dist/batch-refs-Bd8HvwUc.mjs +2 -0
  12. package/dist/{batch-refs-C-gx7A4-.mjs.map → batch-refs-Bd8HvwUc.mjs.map} +1 -1
  13. package/dist/better-auth.d.mts +116 -0
  14. package/dist/better-auth.mjs +6 -0
  15. package/dist/better-auth.mjs.map +1 -0
  16. package/dist/bind-parameter-capacity-BAFQM9Jt.mjs +2 -0
  17. package/dist/{bind-parameter-capacity-BMD-bxMO.mjs.map → bind-parameter-capacity-BAFQM9Jt.mjs.map} +1 -1
  18. package/dist/bun-sql.d.mts +1 -1
  19. package/dist/bun-sql.mjs +1 -1
  20. package/dist/bun-sql.mjs.map +1 -1
  21. package/dist/bun-sqlite.d.mts +1 -1
  22. package/dist/bun-sqlite.mjs +1 -1
  23. package/dist/bun-sqlite.mjs.map +1 -1
  24. package/dist/cache/cloudflare-kv.d.mts +1 -1
  25. package/dist/cache/cloudflare-kv.mjs +1 -1
  26. package/dist/cache/cloudflare-kv.mjs.map +1 -1
  27. package/dist/cache/memory.d.mts +1 -1
  28. package/dist/cache/memory.mjs +1 -1
  29. package/dist/cache/memory.mjs.map +1 -1
  30. package/dist/cache.d.mts +2 -2
  31. package/dist/cache.mjs +1 -1
  32. package/dist/cache.mjs.map +1 -1
  33. package/dist/call-0bd_B9Vp.mjs +2 -0
  34. package/dist/{call-Cz8XUmrl.mjs.map → call-0bd_B9Vp.mjs.map} +1 -1
  35. package/dist/cli.mjs +6 -6
  36. package/dist/cli.mjs.map +1 -1
  37. package/dist/client-D7sWgUt2.mjs +2 -0
  38. package/dist/client-D7sWgUt2.mjs.map +1 -0
  39. package/dist/client-DEfFqv4S.mjs +9 -0
  40. package/dist/client-DEfFqv4S.mjs.map +1 -0
  41. package/dist/{client-CRxfhw2y.d.mts → client-Dlz3-2JC.d.mts} +3 -3
  42. package/dist/client.d.mts +3 -3
  43. package/dist/client.mjs +1 -1
  44. package/dist/client.mjs.map +1 -1
  45. package/dist/config.d.mts +2 -2
  46. package/dist/config.mjs +1 -1
  47. package/dist/confine-CyI9IwjC.mjs +2 -0
  48. package/dist/{confine-DqFBTUw6.mjs.map → confine-CyI9IwjC.mjs.map} +1 -1
  49. package/dist/coordination-BxMskOgi.mjs +2 -0
  50. package/dist/coordination-BxMskOgi.mjs.map +1 -0
  51. package/dist/d1.d.mts +2 -30
  52. package/dist/d1.mjs +1 -1
  53. package/dist/d1.mjs.map +1 -1
  54. package/dist/{database-adapter-BGqvjeEy.d.mts → database-adapter-BMjJiBFm.d.mts} +8476 -8386
  55. package/dist/datetime-physical-codec-DAF7WJpy.mjs +2 -0
  56. package/dist/datetime-physical-codec-DAF7WJpy.mjs.map +1 -0
  57. package/dist/defaults-DAPb-tJ4.mjs +2 -0
  58. package/dist/{defaults-DwOHWI_M.mjs.map → defaults-DAPb-tJ4.mjs.map} +1 -1
  59. package/dist/{document-BVTQ-cF-.d.mts → document-CHaVF7Vn.d.mts} +36 -2
  60. package/dist/{driver-BBEmaJZy.d.mts → driver-BvTixv-m.d.mts} +1 -1
  61. package/dist/driver-diagnostics-aQ54bArn.mjs +2 -0
  62. package/dist/{driver-diagnostics-DW9NdckJ.mjs.map → driver-diagnostics-aQ54bArn.mjs.map} +1 -1
  63. package/dist/driver-kiIQS_Fd.mjs +2 -0
  64. package/dist/driver-kiIQS_Fd.mjs.map +1 -0
  65. package/dist/driver-lShUkDmf.mjs +2 -0
  66. package/dist/driver-lShUkDmf.mjs.map +1 -0
  67. package/dist/driver.d.mts +1 -1
  68. package/dist/driver.mjs +1 -1
  69. package/dist/durable-object.d.mts +1 -1
  70. package/dist/durable-object.mjs +2 -2
  71. package/dist/durable-object.mjs.map +1 -1
  72. package/dist/error-mapping-B9rSvgG9.mjs +2 -0
  73. package/dist/error-mapping-B9rSvgG9.mjs.map +1 -0
  74. package/dist/every-JpbiHdMb.mjs +2 -0
  75. package/dist/{every-tOgQmaIE.mjs.map → every-JpbiHdMb.mjs.map} +1 -1
  76. package/dist/execution-context-couU2tgh.mjs +2 -0
  77. package/dist/execution-context-couU2tgh.mjs.map +1 -0
  78. package/dist/{exports-COCJ8f2f.d.mts → exports-DYnTfvQo.d.mts} +1 -1
  79. package/dist/extension-Dh1ddrlA.mjs +2 -0
  80. package/dist/{extension-CGepsF-p.mjs.map → extension-Dh1ddrlA.mjs.map} +1 -1
  81. package/dist/fs-estate-n-QpsFqb.mjs +2 -0
  82. package/dist/{fs-estate-D1Nsg9G1.mjs.map → fs-estate-n-QpsFqb.mjs.map} +1 -1
  83. package/dist/geo-area-codec-Bti2PA2i.mjs +2 -0
  84. package/dist/geo-area-codec-Bti2PA2i.mjs.map +1 -0
  85. package/dist/id-domain-Cg65TLZ-.mjs +2 -0
  86. package/dist/id-domain-Cg65TLZ-.mjs.map +1 -0
  87. package/dist/identifier-conversion-BTDxDwDB.mjs +2 -0
  88. package/dist/identifier-conversion-BTDxDwDB.mjs.map +1 -0
  89. package/dist/identifiers-BxOf57qy.mjs +2 -0
  90. package/dist/identifiers-BxOf57qy.mjs.map +1 -0
  91. package/dist/identity-CJlRQA-m.mjs +2 -0
  92. package/dist/identity-CJlRQA-m.mjs.map +1 -0
  93. package/dist/index.d.mts +3 -3
  94. package/dist/index.mjs +1 -1
  95. package/dist/index.mjs.map +1 -1
  96. package/dist/instrumentation.d.mts +1 -1
  97. package/dist/instrumentation.mjs +1 -1
  98. package/dist/instrumentation.mjs.map +1 -1
  99. package/dist/introspect-q3Rf_Xv8.mjs +2 -0
  100. package/dist/introspect-q3Rf_Xv8.mjs.map +1 -0
  101. package/dist/json-CsAdz9pg.mjs +2 -0
  102. package/dist/json-CsAdz9pg.mjs.map +1 -0
  103. package/dist/json-number-C09rsm1g.mjs +2 -0
  104. package/dist/{json-number-AI-SdUUn.mjs.map → json-number-C09rsm1g.mjs.map} +1 -1
  105. package/dist/json-parameter-D7hDrVKw.mjs +2 -0
  106. package/dist/{json-parameter-oQ8nGaKr.mjs.map → json-parameter-D7hDrVKw.mjs.map} +1 -1
  107. package/dist/judge-words-k5GCc4cV.mjs +2 -0
  108. package/dist/judge-words-k5GCc4cV.mjs.map +1 -0
  109. package/dist/key-BDH6oTyC.mjs +2 -0
  110. package/dist/key-BDH6oTyC.mjs.map +1 -0
  111. package/dist/keys-CIal55WQ.mjs +2 -0
  112. package/dist/{keys-BQxM4c_a.mjs.map → keys-CIal55WQ.mjs.map} +1 -1
  113. package/dist/keys-DZdKAd4n.mjs +2 -0
  114. package/dist/keys-DZdKAd4n.mjs.map +1 -0
  115. package/dist/libsql-DEZ0uhK2.mjs +3 -0
  116. package/dist/libsql-DEZ0uhK2.mjs.map +1 -0
  117. package/dist/libsql.d.mts +2 -20
  118. package/dist/libsql.mjs +1 -1
  119. package/dist/libsql.mjs.map +1 -1
  120. package/dist/light-D2wNSbzY.mjs +2 -0
  121. package/dist/{light-BkJe3-yW.mjs.map → light-D2wNSbzY.mjs.map} +1 -1
  122. package/dist/memory-BaGWNdvk.mjs +2 -0
  123. package/dist/{memory-G4cSuc6A.mjs.map → memory-BaGWNdvk.mjs.map} +1 -1
  124. package/dist/methods-part-BaNx3o7b.mjs +2 -0
  125. package/dist/methods-part-BaNx3o7b.mjs.map +1 -0
  126. package/dist/migrations/mysql.d.mts +5 -5
  127. package/dist/migrations/mysql.mjs +1 -1
  128. package/dist/migrations/postgres.d.mts +5 -5
  129. package/dist/migrations/postgres.mjs +1 -1
  130. package/dist/migrations/snowflake.d.mts +5 -5
  131. package/dist/migrations/snowflake.mjs +1 -1
  132. package/dist/migrations/sqlite.d.mts +5 -5
  133. package/dist/migrations/sqlite.mjs +1 -1
  134. package/dist/migrations/storage/durable-object.d.mts +1 -1
  135. package/dist/migrations/storage/durable-object.mjs +1 -1
  136. package/dist/migrations/storage/durable-object.mjs.map +1 -1
  137. package/dist/migrations/storage/fs.d.mts +1 -1
  138. package/dist/migrations/storage/fs.mjs +1 -1
  139. package/dist/migrations/storage/r2.d.mts +1 -1
  140. package/dist/migrations/storage/r2.mjs +1 -1
  141. package/dist/migrations/storage/r2.mjs.map +1 -1
  142. package/dist/migrations/surrealdb.d.mts +5 -5
  143. package/dist/migrations/surrealdb.mjs +1 -1
  144. package/dist/migrations/tenant.d.mts +3 -3
  145. package/dist/migrations/tenant.mjs +1 -1
  146. package/dist/migrations/tenant.mjs.map +1 -1
  147. package/dist/migrations-DIUltjr3.mjs +2 -0
  148. package/dist/{migrations-BMiRjR-N.mjs.map → migrations-DIUltjr3.mjs.map} +1 -1
  149. package/dist/migrations.d.mts +5 -5
  150. package/dist/migrations.mjs +1 -1
  151. package/dist/model-Dtd37Sky.mjs +2 -0
  152. package/dist/model-Dtd37Sky.mjs.map +1 -0
  153. package/dist/mysql-BFPF8xyv.mjs +9 -0
  154. package/dist/mysql-BFPF8xyv.mjs.map +1 -0
  155. package/dist/mysql-adapter-BFWYPoM0.mjs +2 -0
  156. package/dist/mysql-adapter-BFWYPoM0.mjs.map +1 -0
  157. package/dist/mysql2.d.mts +2 -27
  158. package/dist/mysql2.mjs +1 -1
  159. package/dist/mysql2.mjs.map +1 -1
  160. package/dist/named-statements-CkOOD__I.mjs +2 -0
  161. package/dist/named-statements-CkOOD__I.mjs.map +1 -0
  162. package/dist/named-statements-NF7Iycjk.d.mts +13 -0
  163. package/dist/native-types-1ewJXVks.mjs +2 -0
  164. package/dist/native-types-1ewJXVks.mjs.map +1 -0
  165. package/dist/neon-http.d.mts +1 -1
  166. package/dist/neon-http.mjs +1 -1
  167. package/dist/neon-http.mjs.map +1 -1
  168. package/dist/normalized-result-D7nVkF36.mjs +2 -0
  169. package/dist/normalized-result-D7nVkF36.mjs.map +1 -0
  170. package/dist/{object-store-B_YMoW8u.d.mts → object-store-C4qmW7xf.d.mts} +4 -4
  171. package/dist/object-store-Chq1PMYz.mjs +2 -0
  172. package/dist/object-store-Chq1PMYz.mjs.map +1 -0
  173. package/dist/on-ZkOVmE4-.mjs +2 -0
  174. package/dist/{on-ylYaKuRu.mjs.map → on-ZkOVmE4-.mjs.map} +1 -1
  175. package/dist/on.d.mts +1 -1
  176. package/dist/on.mjs +1 -1
  177. package/dist/on.mjs.map +1 -1
  178. package/dist/ordering/keys.mjs +1 -1
  179. package/dist/ordering.d.mts +9 -3
  180. package/dist/ordering.mjs +10 -10
  181. package/dist/ordering.mjs.map +1 -1
  182. package/dist/pending-operation-D4gUKMxD.mjs +2 -0
  183. package/dist/pending-operation-D4gUKMxD.mjs.map +1 -0
  184. package/dist/permissions.d.mts +1 -1
  185. package/dist/permissions.mjs +1 -1
  186. package/dist/permissions.mjs.map +1 -1
  187. package/dist/pg.d.mts +16 -99
  188. package/dist/pg.mjs +1 -1
  189. package/dist/pg.mjs.map +1 -1
  190. package/dist/pglite.d.mts +3 -1
  191. package/dist/pglite.mjs +1 -1
  192. package/dist/pglite.mjs.map +1 -1
  193. package/dist/physical-DO4PEYcc.mjs +2 -0
  194. package/dist/physical-DO4PEYcc.mjs.map +1 -0
  195. package/dist/pinned-session-Y7-2pRBJ.mjs +2 -0
  196. package/dist/pinned-session-Y7-2pRBJ.mjs.map +1 -0
  197. package/dist/planetscale.d.mts +1 -1
  198. package/dist/planetscale.mjs +1 -1
  199. package/dist/planetscale.mjs.map +1 -1
  200. package/dist/{planner-DHjdvjwk.d.mts → planner-C-zjj19U.d.mts} +123 -1
  201. package/dist/postgres-DQQE2ys_.mjs +34 -0
  202. package/dist/postgres-DQQE2ys_.mjs.map +1 -0
  203. package/dist/postgres-adapter-BpLizOaK.mjs +2 -0
  204. package/dist/{postgres-adapter-axapXX8d.mjs.map → postgres-adapter-BpLizOaK.mjs.map} +1 -1
  205. package/dist/postgres-adapter-psTVfuw7.mjs +2 -0
  206. package/dist/postgres-adapter-psTVfuw7.mjs.map +1 -0
  207. package/dist/postgres-result-133boRW-.mjs +2 -0
  208. package/dist/postgres-result-133boRW-.mjs.map +1 -0
  209. package/dist/postgres.d.mts +27 -59
  210. package/dist/postgres.mjs +1 -1
  211. package/dist/postgres.mjs.map +1 -1
  212. package/dist/provider-limits-Bcsz0EJv.mjs +2 -0
  213. package/dist/provider-limits-Bcsz0EJv.mjs.map +1 -0
  214. package/dist/provider-parameter-snapshot-cyTUDutH.mjs +2 -0
  215. package/dist/provider-parameter-snapshot-cyTUDutH.mjs.map +1 -0
  216. package/dist/quantized-BKBs0joq.mjs +2 -0
  217. package/dist/quantized-BKBs0joq.mjs.map +1 -0
  218. package/dist/query-BTb6iakn.mjs +2 -0
  219. package/dist/query-BTb6iakn.mjs.map +1 -0
  220. package/dist/query-backend-TisPjCPF.mjs +2 -0
  221. package/dist/query-backend-TisPjCPF.mjs.map +1 -0
  222. package/dist/query-inspection-DwYBKSDG.mjs +2 -0
  223. package/dist/query-inspection-DwYBKSDG.mjs.map +1 -0
  224. package/dist/raw-DqEb71JZ.mjs +2 -0
  225. package/dist/raw-DqEb71JZ.mjs.map +1 -0
  226. package/dist/relation-bound-CSNKLyDy.mjs +2 -0
  227. package/dist/{relation-bound-ku_cMdye.mjs.map → relation-bound-CSNKLyDy.mjs.map} +1 -1
  228. package/dist/result-parsing-BbffueEX.mjs +2 -0
  229. package/dist/{result-parsing-B0Y4KGDT.mjs.map → result-parsing-BbffueEX.mjs.map} +1 -1
  230. package/dist/routed-operations-CcKOdn51.mjs +2 -0
  231. package/dist/{routed-operations-wytpbYKv.mjs.map → routed-operations-CcKOdn51.mjs.map} +1 -1
  232. package/dist/rows-of-Bgl9GVtK.mjs +2 -0
  233. package/dist/rows-of-Bgl9GVtK.mjs.map +1 -0
  234. package/dist/rule-words-DMbQuvD2.mjs +2 -0
  235. package/dist/{rule-words-ZIGm7cDm.mjs.map → rule-words-DMbQuvD2.mjs.map} +1 -1
  236. package/dist/scalar-Dm9brvAU.mjs +4 -0
  237. package/dist/scalar-Dm9brvAU.mjs.map +1 -0
  238. package/dist/schema/introspect.d.mts +2 -2
  239. package/dist/schema/introspect.mjs +1 -1
  240. package/dist/schema/json.d.mts +6 -4
  241. package/dist/schema/json.mjs +1 -1
  242. package/dist/schema-DDkAUfOb.mjs +2 -0
  243. package/dist/schema-DDkAUfOb.mjs.map +1 -0
  244. package/dist/schema-DqR_Kcje.mjs +2 -0
  245. package/dist/schema-DqR_Kcje.mjs.map +1 -0
  246. package/dist/schema-introspection-Bbo4DN_d.mjs +4 -0
  247. package/dist/schema-introspection-Bbo4DN_d.mjs.map +1 -0
  248. package/dist/schema.d.mts +2 -2
  249. package/dist/schema.mjs +1 -1
  250. package/dist/select-assembly-CEpNu-Gw.mjs +2 -0
  251. package/dist/select-assembly-CEpNu-Gw.mjs.map +1 -0
  252. package/dist/serializer-ettLu5xG.mjs +33 -0
  253. package/dist/serializer-ettLu5xG.mjs.map +1 -0
  254. package/dist/settle-Pui-1tfJ.mjs +2 -0
  255. package/dist/{settle-1cy5x_52.mjs.map → settle-Pui-1tfJ.mjs.map} +1 -1
  256. package/dist/settled-DYYPcaBX.mjs +2 -0
  257. package/dist/{settled-BjyuA76m.mjs.map → settled-DYYPcaBX.mjs.map} +1 -1
  258. package/dist/snowflake-BfF8xwfP.mjs +2 -0
  259. package/dist/{snowflake-UOCC820W.mjs.map → snowflake-BfF8xwfP.mjs.map} +1 -1
  260. package/dist/snowflake.d.mts +3 -3
  261. package/dist/snowflake.mjs +2 -2
  262. package/dist/snowflake.mjs.map +1 -1
  263. package/dist/soft-delete.d.mts +9 -3
  264. package/dist/soft-delete.mjs +1 -1
  265. package/dist/soft-delete.mjs.map +1 -1
  266. package/dist/{spans-XDUFeTzC.mjs → spans-DwDXMvyd.mjs} +1 -1
  267. package/dist/{spans-XDUFeTzC.mjs.map → spans-DwDXMvyd.mjs.map} +1 -1
  268. package/dist/sql-Bu63iAfT.mjs +2 -0
  269. package/dist/sql-Bu63iAfT.mjs.map +1 -0
  270. package/dist/{sql-BVZ8QefY.d.mts → sql-C4_sFNDm.d.mts} +18 -5
  271. package/dist/sql-statement-tokens-Z5Ta4iDB.mjs +3 -0
  272. package/dist/{sql-statement-tokens-DbeMwHra.mjs.map → sql-statement-tokens-Z5Ta4iDB.mjs.map} +1 -1
  273. package/dist/sql-tegqTqGq.mjs +2 -0
  274. package/dist/sql-tegqTqGq.mjs.map +1 -0
  275. package/dist/sql.d.mts +1 -1
  276. package/dist/sql.mjs +1 -1
  277. package/dist/sqlite-adapter-Cb-SJw2f.mjs +2 -0
  278. package/dist/sqlite-adapter-Cb-SJw2f.mjs.map +1 -0
  279. package/dist/sqlite-statement-classifier-JBHiQO6Q.mjs +2 -0
  280. package/dist/{sqlite-statement-classifier-BAHl-WXS.mjs.map → sqlite-statement-classifier-JBHiQO6Q.mjs.map} +1 -1
  281. package/dist/sqlite-utils-Bfmtkt1b.mjs +2 -0
  282. package/dist/sqlite-utils-Bfmtkt1b.mjs.map +1 -0
  283. package/dist/sqlite3.d.mts +2 -46
  284. package/dist/sqlite3.mjs +1 -1
  285. package/dist/sqlite3.mjs.map +1 -1
  286. package/dist/standard-sql-Bl2OHGfi.mjs +6 -0
  287. package/dist/standard-sql-Bl2OHGfi.mjs.map +1 -0
  288. package/dist/suppressed-failure-CFUDJrUw.mjs +2 -0
  289. package/dist/{suppressed-failure-CQkQsMVS.mjs.map → suppressed-failure-CFUDJrUw.mjs.map} +1 -1
  290. package/dist/surrealdb.d.mts +2 -2
  291. package/dist/surrealdb.mjs +1 -1
  292. package/dist/surrealdb.mjs.map +1 -1
  293. package/dist/surrealql-DY74AUeD.mjs +2 -0
  294. package/dist/surrealql-DY74AUeD.mjs.map +1 -0
  295. package/dist/time-step-DJaIhpAz.mjs +2 -0
  296. package/dist/time-step-DJaIhpAz.mjs.map +1 -0
  297. package/dist/transaction-Bv5nyp-U.mjs +2 -0
  298. package/dist/{transaction-BNomMtme.mjs.map → transaction-Bv5nyp-U.mjs.map} +1 -1
  299. package/dist/transaction-operation-CaWzo7gE.mjs +2 -0
  300. package/dist/{transaction-operation-CVVJxQ19.mjs.map → transaction-operation-CaWzo7gE.mjs.map} +1 -1
  301. package/dist/types-Dy33vBdd.mjs +2 -0
  302. package/dist/{types-DtDnXhwa.mjs.map → types-Dy33vBdd.mjs.map} +1 -1
  303. package/dist/unit-DUPX5Sdd.mjs +2 -0
  304. package/dist/{unit-BhHbZyuJ.mjs.map → unit-DUPX5Sdd.mjs.map} +1 -1
  305. package/dist/unit-words-BXpLpyr2.mjs +2 -0
  306. package/dist/{unit-words-CT0yeqfZ.mjs.map → unit-words-BXpLpyr2.mjs.map} +1 -1
  307. package/dist/utils-BHkJsduV.mjs +26 -0
  308. package/dist/{utils-CpAojrCj.mjs.map → utils-BHkJsduV.mjs.map} +1 -1
  309. package/dist/v1-parse-shared-cJ-uD14P.mjs +2 -0
  310. package/dist/v1-parse-shared-cJ-uD14P.mjs.map +1 -0
  311. package/dist/validation-ATmgN5RE.mjs +2 -0
  312. package/dist/validation-ATmgN5RE.mjs.map +1 -0
  313. package/dist/validation-BHjx13zG.mjs +2 -0
  314. package/dist/validation-BHjx13zG.mjs.map +1 -0
  315. package/dist/validation.d.mts +1 -1
  316. package/dist/validation.mjs +1 -1
  317. package/dist/validator-DMzH5Tz0.mjs +2 -0
  318. package/dist/validator-DMzH5Tz0.mjs.map +1 -0
  319. package/dist/value-guards-CBVIJXlI.mjs +2 -0
  320. package/dist/{value-guards-CBuxSC66.mjs.map → value-guards-CBVIJXlI.mjs.map} +1 -1
  321. package/dist/values-Ch2cTlss.mjs +2 -0
  322. package/dist/{values-B4aj1i1f.mjs.map → values-Ch2cTlss.mjs.map} +1 -1
  323. package/dist/version-0BDwfy7C.mjs +2 -0
  324. package/dist/{version-CXGIA82S.mjs.map → version-0BDwfy7C.mjs.map} +1 -1
  325. package/dist/view-CHgjF2BO.mjs +2 -0
  326. package/dist/view-CHgjF2BO.mjs.map +1 -0
  327. package/dist/write-sinks-Bei5vFHP.mjs +2 -0
  328. package/dist/{write-sinks-3IKCDF-S.mjs.map → write-sinks-Bei5vFHP.mjs.map} +1 -1
  329. package/package.json +50 -37
  330. package/dist/adapter-internals-DOqI8IlQ.mjs +0 -2
  331. package/dist/adapter-internals-DOqI8IlQ.mjs.map +0 -1
  332. package/dist/adapter-namespace-DaRiTIIf.mjs +0 -2
  333. package/dist/adapter-result-parser-3WP82Cm-.mjs +0 -2
  334. package/dist/adapter-result-parser-3WP82Cm-.mjs.map +0 -1
  335. package/dist/args-764KdWMr.mjs +0 -2
  336. package/dist/array-literal-DHinAnVs.mjs +0 -2
  337. package/dist/base-z-cH5ZBI.mjs +0 -2
  338. package/dist/base-z-cH5ZBI.mjs.map +0 -1
  339. package/dist/batch-refs-C-gx7A4-.mjs +0 -2
  340. package/dist/bind-parameter-capacity-BMD-bxMO.mjs +0 -2
  341. package/dist/call-Cz8XUmrl.mjs +0 -2
  342. package/dist/canonical-json-Bl-fKFF_.mjs +0 -2
  343. package/dist/canonical-json-Bl-fKFF_.mjs.map +0 -1
  344. package/dist/chunk-BuuaeEvq.mjs +0 -1
  345. package/dist/client-DRpX3-vw.mjs +0 -2
  346. package/dist/client-DRpX3-vw.mjs.map +0 -1
  347. package/dist/client-y7TV0PRZ.mjs +0 -9
  348. package/dist/client-y7TV0PRZ.mjs.map +0 -1
  349. package/dist/confine-DqFBTUw6.mjs +0 -2
  350. package/dist/coordination-6qZHx_kl.mjs +0 -2
  351. package/dist/coordination-6qZHx_kl.mjs.map +0 -1
  352. package/dist/current-DBTlPsQg.mjs +0 -2
  353. package/dist/current-DBTlPsQg.mjs.map +0 -1
  354. package/dist/datetime-physical-codec-Dj-APo9f.mjs +0 -2
  355. package/dist/datetime-physical-codec-Dj-APo9f.mjs.map +0 -1
  356. package/dist/defaults-DwOHWI_M.mjs +0 -2
  357. package/dist/driver-BGVcgnIX.mjs +0 -2
  358. package/dist/driver-BGVcgnIX.mjs.map +0 -1
  359. package/dist/driver-BIXhOH2_.mjs +0 -2
  360. package/dist/driver-BIXhOH2_.mjs.map +0 -1
  361. package/dist/driver-diagnostics-DW9NdckJ.mjs +0 -2
  362. package/dist/error-mapping-B1-IWkCQ.mjs +0 -2
  363. package/dist/error-mapping-B1-IWkCQ.mjs.map +0 -1
  364. package/dist/every-tOgQmaIE.mjs +0 -2
  365. package/dist/execution-context-BXpcbyPe.mjs +0 -2
  366. package/dist/execution-context-BXpcbyPe.mjs.map +0 -1
  367. package/dist/extension-CGepsF-p.mjs +0 -2
  368. package/dist/fs-estate-D1Nsg9G1.mjs +0 -2
  369. package/dist/geo-area-codec-mHrM3b9A.mjs +0 -2
  370. package/dist/geo-area-codec-mHrM3b9A.mjs.map +0 -1
  371. package/dist/hydration-A3zffFWP.mjs +0 -2
  372. package/dist/hydration-A3zffFWP.mjs.map +0 -1
  373. package/dist/identifier-conversion-DHYPTgzr.mjs +0 -2
  374. package/dist/identifier-conversion-DHYPTgzr.mjs.map +0 -1
  375. package/dist/identifiers-s00pGES8.mjs +0 -2
  376. package/dist/identifiers-s00pGES8.mjs.map +0 -1
  377. package/dist/identity-CtW15WlB.mjs +0 -2
  378. package/dist/identity-CtW15WlB.mjs.map +0 -1
  379. package/dist/introspect-Bm6xnXcG.mjs +0 -2
  380. package/dist/introspect-Bm6xnXcG.mjs.map +0 -1
  381. package/dist/json-DgMc8-GU.mjs +0 -2
  382. package/dist/json-DgMc8-GU.mjs.map +0 -1
  383. package/dist/json-number-AI-SdUUn.mjs +0 -2
  384. package/dist/json-parameter-oQ8nGaKr.mjs +0 -2
  385. package/dist/judge-words-CzUyXtJ6.mjs +0 -2
  386. package/dist/judge-words-CzUyXtJ6.mjs.map +0 -1
  387. package/dist/key-hxFFCKed.mjs +0 -2
  388. package/dist/key-hxFFCKed.mjs.map +0 -1
  389. package/dist/keys-BQxM4c_a.mjs +0 -2
  390. package/dist/libsql-DuGR904j.mjs +0 -3
  391. package/dist/libsql-DuGR904j.mjs.map +0 -1
  392. package/dist/light-BkJe3-yW.mjs +0 -2
  393. package/dist/memory-G4cSuc6A.mjs +0 -2
  394. package/dist/methods-part-ZY0f2AV_.mjs +0 -2
  395. package/dist/methods-part-ZY0f2AV_.mjs.map +0 -1
  396. package/dist/migrations-BMiRjR-N.mjs +0 -2
  397. package/dist/mysql-BNXWfTOo.mjs +0 -100
  398. package/dist/mysql-BNXWfTOo.mjs.map +0 -1
  399. package/dist/mysql-adapter-C69j1sKh.mjs +0 -2
  400. package/dist/mysql-adapter-C69j1sKh.mjs.map +0 -1
  401. package/dist/native-types-DgjMUikz.mjs +0 -2
  402. package/dist/native-types-DgjMUikz.mjs.map +0 -1
  403. package/dist/normalized-result-B8pifWS0.mjs +0 -2
  404. package/dist/normalized-result-B8pifWS0.mjs.map +0 -1
  405. package/dist/object-store-DS0F0yZX.mjs +0 -2
  406. package/dist/object-store-DS0F0yZX.mjs.map +0 -1
  407. package/dist/on-ylYaKuRu.mjs +0 -2
  408. package/dist/pending-operation-C_eOFOBE.mjs +0 -2
  409. package/dist/pending-operation-C_eOFOBE.mjs.map +0 -1
  410. package/dist/physical-CeE2nYmI.mjs +0 -2
  411. package/dist/physical-CeE2nYmI.mjs.map +0 -1
  412. package/dist/pinned-session-DCoAZDOz.mjs +0 -2
  413. package/dist/pinned-session-DCoAZDOz.mjs.map +0 -1
  414. package/dist/postgres-CDdh5dSP.mjs +0 -437
  415. package/dist/postgres-CDdh5dSP.mjs.map +0 -1
  416. package/dist/postgres-adapter-Dlr3ZWd7.mjs +0 -2
  417. package/dist/postgres-adapter-Dlr3ZWd7.mjs.map +0 -1
  418. package/dist/postgres-adapter-axapXX8d.mjs +0 -2
  419. package/dist/postgres-result-DF6DmW3r.mjs +0 -2
  420. package/dist/postgres-result-DF6DmW3r.mjs.map +0 -1
  421. package/dist/provider-limits-Ccsb8PTb.mjs +0 -2
  422. package/dist/provider-limits-Ccsb8PTb.mjs.map +0 -1
  423. package/dist/provider-parameter-snapshot-BikrgKqI.mjs +0 -2
  424. package/dist/provider-parameter-snapshot-BikrgKqI.mjs.map +0 -1
  425. package/dist/query-BZVHfA0s.mjs +0 -2
  426. package/dist/query-BZVHfA0s.mjs.map +0 -1
  427. package/dist/query-inspection-BoG-yAln.mjs +0 -2
  428. package/dist/query-inspection-BoG-yAln.mjs.map +0 -1
  429. package/dist/raw-Dyq6Y6UX.mjs +0 -2
  430. package/dist/raw-Dyq6Y6UX.mjs.map +0 -1
  431. package/dist/relation-bound-ku_cMdye.mjs +0 -2
  432. package/dist/result-parsing-B0Y4KGDT.mjs +0 -2
  433. package/dist/routed-operations-wytpbYKv.mjs +0 -2
  434. package/dist/rule-words-ZIGm7cDm.mjs +0 -2
  435. package/dist/scalar-BHCh7aUz.mjs +0 -4
  436. package/dist/scalar-BHCh7aUz.mjs.map +0 -1
  437. package/dist/schema-BYA-_bpk.mjs +0 -2
  438. package/dist/schema-BYA-_bpk.mjs.map +0 -1
  439. package/dist/schema-CFIaebgi.mjs +0 -2
  440. package/dist/schema-CFIaebgi.mjs.map +0 -1
  441. package/dist/schema-introspection-D0f8cti4.mjs +0 -6
  442. package/dist/schema-introspection-D0f8cti4.mjs.map +0 -1
  443. package/dist/select-assembly-DVI7d3tf.mjs +0 -2
  444. package/dist/select-assembly-DVI7d3tf.mjs.map +0 -1
  445. package/dist/serializer-rBq3v1xr.mjs +0 -51
  446. package/dist/serializer-rBq3v1xr.mjs.map +0 -1
  447. package/dist/settle-1cy5x_52.mjs +0 -2
  448. package/dist/settled-BjyuA76m.mjs +0 -2
  449. package/dist/snowflake-UOCC820W.mjs +0 -2
  450. package/dist/sql-3o4DOKm9.mjs +0 -2
  451. package/dist/sql-3o4DOKm9.mjs.map +0 -1
  452. package/dist/sql-Dl6nykFV.mjs +0 -2
  453. package/dist/sql-Dl6nykFV.mjs.map +0 -1
  454. package/dist/sql-statement-tokens-DbeMwHra.mjs +0 -3
  455. package/dist/sqlite-adapter-Ad0d-m2t.mjs +0 -2
  456. package/dist/sqlite-adapter-Ad0d-m2t.mjs.map +0 -1
  457. package/dist/sqlite-statement-classifier-BAHl-WXS.mjs +0 -2
  458. package/dist/sqlite-utils-BRvbmlQ1.mjs +0 -2
  459. package/dist/sqlite-utils-BRvbmlQ1.mjs.map +0 -1
  460. package/dist/standard-sql-qLcQyCtK.mjs +0 -6
  461. package/dist/standard-sql-qLcQyCtK.mjs.map +0 -1
  462. package/dist/suppressed-failure-CQkQsMVS.mjs +0 -2
  463. package/dist/surrealql-C1dp1sWw.mjs +0 -2
  464. package/dist/surrealql-C1dp1sWw.mjs.map +0 -1
  465. package/dist/to-many-BybuKQM1.mjs +0 -2
  466. package/dist/to-many-BybuKQM1.mjs.map +0 -1
  467. package/dist/transaction-BNomMtme.mjs +0 -2
  468. package/dist/transaction-operation-CVVJxQ19.mjs +0 -2
  469. package/dist/types-DtDnXhwa.mjs +0 -2
  470. package/dist/unit-BhHbZyuJ.mjs +0 -2
  471. package/dist/unit-words-CT0yeqfZ.mjs +0 -2
  472. package/dist/utils-CpAojrCj.mjs +0 -26
  473. package/dist/validation--qS7OPmg.mjs +0 -2
  474. package/dist/validation--qS7OPmg.mjs.map +0 -1
  475. package/dist/validation-CYaJ8ndO.mjs +0 -2
  476. package/dist/validation-CYaJ8ndO.mjs.map +0 -1
  477. package/dist/validator-CZLW7aR3.mjs +0 -2
  478. package/dist/validator-CZLW7aR3.mjs.map +0 -1
  479. package/dist/value-guards-CBuxSC66.mjs +0 -2
  480. package/dist/values-B4aj1i1f.mjs +0 -2
  481. package/dist/version-CXGIA82S.mjs +0 -2
  482. package/dist/write-sinks-3IKCDF-S.mjs +0 -2
  483. /package/dist/{contract-CrIB-3ZJ.d.mts → contract-CxJn0_cV.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods-part-BaNx3o7b.mjs","names":["methods"],"sources":["../src/extensions/arguments.ts","../src/extensions/methods.ts","../src/extensions/methods-part.ts"],"sourcesContent":["/**\n * Arguments: what `args` declares, placed on a chain and admitted once per\n * call. Brought by `args` alone: an extension that declares no argument\n * carries none of it.\n */\n\nimport { QueryError, ValidationError, VibORMError } from \"@errors\";\nimport { memo } from \"@query-engine/raptor3/shared/schema\";\nimport type { Operation } from \"@query-engine/types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { discardAsyncValidationResult } from \"@validation/parse-failure\";\nimport { errorCause } from \"../errors/diagnostic-safety\";\nimport { extensionError } from \"./chain\";\nimport type { ResolvedArgs } from \"./chain-state\";\n\ntype ArgLiteral = string | number | boolean;\n\n/**\n * One argument an extension declares. Its values are a closed list or a\n * Standard Schema, and `admit` is the code that checks one, brought by the\n * word that declared it (`oneOf`, or `accepts` and `bound`), so a chain of\n * closed arguments carries no Standard Schema admission. `on` names the\n * operations that accept it (every operation when absent), `models` the\n * models (every model when absent). With `required`, a call on one of those\n * operations that does not pass it is refused: on every model that accepts\n * it, or on the models it lists. With `bound`, it is accepted only from a\n * binding (the client scope's `$bind`, which `bind` runs), never from a\n * call's arguments, so a call that passes it is refused as passing an\n * unknown key. With `volatile`, a call that holds a value of it has no key\n * (`key(run)`): a read that holds one is never served from a store nor kept\n * in one.\n */\nexport interface ArgDeclaration {\n /** A closed argument's values; absent for a Standard Schema's. */\n readonly oneOf?: readonly ArgLiteral[];\n readonly admit: AdmitValue;\n readonly on?: readonly string[];\n readonly models?: readonly string[];\n readonly required?: true | readonly string[];\n /** The value a call that passes none reads. */\n readonly default?: ArgLiteral;\n readonly bound?: boolean;\n readonly bind?: typeof bindArguments;\n readonly volatile?: boolean;\n}\n\n/** One value admitted for a call's (model, operation), or, without them, a binding. */\ntype AdmitValue = (\n argument: ResolvedArg,\n value: unknown,\n model?: string,\n operation?: Operation\n) => unknown;\n\n/**\n * One argument of a chain: its declaration as written, its name and the\n * extension that declares it. Its declaration alone places it: no other part\n * moves it.\n */\nexport type ResolvedArg = ArgDeclaration & {\n readonly name: string;\n readonly extension: string;\n};\n\n/** The arguments one call admitted, by name; one it did not pass is absent. */\nexport type AdmittedArgs = Readonly<Record<string, unknown>>;\n\nexport interface ArgAdmission {\n /** The call's arguments without the chain's; the input itself when it passed none. */\n readonly args: Record<string, unknown>;\n /** `undefined` when the call admitted no value. */\n readonly values: AdmittedArgs | undefined;\n}\n\n/**\n * The values a view binds after one extension binds its own arguments: each\n * admitted once, over the values the view already binds, a value replacing\n * an earlier one. Brought by `bound`: only a `bound` argument is bound.\n */\nexport function bindArguments(\n all: readonly ResolvedArg[],\n extension: string,\n values: Readonly<Record<string, unknown>>,\n previous: AdmittedArgs | undefined\n): AdmittedArgs {\n const next: Record<string, unknown> = { ...previous };\n for (const [name, raw] of Object.entries(values)) {\n const argument = all.find(\n (candidate) =>\n candidate.name === name &&\n candidate.extension === extension &&\n candidate.bound === true\n );\n if (argument === undefined) notBound(extension, name);\n next[name] = argument.admit(argument, raw);\n }\n return next;\n}\n\n/** The refusal of a `$bind` naming an argument its extension does not declare `bound`. */\nexport function notBound(extension: string, name: string): never {\n return extensionError(\n `Extension \"${extension}\" binds argument \"${name}\", which it does not declare with bound(schema).`,\n extension\n );\n}\n\n/** One extension's own admitted arguments, as its parts see them (`c.values`). */\nfunction argsOwnedBy(\n admitted: AdmittedArgs | undefined,\n names: readonly string[]\n): AdmittedArgs {\n const owned: Record<string, unknown> = {};\n for (const name of names)\n if (admitted && Object.hasOwn(admitted, name)) owned[name] = admitted[name];\n return owned;\n}\n\n/** What admits a value of one of `values`, brought by `oneOf`. */\nexport const closedValues =\n (values: readonly ArgLiteral[]): AdmitValue =>\n (argument, value, model, operation) => {\n if (values.some((allowed) => allowed === value)) return value;\n throw invalidArgument(argument, model, operation, [\n `must be one of ${values.map((allowed) => JSON.stringify(allowed)).join(\", \")}`,\n ]);\n };\n\n/** What admits a value `schema` checks, brought by `accepts` and `bound`. */\nexport const checkedBy =\n (schema: StandardSchemaV1): AdmitValue =>\n (argument, value, model, operation) => {\n let result: ReturnType<StandardSchemaV1[\"~standard\"][\"validate\"]>;\n try {\n result = schema[\"~standard\"].validate(value);\n } catch (cause) {\n // A validator may own its typed failure; anything else is a failure of\n // extension code, as a throwing first moment is.\n if (cause instanceof VibORMError) throw cause;\n throw validatorFailure(argument, model, operation, \"threw\", cause);\n }\n if (\"then\" in result) {\n // The refused promise is still live; without a handler its rejection\n // would surface as an unhandled rejection (D-37).\n discardAsyncValidationResult(result);\n throw validatorFailure(\n argument,\n model,\n operation,\n \"returned a promise\",\n new TypeError(\"Argument validators must return synchronously\")\n );\n }\n if (result.issues)\n throw invalidArgument(\n argument,\n model,\n operation,\n result.issues.map((issue) => issue.message)\n );\n return result.value;\n };\n\nfunction invalidArgument(\n argument: ResolvedArg,\n model: string | undefined,\n operation: Operation | undefined,\n messages: readonly string[]\n): ValidationError {\n return new ValidationError(\n operation === undefined\n ? { kind: \"schema-builder\", builder: \"$bind\", path: argument.name }\n : { kind: \"operation\", operation, model },\n messages.map((message) => ({\n path: argument.name,\n message: `Argument \"${argument.name}\" ${message}`,\n })),\n { meta: { model, extension: argument.extension } }\n );\n}\n\nfunction validatorFailure(\n argument: ResolvedArg,\n model: string | undefined,\n operation: Operation | undefined,\n failure: string,\n cause: unknown\n): QueryError {\n return new QueryError(\n `Extension \"${argument.extension}\" argument \"${argument.name}\" validator for ${operation === undefined ? \"$bind\" : `${model}.${operation}`} ${failure}.`,\n { cause: errorCause(cause), meta: { model, operation } }\n );\n}\n\n/**\n * The chain's arguments with one extension's added, each (model, operation)\n * listing the ones it accepts the first time a call asks. One name, one\n * argument: a call's value is read once and admitted against one\n * declaration, so a second declaration of a name would refuse every call\n * that passes either value, and a binding would answer for both.\n */\nexport function appendArguments(\n previous: ResolvedArgs | undefined,\n declared: readonly ResolvedArg[]\n): ResolvedArgs {\n const all = [...(previous?.all ?? []), ...declared];\n const binder = all.find((argument) => argument.bind)?.bind;\n const names = new Set<string>();\n for (const { name, extension } of all) {\n // `named` is core's own call option (named statements): no extension takes it.\n if (name === \"named\")\n extensionError(\n `Extension \"${extension}\" declares argument \"named\", which VibORM reserves for named statements.`,\n extension\n );\n if (names.has(name))\n extensionError(\n `Extension \"${extension}\" declares argument \"${name}\", which extension \"${all.find((argument) => argument.name === name)?.extension}\" already declares.`,\n extension\n );\n names.add(name);\n }\n const lists = new Map<string, readonly ResolvedArg[]>();\n const placed = (model: string, operation: string): readonly ResolvedArg[] => {\n const key = `${model}\\u0000${operation}`;\n return memo(lists, key, () =>\n all.filter(\n ({ on, models }) =>\n (on === undefined || on.includes(operation)) &&\n (models === undefined || models.includes(model))\n )\n );\n };\n return {\n names,\n all,\n placed,\n owned: argsOwnedBy,\n /**\n * Take every argument placed on this operation out of the call's\n * arguments and admit each once, before any first moment runs. A key\n * naming an argument placed elsewhere, or a bound one, stays in the\n * arguments, where core validation refuses it as an unknown key. An\n * argument the call did not pass takes the value its view binds, else\n * its default; without either it is refused where it is required.\n */\n admit: (\n model: string,\n placement: string,\n operation: Operation,\n input: Record<string, unknown>,\n bound: AdmittedArgs | undefined\n ): ArgAdmission | undefined => {\n const list = placed(model, placement);\n if (list.length === 0) return undefined;\n // Arguments that are not an object hold no extension argument: core\n // validation refuses them as it does on a client without extensions.\n if (typeof input !== \"object\" || input === null) {\n return { args: input, values: undefined };\n }\n let values: Record<string, unknown> | undefined;\n let args: Record<string, unknown> | undefined;\n for (const argument of list) {\n const { name, required } = argument;\n let raw: unknown;\n if (argument.bound !== true && Object.hasOwn(input, name)) {\n raw = input[name];\n args ??= { ...input };\n delete args[name];\n }\n // A bound value was admitted once, when its view was bound.\n const value =\n raw === undefined\n ? (bound?.[name] ?? argument.default)\n : argument.admit(argument, raw, model, operation);\n if (value !== undefined) (values ??= {})[name] = value;\n else if (required === true || required?.includes(model)) {\n throw invalidArgument(argument, model, operation, [\"is required\"]);\n }\n }\n return { args: args ?? input, values };\n },\n // Brought by `bound`: a chain that declares no bound argument binds none.\n bind: binder && ((...binding) => binder(all, ...binding)),\n };\n}\n","import type { TransactionClient, VibORMConfig } from \"@client/client\";\nimport {\n RAW_METHOD_NAMES,\n type RawSurface,\n type RowsFragment,\n} from \"@client/raw\";\nimport type { ClientSchema } from \"@client/schema-links\";\nimport type {\n Client,\n ClientRowsContext,\n ComputedOperation,\n ComputedOperations,\n DeclaredTable,\n Schema,\n StampedOperation,\n StampedOperations,\n ViewOperations,\n} from \"@client/types\";\nimport type { ModelSql } from \"@query-engine/raptor3/shared/insert-value\";\nimport { ROUTED_OPERATIONS } from \"@query-engine/routed-operations\";\nimport { isFunction, isRecord } from \"@validation/value-guards\";\nimport { type AdmittedArgs, notBound } from \"./arguments\";\nimport type { ExtensionPart } from \"./chain\";\nimport { extensionError } from \"./chain\";\nimport type { NoArguments } from \"./contract\";\nimport type { MergeResultFields } from \"./result-types\";\n\ntype NoMethods = Record<never, never>;\ntype RuntimeExtensionMethodFunction = (...args: never[]) => unknown;\n\ndeclare const extensionResultConsumerState: unique symbol;\nexport interface ExtensionResultConsumerState {\n readonly [extensionResultConsumerState]: true;\n}\n\n/** The only static facts accumulated while extensions are chained. */\nexport interface ClientExtensionState<\n ClientMethods extends object = NoMethods,\n ModelMethods extends object = NoMethods,\n ResultConsumerState extends\n | ExtensionResultConsumerState\n | undefined = undefined,\n Arguments extends object = NoArguments,\n Filtered extends string = never,\n Defaults = never,\n Fields extends object = Record<never, never>,\n> {\n readonly client: ClientMethods;\n readonly models: ModelMethods;\n readonly resultConsumer: ResultConsumerState;\n /** The arguments the chain declares: each one's values and placement. */\n readonly args: Arguments;\n /** The models whose rows the chain's rules filter: a relation read can find none. */\n readonly filtered: Filtered;\n /** The fields the chain's `defaults` write on a create, which a caller no longer writes. */\n readonly defaults: Defaults;\n /** The fields the chain's `fields` compute, per model key, and their types. */\n readonly fields: Fields;\n}\n\nexport type EmptyClientExtensionState = ClientExtensionState;\n\n/** What every extension state is: the widest of each fact. */\nexport type ExtensionStateConstraint = ClientExtensionState<\n object,\n object,\n ExtensionResultConsumerState | undefined,\n object,\n string,\n unknown,\n object\n>;\n\n/** Whether an earlier extension was typed against result-bearing delegates. */\ntype HasResultConsumingExtension<X extends ExtensionStateConstraint> = [\n X[\"resultConsumer\"],\n] extends [undefined]\n ? false\n : [X[\"resultConsumer\"]] extends [ExtensionResultConsumerState]\n ? true\n : false;\n\ndeclare const delegateState: unique symbol;\n/**\n * Declaration-only: what a result read on a delegate of a chain that adds\n * model methods depends on (its client's config, the models the chain's\n * rules filter, its computed fields, the model), so a method typed with a\n * `this` parameter reads its result from the client it is called on\n * (`DelegateOperationResult`), whatever the chain added after it. Nothing\n * else of the extension state: a later step that changes none of these (the\n * cache) keeps the client assignable to the one before it. No property is\n * installed at runtime.\n */\nexport interface DelegateState<C, Rows, Result, ModelName> {\n readonly [delegateState]?: readonly [C, Rows, Result, ModelName];\n}\n\ntype MethodsForModel<\n X extends ExtensionStateConstraint,\n ModelName extends PropertyKey,\n> = ModelName extends keyof X[\"models\"] ? X[\"models\"][ModelName] : NoMethods;\n\n/**\n * The link, on every delegate of a chain that adds model methods: decided by\n * the extension state alone, so a client generic over its schema without\n * them (the empty state) compares as before.\n */\ntype DelegateLink<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends PropertyKey,\n> = [keyof X[\"models\"]] extends [never]\n ? unknown\n : DelegateState<C, X[\"filtered\"], X[\"fields\"], ModelName>;\n\n/**\n * One model's delegate after the chain's methods and arguments. On a chain\n * that writes `defaults` on a create, its writes may leave out the fields the chain\n * writes on a create.\n */\nexport type ExtensionModelDelegate<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends keyof ClientSchema<C>,\n> = ([X[\"defaults\"]] extends [never]\n ? Client<C, ClientRowsContext<C, X[\"filtered\"]>, X[\"args\"]>[ModelName]\n : Omit<\n Client<C, ClientRowsContext<C, X[\"filtered\"]>, X[\"args\"]>[ModelName],\n StampedOperation\n > &\n // A view is never written, so a chain's create data gives it no write.\n (ClientSchema<C>[ModelName] extends DeclaredTable\n ? StampedOperations<\n C,\n ClientRowsContext<C, X[\"filtered\"]>,\n X[\"args\"],\n X[\"defaults\"],\n ModelName\n >\n : unknown)) &\n MethodsForModel<X, ModelName> &\n DelegateLink<C, X, ModelName> &\n ModelRows;\n\n/** The core member every model delegate has beside its operations. */\ninterface ModelRows {\n /**\n * The rows of this model this client may read, as a `FROM` item of a\n * tagged `$queryRaw` named `alias`: a derived table filtered by the row\n * domain a `findMany` of this model on this client takes (permissions,\n * soft delete, bound arguments). Refused anywhere else.\n *\n * @example\n * ```ts\n * await db.$as(actor).$queryRaw`\n * SELECT p.id FROM ${db.$as(actor).page.$rows(\"p\")} WHERE p.title LIKE ${q}\n * `;\n * ```\n */\n $rows(alias: string): RowsFragment;\n /**\n * This model's names and values as this client's statements spell them:\n * its table, its columns, a value bound as one of its fields, and the rows\n * a call may see as a condition. For a fragment you write by hand and hand\n * to a model operation (a `computed` value, a filter's expression).\n */\n readonly $sql: ModelSql;\n}\n\n/**\n * One model's delegate on a chain that declares `fields`: its projecting\n * operations rebuilt so `select` and `omit` name the computed fields and the\n * rows carry them. A chain without `fields` never reaches this type.\n */\ntype ComputedModelDelegate<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends keyof ClientSchema<C>,\n> = Omit<ExtensionModelDelegate<C, X, ModelName>, ComputedOperation> &\n (ClientSchema<C>[ModelName] extends DeclaredTable\n ? ComputedOperations<\n C,\n ClientRowsContext<C, X[\"filtered\"]>,\n X[\"args\"],\n X[\"defaults\"],\n ModelName,\n X[\"fields\"]\n >\n : Pick<\n ComputedOperations<\n C,\n ClientRowsContext<C, X[\"filtered\"]>,\n X[\"args\"],\n X[\"defaults\"],\n ModelName,\n X[\"fields\"]\n >,\n Extract<ComputedOperation, ViewOperations<ClientSchema<C>[ModelName]>>\n >);\n\n/**\n * Model delegates after the methods contributed by the current chain. The\n * always-true test is deliberate: for a client generic over its config it\n * stays deferred, so the model map adds no index signature to that client and\n * its `$` members stay reachable inside a body generic over `C`. A chain\n * that declares `fields` is told apart here, once per client.\n */\nexport type ExtensionModelClient<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n> = [keyof C[\"schema\"]] extends [PropertyKey]\n ? [keyof X[\"fields\"]] extends [never]\n ? {\n [ModelName in keyof ClientSchema<C>]: ExtensionModelDelegate<\n C,\n X,\n ModelName\n >;\n }\n : {\n [ModelName in keyof ClientSchema<C>]: ComputedModelDelegate<\n C,\n X,\n ModelName\n >;\n }\n : unknown;\n\n/** The surface given to one client-method factory. */\nexport type ExtensionClientScope<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n> = ExtensionModelClient<C, X> &\n RawSurface &\n X[\"client\"] & {\n readonly $schema: ClientSchema<C>;\n readonly $transaction: TransactionClient<C, X>[\"$transaction\"];\n /**\n * The client this scope's methods are called on, its calls admitting\n * these values of this extension's own arguments as if passed (a\n * `bound: true` argument only from here). Its type is that client's,\n * which only the method knows: declare it with a `this` parameter,\n * `$with<Self>(this: Self, value: Value): Self`, outside the returned\n * literal (inside it, the factory's contextual type makes `Self` void).\n */\n readonly $bind: (values: Readonly<Record<string, unknown>>) => unknown;\n };\n\nexport type MergeModelMethods<Left extends object, Right extends object> = {\n readonly [ModelName in\n | keyof Left\n | keyof Right]: (ModelName extends keyof Left\n ? Left[ModelName]\n : NoMethods) &\n (ModelName extends keyof Right ? Right[ModelName] : NoMethods);\n};\n\n/** Incoming facts keep their nominal bit derivation inside this named state. */\nexport interface AddedExtensionState<\n ClientMethods extends object,\n ModelMethods extends object,\n Arguments extends object,\n Filtered extends string,\n Defaults,\n ConsumerContext extends string,\n // Defaulted: 1.3.3 exported this state with six parameters.\n Fields extends object = Record<never, never>,\n> extends ExtensionStateConstraint {\n readonly client: ClientMethods;\n readonly models: ModelMethods;\n readonly resultConsumer: ConsumerContext extends \"result-consuming\"\n ? ExtensionResultConsumerState\n : undefined;\n readonly args: Arguments;\n readonly filtered: Filtered;\n readonly defaults: Defaults;\n readonly fields: Fields;\n}\n\n/** Accumulate the same seven facts lazily, without retaining callback definitions. */\nexport interface ChainedExtensionState<\n X extends ExtensionStateConstraint,\n Added extends ExtensionStateConstraint,\n> extends ExtensionStateConstraint {\n readonly client: X[\"client\"] & Added[\"client\"];\n readonly models: MergeModelMethods<X[\"models\"], Added[\"models\"]>;\n readonly resultConsumer: HasResultConsumingExtension<Added> extends true\n ? ExtensionResultConsumerState\n : X[\"resultConsumer\"];\n readonly args: X[\"args\"] & Added[\"args\"];\n readonly filtered: X[\"filtered\"] | Added[\"filtered\"];\n readonly defaults: X[\"defaults\"] | Added[\"defaults\"];\n readonly fields: MergeResultFields<X[\"fields\"], Added[\"fields\"]>;\n}\n\ntype MethodRecord = Readonly<Record<string, RuntimeExtensionMethodFunction>>;\n\n/**\n * The methods a view answers after some prefix of its chain: its client\n * methods, and one model's. Each is computed the first time it is read.\n */\nexport interface ExtensionMethods {\n readonly client: () => MethodRecord;\n readonly model: (model: string) => MethodRecord;\n}\n\n/** A view's methods, and what invokes every factory of its chain in order. */\ntype BoundExtensionMethods = ExtensionMethods & {\n readonly force: () => void;\n};\n\nconst NO_METHODS: MethodRecord = /* @__PURE__ */ Object.freeze(\n Object.create(null)\n);\nconst NO_LAYER: BoundExtensionMethods = /* @__PURE__ */ Object.freeze({\n client: () => NO_METHODS,\n model: () => NO_METHODS,\n force: () => undefined,\n});\n\nconst CORE_CLIENT_METHODS = new Set([\n \"$driver\",\n \"$schema\",\n \"$transaction\",\n \"$connect\",\n \"$disconnect\",\n \"$extends\",\n]);\n\n/**\n * The methods before one extension with its own added, each a function and\n * each name (`at` the model's, for a model method) checked against what the\n * view already answers.\n */\nfunction addMethods(\n previous: MethodRecord,\n added: readonly (readonly [string, unknown])[],\n refuse: (problem: string) => never,\n collides: (name: string) => boolean,\n surface: \"client\" | \"model\",\n at = \"\"\n): MethodRecord {\n const methods: Record<string, RuntimeExtensionMethodFunction> = Object.assign(\n Object.create(null),\n previous\n );\n for (const [name, method] of added) {\n const label = `${surface} method \"${at}${name}\"`;\n if (!isFunction(method)) refuse(`${label} must be a function`);\n if (Object.hasOwn(methods, name) || collides(name))\n refuse(`${label} collides with the existing ${surface} surface`);\n methods[name] = method;\n }\n return Object.freeze(methods);\n}\n\n/**\n * What one factory's methods add to a view, given the view's methods before\n * it: brought by the builder (`methods` its client methods, `modelMethods`\n * its model methods), so an extension carries only the half it writes. Its\n * `force` forces the view before it first.\n */\ntype MethodsLayer = (made: {\n readonly prior: BoundExtensionMethods;\n /** The factory's answer, once per view, each key checked by `owns`. */\n readonly answer: () => Readonly<Record<string, unknown>>;\n readonly scope: () => object;\n readonly refuse: (problem: string) => never;\n}) => BoundExtensionMethods;\n\n/** `methods`' half: the `$` client methods its factory returns. */\nexport const clientLayer: MethodsLayer = ({ prior, answer, refuse }) => {\n let client: MethodRecord | undefined;\n const methods = () =>\n (client ??= addMethods(\n prior.client(),\n Object.entries(answer()),\n refuse,\n (method) =>\n CORE_CLIENT_METHODS.has(method) ||\n Object.hasOwn(RAW_METHOD_NAMES, method),\n \"client\"\n ));\n return {\n client: methods,\n model: prior.model,\n force: () => {\n prior.force();\n methods();\n },\n };\n};\n\n/**\n * `modelMethods`' half: each model's methods, made the first time the model\n * is read on a view; a model's entry may be a function of its delegate and\n * the scope, and a model method is called with `this` equal to its delegate.\n */\nexport const modelLayer: MethodsLayer = ({ prior, answer, scope, refuse }) => {\n const models = new Map<string, MethodRecord>();\n const methods = (model: string) => {\n let made = models.get(model);\n if (made === undefined) {\n const given = answer()[model];\n const delegate: unknown = Reflect.get(scope(), model);\n const own: unknown = isFunction(given)\n ? Reflect.apply(given, undefined, [delegate, scope()])\n : given;\n if (own !== undefined && !isRecord(own))\n refuse(`methods.${model} must be an object of methods`);\n made = addMethods(\n prior.model(model),\n Object.entries(own ?? {}).map(([method, fn]) => [\n method,\n isFunction(fn)\n ? (...args: unknown[]) => Reflect.apply(fn, delegate, args)\n : fn,\n ]),\n refuse,\n (method) =>\n method === \"then\" ||\n method === \"$rows\" ||\n ROUTED_OPERATIONS.has(method),\n \"model\",\n `${model}.`\n );\n models.set(model, made);\n }\n return made;\n };\n return {\n client: prior.client,\n model: methods,\n force: () => {\n prior.force();\n for (const key of Object.keys(answer())) methods(key);\n },\n };\n};\n\n/** A `methods` factory as its part keeps it. */\ntype RuntimeMethodsFactory = (scope: never) => unknown;\n\n/** A chain's methods, and what binds one view's methods. */\nexport interface ExtensionMethodsState {\n readonly bind: (\n createScope: (prior: ExtensionMethods, extension: string) => object\n ) => BoundExtensionMethods;\n /**\n * A factory scope's `$bind` on a chain that declares no `bound` argument:\n * it binds nothing, and refuses any argument it is asked to.\n */\n readonly bindNone: (\n extension: string,\n values: Readonly<Record<string, unknown>>,\n previous: AdmittedArgs | undefined\n ) => AdmittedArgs;\n}\n\n/**\n * A methods part: what a view answers, in chain order. `owns` (which keys\n * the factory may return: why not, else `undefined`) and `layer` (what its\n * methods add to a view) are its builder's half (`methods-part.ts`).\n *\n * A view's methods are this part's layer over the view the chain's methods\n * before it bind. The factory is invoked against the scope `createScope`\n * builds over those, the first time a method it returns could be read: a\n * view costs the factories it uses. `force` invokes every factory in chain\n * order, where a root view surfaces an extension's faults.\n */\nexport function methodsPart(\n factory: RuntimeMethodsFactory,\n layer: MethodsLayer,\n owns: (key: string, schema: Schema) => string | undefined\n): ExtensionPart {\n return {\n join({ next, name, schema }) {\n const before = next.methods;\n next.methods = {\n bind: (createScope) => {\n const prior = before?.bind(createScope) ?? NO_LAYER;\n // Typed where it is declared, so a call to it ends the argument flow.\n const refuse: (problem: string) => never = (problem) =>\n extensionError(`Extension \"${name}\" ${problem}.`, name);\n let scope: object | undefined;\n const scopeOf = () => (scope ??= createScope(prior, name));\n let returned: Readonly<Record<string, unknown>> | undefined;\n return layer({\n prior,\n // The factory's answer, once per view: the methods come from it.\n answer: () => {\n if (returned !== undefined) return returned;\n const value: unknown = Reflect.apply(factory, undefined, [\n scopeOf(),\n ]);\n if (!isRecord(value))\n refuse(\"methods factory must return an object\");\n for (const key of Object.keys(value)) {\n const problem = owns(key, schema);\n if (problem) refuse(`methods returned \"${key}\", ${problem}`);\n }\n returned = value;\n return value;\n },\n scope: scopeOf,\n refuse,\n });\n },\n bindNone: (extension, values, previous) => {\n for (const key of Object.keys(values)) notBound(extension, key);\n return { ...previous };\n },\n };\n },\n };\n}\n","/**\n * `methods((scope) => ({ $name: fn }))`: functions added to the client, and\n * `modelMethods((scope) => ({ model: { name: fn } }))`: functions added to\n * the models. Each factory runs once per view it serves, the first time one\n * of its methods is read; a model method is called with `this` equal to the\n * delegate it is read from. Two builders, each bringing its own half of the\n * methods host (`methods.ts`): an extension that adds client methods only\n * carries no model-method code, and the reverse.\n */\nimport type {\n AnyTarget,\n ConsumesResults,\n MethodsCheck,\n MethodsFacts,\n MethodsScope,\n ModelName,\n Part,\n} from \"./contract\";\nimport { clientLayer, methodsPart, modelLayer } from \"./methods\";\n\n/** Functions added to the client of the extension's chain: `$` names. */\nexport function methods<\n T extends AnyTarget,\n F extends (\n scope: MethodsScope<T>\n ) => MethodsCheck<ReturnType<F>, T, \"client\"> = (\n scope: MethodsScope<T>\n ) => object,\n>(factory: F): Part<T, MethodsFacts<ReturnType<F>, ConsumesResults<F>, never>>;\nexport function methods(factory: (scope: never) => unknown): unknown {\n return methodsPart(factory, clientLayer, (key) =>\n key.startsWith(\"$\")\n ? undefined\n : \"which is not a $ client method (a model's are written with modelMethods)\"\n );\n}\n\n/** Functions added to the models of the extension's chain, by model. */\nexport function modelMethods<\n T extends AnyTarget,\n F extends (\n scope: MethodsScope<T>\n ) => MethodsCheck<ReturnType<F>, T, \"model\"> = (\n scope: MethodsScope<T>\n ) => object,\n>(\n factory: F\n): Part<T, MethodsFacts<ReturnType<F>, ConsumesResults<F>, ModelName<T>>>;\nexport function modelMethods(factory: (scope: never) => unknown): unknown {\n return methodsPart(factory, modelLayer, (key, schema) =>\n Object.hasOwn(schema, key) ? undefined : \"which is not a model\"\n );\n}\n"],"mappings":"qXA+EA,SAAgB,EACd,EACA,EACA,EACA,EACc,CACd,IAAM,EAAgC,CAAE,GAAG,EAAU,CACrD,IAAK,GAAM,CAAC,EAAM,KAAQ,OAAO,QAAQ,EAAO,CAAE,CAChD,IAAM,EAAW,EAAI,KAClB,GACC,EAAU,OAAS,GACnB,EAAU,YAAc,GACxB,EAAU,QAAU,GACvB,CACG,IAAa,IAAA,IAAW,EAAS,EAAW,EAAK,CACrD,EAAK,GAAQ,EAAS,MAAM,EAAU,EAAI,CAE5C,OAAO,EAIT,SAAgB,EAAS,EAAmB,EAAqB,CAC/D,OAAO,EACL,cAAc,EAAU,oBAAoB,EAAK,kDACjD,EACD,CAIH,SAAS,EACP,EACA,EACc,CACd,IAAM,EAAiC,EAAE,CACzC,IAAK,IAAM,KAAQ,EACb,GAAY,OAAO,OAAO,EAAU,EAAK,GAAE,EAAM,GAAQ,EAAS,IACxE,OAAO,EAIT,MAAa,EACV,IACA,EAAU,EAAO,EAAO,IAAc,CACrC,GAAI,EAAO,KAAM,GAAY,IAAY,EAAM,CAAE,OAAO,EACxD,MAAM,EAAgB,EAAU,EAAO,EAAW,CAChD,kBAAkB,EAAO,IAAK,GAAY,KAAK,UAAU,EAAQ,CAAC,CAAC,KAAK,KAAK,GAC9E,CAAC,EAIO,EACV,IACA,EAAU,EAAO,EAAO,IAAc,CACrC,IAAI,EACJ,GAAI,CACF,EAAS,EAAO,aAAa,SAAS,EAAM,OACrC,EAAO,CAId,MADI,aAAiB,EAAmB,EAClC,EAAiB,EAAU,EAAO,EAAW,QAAS,EAAM,CAEpE,GAAI,SAAU,EAIZ,MADA,EAA6B,EAAO,CAC9B,EACJ,EACA,EACA,EACA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apter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "../database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-rBq3v1xr.mjs";import{t as l}from"../mysql-BNXWfTOo.mjs";import{t as u}from"../identifier-conversion-DHYPTgzr.mjs";import{s as d,t as f}from"../client-y7TV0PRZ.mjs";import{n as p,t as m}from"../memory-G4cSuc6A.mjs";import{n as h,r as g,t as _}from"../object-store-DS0F0yZX.mjs";c(l);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,u as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"../migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,x as o,xn as s,yn as c}from"../serializer-ettLu5xG.mjs";import{t as l}from"../mysql-BFPF8xyv.mjs";import{t as u}from"../identifier-conversion-BTDxDwDB.mjs";import{s as d,t as f}from"../client-DEfFqv4S.mjs";import{n as p,t as m}from"../memory-BaGWNdvk.mjs";import{n as h,r as g,t as _}from"../object-store-Chq1PMYz.mjs";o(l);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,n as addDropResolver,d as auditStorage,f as createMigrationClient,a as createPredefinedResolver,p as createStorageConformanceSuite,u as identifierConversionChecks,e as isMigrationError,c as lenientResolver,g as refuseWorkersKvWritable,s as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=mysql.mjs.map
@@ -1,6 +1,6 @@
1
- import { oo as MigrationError, so as isMigrationError } from "../database-adapter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "../database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-rBq3v1xr.mjs";import{t as l}from"../identifier-conversion-DHYPTgzr.mjs";import{t as u}from"../postgres-CDdh5dSP.mjs";import{s as d,t as f}from"../client-y7TV0PRZ.mjs";import{n as p,t as m}from"../memory-G4cSuc6A.mjs";import{n as h,r as g,t as _}from"../object-store-DS0F0yZX.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"../migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,x as o,xn as s,yn as c}from"../serializer-ettLu5xG.mjs";import{t as l}from"../identifier-conversion-BTDxDwDB.mjs";import{t as u}from"../postgres-DQQE2ys_.mjs";import{s as d,t as f}from"../client-DEfFqv4S.mjs";import{n as p,t as m}from"../memory-BaGWNdvk.mjs";import{n as h,r as g,t as _}from"../object-store-Chq1PMYz.mjs";o(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,n as addDropResolver,d as auditStorage,f as createMigrationClient,a as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,c as lenientResolver,g as refuseWorkersKvWritable,s as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=postgres.mjs.map
@@ -1,6 +1,6 @@
1
- import { oo as MigrationError, so as isMigrationError } from "../database-adapter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "../database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-rBq3v1xr.mjs";import{t as l}from"../identifier-conversion-DHYPTgzr.mjs";import{t as u}from"../snowflake-UOCC820W.mjs";import{s as d,t as f}from"../client-y7TV0PRZ.mjs";import{n as p,t as m}from"../memory-G4cSuc6A.mjs";import{n as h,r as g,t as _}from"../object-store-DS0F0yZX.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"../migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,x as o,xn as s,yn as c}from"../serializer-ettLu5xG.mjs";import{t as l}from"../identifier-conversion-BTDxDwDB.mjs";import{t as u}from"../snowflake-BfF8xwfP.mjs";import{s as d,t as f}from"../client-DEfFqv4S.mjs";import{n as p,t as m}from"../memory-BaGWNdvk.mjs";import{n as h,r as g,t as _}from"../object-store-Chq1PMYz.mjs";o(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,n as addDropResolver,d as auditStorage,f as createMigrationClient,a as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,c as lenientResolver,g as refuseWorkersKvWritable,s as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=snowflake.mjs.map
@@ -1,6 +1,6 @@
1
- import { oo as MigrationError, so as isMigrationError } from "../database-adapter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "../database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-rBq3v1xr.mjs";import{n as l,t as u}from"../libsql-DuGR904j.mjs";import{t as d}from"../identifier-conversion-DHYPTgzr.mjs";import{s as f,t as p}from"../client-y7TV0PRZ.mjs";import{n as m,t as h}from"../memory-G4cSuc6A.mjs";import{n as g,r as _,t as v}from"../object-store-DS0F0yZX.mjs";c(l),c(u);export{v as MemoryConditionalObjectStore,h as MemoryEstateStorage,t as MigrationError,g as ObjectStoreEstateStorage,r as addDropResolver,f as auditStorage,p as createMigrationClient,o as createPredefinedResolver,m as createStorageConformanceSuite,d as identifierConversionChecks,e as isMigrationError,a as lenientResolver,_ as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"../migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,x as o,xn as s,yn as c}from"../serializer-ettLu5xG.mjs";import{n as l,t as u}from"../libsql-DEZ0uhK2.mjs";import{t as d}from"../identifier-conversion-BTDxDwDB.mjs";import{s as f,t as p}from"../client-DEfFqv4S.mjs";import{n as m,t as h}from"../memory-BaGWNdvk.mjs";import{n as g,r as _,t as v}from"../object-store-Chq1PMYz.mjs";o(l),o(u);export{v as MemoryConditionalObjectStore,h as MemoryEstateStorage,t as MigrationError,g as ObjectStoreEstateStorage,n as addDropResolver,f as auditStorage,p as createMigrationClient,a as createPredefinedResolver,m as createStorageConformanceSuite,d as identifierConversionChecks,e as isMigrationError,c as lenientResolver,_ as refuseWorkersKvWritable,s as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=sqlite.mjs.map
@@ -1,4 +1,4 @@
1
- import { n as MigrationStorageWriter } from "../../contract-CrIB-3ZJ.mjs";
1
+ import { n as MigrationStorageWriter } from "../../contract-CxJn0_cV.mjs";
2
2
  import { DurableObjectStorage } from "@cloudflare/workers-types";
3
3
 
4
4
  //#region src/migrations/storage/durable-object.d.ts
@@ -1,2 +1,2 @@
1
- import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-DS0F0yZX.mjs";const n=`viborm_migration_estate`;function createDurableObjectStorageWriter(e,r={}){let{sql:i}=e,a=r.prefix??``;return i.exec(`CREATE TABLE IF NOT EXISTS ${n} (key TEXT PRIMARY KEY, bytes BLOB NOT NULL)`),new t({putIfAbsent:async(e,t)=>i.exec(`INSERT INTO ${n} (key, bytes) VALUES (?, ?) ON CONFLICT (key) DO NOTHING RETURNING key`,`${a}${e}`,t.slice().buffer).toArray().length===1?`created`:`exists`,get:async e=>{let[t]=i.exec(`SELECT bytes FROM ${n} WHERE key = ?`,`${a}${e}`).toArray();return t?new Uint8Array(t.bytes):null},list:async e=>i.exec(`SELECT key FROM ${n} WHERE substr(key, 1, length(?)) = ? ORDER BY key`,`${a}${e}`,`${a}${e}`).toArray().map(e=>e.key.slice(a.length))})}export{createDurableObjectStorageWriter};
1
+ import{n as e}from"../../object-store-Chq1PMYz.mjs";const t=`viborm_migration_estate`;function n(n,r={}){let{sql:i}=n,a=r.prefix??``;return i.exec(`CREATE TABLE IF NOT EXISTS ${t} (key TEXT PRIMARY KEY, bytes BLOB NOT NULL)`),new e({putIfAbsent:async(e,n)=>i.exec(`INSERT INTO ${t} (key, bytes) VALUES (?, ?) ON CONFLICT (key) DO NOTHING RETURNING key`,`${a}${e}`,n.slice().buffer).toArray().length===1?`created`:`exists`,get:async e=>{let[n]=i.exec(`SELECT bytes FROM ${t} WHERE key = ?`,`${a}${e}`).toArray();return n?new Uint8Array(n.bytes):null},list:async e=>i.exec(`SELECT key FROM ${t} WHERE substr(key, 1, length(?)) = ? ORDER BY key`,`${a}${e}`,`${a}${e}`).toArray().map(e=>e.key.slice(a.length))})}export{n as createDurableObjectStorageWriter};
2
2
  //# sourceMappingURL=durable-object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"durable-object.mjs","names":[],"sources":["../../../src/migrations/storage/durable-object.ts"],"sourcesContent":["/**\n * Estate storage in a SQLite-backed Durable Object's own storage.\n *\n * Conditional create is one `INSERT … ON CONFLICT DO NOTHING RETURNING`\n * statement on `ctx.storage.sql`. The SQL API is synchronous, so the\n * existence check and the write are one SQLite statement with no await\n * between them: no other request, and no other publish from this one, can\n * interleave, even when callers race across awaits.\n */\n\nimport type { DurableObjectStorage } from \"@cloudflare/workers-types\";\nimport type { MigrationStorageWriter } from \"./contract\";\nimport { ObjectStoreEstateStorage } from \"./object-store\";\n\nconst TABLE = \"viborm_migration_estate\";\n\n/**\n * History writer over `ctx.storage` of a SQLite-backed Durable Object\n * (`new_sqlite_classes`). Each value is one row, so one artifact is at most\n * the platform's 2 MB row size. `prefix` places one history under a key\n * prefix (for example `h2/`), so an object can hold a pruned history beside\n * its current one.\n */\nexport function createDurableObjectStorageWriter(\n storage: DurableObjectStorage,\n options: { readonly prefix?: string } = {}\n): MigrationStorageWriter {\n const { sql } = storage;\n const prefix = options.prefix ?? \"\";\n sql.exec(\n `CREATE TABLE IF NOT EXISTS ${TABLE} (key TEXT PRIMARY KEY, bytes BLOB NOT NULL)`\n );\n return new ObjectStoreEstateStorage({\n putIfAbsent: async (key, bytes) =>\n sql\n .exec(\n `INSERT INTO ${TABLE} (key, bytes) VALUES (?, ?) ON CONFLICT (key) DO NOTHING RETURNING key`,\n `${prefix}${key}`,\n bytes.slice().buffer\n )\n .toArray().length === 1\n ? \"created\"\n : \"exists\",\n get: async (key) => {\n const [row] = sql\n .exec<{ bytes: ArrayBuffer }>(\n `SELECT bytes FROM ${TABLE} WHERE key = ?`,\n `${prefix}${key}`\n )\n .toArray();\n return row ? new Uint8Array(row.bytes) : null;\n },\n list: async (keyPrefix) =>\n sql\n .exec<{ key: string }>(\n `SELECT key FROM ${TABLE} WHERE substr(key, 1, length(?)) = ? ORDER BY key`,\n `${prefix}${keyPrefix}`,\n `${prefix}${keyPrefix}`\n )\n .toArray()\n .map((row) => row.key.slice(prefix.length)),\n });\n}\n"],"mappings":"iGAcA,MAAM,EAAQ,0BASd,SAAgB,iCACd,EACA,EAAwC,EAAE,CAClB,CACxB,GAAM,CAAE,OAAQ,EACV,EAAS,EAAQ,QAAU,GAIjC,OAHA,EAAI,KACF,8BAA8B,EAAM,8CACrC,CACM,IAAI,EAAyB,CAClC,YAAa,MAAO,EAAK,IACvB,EACG,KACC,eAAe,EAAM,wEACrB,GAAG,IAAS,IACZ,EAAM,OAAO,CAAC,OACf,CACA,SAAS,CAAC,SAAW,EACpB,UACA,SACN,IAAK,KAAO,IAAQ,CAClB,GAAM,CAAC,GAAO,EACX,KACC,qBAAqB,EAAM,gBAC3B,GAAG,IAAS,IACb,CACA,SAAS,CACZ,OAAO,EAAM,IAAI,WAAW,EAAI,MAAM,CAAG,MAE3C,KAAM,KAAO,IACX,EACG,KACC,mBAAmB,EAAM,mDACzB,GAAG,IAAS,IACZ,GAAG,IAAS,IACb,CACA,SAAS,CACT,IAAK,GAAQ,EAAI,IAAI,MAAM,EAAO,OAAO,CAAC,CAChD,CAAC"}
1
+ {"version":3,"file":"durable-object.mjs","names":[],"sources":["../../../src/migrations/storage/durable-object.ts"],"sourcesContent":["/**\n * Estate storage in a SQLite-backed Durable Object's own storage.\n *\n * Conditional create is one `INSERT … ON CONFLICT DO NOTHING RETURNING`\n * statement on `ctx.storage.sql`. The SQL API is synchronous, so the\n * existence check and the write are one SQLite statement with no await\n * between them: no other request, and no other publish from this one, can\n * interleave, even when callers race across awaits.\n */\n\nimport type { DurableObjectStorage } from \"@cloudflare/workers-types\";\nimport type { MigrationStorageWriter } from \"./contract\";\nimport { ObjectStoreEstateStorage } from \"./object-store\";\n\nconst TABLE = \"viborm_migration_estate\";\n\n/**\n * History writer over `ctx.storage` of a SQLite-backed Durable Object\n * (`new_sqlite_classes`). Each value is one row, so one artifact is at most\n * the platform's 2 MB row size. `prefix` places one history under a key\n * prefix (for example `h2/`), so an object can hold a pruned history beside\n * its current one.\n */\nexport function createDurableObjectStorageWriter(\n storage: DurableObjectStorage,\n options: { readonly prefix?: string } = {}\n): MigrationStorageWriter {\n const { sql } = storage;\n const prefix = options.prefix ?? \"\";\n sql.exec(\n `CREATE TABLE IF NOT EXISTS ${TABLE} (key TEXT PRIMARY KEY, bytes BLOB NOT NULL)`\n );\n return new ObjectStoreEstateStorage({\n putIfAbsent: async (key, bytes) =>\n sql\n .exec(\n `INSERT INTO ${TABLE} (key, bytes) VALUES (?, ?) ON CONFLICT (key) DO NOTHING RETURNING key`,\n `${prefix}${key}`,\n bytes.slice().buffer\n )\n .toArray().length === 1\n ? \"created\"\n : \"exists\",\n get: async (key) => {\n const [row] = sql\n .exec<{ bytes: ArrayBuffer }>(\n `SELECT bytes FROM ${TABLE} WHERE key = ?`,\n `${prefix}${key}`\n )\n .toArray();\n return row ? new Uint8Array(row.bytes) : null;\n },\n list: async (keyPrefix) =>\n sql\n .exec<{ key: string }>(\n `SELECT key FROM ${TABLE} WHERE substr(key, 1, length(?)) = ? ORDER BY key`,\n `${prefix}${keyPrefix}`,\n `${prefix}${keyPrefix}`\n )\n .toArray()\n .map((row) => row.key.slice(prefix.length)),\n });\n}\n"],"mappings":"oDAcA,MAAM,EAAQ,0BASd,SAAgB,EACd,EACA,EAAwC,EAAE,CAClB,CACxB,GAAM,CAAE,OAAQ,EACV,EAAS,EAAQ,QAAU,GAIjC,OAHA,EAAI,KACF,8BAA8B,EAAM,8CACrC,CACM,IAAI,EAAyB,CAClC,YAAa,MAAO,EAAK,IACvB,EACG,KACC,eAAe,EAAM,wEACrB,GAAG,IAAS,IACZ,EAAM,OAAO,CAAC,OACf,CACA,SAAS,CAAC,SAAW,EACpB,UACA,SACN,IAAK,KAAO,IAAQ,CAClB,GAAM,CAAC,GAAO,EACX,KACC,qBAAqB,EAAM,gBAC3B,GAAG,IAAS,IACb,CACA,SAAS,CACZ,OAAO,EAAM,IAAI,WAAW,EAAI,MAAM,CAAG,MAE3C,KAAM,KAAO,IACX,EACG,KACC,mBAAmB,EAAM,mDACzB,GAAG,IAAS,IACZ,GAAG,IAAS,IACb,CACA,SAAS,CACT,IAAK,GAAQ,EAAI,IAAI,MAAM,EAAO,OAAO,CAAC,CAChD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as MigrationStorageWriter } from "../../contract-CrIB-3ZJ.mjs";
1
+ import { n as MigrationStorageWriter } from "../../contract-CxJn0_cV.mjs";
2
2
 
3
3
  //#region src/migrations/storage/fs-estate.d.ts
4
4
 
@@ -1 +1 @@
1
- import{t as e}from"../../fs-estate-D1Nsg9G1.mjs";export{e as createFsStorageWriter};
1
+ import{t as e}from"../../fs-estate-n-QpsFqb.mjs";export{e as createFsStorageWriter};
@@ -1,4 +1,4 @@
1
- import { n as MigrationStorageWriter } from "../../contract-CrIB-3ZJ.mjs";
1
+ import { n as MigrationStorageWriter } from "../../contract-CxJn0_cV.mjs";
2
2
  import { R2Bucket } from "@cloudflare/workers-types";
3
3
 
4
4
  //#region src/migrations/storage/r2.d.ts
@@ -1,2 +1,2 @@
1
- import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-DS0F0yZX.mjs";function createR2StorageWriter(e,n={}){let r=n.prefix??``;return new t({putIfAbsent:async(t,n)=>{let i=`${r}${t}`;try{return await e.put(i,n,{onlyIf:{etagDoesNotMatch:`*`}})?`created`:`exists`}catch(t){if(!(t instanceof Error&&t.message.includes(`(10058)`)&&await e.head(i)!==null))throw t;return`exists`}},get:async t=>{let n=await e.get(`${r}${t}`);return n?new Uint8Array(await n.arrayBuffer()):null},list:async t=>{let n=[],i;do{let a=await e.list({prefix:`${r}${t}`,cursor:i});for(let e of a.objects)n.push(e.key.slice(r.length));i=a.truncated?a.cursor:void 0}while(i);return n}})}export{createR2StorageWriter};
1
+ import{n as e}from"../../object-store-Chq1PMYz.mjs";function t(t,n={}){let r=n.prefix??``;return new e({putIfAbsent:async(e,n)=>{let i=`${r}${e}`;try{return await t.put(i,n,{onlyIf:{etagDoesNotMatch:`*`}})?`created`:`exists`}catch(e){if(!(e instanceof Error&&e.message.includes(`(10058)`)&&await t.head(i)!==null))throw e;return`exists`}},get:async e=>{let n=await t.get(`${r}${e}`);return n?new Uint8Array(await n.arrayBuffer()):null},list:async e=>{let n=[],i;do{let a=await t.list({prefix:`${r}${e}`,cursor:i});for(let e of a.objects)n.push(e.key.slice(r.length));i=a.truncated?a.cursor:void 0}while(i);return n}})}export{t as createR2StorageWriter};
2
2
  //# sourceMappingURL=r2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"r2.mjs","names":[],"sources":["../../../src/migrations/storage/r2.ts"],"sourcesContent":["/**\n * Estate storage in an R2 bucket.\n *\n * R2 writes and listings are strongly consistent. Conditional create is a put\n * conditioned on `etagDoesNotMatch: \"*\"` (`If-None-Match: *`): R2 checks the\n * condition and stores the object in one step, and returns `null` instead of\n * storing when the key exists. Hosted R2 may instead answer a put that loses a\n * race for one key with error 10058, having stored nothing: once the winner's\n * object is there, that is the same lost put. `list` follows the cursor until\n * R2 reports the listing complete, because a page may hold fewer keys than its\n * limit while more remain (hosted R2 pages 1,001 keys as 485, 485 and 31).\n */\n\nimport type { R2Bucket } from \"@cloudflare/workers-types\";\nimport type { MigrationStorageWriter } from \"./contract\";\nimport { ObjectStoreEstateStorage } from \"./object-store\";\n\n/** R2's \"Reduce your concurrent request rate for the same object\" error. */\nconst CONTENDED_PUT = \"(10058)\";\n\n/**\n * History writer over an R2 bucket. `prefix` places one estate under a key\n * prefix (for example `tenants/42/`), so many estates can share a bucket.\n */\nexport function createR2StorageWriter(\n bucket: R2Bucket,\n options: { readonly prefix?: string } = {}\n): MigrationStorageWriter {\n const prefix = options.prefix ?? \"\";\n return new ObjectStoreEstateStorage({\n putIfAbsent: async (key, bytes) => {\n const name = `${prefix}${key}`;\n try {\n return (await bucket.put(name, bytes, {\n onlyIf: { etagDoesNotMatch: \"*\" },\n }))\n ? \"created\"\n : \"exists\";\n } catch (error) {\n const lost =\n error instanceof Error &&\n error.message.includes(CONTENDED_PUT) &&\n (await bucket.head(name)) !== null;\n if (!lost) throw error;\n return \"exists\";\n }\n },\n get: async (key) => {\n const object = await bucket.get(`${prefix}${key}`);\n return object ? new Uint8Array(await object.arrayBuffer()) : null;\n },\n list: async (keyPrefix) => {\n const keys: string[] = [];\n let cursor: string | undefined;\n do {\n const page = await bucket.list({\n prefix: `${prefix}${keyPrefix}`,\n cursor,\n });\n for (const object of page.objects) {\n keys.push(object.key.slice(prefix.length));\n }\n cursor = page.truncated ? page.cursor : undefined;\n } while (cursor);\n return keys;\n },\n });\n}\n"],"mappings":"iGAwBA,SAAgB,sBACd,EACA,EAAwC,EAAE,CAClB,CACxB,IAAM,EAAS,EAAQ,QAAU,GACjC,OAAO,IAAI,EAAyB,CAClC,YAAa,MAAO,EAAK,IAAU,CACjC,IAAM,EAAO,GAAG,IAAS,IACzB,GAAI,CACF,OAAQ,MAAM,EAAO,IAAI,EAAM,EAAO,CACpC,OAAQ,CAAE,iBAAkB,IAAK,CAClC,CAAC,CACE,UACA,eACG,EAAO,CAKd,GAAI,EAHF,aAAiB,OACjB,EAAM,QAAQ,SAAS,UAAc,EACpC,MAAM,EAAO,KAAK,EAAK,GAAM,MACrB,MAAM,EACjB,MAAO,WAGX,IAAK,KAAO,IAAQ,CAClB,IAAM,EAAS,MAAM,EAAO,IAAI,GAAG,IAAS,IAAM,CAClD,OAAO,EAAS,IAAI,WAAW,MAAM,EAAO,aAAa,CAAC,CAAG,MAE/D,KAAM,KAAO,IAAc,CACzB,IAAM,EAAiB,EAAE,CACrB,EACJ,EAAG,CACD,IAAM,EAAO,MAAM,EAAO,KAAK,CAC7B,OAAQ,GAAG,IAAS,IACpB,SACD,CAAC,CACF,IAAK,IAAM,KAAU,EAAK,QACxB,EAAK,KAAK,EAAO,IAAI,MAAM,EAAO,OAAO,CAAC,CAE5C,EAAS,EAAK,UAAY,EAAK,OAAS,IAAA,SACjC,GACT,OAAO,GAEV,CAAC"}
1
+ {"version":3,"file":"r2.mjs","names":[],"sources":["../../../src/migrations/storage/r2.ts"],"sourcesContent":["/**\n * Estate storage in an R2 bucket.\n *\n * R2 writes and listings are strongly consistent. Conditional create is a put\n * conditioned on `etagDoesNotMatch: \"*\"` (`If-None-Match: *`): R2 checks the\n * condition and stores the object in one step, and returns `null` instead of\n * storing when the key exists. Hosted R2 may instead answer a put that loses a\n * race for one key with error 10058, having stored nothing: once the winner's\n * object is there, that is the same lost put. `list` follows the cursor until\n * R2 reports the listing complete, because a page may hold fewer keys than its\n * limit while more remain (hosted R2 pages 1,001 keys as 485, 485 and 31).\n */\n\nimport type { R2Bucket } from \"@cloudflare/workers-types\";\nimport type { MigrationStorageWriter } from \"./contract\";\nimport { ObjectStoreEstateStorage } from \"./object-store\";\n\n/** R2's \"Reduce your concurrent request rate for the same object\" error. */\nconst CONTENDED_PUT = \"(10058)\";\n\n/**\n * History writer over an R2 bucket. `prefix` places one estate under a key\n * prefix (for example `tenants/42/`), so many estates can share a bucket.\n */\nexport function createR2StorageWriter(\n bucket: R2Bucket,\n options: { readonly prefix?: string } = {}\n): MigrationStorageWriter {\n const prefix = options.prefix ?? \"\";\n return new ObjectStoreEstateStorage({\n putIfAbsent: async (key, bytes) => {\n const name = `${prefix}${key}`;\n try {\n return (await bucket.put(name, bytes, {\n onlyIf: { etagDoesNotMatch: \"*\" },\n }))\n ? \"created\"\n : \"exists\";\n } catch (error) {\n const lost =\n error instanceof Error &&\n error.message.includes(CONTENDED_PUT) &&\n (await bucket.head(name)) !== null;\n if (!lost) throw error;\n return \"exists\";\n }\n },\n get: async (key) => {\n const object = await bucket.get(`${prefix}${key}`);\n return object ? new Uint8Array(await object.arrayBuffer()) : null;\n },\n list: async (keyPrefix) => {\n const keys: string[] = [];\n let cursor: string | undefined;\n do {\n const page = await bucket.list({\n prefix: `${prefix}${keyPrefix}`,\n cursor,\n });\n for (const object of page.objects) {\n keys.push(object.key.slice(prefix.length));\n }\n cursor = page.truncated ? page.cursor : undefined;\n } while (cursor);\n return keys;\n },\n });\n}\n"],"mappings":"oDAwBA,SAAgB,EACd,EACA,EAAwC,EAAE,CAClB,CACxB,IAAM,EAAS,EAAQ,QAAU,GACjC,OAAO,IAAI,EAAyB,CAClC,YAAa,MAAO,EAAK,IAAU,CACjC,IAAM,EAAO,GAAG,IAAS,IACzB,GAAI,CACF,OAAQ,MAAM,EAAO,IAAI,EAAM,EAAO,CACpC,OAAQ,CAAE,iBAAkB,IAAK,CAClC,CAAC,CACE,UACA,eACG,EAAO,CAKd,GAAI,EAHF,aAAiB,OACjB,EAAM,QAAQ,SAAS,UAAc,EACpC,MAAM,EAAO,KAAK,EAAK,GAAM,MACrB,MAAM,EACjB,MAAO,WAGX,IAAK,KAAO,IAAQ,CAClB,IAAM,EAAS,MAAM,EAAO,IAAI,GAAG,IAAS,IAAM,CAClD,OAAO,EAAS,IAAI,WAAW,MAAM,EAAO,aAAa,CAAC,CAAG,MAE/D,KAAM,KAAO,IAAc,CACzB,IAAM,EAAiB,EAAE,CACrB,EACJ,EAAG,CACD,IAAM,EAAO,MAAM,EAAO,KAAK,CAC7B,OAAQ,GAAG,IAAS,IACpB,SACD,CAAC,CACF,IAAK,IAAM,KAAU,EAAK,QACxB,EAAK,KAAK,EAAO,IAAI,MAAM,EAAO,OAAO,CAAC,CAE5C,EAAS,EAAK,UAAY,EAAK,OAAS,IAAA,SACjC,GACT,OAAO,GAEV,CAAC"}
@@ -1,6 +1,6 @@
1
- import { oo as MigrationError, so as isMigrationError } from "../database-adapter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "../database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-rBq3v1xr.mjs";import{t as l}from"../identifier-conversion-DHYPTgzr.mjs";import{t as u}from"../surrealql-C1dp1sWw.mjs";import{s as d,t as f}from"../client-y7TV0PRZ.mjs";import{n as p,t as m}from"../memory-G4cSuc6A.mjs";import{n as h,r as g,t as _}from"../object-store-DS0F0yZX.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"../migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,x as o,xn as s,yn as c}from"../serializer-ettLu5xG.mjs";import{t as l}from"../identifier-conversion-BTDxDwDB.mjs";import{t as u}from"../surrealql-DY74AUeD.mjs";import{s as d,t as f}from"../client-DEfFqv4S.mjs";import{n as p,t as m}from"../memory-BaGWNdvk.mjs";import{n as h,r as g,t as _}from"../object-store-Chq1PMYz.mjs";o(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,n as addDropResolver,d as auditStorage,f as createMigrationClient,a as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,c as lenientResolver,g as refuseWorkersKvWritable,s as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=surrealdb.mjs.map
@@ -1,6 +1,6 @@
1
- import { s as MigrationLimits, t as MigrationClient } from "../planner-DHjdvjwk.mjs";
2
- import { i as Sha256, n as MigrationStorageWriter } from "../contract-CrIB-3ZJ.mjs";
3
- import { U as MigrationMarkerV1, V as MigrationDecisionV1, c as ReadableMigrations } from "../client-CRxfhw2y.mjs";
1
+ import { s as MigrationLimits, t as MigrationClient } from "../planner-C-zjj19U.mjs";
2
+ import { i as Sha256, n as MigrationStorageWriter } from "../contract-CxJn0_cV.mjs";
3
+ import { U as MigrationMarkerV1, V as MigrationDecisionV1, c as ReadableMigrations } from "../client-Dlz3-2JC.mjs";
4
4
 
5
5
  //#region src/migrations/tenant.d.ts
6
6
 
@@ -1,2 +1,2 @@
1
- import{n as e}from"../chunk-BuuaeEvq.mjs";import{a as t,i as n,n as r}from"../base-z-cH5ZBI.mjs";import{mn as i,rn as a}from"../serializer-rBq3v1xr.mjs";import{i as o,r as s,t as c}from"../client-y7TV0PRZ.mjs";const l=new Set([r.MIGRATION_PARTIAL_EFFECT,r.MIGRATION_AMBIGUOUS_COMMIT,r.MIGRATION_UNFINISHED_ATTEMPT]),u=new Set([r.MIGRATION_FAILED,r.MIGRATION_MARKER_CONFLICT]);function createTenantMigrator({client:e,history:t,tables:n,limits:r}){let a={storage:t,tables:n,limits:r},l=c(e,a),u=Promise.resolve(),exclusive=async(e,t)=>{let n=u,release=()=>void 0;u=new Promise(e=>{release=e}).then(()=>n);try{return await untilAborted(n,t),await e()}finally{release()}},change=async(n,{decisions:r=[],signal:l,beforeDestructive:u}={})=>{let d,f;try{l?.throwIfAborted(),o(s(e),`batch`,`apply()`),f=c({$driver:e.$driver,$schema:n},a);let p=i(r);if(u&&await isDestructive(f,p,t)){l?.throwIfAborted();try{await u()}catch(e){return{kind:`refused`,error:describe(e)}}}l?.throwIfAborted(),d=(await f.generate({resolve:p})).outcome===`published`}catch(e){return{kind:classify(e),error:describe(e)}}for(let e=1;;e+=1)try{let e=await f.apply();return e.outcome===`noop`&&!d?{kind:`noop`}:{kind:`applied`,path:e.path,...e.warnings?{warnings:e.warnings}:{}}}catch(t){let n=classify(t),r=d&&n===`refused`?`failed`:n;if(e===4||r!==`failed`||!retryable(t)||!await backoff(e,l))return withMarker({kind:r,error:describe(t)},f)}};return Object.freeze({change:(e,t)=>exclusive(()=>change(e,t),t?.signal).catch(e=>({kind:`failed`,error:describe(e)})),status:()=>l.status(),log:()=>l.log(),resolve:e=>exclusive(()=>l.resolve(e)),down:e=>exclusive(()=>l.down(e)),reanchor:e=>exclusive(()=>l.reanchor(e)),prune:e=>exclusive(()=>l.prune(e))})}async function isDestructive(e,t,n){if((await e.generate({dryRun:!0,resolve:t})).operations.some(a))return!0;if(!await n.readEstate())return!1;let{states:r,edges:i}=await e.graph();if(r.length===0)return!1;let{path:o}=await e.apply({dryRun:!0});return i.some(e=>o.includes(e.toState)&&(e.approvals.length>0||e.risks.includes(`destructive`)))}function retryable(e){if(t(e)&&e.code===r.MIGRATION_LOCK_FAILED)return!0;for(let t=e;t instanceof Error;t=t.cause)if(n(t))return!0;return!1}function classify(e){return t(e)?l.has(e.code)||e.meta.partial===!0?`ambiguous`:u.has(e.code)||retryable(e)?`failed`:`refused`:`failed`}async function withMarker(e,t){try{return{...e,marker:(await t.status()).marker}}catch{return e}}function describe(e){if(!(e instanceof Error))return{name:`Error`,message:String(e)};let n=e.cause instanceof Error?Reflect.get(e.cause,`code`):null,r=t(e)?e.meta.providerSqlState:void 0;return{name:e.name,...t(e)?{code:e.code}:{},message:e.message,...typeof n==`string`?{causeCode:n}:{},...typeof r==`string`?{providerSqlState:r}:{}}}function untilAborted(e,t){if(!t)return e;t.throwIfAborted();let abort=()=>void 0,n=new Promise((e,n)=>{abort=()=>n(t.reason),t.addEventListener(`abort`,abort,{once:!0})});return Promise.race([e,n]).finally(()=>t.removeEventListener(`abort`,abort))}async function backoff(e,t){let n=200*2**(e-1)*(.5+Math.random()/2);try{return await untilAborted(new Promise(e=>setTimeout(e,n)),t),!0}catch{return!1}}export{createTenantMigrator};
1
+ import{a as e,i as t}from"../base-17NSFtrA.mjs";import{sn as n,vn as r}from"../serializer-ettLu5xG.mjs";import{i,r as a,t as o}from"../client-DEfFqv4S.mjs";const s=new Set([`V11019`,`V11020`,`V11016`]),c=new Set([`V11001`,`V11015`]);function l({client:e,history:t,tables:n,limits:s}){let c={storage:t,tables:n,limits:s},l=o(e,c),_=Promise.resolve(),v=async(e,t)=>{let n=_,r=()=>void 0;_=new Promise(e=>{r=e}).then(()=>n);try{return await h(n,t),await e()}finally{r()}},y=async(n,{decisions:s=[],signal:l,beforeDestructive:h}={})=>{let _,v;try{l?.throwIfAborted(),i(a(e),`batch`,`apply()`),v=o({$driver:e.$driver,$schema:n},c);let d=r(s);if(h&&await u(v,d,t)){l?.throwIfAborted();try{await h()}catch(e){return{kind:`refused`,error:m(e)}}}l?.throwIfAborted(),_=(await v.generate({resolve:d})).outcome===`published`}catch(e){return{kind:f(e),error:m(e)}}for(let e=1;;e+=1)try{let e=await v.apply();return e.outcome===`noop`&&!_?{kind:`noop`}:{kind:`applied`,path:e.path,...e.warnings?{warnings:e.warnings}:{}}}catch(t){let n=f(t),r=_&&n===`refused`?`failed`:n;if(e===4||r!==`failed`||!d(t)||!await g(e,l))return p({kind:r,error:m(t)},v)}};return Object.freeze({change:(e,t)=>v(()=>y(e,t),t?.signal).catch(e=>({kind:`failed`,error:m(e)})),status:()=>l.status(),log:()=>l.log(),resolve:e=>v(()=>l.resolve(e)),down:e=>v(()=>l.down(e)),reanchor:e=>v(()=>l.reanchor(e)),prune:e=>v(()=>l.prune(e))})}async function u(e,t,r){if((await e.generate({dryRun:!0,resolve:t})).operations.some(n))return!0;if(!await r.readEstate())return!1;let{states:i,edges:a}=await e.graph();if(i.length===0)return!1;let{path:o}=await e.apply({dryRun:!0});return a.some(e=>o.includes(e.toState)&&(e.approvals.length>0||e.risks.includes(`destructive`)))}function d(n){if(e(n)&&n.code===`V11005`)return!0;for(let e=n;e instanceof Error;e=e.cause)if(t(e))return!0;return!1}function f(t){return e(t)?s.has(t.code)||t.meta.partial===!0?`ambiguous`:c.has(t.code)||d(t)?`failed`:`refused`:`failed`}async function p(e,t){try{return{...e,marker:(await t.status()).marker}}catch{return e}}function m(t){if(!(t instanceof Error))return{name:`Error`,message:String(t)};let n=t.cause instanceof Error?Reflect.get(t.cause,`code`):null,r=e(t)?t.meta.providerSqlState:void 0;return{name:t.name,...e(t)?{code:t.code}:{},message:t.message,...typeof n==`string`?{causeCode:n}:{},...typeof r==`string`?{providerSqlState:r}:{}}}function h(e,t){if(!t)return e;t.throwIfAborted();let n=()=>void 0,r=new Promise((e,r)=>{n=()=>r(t.reason),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e,r]).finally(()=>t.removeEventListener(`abort`,n))}async function g(e,t){let n=200*2**(e-1)*(.5+Math.random()/2);try{return await h(new Promise(e=>setTimeout(e,n)),t),!0}catch{return!1}}export{l as createTenantMigrator};
2
2
  //# sourceMappingURL=tenant.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.mjs","names":["options"],"sources":["../../src/migrations/tenant.ts"],"sourcesContent":["/**\n * One tenant's schema changes, from a Durable Object (plan D4).\n *\n * A helper over `createMigrationClient`, not a second composition root: a\n * change is that client's `generate` and `apply`, run one at a time per\n * migrator, and what they throw comes back as one of five outcomes.\n */\n\nimport { isRetryableError, isVibORMError, VibORMErrorCode } from \"../errors\";\nimport { admitLiveMigrationCapability } from \"./admission\";\nimport {\n createMigrationClient,\n type ReadableMigrations,\n type WritableMigrations,\n} from \"./client\";\nimport { isDestructiveOperation } from \"./differ\";\nimport type { Sha256 } from \"./identity\";\nimport type { MigrationLimits } from \"./limits\";\nimport { getPushMigrationDriver, type MigrationClient } from \"./push/planner\";\nimport { createPredefinedResolver } from \"./resolver\";\nimport type {\n MigrationStorageReader,\n MigrationStorageWriter,\n} from \"./storage/contract\";\nimport type { ResolveCallback } from \"./types\";\nimport type { MigrationDecisionV1, MigrationMarkerV1 } from \"./v1-types\";\n\nexport interface TenantMigratorOptions {\n /**\n * Any client on the tenant's database. `change` uses its connection with\n * the schema it is given; `status`, `log`, `resolve`, `down` and\n * `reanchor` use the client as it is.\n */\n readonly client: MigrationClient;\n /** The tenant's history: `createDurableObjectStorageWriter(ctx.storage)`. */\n readonly history: MigrationStorageWriter;\n /** The managed tables, as `createMigrationClient`'s `tables`. */\n readonly tables?: readonly string[];\n readonly limits?: MigrationLimits;\n}\n\nexport interface TenantChangeOptions {\n /** Renames, enum mappings and approved destructive changes, as data. */\n readonly decisions?: readonly MigrationDecisionV1[];\n /**\n * Checked while queued, before `beforeDestructive`, before publishing and\n * during retry backoff. Once a state is published `apply` runs, and is\n * never interrupted: bound it with `limits`.\n */\n readonly signal?: AbortSignal;\n /**\n * Awaited after the preview and before any effect when the change, or a\n * published state `apply` reaches first, is destructive. If it throws, the\n * change is `refused`.\n */\n readonly beforeDestructive?: () => unknown;\n}\n\n/** An error as plain data, so an outcome crosses Durable Object RPC intact. */\nexport interface TenantChangeError {\n readonly name: string;\n readonly code?: string;\n readonly message: string;\n /** The code of the error's cause, such as the driver's, when it has one. */\n readonly causeCode?: string;\n /** The SQLSTATE the server answered, when the error carries one. */\n readonly providerSqlState?: string;\n}\n\nexport type TenantChangeResult =\n | {\n readonly kind: \"applied\";\n readonly path: readonly Sha256[];\n readonly warnings?: readonly string[];\n }\n | { readonly kind: \"noop\" }\n | {\n /**\n * `refused`: this call changed nothing. `failed`: the change did not\n * reach its state, which may be published; calling again may. A\n * refusal of a state this call published is `failed`. `ambiguous`: the\n * database may be between states; read `status()`, then `resolve()`.\n */\n readonly kind: \"refused\" | \"failed\" | \"ambiguous\";\n readonly error: TenantChangeError;\n /** `status().marker` after an apply attempt, when it could be read. */\n readonly marker?: MigrationMarkerV1 | null;\n };\n\nexport interface TenantMigrator {\n change(\n schema: MigrationClient[\"$schema\"],\n options?: TenantChangeOptions\n ): Promise<TenantChangeResult>;\n status: ReadableMigrations[\"status\"];\n log: ReadableMigrations[\"log\"];\n resolve: ReadableMigrations[\"resolve\"];\n down: ReadableMigrations[\"down\"];\n /** After a restore left this object's history older than the database. */\n reanchor: ReadableMigrations[\"reanchor\"];\n /**\n * Copies an authored checkpoint and what follows it into a fresh history,\n * such as `createDurableObjectStorageWriter(ctx.storage, { prefix })`;\n * a migrator over it then calls `reanchor()`.\n */\n prune: ReadableMigrations[\"prune\"];\n}\n\nconst AMBIGUOUS = new Set<string>([\n VibORMErrorCode.MIGRATION_PARTIAL_EFFECT,\n VibORMErrorCode.MIGRATION_AMBIGUOUS_COMMIT,\n VibORMErrorCode.MIGRATION_UNFINISHED_ATTEMPT,\n]);\n/** An attempt that rolled back, or lost the marker to another writer. */\nconst FAILED = new Set<string>([\n VibORMErrorCode.MIGRATION_FAILED,\n VibORMErrorCode.MIGRATION_MARKER_CONFLICT,\n]);\nconst ATTEMPTS = 4;\nconst BACKOFF_MS = 200;\n\n/**\n * `change`, `resolve`, `down`, `reanchor` and `prune` run one at a time: a call made while another\n * runs waits for it, and leaves the queue as `failed` if its signal aborts\n * first. Call them from a request or an alarm, never from the constructor or\n * `blockConcurrencyWhile`.\n */\nexport function createTenantMigrator({\n client,\n history,\n tables,\n limits,\n}: TenantMigratorOptions): TenantMigrator {\n const options = { storage: history, tables, limits };\n const current = createMigrationClient(client, options);\n let tail: Promise<unknown> = Promise.resolve();\n const exclusive = async <T>(\n run: () => Promise<T>,\n signal?: AbortSignal\n ): Promise<T> => {\n const previous = tail;\n let release = (): void => undefined;\n tail = new Promise<void>((resolve) => {\n release = resolve;\n }).then(() => previous);\n try {\n await untilAborted(previous, signal);\n return await run();\n } finally {\n release();\n }\n };\n\n const change = async (\n schema: MigrationClient[\"$schema\"],\n { decisions = [], signal, beforeDestructive }: TenantChangeOptions = {}\n ): Promise<TenantChangeResult> => {\n let published: boolean;\n let migrations: WritableMigrations;\n try {\n signal?.throwIfAborted();\n // A transport apply refuses is refused before generate publishes.\n admitLiveMigrationCapability(\n getPushMigrationDriver(client),\n \"batch\",\n \"apply()\"\n );\n migrations = createMigrationClient(\n { $driver: client.$driver, $schema: schema },\n options\n );\n const resolve = createPredefinedResolver(decisions);\n if (\n beforeDestructive &&\n (await isDestructive(migrations, resolve, history))\n ) {\n signal?.throwIfAborted();\n try {\n await beforeDestructive();\n } catch (failure) {\n return { kind: \"refused\", error: describe(failure) };\n }\n }\n signal?.throwIfAborted();\n const generated = await migrations.generate({ resolve });\n published = generated.outcome === \"published\";\n } catch (failure) {\n return { kind: classify(failure), error: describe(failure) };\n }\n for (let attempt = 1; ; attempt += 1) {\n try {\n const applied = await migrations.apply();\n if (applied.outcome === \"noop\" && !published) return { kind: \"noop\" };\n return {\n kind: \"applied\",\n path: applied.path,\n ...(applied.warnings ? { warnings: applied.warnings } : {}),\n };\n } catch (failure) {\n const refusal = classify(failure);\n // The state this call published is an effect: its refusal is a failure.\n const kind = published && refusal === \"refused\" ? \"failed\" : refusal;\n if (\n attempt === ATTEMPTS ||\n kind !== \"failed\" ||\n !retryable(failure) ||\n !(await backoff(attempt, signal))\n ) {\n return withMarker({ kind, error: describe(failure) }, migrations);\n }\n }\n }\n };\n\n return Object.freeze({\n change: (schema, options) =>\n exclusive(() => change(schema, options), options?.signal).catch(\n (failure: unknown) => ({\n kind: \"failed\" as const,\n error: describe(failure),\n })\n ),\n status: () => current.status(),\n log: () => current.log(),\n resolve: (options) => exclusive(() => current.resolve(options)),\n down: (options) => exclusive(() => current.down(options)),\n reanchor: (options) => exclusive(() => current.reanchor(options)),\n prune: (options) => exclusive(() => current.prune(options)),\n });\n}\n\n/**\n * Whether the change previews a loss, or a published state `apply` would\n * reach first carries one or an approval.\n */\nasync function isDestructive(\n migrations: WritableMigrations,\n resolve: ResolveCallback,\n history: MigrationStorageReader\n): Promise<boolean> {\n const preview = await migrations.generate({ dryRun: true, resolve });\n if (preview.operations.some(isDestructiveOperation)) return true;\n // A first change has no history (`graph()` refuses it): nothing published\n // can carry a loss.\n if (!(await history.readEstate())) return false;\n const { states, edges } = await migrations.graph();\n if (states.length === 0) return false;\n const { path } = await migrations.apply({ dryRun: true });\n return edges.some(\n (edge) =>\n path.includes(edge.toState) &&\n (edge.approvals.length > 0 || edge.risks.includes(\"destructive\"))\n );\n}\n\n/** A transient failure, or the migration lock another command holds. */\nfunction retryable(failure: unknown): boolean {\n if (\n isVibORMError(failure) &&\n failure.code === VibORMErrorCode.MIGRATION_LOCK_FAILED\n ) {\n return true;\n }\n for (let link = failure; link instanceof Error; link = link.cause) {\n if (isRetryableError(link)) return true;\n }\n return false;\n}\n\n/**\n * VibORM's refusals are `refused`; anything else unexpected is `failed`. A\n * possible commit stays `ambiguous` whatever caused it, as does a stepwise\n * step the database refused (`partial`), whose attempt stays open for\n * `resolve`: neither is retried.\n */\nfunction classify(failure: unknown): \"refused\" | \"failed\" | \"ambiguous\" {\n if (!isVibORMError(failure)) return \"failed\";\n if (AMBIGUOUS.has(failure.code) || failure.meta.partial === true) {\n return \"ambiguous\";\n }\n return FAILED.has(failure.code) || retryable(failure) ? \"failed\" : \"refused\";\n}\n\n/** The state reached, read again: since 1.1.0 a change may commit in steps. */\nasync function withMarker(\n result: Extract<TenantChangeResult, { error: TenantChangeError }>,\n migrations: ReadableMigrations\n): Promise<TenantChangeResult> {\n try {\n return { ...result, marker: (await migrations.status()).marker };\n } catch {\n return result;\n }\n}\n\nfunction describe(failure: unknown): TenantChangeError {\n if (!(failure instanceof Error)) {\n return { name: \"Error\", message: String(failure) };\n }\n // Codes only: a cause's message may quote a data-bearing statement.\n const causeCode: unknown =\n failure.cause instanceof Error ? Reflect.get(failure.cause, \"code\") : null;\n const sqlState = isVibORMError(failure)\n ? failure.meta.providerSqlState\n : undefined;\n return {\n name: failure.name,\n ...(isVibORMError(failure) ? { code: failure.code } : {}),\n message: failure.message,\n ...(typeof causeCode === \"string\" ? { causeCode } : {}),\n ...(typeof sqlState === \"string\" ? { providerSqlState: sqlState } : {}),\n };\n}\n\n/** Waits for `previous`, or rejects with the signal's reason first. */\nfunction untilAborted(\n previous: Promise<unknown>,\n signal: AbortSignal | undefined\n): Promise<unknown> {\n if (!signal) return previous;\n signal.throwIfAborted();\n let abort = (): void => undefined;\n const aborted = new Promise<never>((_, reject) => {\n abort = () => reject(signal.reason);\n signal.addEventListener(\"abort\", abort, { once: true });\n });\n return Promise.race([previous, aborted]).finally(() =>\n signal.removeEventListener(\"abort\", abort)\n );\n}\n\n/** Jittered exponential backoff; false when the signal aborts the wait. */\nasync function backoff(\n attempt: number,\n signal: AbortSignal | undefined\n): Promise<boolean> {\n const ms = BACKOFF_MS * 2 ** (attempt - 1) * (0.5 + Math.random() / 2);\n try {\n await untilAborted(\n new Promise((resolve) => setTimeout(resolve, ms)),\n signal\n );\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":"kNA4GA,MAAM,EAAY,IAAI,IAAY,CAChC,EAAgB,yBAChB,EAAgB,2BAChB,EAAgB,6BACjB,CAAC,CAEI,EAAS,IAAI,IAAY,CAC7B,EAAgB,iBAChB,EAAgB,0BACjB,CAAC,CAUF,SAAgB,qBAAqB,CACnC,SACA,UACA,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,IAAM,GAAM,KAAK,QAAQ,CAAG,GACpE,GAAI,CAKF,OAJA,MAAM,aACJ,IAAI,QAAS,GAAY,WAAW,EAAS,EAAG,CAAC,CACjD,EACD,CACM,QACD,CACN,MAAO"}
1
+ {"version":3,"file":"tenant.mjs","names":[],"sources":["../../src/migrations/tenant.ts"],"sourcesContent":["/**\n * One tenant's schema changes, from a Durable Object (plan D4).\n *\n * A helper over `createMigrationClient`, not a second composition root: a\n * change is that client's `generate` and `apply`, run one at a time per\n * migrator, and what they throw comes back as one of five outcomes.\n */\n\nimport { isRetryableError, isVibORMError, VibORMErrorCode } from \"../errors\";\nimport { admitLiveMigrationCapability } from \"./admission\";\nimport {\n createMigrationClient,\n type ReadableMigrations,\n type WritableMigrations,\n} from \"./client\";\nimport { isDestructiveOperation } from \"./differ\";\nimport type { Sha256 } from \"./identity\";\nimport type { MigrationLimits } from \"./limits\";\nimport { getPushMigrationDriver, type MigrationClient } from \"./push/planner\";\nimport { createPredefinedResolver } from \"./resolver\";\nimport type {\n MigrationStorageReader,\n MigrationStorageWriter,\n} from \"./storage/contract\";\nimport type { ResolveCallback } from \"./types\";\nimport type { MigrationDecisionV1, MigrationMarkerV1 } from \"./v1-types\";\n\nexport interface TenantMigratorOptions {\n /**\n * Any client on the tenant's database. `change` uses its connection with\n * the schema it is given; `status`, `log`, `resolve`, `down` and\n * `reanchor` use the client as it is.\n */\n readonly client: MigrationClient;\n /** The tenant's history: `createDurableObjectStorageWriter(ctx.storage)`. */\n readonly history: MigrationStorageWriter;\n /** The managed tables, as `createMigrationClient`'s `tables`. */\n readonly tables?: readonly string[];\n readonly limits?: MigrationLimits;\n}\n\nexport interface TenantChangeOptions {\n /** Renames, enum mappings and approved destructive changes, as data. */\n readonly decisions?: readonly MigrationDecisionV1[];\n /**\n * Checked while queued, before `beforeDestructive`, before publishing and\n * during retry backoff. Once a state is published `apply` runs, and is\n * never interrupted: bound it with `limits`.\n */\n readonly signal?: AbortSignal;\n /**\n * Awaited after the preview and before any effect when the change, or a\n * published state `apply` reaches first, is destructive. If it throws, the\n * change is `refused`.\n */\n readonly beforeDestructive?: () => unknown;\n}\n\n/** An error as plain data, so an outcome crosses Durable Object RPC intact. */\nexport interface TenantChangeError {\n readonly name: string;\n readonly code?: string;\n readonly message: string;\n /** The code of the error's cause, such as the driver's, when it has one. */\n readonly causeCode?: string;\n /** The SQLSTATE the server answered, when the error carries one. */\n readonly providerSqlState?: string;\n}\n\nexport type TenantChangeResult =\n | {\n readonly kind: \"applied\";\n readonly path: readonly Sha256[];\n readonly warnings?: readonly string[];\n }\n | { readonly kind: \"noop\" }\n | {\n /**\n * `refused`: this call changed nothing. `failed`: the change did not\n * reach its state, which may be published; calling again may. A\n * refusal of a state this call published is `failed`. `ambiguous`: the\n * database may be between states; read `status()`, then `resolve()`.\n */\n readonly kind: \"refused\" | \"failed\" | \"ambiguous\";\n readonly error: TenantChangeError;\n /** `status().marker` after an apply attempt, when it could be read. */\n readonly marker?: MigrationMarkerV1 | null;\n };\n\nexport interface TenantMigrator {\n change(\n schema: MigrationClient[\"$schema\"],\n options?: TenantChangeOptions\n ): Promise<TenantChangeResult>;\n status: ReadableMigrations[\"status\"];\n log: ReadableMigrations[\"log\"];\n resolve: ReadableMigrations[\"resolve\"];\n down: ReadableMigrations[\"down\"];\n /** After a restore left this object's history older than the database. */\n reanchor: ReadableMigrations[\"reanchor\"];\n /**\n * Copies an authored checkpoint and what follows it into a fresh history,\n * such as `createDurableObjectStorageWriter(ctx.storage, { prefix })`;\n * a migrator over it then calls `reanchor()`.\n */\n prune: ReadableMigrations[\"prune\"];\n}\n\nconst AMBIGUOUS = new Set<string>([\n VibORMErrorCode.MIGRATION_PARTIAL_EFFECT,\n VibORMErrorCode.MIGRATION_AMBIGUOUS_COMMIT,\n VibORMErrorCode.MIGRATION_UNFINISHED_ATTEMPT,\n]);\n/** An attempt that rolled back, or lost the marker to another writer. */\nconst FAILED = new Set<string>([\n VibORMErrorCode.MIGRATION_FAILED,\n VibORMErrorCode.MIGRATION_MARKER_CONFLICT,\n]);\nconst ATTEMPTS = 4;\nconst BACKOFF_MS = 200;\n\n/**\n * `change`, `resolve`, `down`, `reanchor` and `prune` run one at a time: a call made while another\n * runs waits for it, and leaves the queue as `failed` if its signal aborts\n * first. Call them from a request or an alarm, never from the constructor or\n * `blockConcurrencyWhile`.\n */\nexport function createTenantMigrator({\n client,\n history,\n tables,\n limits,\n}: TenantMigratorOptions): TenantMigrator {\n const options = { storage: history, tables, limits };\n const current = createMigrationClient(client, options);\n let tail: Promise<unknown> = Promise.resolve();\n const exclusive = async <T>(\n run: () => Promise<T>,\n signal?: AbortSignal\n ): Promise<T> => {\n const previous = tail;\n let release = (): void => undefined;\n tail = new Promise<void>((resolve) => {\n release = resolve;\n }).then(() => previous);\n try {\n await untilAborted(previous, signal);\n return await run();\n } finally {\n release();\n }\n };\n\n const change = async (\n schema: MigrationClient[\"$schema\"],\n { decisions = [], signal, beforeDestructive }: TenantChangeOptions = {}\n ): Promise<TenantChangeResult> => {\n let published: boolean;\n let migrations: WritableMigrations;\n try {\n signal?.throwIfAborted();\n // A transport apply refuses is refused before generate publishes.\n admitLiveMigrationCapability(\n getPushMigrationDriver(client),\n \"batch\",\n \"apply()\"\n );\n migrations = createMigrationClient(\n { $driver: client.$driver, $schema: schema },\n options\n );\n const resolve = createPredefinedResolver(decisions);\n if (\n beforeDestructive &&\n (await isDestructive(migrations, resolve, history))\n ) {\n signal?.throwIfAborted();\n try {\n await beforeDestructive();\n } catch (failure) {\n return { kind: \"refused\", error: describe(failure) };\n }\n }\n signal?.throwIfAborted();\n const generated = await migrations.generate({ resolve });\n published = generated.outcome === \"published\";\n } catch (failure) {\n return { kind: classify(failure), error: describe(failure) };\n }\n for (let attempt = 1; ; attempt += 1) {\n try {\n const applied = await migrations.apply();\n if (applied.outcome === \"noop\" && !published) return { kind: \"noop\" };\n return {\n kind: \"applied\",\n path: applied.path,\n ...(applied.warnings ? { warnings: applied.warnings } : {}),\n };\n } catch (failure) {\n const refusal = classify(failure);\n // The state this call published is an effect: its refusal is a failure.\n const kind = published && refusal === \"refused\" ? \"failed\" : refusal;\n if (\n attempt === ATTEMPTS ||\n kind !== \"failed\" ||\n !retryable(failure) ||\n !(await backoff(attempt, signal))\n ) {\n return withMarker({ kind, error: describe(failure) }, migrations);\n }\n }\n }\n };\n\n return Object.freeze({\n change: (schema, options) =>\n exclusive(() => change(schema, options), options?.signal).catch(\n (failure: unknown) => ({\n kind: \"failed\" as const,\n error: describe(failure),\n })\n ),\n status: () => current.status(),\n log: () => current.log(),\n resolve: (options) => exclusive(() => current.resolve(options)),\n down: (options) => exclusive(() => current.down(options)),\n reanchor: (options) => exclusive(() => current.reanchor(options)),\n prune: (options) => exclusive(() => current.prune(options)),\n });\n}\n\n/**\n * Whether the change previews a loss, or a published state `apply` would\n * reach first carries one or an approval.\n */\nasync function isDestructive(\n migrations: WritableMigrations,\n resolve: ResolveCallback,\n history: MigrationStorageReader\n): Promise<boolean> {\n const preview = await migrations.generate({ dryRun: true, resolve });\n if (preview.operations.some(isDestructiveOperation)) return true;\n // A first change has no history (`graph()` refuses it): nothing published\n // can carry a loss.\n if (!(await history.readEstate())) return false;\n const { states, edges } = await migrations.graph();\n if (states.length === 0) return false;\n const { path } = await migrations.apply({ dryRun: true });\n return edges.some(\n (edge) =>\n path.includes(edge.toState) &&\n (edge.approvals.length > 0 || edge.risks.includes(\"destructive\"))\n );\n}\n\n/** A transient failure, or the migration lock another command holds. */\nfunction retryable(failure: unknown): boolean {\n if (\n isVibORMError(failure) &&\n failure.code === VibORMErrorCode.MIGRATION_LOCK_FAILED\n ) {\n return true;\n }\n for (let link = failure; link instanceof Error; link = link.cause) {\n if (isRetryableError(link)) return true;\n }\n return false;\n}\n\n/**\n * VibORM's refusals are `refused`; anything else unexpected is `failed`. A\n * possible commit stays `ambiguous` whatever caused it, as does a stepwise\n * step the database refused (`partial`), whose attempt stays open for\n * `resolve`: neither is retried.\n */\nfunction classify(failure: unknown): \"refused\" | \"failed\" | \"ambiguous\" {\n if (!isVibORMError(failure)) return \"failed\";\n if (AMBIGUOUS.has(failure.code) || failure.meta.partial === true) {\n return \"ambiguous\";\n }\n return FAILED.has(failure.code) || retryable(failure) ? \"failed\" : \"refused\";\n}\n\n/** The state reached, read again: since 1.1.0 a change may commit in steps. */\nasync function withMarker(\n result: Extract<TenantChangeResult, { error: TenantChangeError }>,\n migrations: ReadableMigrations\n): Promise<TenantChangeResult> {\n try {\n return { ...result, marker: (await migrations.status()).marker };\n } catch {\n return result;\n }\n}\n\nfunction describe(failure: unknown): TenantChangeError {\n if (!(failure instanceof Error)) {\n return { name: \"Error\", message: String(failure) };\n }\n // Codes only: a cause's message may quote a data-bearing statement.\n const causeCode: unknown =\n failure.cause instanceof Error ? Reflect.get(failure.cause, \"code\") : null;\n const sqlState = isVibORMError(failure)\n ? failure.meta.providerSqlState\n : undefined;\n return {\n name: failure.name,\n ...(isVibORMError(failure) ? { code: failure.code } : {}),\n message: failure.message,\n ...(typeof causeCode === \"string\" ? { causeCode } : {}),\n ...(typeof sqlState === \"string\" ? { providerSqlState: sqlState } : {}),\n };\n}\n\n/** Waits for `previous`, or rejects with the signal's reason first. */\nfunction untilAborted(\n previous: Promise<unknown>,\n signal: AbortSignal | undefined\n): Promise<unknown> {\n if (!signal) return previous;\n signal.throwIfAborted();\n let abort = (): void => undefined;\n const aborted = new Promise<never>((_, reject) => {\n abort = () => reject(signal.reason);\n signal.addEventListener(\"abort\", abort, { once: true });\n });\n return Promise.race([previous, aborted]).finally(() =>\n signal.removeEventListener(\"abort\", abort)\n );\n}\n\n/** Jittered exponential backoff; false when the signal aborts the wait. */\nasync function backoff(\n attempt: number,\n signal: AbortSignal | undefined\n): Promise<boolean> {\n const ms = BACKOFF_MS * 2 ** (attempt - 1) * (0.5 + Math.random() / 2);\n try {\n await untilAborted(\n new Promise((resolve) => setTimeout(resolve, ms)),\n signal\n );\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":"4JA4GA,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AAQ,CAAC,CAAC,YACvC,EAAO,oBAAoB,QAAS,EAAK,CAC1C,CAIH,eAAe,EACb,EACA,EACkB,CAClB,IAAM,EAAK,IAAa,IAAM,EAAU,IAAM,GAAM,KAAK,QAAQ,CAAG,GACpE,GAAI,CAKF,OAJA,MAAM,EACJ,IAAI,QAAS,GAAY,WAAW,EAAS,EAAG,CAAC,CACjD,EACD,CACM,QACD,CACN,MAAO"}
@@ -0,0 +1,2 @@
1
+ import{t as e,u as t}from"./base-17NSFtrA.mjs";var n=class extends e{static get name(){return`MigrationError`}static diagnosticName=`MigrationError`;constructor(e,n=`V11001`,r){let i=r?.cause;super(e,n,{...r,diagnostics:i?t(i):void 0})}};function r(e){return e instanceof n}export{r as n,n as t};
2
+ //# sourceMappingURL=migrations-DIUltjr3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrations-BMiRjR-N.mjs","names":[],"sources":["../src/errors/migrations.ts"],"sourcesContent":["import { VibORMError, VibORMErrorCode, type VibORMErrorMeta } from \"./base\";\nimport { getTrustedErrorDisclosure } from \"./diagnostics\";\n\n/**\n * Migration error metadata\n */\nexport interface MigrationErrorMeta extends VibORMErrorMeta {\n /** Name of the migration */\n migrationName?: string;\n /** Expected checksum (from database) */\n expectedChecksum?: string;\n /** Actual checksum (from file) */\n actualChecksum?: string;\n /** Migration index */\n migrationIndex?: number;\n /** Directory path */\n migrationsDir?: string;\n /** Last confirmed dispatch or step identity */\n lastConfirmedStep?: string;\n /** Estate digest involved in the refusal */\n estateHash?: string;\n /** State digest involved in the refusal */\n stateId?: string;\n /** Push plan digest involved in the refusal */\n planHash?: string;\n /** Origin state of the edge (absent for the empty root) */\n fromState?: string;\n /** Destination state of the edge */\n toState?: string;\n /** Operation and dispatch the failure names */\n operationId?: string;\n dispatchId?: string;\n /** Honest effect classification after a non-transactional failure */\n effectState?: \"none\" | \"committed\" | \"partial\" | \"may-have-committed\";\n /** True when some provider work may already have committed */\n partial?: boolean;\n}\n\n/**\n * Every code {@link MigrationError} can carry.\n *\n * The `MIGRATION_*` family plus four codes the migration layer genuinely raises through this\n * class — measured, not assumed: `INVALID_INPUT` (`migrations/utils.ts`, `drivers/base.ts`),\n * `FEATURE_NOT_SUPPORTED` (unsupported index type, SQLite table recreation),\n * `DRIVER_NOT_SUPPORTED` (`drivers/index.ts`) and `INTERNAL_ERROR` (unreachable operation\n * kinds). A code outside this union is a compile error at the construction site.\n */\nexport type MigrationErrorCode =\n | typeof VibORMErrorCode.MIGRATION_FAILED\n | typeof VibORMErrorCode.MIGRATION_NOT_FOUND\n | typeof VibORMErrorCode.MIGRATION_CHECKSUM_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_DIALECT_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_LOCK_FAILED\n | typeof VibORMErrorCode.MIGRATION_ALREADY_APPLIED\n | typeof VibORMErrorCode.MIGRATION_OUT_OF_ORDER\n | typeof VibORMErrorCode.MIGRATION_FILE_NOT_FOUND\n | typeof VibORMErrorCode.MIGRATION_INVALID_STATE\n | typeof VibORMErrorCode.MIGRATION_DESTRUCTIVE_REJECTED\n | typeof VibORMErrorCode.MIGRATION_STORAGE_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_INVALID_ESTATE\n | typeof VibORMErrorCode.MIGRATION_PATH_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_DRIFT\n | typeof VibORMErrorCode.MIGRATION_MARKER_CONFLICT\n | typeof VibORMErrorCode.MIGRATION_UNFINISHED_ATTEMPT\n | typeof VibORMErrorCode.MIGRATION_CONSENT_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_CONSENT_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_PARTIAL_EFFECT\n | typeof VibORMErrorCode.MIGRATION_AMBIGUOUS_COMMIT\n | typeof VibORMErrorCode.MIGRATION_UNSUPPORTED_PROVIDER\n | typeof VibORMErrorCode.MIGRATION_CORRUPTION\n | typeof VibORMErrorCode.MIGRATION_INVALID_INDEX\n | typeof VibORMErrorCode.INVALID_INPUT\n | typeof VibORMErrorCode.FEATURE_NOT_SUPPORTED\n | typeof VibORMErrorCode.DRIVER_NOT_SUPPORTED\n | typeof VibORMErrorCode.INTERNAL_ERROR;\n\n/**\n * Migration-related errors\n */\nexport class MigrationError extends VibORMError {\n static override readonly diagnosticName = \"MigrationError\";\n\n /** Discriminant: one of {@link MigrationErrorCode}, never a code outside the family. */\n declare readonly code: MigrationErrorCode;\n\n constructor(\n message: string,\n code: MigrationErrorCode = VibORMErrorCode.MIGRATION_FAILED,\n options?: {\n cause?: Error | undefined;\n meta?: MigrationErrorMeta | undefined;\n }\n ) {\n // A migration failure discloses its cause as the cause's own failure\n // was allowed to (its client's `diagnostics`): wrapping never redacts.\n const cause = options?.cause;\n super(message, code, {\n ...options,\n diagnostics: cause ? getTrustedErrorDisclosure(cause) : undefined,\n });\n }\n}\n\n/**\n * Type guard for migration errors\n */\nexport function isMigrationError(error: unknown): error is MigrationError {\n return error instanceof MigrationError;\n}\n"],"mappings":"+FA+EA,IAAa,eAAb,cAAoC,CAAY,CAC9C,OAAyB,eAAiB,iBAK1C,YACE,EACA,EAA2B,EAAgB,iBAC3C,EAIA,CAGA,IAAM,EAAQ,GAAS,MACvB,MAAM,EAAS,EAAM,CACnB,GAAG,EACH,YAAa,EAAQ,EAA0B,EAAM,CAAG,IAAA,GACzD,CAAC,GAON,SAAgB,iBAAiB,EAAyC,CACxE,OAAO,aAAiB"}
1
+ {"version":3,"file":"migrations-DIUltjr3.mjs","names":[],"sources":["../src/errors/migrations.ts"],"sourcesContent":["import { VibORMError, VibORMErrorCode, type VibORMErrorMeta } from \"./base\";\nimport { getTrustedErrorDisclosure } from \"./diagnostics\";\n\n/**\n * Migration error metadata\n */\nexport interface MigrationErrorMeta extends VibORMErrorMeta {\n /** Name of the migration */\n migrationName?: string;\n /** Expected checksum (from database) */\n expectedChecksum?: string;\n /** Actual checksum (from file) */\n actualChecksum?: string;\n /** Migration index */\n migrationIndex?: number;\n /** Directory path */\n migrationsDir?: string;\n /** Last confirmed dispatch or step identity */\n lastConfirmedStep?: string;\n /** Estate digest involved in the refusal */\n estateHash?: string;\n /** State digest involved in the refusal */\n stateId?: string;\n /** Push plan digest involved in the refusal */\n planHash?: string;\n /** Origin state of the edge (absent for the empty root) */\n fromState?: string;\n /** Destination state of the edge */\n toState?: string;\n /** Operation and dispatch the failure names */\n operationId?: string;\n dispatchId?: string;\n /** Honest effect classification after a non-transactional failure */\n effectState?: \"none\" | \"committed\" | \"partial\" | \"may-have-committed\";\n /** True when some provider work may already have committed */\n partial?: boolean;\n}\n\n/**\n * Every code {@link MigrationError} can carry.\n *\n * The `MIGRATION_*` family plus four codes the migration layer genuinely raises through this\n * class — measured, not assumed: `INVALID_INPUT` (`migrations/utils.ts`, `drivers/base.ts`),\n * `FEATURE_NOT_SUPPORTED` (unsupported index type, SQLite table recreation),\n * `DRIVER_NOT_SUPPORTED` (`drivers/index.ts`) and `INTERNAL_ERROR` (unreachable operation\n * kinds). A code outside this union is a compile error at the construction site.\n */\nexport type MigrationErrorCode =\n | typeof VibORMErrorCode.MIGRATION_FAILED\n | typeof VibORMErrorCode.MIGRATION_NOT_FOUND\n | typeof VibORMErrorCode.MIGRATION_CHECKSUM_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_DIALECT_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_LOCK_FAILED\n | typeof VibORMErrorCode.MIGRATION_ALREADY_APPLIED\n | typeof VibORMErrorCode.MIGRATION_OUT_OF_ORDER\n | typeof VibORMErrorCode.MIGRATION_FILE_NOT_FOUND\n | typeof VibORMErrorCode.MIGRATION_INVALID_STATE\n | typeof VibORMErrorCode.MIGRATION_DESTRUCTIVE_REJECTED\n | typeof VibORMErrorCode.MIGRATION_STORAGE_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_INVALID_ESTATE\n | typeof VibORMErrorCode.MIGRATION_PATH_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_DRIFT\n | typeof VibORMErrorCode.MIGRATION_MARKER_CONFLICT\n | typeof VibORMErrorCode.MIGRATION_UNFINISHED_ATTEMPT\n | typeof VibORMErrorCode.MIGRATION_CONSENT_REQUIRED\n | typeof VibORMErrorCode.MIGRATION_CONSENT_MISMATCH\n | typeof VibORMErrorCode.MIGRATION_PARTIAL_EFFECT\n | typeof VibORMErrorCode.MIGRATION_AMBIGUOUS_COMMIT\n | typeof VibORMErrorCode.MIGRATION_UNSUPPORTED_PROVIDER\n | typeof VibORMErrorCode.MIGRATION_CORRUPTION\n | typeof VibORMErrorCode.MIGRATION_INVALID_INDEX\n | typeof VibORMErrorCode.INVALID_INPUT\n | typeof VibORMErrorCode.FEATURE_NOT_SUPPORTED\n | typeof VibORMErrorCode.DRIVER_NOT_SUPPORTED\n | typeof VibORMErrorCode.INTERNAL_ERROR;\n\n/**\n * Migration-related errors\n */\nexport class MigrationError extends VibORMError {\n static override readonly diagnosticName = \"MigrationError\";\n\n /** Discriminant: one of {@link MigrationErrorCode}, never a code outside the family. */\n declare readonly code: MigrationErrorCode;\n\n constructor(\n message: string,\n code: MigrationErrorCode = VibORMErrorCode.MIGRATION_FAILED,\n options?: {\n cause?: Error | undefined;\n meta?: MigrationErrorMeta | undefined;\n }\n ) {\n // A migration failure discloses its cause as the cause's own failure\n // was allowed to (its client's `diagnostics`): wrapping never redacts.\n const cause = options?.cause;\n super(message, code, {\n ...options,\n diagnostics: cause ? getTrustedErrorDisclosure(cause) : undefined,\n });\n }\n}\n\n/**\n * Type guard for migration errors\n */\nexport function isMigrationError(error: unknown): error is MigrationError {\n return error instanceof MigrationError;\n}\n"],"mappings":"+CA+EA,IAAa,EAAb,cAAoC,CAAY,CAAA,WAAA,MAAA,CAAA,MAAA,iBAC9C,OAAyB,eAAiB,iBAK1C,YACE,EACA,EAA2B,SAC3B,EAIA,CAGA,IAAM,EAAQ,GAAS,MACvB,MAAM,EAAS,EAAM,CACnB,GAAG,EACH,YAAa,EAAQ,EAA0B,EAAM,CAAG,IAAA,GACzD,CAAC,GAON,SAAgB,EAAiB,EAAyC,CACxE,OAAO,aAAiB"}
@@ -1,6 +1,6 @@
1
- import { oo as MigrationError, so as isMigrationError } from "./database-adapter-BGqvjeEy.mjs";
2
- import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "./planner-DHjdvjwk.mjs";
3
- import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "./contract-CrIB-3ZJ.mjs";
4
- import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "./client-CRxfhw2y.mjs";
5
- import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "./object-store-B_YMoW8u.mjs";
1
+ import { vo as MigrationError, yo as isMigrationError } from "./database-adapter-BMjJiBFm.mjs";
2
+ import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "./planner-C-zjj19U.mjs";
3
+ import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "./contract-CxJn0_cV.mjs";
4
+ import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "./client-Dlz3-2JC.mjs";
5
+ import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "./object-store-C4qmW7xf.mjs";
6
6
  export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s}from"./serializer-rBq3v1xr.mjs";import{t as c}from"./identifier-conversion-DHYPTgzr.mjs";import{t as l}from"./every-tOgQmaIE.mjs";import{s as u,t as d}from"./client-y7TV0PRZ.mjs";import{n as f,t as p}from"./memory-G4cSuc6A.mjs";import{n as m,r as h,t as g}from"./object-store-DS0F0yZX.mjs";l();export{g as MemoryConditionalObjectStore,p as MemoryEstateStorage,t as MigrationError,m as ObjectStoreEstateStorage,r as addDropResolver,u as auditStorage,d as createMigrationClient,o as createPredefinedResolver,f as createStorageConformanceSuite,c as identifierConversionChecks,e as isMigrationError,a as lenientResolver,h as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
1
+ import{n as e,t}from"./migrations-DIUltjr3.mjs";import{fn as n,g as r,m as i,vn as a,xn as o,yn as s}from"./serializer-ettLu5xG.mjs";import{t as c}from"./identifier-conversion-BTDxDwDB.mjs";import{t as l}from"./every-JpbiHdMb.mjs";import{s as u,t as d}from"./client-DEfFqv4S.mjs";import{n as f,t as p}from"./memory-BaGWNdvk.mjs";import{n as m,r as h,t as g}from"./object-store-Chq1PMYz.mjs";l();export{g as MemoryConditionalObjectStore,p as MemoryEstateStorage,t as MigrationError,m as ObjectStoreEstateStorage,n as addDropResolver,u as auditStorage,d as createMigrationClient,a as createPredefinedResolver,f as createStorageConformanceSuite,c as identifierConversionChecks,e as isMigrationError,s as lenientResolver,h as refuseWorkersKvWritable,o as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,r as sqliteCanonicalTimeExpression};
2
2
  //# sourceMappingURL=migrations.mjs.map