@prisma/orm-target-sqlite 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1

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 (289) hide show
  1. package/README.md +1 -5
  2. package/dist/{adapter-CUTKlFpX-CW0J0Qs4.mjs → adapter-7m8HU4rt-DN15_Cn8.mjs} +178 -107
  3. package/dist/adapter-7m8HU4rt-DN15_Cn8.mjs.map +1 -0
  4. package/dist/adapter-C3hrAasJ.d.mts +197 -0
  5. package/dist/adapter-C3hrAasJ.d.mts.map +1 -0
  6. package/dist/{adapter-DEYUC-KO-DO_abhIq.d.mts → adapter-xFPDhkod-BsdLsy9N.d.mts} +12 -9
  7. package/dist/adapter-xFPDhkod-BsdLsy9N.d.mts.map +1 -0
  8. package/dist/adapter.d.mts +14 -15
  9. package/dist/adapter.mjs +7 -6
  10. package/dist/adapter__adapter.d.mts +4 -4
  11. package/dist/adapter__adapter.mjs +3 -2
  12. package/dist/adapter__codec-types.d.mts +3 -3
  13. package/dist/adapter__column-types.d.mts +2 -2
  14. package/dist/adapter__column-types.mjs +2 -2
  15. package/dist/adapter__control.d.mts +5 -5
  16. package/dist/adapter__control.mjs +12 -247
  17. package/dist/adapter__control.mjs.map +1 -1
  18. package/dist/adapter__runtime.d.mts +1 -1
  19. package/dist/adapter__runtime.mjs +11 -6
  20. package/dist/adapter__runtime.mjs.map +1 -1
  21. package/dist/adapter__sql-renderer.d.mts +2 -2
  22. package/dist/adapter__sql-renderer.mjs +1 -1
  23. package/dist/adapter__types.d.mts +3 -2
  24. package/dist/{aggregates-DWyPO7t6.mjs → aggregates-D5fuFVMC.mjs} +33 -20
  25. package/dist/aggregates-D5fuFVMC.mjs.map +1 -0
  26. package/dist/aggregates-UBmpuURb.d.mts +164 -0
  27. package/dist/aggregates-UBmpuURb.d.mts.map +1 -0
  28. package/dist/codec-descriptor-3oN7rtrW-Cc_u7U5-.d.mts +1 -0
  29. package/dist/codec-descriptor-C16gQAdS.d.mts +2 -0
  30. package/dist/{codec-descriptor-B9ru99aI-DTkdKFU5.mjs → codec-descriptor-DRmF-crq-BALI5Jtz.mjs} +11 -15
  31. package/dist/codec-descriptor-DRmF-crq-BALI5Jtz.mjs.map +1 -0
  32. package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts +45 -0
  33. package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts.map +1 -0
  34. package/dist/codec-ids-CMbhYIsa.d.mts +1 -0
  35. package/dist/{codec-ids-CzeDyMWW-BZAcI50I.d.mts → codec-ids-DuJYssXV-BPKbFNRL.d.mts} +4 -4
  36. package/dist/codec-ids-DuJYssXV-BPKbFNRL.d.mts.map +1 -0
  37. package/dist/{codec-ids-KMliSCRp-BhTbmbGr.mjs → codec-ids-wgEvkCkg-WltuexMR.mjs} +4 -4
  38. package/dist/codec-ids-wgEvkCkg-WltuexMR.mjs.map +1 -0
  39. package/dist/{codec-types-D7uWRvQ1-DPnvquS8.d.mts → codec-types-COh75Bop-CUehAexc.d.mts} +6 -5
  40. package/dist/codec-types-COh75Bop-CUehAexc.d.mts.map +1 -0
  41. package/dist/codec-types-ELHfd82J.d.mts +2 -0
  42. package/dist/codec-types-PONhVn74.d.mts +1 -0
  43. package/dist/{codecs-BQWqLgCl-CdB8t7HI.d.mts → codecs-BJYruC-a-BKDGae3k.d.mts} +86 -62
  44. package/dist/codecs-BJYruC-a-BKDGae3k.d.mts.map +1 -0
  45. package/dist/codecs-Dn0xoCuf.d.mts +1 -0
  46. package/dist/codecs-g-YI3BtK.mjs +49 -0
  47. package/dist/codecs-g-YI3BtK.mjs.map +1 -0
  48. package/dist/codecs-yZoH21Yj-lQXtGlEq.mjs +618 -0
  49. package/dist/codecs-yZoH21Yj-lQXtGlEq.mjs.map +1 -0
  50. package/dist/column-types-DcbNOYVb.mjs +22 -0
  51. package/dist/column-types-DcbNOYVb.mjs.map +1 -0
  52. package/dist/column-types-Dxm0BpPv.d.mts +36 -0
  53. package/dist/column-types-Dxm0BpPv.d.mts.map +1 -0
  54. package/dist/contract-contributions-wweWdXMK-CN-d35Rj.mjs +24 -0
  55. package/dist/contract-contributions-wweWdXMK-CN-d35Rj.mjs.map +1 -0
  56. package/dist/{contract-free-CCLAXZV2.d.mts → contract-free-BJwIJN6x.d.mts} +3 -3
  57. package/dist/contract-free-BJwIJN6x.d.mts.map +1 -0
  58. package/dist/{contract-free-D5cZrgNl.mjs → contract-free-DetowcoS.mjs} +8 -7
  59. package/dist/contract-free-DetowcoS.mjs.map +1 -0
  60. package/dist/{control-CLirKz11.d.mts → control-BbJiKI2r.d.mts} +24 -29
  61. package/dist/control-BbJiKI2r.d.mts.map +1 -0
  62. package/dist/{control-B16T9OoX.mjs → control-BxbKU2xs.mjs} +15 -6
  63. package/dist/control-BxbKU2xs.mjs.map +1 -0
  64. package/dist/{control-D9vMRRgU.d.mts → control-C2TjacST.d.mts} +3 -3
  65. package/dist/control-C2TjacST.d.mts.map +1 -0
  66. package/dist/{control--wMueaTg.d.mts → control-CmDsxEqb.d.mts} +75 -6
  67. package/dist/control-CmDsxEqb.d.mts.map +1 -0
  68. package/dist/{control-tables-Dua-YcJL.d.mts → control-tables-DKXLHvMU.d.mts} +2 -2
  69. package/dist/control-tables-DKXLHvMU.d.mts.map +1 -0
  70. package/dist/{control-tables-D_o8dKRB-BXi43noL.mjs → control-tables-D_o8dKRB-n_QqsXcm.mjs} +2 -2
  71. package/dist/control-tables-D_o8dKRB-n_QqsXcm.mjs.map +1 -0
  72. package/dist/data-type-entries-yQ-qYugg-C_NnX5WO.mjs +76 -0
  73. package/dist/data-type-entries-yQ-qYugg-C_NnX5WO.mjs.map +1 -0
  74. package/dist/data-types-Dx3rHsbF.d.mts +40 -0
  75. package/dist/data-types-Dx3rHsbF.d.mts.map +1 -0
  76. package/dist/data-types-coQrCWfS-yMCe4F52.mjs +140 -0
  77. package/dist/data-types-coQrCWfS-yMCe4F52.mjs.map +1 -0
  78. package/dist/datetime-text-Bniwehv--BSQhnrdE.mjs +9 -0
  79. package/dist/datetime-text-Bniwehv--BSQhnrdE.mjs.map +1 -0
  80. package/dist/ddl-31OBcTco.d.mts +1 -0
  81. package/dist/{ddl-CXduXyOT-nlDP6DGx.mjs → ddl-CX4tAZ-y-Bng-4PWC.mjs} +42 -5
  82. package/dist/ddl-CX4tAZ-y-Bng-4PWC.mjs.map +1 -0
  83. package/dist/default-normalizer-CkHy3JYk.d.mts +25 -0
  84. package/dist/default-normalizer-CkHy3JYk.d.mts.map +1 -0
  85. package/dist/default-normalizer-DGMXypHg-CPf7oyZA.mjs +112 -0
  86. package/dist/default-normalizer-DGMXypHg-CPf7oyZA.mjs.map +1 -0
  87. package/dist/descriptor-meta-COSGM3xb-Ct_5RPcm.mjs +110 -0
  88. package/dist/descriptor-meta-COSGM3xb-Ct_5RPcm.mjs.map +1 -0
  89. package/dist/descriptor-meta-DrNwC4vO-D7vuA6QK.mjs +26 -0
  90. package/dist/descriptor-meta-DrNwC4vO-D7vuA6QK.mjs.map +1 -0
  91. package/dist/{descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs → descriptor-meta-cwy5CXTT-CLOhiryX.mjs} +17 -3
  92. package/dist/descriptor-meta-cwy5CXTT-CLOhiryX.mjs.map +1 -0
  93. package/dist/descriptor-meta-runtime-DX2JfHWF-Dbsh5NP8.mjs +15 -0
  94. package/dist/descriptor-meta-runtime-DX2JfHWF-Dbsh5NP8.mjs.map +1 -0
  95. package/dist/driver.d.mts +2 -2
  96. package/dist/driver.mjs +1 -1
  97. package/dist/driver__control.d.mts +1 -1
  98. package/dist/driver__control.mjs +1 -1
  99. package/dist/driver__runtime.d.mts +1 -1
  100. package/dist/driver__runtime.mjs +5 -8
  101. package/dist/driver__runtime.mjs.map +1 -1
  102. package/dist/{errors-DnR-sMHS-KkMLIP2U.mjs → errors-DnR-sMHS-D_gh214a.mjs} +2 -2
  103. package/dist/errors-DnR-sMHS-D_gh214a.mjs.map +1 -0
  104. package/dist/{migration-uylRe5MP.d.mts → migration-WJlUQmsn.d.mts} +6 -5
  105. package/dist/migration-WJlUQmsn.d.mts.map +1 -0
  106. package/dist/{migration-DOKPHtxn.mjs → migration-nqIDkjRz.mjs} +6 -5
  107. package/dist/migration-nqIDkjRz.mjs.map +1 -0
  108. package/dist/{nodes-D8EC1yCx-rpfpuJ4T.d.mts → nodes-D8EC1yCx-BS-fKla6.d.mts} +2 -2
  109. package/dist/nodes-D8EC1yCx-BS-fKla6.d.mts.map +1 -0
  110. package/dist/{nodes-DUZSdX86-BBEEaxXY.mjs → nodes-DUZSdX86-DWyLY3OW.mjs} +2 -2
  111. package/dist/nodes-DUZSdX86-DWyLY3OW.mjs.map +1 -0
  112. package/dist/{op-factory-call-DoHN7Q7L.d.mts → op-factory-call-De6MX7Yp.d.mts} +83 -19
  113. package/dist/op-factory-call-De6MX7Yp.d.mts.map +1 -0
  114. package/dist/op-factory-call-emj9Xp05-BFLkxrAK.mjs +1414 -0
  115. package/dist/op-factory-call-emj9Xp05-BFLkxrAK.mjs.map +1 -0
  116. package/dist/pack-DR0n9vHJ.d.mts +1179 -0
  117. package/dist/pack-DR0n9vHJ.d.mts.map +1 -0
  118. package/dist/planner-BvwYScnt-9H9LIJFn.mjs +362 -0
  119. package/dist/planner-BvwYScnt-9H9LIJFn.mjs.map +1 -0
  120. package/dist/{planner-Bxdi7jZF.d.mts → planner-CjMq9oEt.d.mts} +21 -10
  121. package/dist/planner-CjMq9oEt.d.mts.map +1 -0
  122. package/dist/{planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs → planner-produced-sqlite-migration-D2jtaItv-ZFZhPfGE.mjs} +4 -4
  123. package/dist/planner-produced-sqlite-migration-D2jtaItv-ZFZhPfGE.mjs.map +1 -0
  124. package/dist/{planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts → planner-produced-sqlite-migration-DuM9c3YI-Dacb6zQZ.d.mts} +4 -4
  125. package/dist/planner-produced-sqlite-migration-DuM9c3YI-Dacb6zQZ.d.mts.map +1 -0
  126. package/dist/planner-produced-sqlite-migration-GDP1M36D.d.mts +1 -0
  127. package/dist/{planner-target-details-CIQ789Gc-C5U4yVY9.mjs → planner-target-details-CIQ789Gc-Cug2V5g5.mjs} +2 -2
  128. package/dist/planner-target-details-CIQ789Gc-Cug2V5g5.mjs.map +1 -0
  129. package/dist/{planner-target-details-xR6UfIcz-CMahymzq.d.mts → planner-target-details-xR6UfIcz-BrBPQGOS.d.mts} +2 -2
  130. package/dist/planner-target-details-xR6UfIcz-BrBPQGOS.d.mts.map +1 -0
  131. package/dist/render-ops-BPLkHR-y-CPoXG5Ap.mjs +34 -0
  132. package/dist/render-ops-BPLkHR-y-CPoXG5Ap.mjs.map +1 -0
  133. package/dist/{render-ops-B10yqmdG.d.mts → render-ops-Ntl2jBJe.d.mts} +3 -3
  134. package/dist/render-ops-Ntl2jBJe.d.mts.map +1 -0
  135. package/dist/{runtime-B1coahKC.d.mts → runtime-BvMPuBrJ.d.mts} +3 -3
  136. package/dist/runtime-BvMPuBrJ.d.mts.map +1 -0
  137. package/dist/{runtime-B99c4n56.d.mts → runtime-CjIoI3sa.d.mts} +4 -4
  138. package/dist/runtime-CjIoI3sa.d.mts.map +1 -0
  139. package/dist/{runtime-C5J9fusd.d.mts → runtime-YfPIbtO6.d.mts} +4 -4
  140. package/dist/runtime-YfPIbtO6.d.mts.map +1 -0
  141. package/dist/sql-renderer-brQ96quu.d.mts +1 -0
  142. package/dist/{sql-utils-0SJZOd7Q.d.mts → sql-utils-BqHka8P6.d.mts} +2 -2
  143. package/dist/sql-utils-BqHka8P6.d.mts.map +1 -0
  144. package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-XGT5Esi2-Zr2mqJf8.mjs} +31 -4
  145. package/dist/sql-utils-XGT5Esi2-Zr2mqJf8.mjs.map +1 -0
  146. package/dist/{sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts → sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts} +5 -4
  147. package/dist/sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts.map +1 -0
  148. package/dist/{sqlite-contract-view-BYR10usg-BteDAUZr.mjs → sqlite-contract-view-CGfiGvKH-CT-JjNHd.mjs} +9 -6
  149. package/dist/sqlite-contract-view-CGfiGvKH-CT-JjNHd.mjs.map +1 -0
  150. package/dist/sqlite-migration-BAdSmooi-iWFVQgGV.mjs +1295 -0
  151. package/dist/sqlite-migration-BAdSmooi-iWFVQgGV.mjs.map +1 -0
  152. package/dist/{sqlite-migration-o23JHwzY-CwNJcqwl.d.mts → sqlite-migration-CLIMaHLy-5ZjJDdDP.d.mts} +61 -13
  153. package/dist/sqlite-migration-CLIMaHLy-5ZjJDdDP.d.mts.map +1 -0
  154. package/dist/{shared-BYAX0FaQ--VvRXVRC.d.mts → tables-C6oejIsc-CzK00Kwl.d.mts} +38 -10
  155. package/dist/tables-C6oejIsc-CzK00Kwl.d.mts.map +1 -0
  156. package/dist/target.d.mts +29 -29
  157. package/dist/target.mjs +24 -20
  158. package/dist/target__aggregates.d.mts +1 -1
  159. package/dist/target__aggregates.mjs +1 -1
  160. package/dist/target__codec-descriptor.d.mts +2 -2
  161. package/dist/target__codec-descriptor.mjs +1 -1
  162. package/dist/target__codec-ids.d.mts +3 -3
  163. package/dist/target__codec-ids.mjs +2 -2
  164. package/dist/target__codec-types.d.mts +3 -3
  165. package/dist/target__codecs.d.mts +3 -3
  166. package/dist/target__codecs.mjs +4 -2
  167. package/dist/target__contract-free.d.mts +1 -1
  168. package/dist/target__contract-free.mjs +2 -2
  169. package/dist/target__control-tables.d.mts +1 -1
  170. package/dist/target__control-tables.mjs +1 -1
  171. package/dist/target__control.d.mts +3 -3
  172. package/dist/target__control.mjs +168 -72
  173. package/dist/target__control.mjs.map +1 -1
  174. package/dist/target__data-types.d.mts +2 -0
  175. package/dist/target__data-types.mjs +3 -0
  176. package/dist/target__ddl.d.mts +2 -2
  177. package/dist/target__ddl.mjs +1 -1
  178. package/dist/target__default-normalizer.d.mts +2 -2
  179. package/dist/target__default-normalizer.mjs +2 -2
  180. package/dist/target__migration.d.mts +3 -3
  181. package/dist/target__migration.mjs +3 -3
  182. package/dist/target__op-factory-call.d.mts +2 -2
  183. package/dist/target__op-factory-call.mjs +2 -2
  184. package/dist/target__pack.d.mts +1 -1
  185. package/dist/target__pack.mjs +1 -1
  186. package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
  187. package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
  188. package/dist/target__planner-target-details.d.mts +1 -1
  189. package/dist/target__planner-target-details.mjs +1 -1
  190. package/dist/target__planner.d.mts +1 -1
  191. package/dist/target__planner.mjs +1 -1
  192. package/dist/target__render-ops.d.mts +1 -1
  193. package/dist/target__render-ops.mjs +1 -1
  194. package/dist/target__runtime.d.mts +2 -2
  195. package/dist/target__runtime.mjs +3 -3
  196. package/dist/target__runtime.mjs.map +1 -1
  197. package/dist/target__sql-utils.d.mts +1 -1
  198. package/dist/target__sql-utils.mjs +1 -1
  199. package/dist/{types-C5FSREvo-CwUlKK34.d.mts → types-RJMd2PlL-BTGAJrBQ.d.mts} +5 -7
  200. package/dist/types-RJMd2PlL-BTGAJrBQ.d.mts.map +1 -0
  201. package/dist/types-y5JlAv97.d.mts +2 -0
  202. package/package.json +12 -12
  203. package/dist/adapter-CUTKlFpX-CW0J0Qs4.mjs.map +0 -1
  204. package/dist/adapter-D7zw14p5.d.mts +0 -2
  205. package/dist/adapter-DEYUC-KO-DO_abhIq.d.mts.map +0 -1
  206. package/dist/aggregates-BGuKJwfI.d.mts +0 -10
  207. package/dist/aggregates-BGuKJwfI.d.mts.map +0 -1
  208. package/dist/aggregates-DWyPO7t6.mjs.map +0 -1
  209. package/dist/codec-descriptor-B9ru99aI-DTkdKFU5.mjs.map +0 -1
  210. package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts +0 -31
  211. package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map +0 -1
  212. package/dist/codec-descriptor-rFuZ9DzY-CKRIRxah.d.mts +0 -1
  213. package/dist/codec-descriptor-vwfD3BMy.d.mts +0 -2
  214. package/dist/codec-ids-7WqtUuda.d.mts +0 -1
  215. package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts.map +0 -1
  216. package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs.map +0 -1
  217. package/dist/codec-types-B-TDcvQc.d.mts +0 -1
  218. package/dist/codec-types-CS0bD1kX.d.mts +0 -2
  219. package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts.map +0 -1
  220. package/dist/codecs-BDdR6FbY.mjs +0 -504
  221. package/dist/codecs-BDdR6FbY.mjs.map +0 -1
  222. package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts.map +0 -1
  223. package/dist/codecs-BTv6fRXv.d.mts +0 -1
  224. package/dist/column-types-NVxgsjFA.mjs +0 -34
  225. package/dist/column-types-NVxgsjFA.mjs.map +0 -1
  226. package/dist/column-types-iWGuW-0W.d.mts +0 -33
  227. package/dist/column-types-iWGuW-0W.d.mts.map +0 -1
  228. package/dist/contract-free-CCLAXZV2.d.mts.map +0 -1
  229. package/dist/contract-free-D5cZrgNl.mjs.map +0 -1
  230. package/dist/control--wMueaTg.d.mts.map +0 -1
  231. package/dist/control-B16T9OoX.mjs.map +0 -1
  232. package/dist/control-CLirKz11.d.mts.map +0 -1
  233. package/dist/control-D9vMRRgU.d.mts.map +0 -1
  234. package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +0 -1
  235. package/dist/control-tables-Dua-YcJL.d.mts.map +0 -1
  236. package/dist/ddl-CXduXyOT-nlDP6DGx.mjs.map +0 -1
  237. package/dist/ddl-CfSqNT0M.d.mts +0 -1
  238. package/dist/default-normalizer-B9V7TY5u.d.mts +0 -7
  239. package/dist/default-normalizer-B9V7TY5u.d.mts.map +0 -1
  240. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +0 -69
  241. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +0 -1
  242. package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs +0 -34
  243. package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs.map +0 -1
  244. package/dist/descriptor-meta-nORSZfmr-Cw-pzAJr.mjs +0 -33
  245. package/dist/descriptor-meta-nORSZfmr-Cw-pzAJr.mjs.map +0 -1
  246. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +0 -13
  247. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +0 -1
  248. package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +0 -1
  249. package/dist/errors-DnR-sMHS-KkMLIP2U.mjs.map +0 -1
  250. package/dist/migration-DOKPHtxn.mjs.map +0 -1
  251. package/dist/migration-uylRe5MP.d.mts.map +0 -1
  252. package/dist/native-type-normalizer-CO2wKGL6.d.mts +0 -12
  253. package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +0 -1
  254. package/dist/native-type-normalizer-GpQMEyN5.mjs +0 -14
  255. package/dist/native-type-normalizer-GpQMEyN5.mjs.map +0 -1
  256. package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +0 -1
  257. package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +0 -1
  258. package/dist/op-factory-call-DoHN7Q7L.d.mts.map +0 -1
  259. package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs +0 -829
  260. package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs.map +0 -1
  261. package/dist/pack-DIbefoZF.d.mts +0 -102
  262. package/dist/pack-DIbefoZF.d.mts.map +0 -1
  263. package/dist/planner-Bxdi7jZF.d.mts.map +0 -1
  264. package/dist/planner-Cqjr2usR-4wg3FB78.mjs +0 -824
  265. package/dist/planner-Cqjr2usR-4wg3FB78.mjs.map +0 -1
  266. package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +0 -1
  267. package/dist/planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs.map +0 -1
  268. package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +0 -1
  269. package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +0 -1
  270. package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +0 -1
  271. package/dist/render-ops-B10yqmdG.d.mts.map +0 -1
  272. package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs +0 -27
  273. package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs.map +0 -1
  274. package/dist/runtime-B1coahKC.d.mts.map +0 -1
  275. package/dist/runtime-B99c4n56.d.mts.map +0 -1
  276. package/dist/runtime-C5J9fusd.d.mts.map +0 -1
  277. package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +0 -1
  278. package/dist/sql-renderer-KX6hn_tg.d.mts +0 -1
  279. package/dist/sql-utils-0SJZOd7Q.d.mts.map +0 -1
  280. package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
  281. package/dist/sqlite-contract-view-BYR10usg-BteDAUZr.mjs.map +0 -1
  282. package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +0 -1
  283. package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs +0 -94
  284. package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs.map +0 -1
  285. package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +0 -1
  286. package/dist/target__native-type-normalizer.d.mts +0 -2
  287. package/dist/target__native-type-normalizer.mjs +0 -2
  288. package/dist/types-B7e2QVEx.d.mts +0 -1
  289. package/dist/types-C5FSREvo-CwUlKK34.d.mts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, d as SQL_INT_CODEC_ID, f as SQL_VARCHAR_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, l as SQL_CHAR_CODEC_ID, n as SQLITE_BIGINT_NUMBER_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQL_FLOAT_CODEC_ID } from "./codec-ids-KMliSCRp-BhTbmbGr.mjs";
2
- export { SQLITE_BIGINT_CODEC_ID, SQLITE_BIGINT_NUMBER_CODEC_ID, SQLITE_BLOB_CODEC_ID, SQLITE_DATETIME_CODEC_ID, SQLITE_INTEGER_CODEC_ID, SQLITE_JSON_CODEC_ID, SQLITE_REAL_CODEC_ID, SQLITE_TEXT_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_VARCHAR_CODEC_ID };
1
+ import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, d as SQL_INT_CODEC_ID, f as SQL_RAW_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, l as SQL_CHAR_CODEC_ID, n as SQLITE_BIGINT_NUMBER_CODEC_ID, o as SQLITE_JSON_CODEC_ID, p as SQL_VARCHAR_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQL_FLOAT_CODEC_ID } from "./codec-ids-wgEvkCkg-WltuexMR.mjs";
2
+ export { SQLITE_BIGINT_CODEC_ID, SQLITE_BIGINT_NUMBER_CODEC_ID, SQLITE_BLOB_CODEC_ID, SQLITE_DATETIME_CODEC_ID, SQLITE_INTEGER_CODEC_ID, SQLITE_JSON_CODEC_ID, SQLITE_REAL_CODEC_ID, SQLITE_TEXT_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_RAW_CODEC_ID, SQL_VARCHAR_CODEC_ID };
@@ -1,4 +1,4 @@
1
- import { t as JsonValue$1 } from "./codecs-BQWqLgCl-CdB8t7HI.mjs";
2
- import { t as CodecTypes } from "./codec-types-D7uWRvQ1-DPnvquS8.mjs";
3
- import "./codec-types-CS0bD1kX.mjs";
1
+ import { t as JsonValue$1 } from "./codecs-BJYruC-a-BKDGae3k.mjs";
2
+ import { t as CodecTypes } from "./codec-types-COh75Bop-CUehAexc.mjs";
3
+ import "./codec-types-ELHfd82J.mjs";
4
4
  export { CodecTypes, type JsonValue$1 as JsonValue };
@@ -1,3 +1,3 @@
1
- import { _ as sqliteIntegerColumn, a as SqliteDatetimeDescriptor, b as sqliteTextColumn, c as SqliteRealDescriptor, d as sqliteBigintColumn, f as sqliteBigintNumberColumn, g as sqliteDatetimeColumn, h as sqliteCodecRegistry, i as SqliteBlobDescriptor, l as SqliteTextDescriptor, m as sqliteCodecDescriptorRegistry, n as SqliteBigintDescriptor, o as SqliteIntegerDescriptor, p as sqliteBlobColumn, r as SqliteBigintNumberDescriptor, s as SqliteJsonDescriptor, t as JsonValue$1, u as jsonDocumentRetag, v as sqliteJsonColumn, y as sqliteRealColumn } from "./codecs-BQWqLgCl-CdB8t7HI.mjs";
2
- import "./codecs-BTv6fRXv.mjs";
3
- export { type JsonValue$1 as JsonValue, type SqliteBigintDescriptor, type SqliteBigintNumberDescriptor, type SqliteBlobDescriptor, type SqliteDatetimeDescriptor, type SqliteIntegerDescriptor, type SqliteJsonDescriptor, type SqliteRealDescriptor, type SqliteTextDescriptor, jsonDocumentRetag, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
1
+ import { C as sqliteJsonColumn, S as sqliteIntegerColumn, T as sqliteTextColumn, _ as sqliteBigintNumberColumn, a as SqliteBlobDescriptor, b as sqliteCodecRegistry, c as SqliteIntegerDescriptor, d as SqliteTextDescriptor, f as assembleSqliteCodecRegistry, g as sqliteBigintColumn, h as jsonDocumentRetag, i as SqliteBigintNumberDescriptor, l as SqliteJsonDescriptor, m as createSqliteCodecRegistryWithBuiltins, n as SQLITE_NOW_EXPRESSION, o as SqliteCodecRegistry, p as createSqliteBuiltinCodecLookup, r as SqliteBigintDescriptor, s as SqliteDatetimeDescriptor, t as JsonValue$1, u as SqliteRealDescriptor, v as sqliteBlobColumn, w as sqliteRealColumn, x as sqliteDatetimeColumn, y as sqliteCodecDescriptorRegistry } from "./codecs-BJYruC-a-BKDGae3k.mjs";
2
+ import "./codecs-Dn0xoCuf.mjs";
3
+ export { type JsonValue$1 as JsonValue, SQLITE_NOW_EXPRESSION, type SqliteBigintDescriptor, type SqliteBigintNumberDescriptor, type SqliteBlobDescriptor, type SqliteCodecRegistry, type SqliteDatetimeDescriptor, type SqliteIntegerDescriptor, type SqliteJsonDescriptor, type SqliteRealDescriptor, type SqliteTextDescriptor, assembleSqliteCodecRegistry, createSqliteBuiltinCodecLookup, createSqliteCodecRegistryWithBuiltins, jsonDocumentRetag, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
@@ -1,2 +1,4 @@
1
- import { a as sqliteCodecDescriptorRegistry, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBlobColumn, l as sqliteJsonColumn, n as sqliteBigintColumn, o as sqliteCodecRegistry, r as sqliteBigintNumberColumn, s as sqliteDatetimeColumn, t as jsonDocumentRetag, u as sqliteRealColumn } from "./codecs-BDdR6FbY.mjs";
2
- export { jsonDocumentRetag, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
1
+ import { a as sqliteBigintNumberColumn, c as sqliteIntegerColumn, d as sqliteTextColumn, i as sqliteBigintColumn, l as sqliteJsonColumn, o as sqliteBlobColumn, r as jsonDocumentRetag, s as sqliteDatetimeColumn, u as sqliteRealColumn } from "./codecs-yZoH21Yj-lQXtGlEq.mjs";
2
+ import { n as SQLITE_NOW_EXPRESSION } from "./datetime-text-Bniwehv--BSQhnrdE.mjs";
3
+ import { a as sqliteCodecRegistry, i as sqliteCodecDescriptorRegistry, n as createSqliteBuiltinCodecLookup, r as createSqliteCodecRegistryWithBuiltins, t as assembleSqliteCodecRegistry } from "./codecs-g-YI3BtK.mjs";
4
+ export { SQLITE_NOW_EXPRESSION, assembleSqliteCodecRegistry, createSqliteBuiltinCodecLookup, createSqliteCodecRegistryWithBuiltins, jsonDocumentRetag, sqliteBigintColumn, sqliteBigintNumberColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
@@ -1,2 +1,2 @@
1
- import { a as buildSignMarkerBootstrapQueries, c as datetime, d as jsonText, f as sqliteTable, i as buildControlTableBootstrapQueries, l as indexExistsAst, m as text, n as IndexExistsCheckBuilder, o as columnExistsAst, p as tableExistsAst, r as TableExistsCheckBuilder, s as createTable, t as ColumnExistsCheckBuilder, u as integer } from "./contract-free-CCLAXZV2.mjs";
1
+ import { a as buildSignMarkerBootstrapQueries, c as datetime, d as jsonText, f as sqliteTable, i as buildControlTableBootstrapQueries, l as indexExistsAst, m as text, n as IndexExistsCheckBuilder, o as columnExistsAst, p as tableExistsAst, r as TableExistsCheckBuilder, s as createTable, t as ColumnExistsCheckBuilder, u as integer } from "./contract-free-BJwIJN6x.mjs";
2
2
  export { type ColumnExistsCheckBuilder, type IndexExistsCheckBuilder, type TableExistsCheckBuilder, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, columnExistsAst, createTable, datetime, indexExistsAst, integer, jsonText, sqliteTable, tableExistsAst, text };
@@ -1,3 +1,3 @@
1
- import { i as tableExistsAst, n as createTable, r as indexExistsAst, t as columnExistsAst } from "./ddl-CXduXyOT-nlDP6DGx.mjs";
2
- import { a as jsonText, i as integer, n as buildSignMarkerBootstrapQueries, o as sqliteTable, r as datetime, s as text, t as buildControlTableBootstrapQueries } from "./contract-free-D5cZrgNl.mjs";
1
+ import { a as tableExistsAst, i as indexExistsAst, r as createTable, t as columnExistsAst } from "./ddl-CX4tAZ-y-Bng-4PWC.mjs";
2
+ import { a as jsonText, i as integer, n as buildSignMarkerBootstrapQueries, o as sqliteTable, r as datetime, s as text, t as buildControlTableBootstrapQueries } from "./contract-free-DetowcoS.mjs";
3
3
  export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, columnExistsAst, createTable, datetime, indexExistsAst, integer, jsonText, sqliteTable, tableExistsAst, text };
@@ -1,2 +1,2 @@
1
- import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAMES } from "./control-tables-Dua-YcJL.mjs";
1
+ import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAMES } from "./control-tables-DKXLHvMU.mjs";
2
2
  export { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME };
@@ -1,2 +1,2 @@
1
- import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAMES } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
1
+ import { n as LEDGER_TABLE_NAME, r as MARKER_TABLE_NAME, t as CONTROL_TABLE_NAMES } from "./control-tables-D_o8dKRB-n_QqsXcm.mjs";
2
2
  export { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME };
@@ -1,3 +1,3 @@
1
- import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
2
- import { n as sqliteControlTargetDescriptor, r as sqliteCreateNamespace, t as SqliteUnboundDatabase } from "./control--wMueaTg.mjs";
3
- export { type SqlitePlanTargetDetails, SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };
1
+ import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-BrBPQGOS.mjs";
2
+ import { i as sqliteScalarTypeConstructors, n as sqliteControlTargetDescriptor, r as sqliteCreateNamespace, t as SqliteUnboundDatabase } from "./control-CmDsxEqb.mjs";
3
+ export { type SqlitePlanTargetDetails, SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };
@@ -1,18 +1,22 @@
1
- import { n as sqliteError } from "./errors-DnR-sMHS-KkMLIP2U.mjs";
2
- import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-nORSZfmr-Cw-pzAJr.mjs";
3
- import { r as MARKER_TABLE_NAME } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
4
- import { i as sqliteCreateNamespace, r as SqliteUnboundDatabase, t as SqliteContractSerializer } from "./sqlite-contract-view-BYR10usg-BteDAUZr.mjs";
5
- import { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from "./planner-Cqjr2usR-4wg3FB78.mjs";
1
+ import { n as sqliteError } from "./errors-DnR-sMHS-D_gh214a.mjs";
2
+ import { n as sqliteTargetDescriptorMeta, t as sqliteScalarTypeConstructors } from "./descriptor-meta-COSGM3xb-Ct_5RPcm.mjs";
3
+ import { r as quoteIdentifier } from "./sql-utils-XGT5Esi2-Zr2mqJf8.mjs";
4
+ import { i as sqliteCreateNamespace, r as SqliteUnboundDatabase, t as SqliteContractSerializer } from "./sqlite-contract-view-CGfiGvKH-CT-JjNHd.mjs";
5
+ import { g as conversionCopyOf, p as affinityStorageClasses, y as rebuiltTableName } from "./op-factory-call-emj9Xp05-BFLkxrAK.mjs";
6
+ import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-BAdSmooi-iWFVQgGV.mjs";
7
+ import { n as createSqliteMigrationPlanner } from "./planner-BvwYScnt-9H9LIJFn.mjs";
6
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
8
- import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
9
- import { runnerFailure, runnerSuccess } from "@prisma/orm-family-sql/family/control";
10
- import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
10
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
11
+ import { APP_SPACE_ID, failedPostcheckWhy, failedPrecheckWhy, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from "@prisma/orm-framework/components/control";
11
12
  import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
12
13
  import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
14
+ import { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
15
+ import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
13
16
  import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
14
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
15
- //#region ../../../3-targets/3-targets/sqlite/dist/control.mjs
17
+ import { SqlQueryError } from "@prisma/orm-family-sql/errors";
18
+ //#region ../../../3-targets/sqlite/1-target/dist/control.mjs
19
+ const NOT_NULL_VIOLATION_SQLSTATE = "23502";
16
20
  function createSqliteMigrationRunner(family) {
17
21
  return new SqliteMigrationRunner(family);
18
22
  }
@@ -70,12 +74,11 @@ var SqliteMigrationRunner = class {
70
74
  contract: options.destinationContract,
71
75
  actualSchema: schemaNode,
72
76
  strict: options.strictVerification ?? true,
73
- typeMetadataRegistry: this.family.typeMetadataRegistry,
74
77
  frameworkComponents: options.frameworkComponents
75
78
  });
76
79
  if (!schemaVerifyResult.ok) return runnerFailure("MIGRATION.SCHEMA_VERIFY_FAILED", schemaVerifyResult.summary, {
77
- why: "The resulting database schema does not satisfy the destination contract.",
78
- meta: { issues: schemaVerifyResult.schema.issues }
80
+ why: schemaCheckWhy(schemaVerifyResult.schema.issues),
81
+ meta: { schemaIssues: schemaVerifyResult.schema.issues }
79
82
  });
80
83
  }
81
84
  const incomingInvariants = options.plan.providedInvariants;
@@ -101,35 +104,11 @@ var SqliteMigrationRunner = class {
101
104
  await this.beginExclusiveTransaction(driver);
102
105
  let committed = false;
103
106
  try {
104
- const perSpaceResults = [];
105
- let lastProcessedSpace;
106
- for (const spaceOptions of perSpaceOptions) {
107
- const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
108
- const result = await this.executeOnConnection({
109
- ...spaceOptions,
110
- driver,
111
- space
112
- });
113
- if (!result.ok) return notOk({
114
- ...result.failure,
115
- failingSpace: space
116
- });
117
- perSpaceResults.push({
118
- space,
119
- value: result.value
120
- });
121
- lastProcessedSpace = space;
122
- }
123
- if (fkWasEnabled) {
124
- const fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);
125
- if (!fkIntegrityCheck.ok) return notOk({
126
- ...fkIntegrityCheck.failure,
127
- failingSpace: lastProcessedSpace ?? APP_SPACE_ID
128
- });
129
- }
107
+ const result = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);
108
+ if (!result.ok) return notOk(withDatabaseUnchanged(result.failure, true));
130
109
  await this.commitTransaction(driver);
131
110
  committed = true;
132
- return ok({ perSpaceResults });
111
+ return result;
133
112
  } finally {
134
113
  if (!committed) await this.rollbackTransaction(driver);
135
114
  }
@@ -137,6 +116,29 @@ var SqliteMigrationRunner = class {
137
116
  if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = ON");
138
117
  }
139
118
  }
119
+ async executeSpaces(driver, perSpaceOptions, fkWasEnabled) {
120
+ const perSpaceResults = [];
121
+ let lastProcessedSpace;
122
+ for (const spaceOptions of perSpaceOptions) {
123
+ const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
124
+ const result = await this.executeOnConnection({
125
+ ...spaceOptions,
126
+ driver,
127
+ space
128
+ });
129
+ if (!result.ok) return notOk(withFailingSpace(result.failure, space));
130
+ perSpaceResults.push({
131
+ space,
132
+ value: result.value
133
+ });
134
+ lastProcessedSpace = space;
135
+ }
136
+ if (fkWasEnabled) {
137
+ const fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);
138
+ if (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));
139
+ }
140
+ return ok({ perSpaceResults });
141
+ }
140
142
  async readForeignKeysEnabled(driver) {
141
143
  return (await driver.query("PRAGMA foreign_keys")).rows[0]?.foreign_keys === 1;
142
144
  }
@@ -168,10 +170,18 @@ var SqliteMigrationRunner = class {
168
170
  const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck");
169
171
  if (!precheckResult.ok) return precheckResult;
170
172
  }
171
- const executeResult = await this.runExecuteSteps(driver, operation.execute, operation);
173
+ const executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {
174
+ contract: options.destinationContract,
175
+ operationIndex: ops.indexOf(operation),
176
+ operations: ops,
177
+ edges: options.migrationEdges
178
+ });
172
179
  if (!executeResult.ok) return executeResult;
173
180
  if (runPostchecks) {
174
- const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck");
181
+ const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck", {
182
+ contract: options.destinationContract,
183
+ operationIndex: ops.indexOf(operation)
184
+ });
175
185
  if (!postcheckResult.ok) return postcheckResult;
176
186
  }
177
187
  executedOperations.push(operation);
@@ -186,49 +196,128 @@ var SqliteMigrationRunner = class {
186
196
  });
187
197
  }
188
198
  async ensureControlTables(driver, contract) {
189
- const legacyDetection = await this.detectLegacyMarkerShape(driver);
190
- if (!legacyDetection.ok) return legacyDetection;
191
199
  const lowererContext = { contract };
192
200
  for (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));
193
201
  return okVoid();
194
202
  }
195
- async detectLegacyMarkerShape(driver) {
196
- const tableInfo = await driver.query(`PRAGMA table_info("${MARKER_TABLE_NAME}")`);
197
- if (tableInfo.rows.length === 0) return okVoid();
198
- const columns = new Set(tableInfo.rows.map((row) => row.name));
199
- if (columns.has("space")) return okVoid();
200
- return runnerFailure("MIGRATION.LEGACY_MARKER_SHAPE", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \`space\` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \`${MARKER_TABLE_NAME}\` and re-run \`dbInit\` to reinitialise from a clean baseline.`, { meta: {
201
- table: MARKER_TABLE_NAME,
202
- columns: [...columns].sort()
203
- } });
204
- }
205
- async runExpectationSteps(driver, steps, operation, phase) {
203
+ async runExpectationSteps(driver, steps, operation, phase, plan) {
206
204
  for (const step of steps) {
207
205
  const result = await driver.query(step.sql, step.params ?? []);
208
- if (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {
209
- operationId: operation.id,
210
- phase,
211
- stepDescription: step.description
212
- } });
206
+ if (!this.stepResultIsTrue(result.rows)) {
207
+ const code = phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED";
208
+ const field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);
209
+ const converted = convertedColumnOf(step);
210
+ const failedCheck = {
211
+ operationId: operation.id,
212
+ phase,
213
+ description: step.description,
214
+ ...ifDefined("expectation", step.expectation)
215
+ };
216
+ const unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);
217
+ return runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {
218
+ ...ifDefined("why", unconverted ?? (phase === "precheck" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck))),
219
+ meta: {
220
+ failedCheck,
221
+ ...ifDefined("failedTypeChange", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === "conversion" ? {
222
+ field,
223
+ by: "conversion",
224
+ reason: "invalidResult",
225
+ operationIndex: plan.operationIndex
226
+ } : {
227
+ field,
228
+ by: "cast",
229
+ reason: "value",
230
+ operationIndex: plan.operationIndex
231
+ })
232
+ }
233
+ });
234
+ }
213
235
  }
214
236
  return okVoid();
215
237
  }
216
- async runExecuteSteps(driver, steps, operation) {
238
+ /** Names the first value of a retyped column that kept a storage class its new type does not hold. */
239
+ async unconvertedValueText(driver, cast) {
240
+ const typeSql = (await driver.query("SELECT type FROM pragma_table_info(?) WHERE name = ?", [cast.table, cast.column])).rows[0]?.type;
241
+ if (typeSql === void 0) return void 0;
242
+ const column = quoteIdentifier(cast.column);
243
+ const classes = ["null", ...affinityStorageClasses(typeSql)];
244
+ const row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => "?").join(", ")}) LIMIT 1`, classes)).rows[0];
245
+ if (row === void 0) return void 0;
246
+ return `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column "${cast.column}" on "${cast.table}" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;
247
+ }
248
+ async runExecuteSteps(driver, steps, operation, plan) {
217
249
  for (const step of steps) try {
218
250
  await driver.query(step.sql, step.params ?? []);
219
251
  } catch (error) {
220
252
  const message = error instanceof Error ? error.message : String(error);
221
- return runnerFailure("MIGRATION.EXECUTION_FAILED", `Operation ${operation.id} failed during execution: ${step.description}`, {
222
- why: message,
253
+ const failed = `Operation ${operation.id} failed during execution: ${step.description}`;
254
+ const rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);
255
+ const failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;
256
+ return runnerFailure("MIGRATION.EXECUTION_FAILED", rowsWithoutValue?.summary ?? failed, {
257
+ why: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,
223
258
  meta: {
224
259
  operationId: operation.id,
225
260
  stepDescription: step.description,
226
- sql: step.sql
261
+ sql: step.sql,
262
+ ...ifDefined("rowsWithoutValue", rowsWithoutValue?.reports),
263
+ ...ifDefined("failedTypeChange", failedConversion)
227
264
  }
228
265
  });
229
266
  }
230
267
  return okVoid();
231
268
  }
269
+ /**
270
+ * The conversion that failed, when the failed step is the copy of a rebuild that converts columns
271
+ * and there is evidence for it: a copy expression that fails on its own has an error in its
272
+ * expression, and a constraint of the new table that names a converted column was broken by a
273
+ * value the conversion produced. Any other failure of the copy is not the conversion's.
274
+ */
275
+ async failedConversion(driver, step, error, plan) {
276
+ const copy = conversionCopyOf(step);
277
+ if (copy === void 0) return void 0;
278
+ const columns = Object.keys(copy.expressions);
279
+ const failed = async (column) => {
280
+ try {
281
+ await driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);
282
+ return false;
283
+ } catch {
284
+ return true;
285
+ }
286
+ };
287
+ for (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, "expressionError");
288
+ const constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;
289
+ if (constrainedList === void 0) return void 0;
290
+ const constrained = new Set(constrainedList.split(", "));
291
+ const column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));
292
+ return column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, "invalidResult");
293
+ }
294
+ conversionOf(plan, table, column, reason) {
295
+ const field = fieldOfColumn(plan.contract, table, column);
296
+ return field === void 0 ? void 0 : {
297
+ field,
298
+ by: "conversion",
299
+ reason,
300
+ operationIndex: plan.operationIndex
301
+ };
302
+ }
303
+ /**
304
+ * The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the
305
+ * new table: the columns the rebuild's postchecks mark as becoming required are counted, the
306
+ * rebuild's own first, then those of every other operation of its migration.
307
+ */
308
+ rowsWithoutValue(driver, error, plan) {
309
+ if (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);
310
+ const marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);
311
+ return rowsWithoutValueFailure({
312
+ failed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),
313
+ others: marks,
314
+ count: async ({ required }) => {
315
+ const where = required.reason !== "newField" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : "";
316
+ return (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;
317
+ },
318
+ contract: plan.contract
319
+ });
320
+ }
232
321
  stepResultIsTrue(rows) {
233
322
  if (!rows || rows.length === 0) return false;
234
323
  const firstRow = rows[0];
@@ -332,11 +421,18 @@ var SqliteMigrationRunner = class {
332
421
  space,
333
422
  expectedFrom: existingMarker.storageHash,
334
423
  destination
335
- })) return runnerFailure("MIGRATION.MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
336
- space,
337
- expectedStorageHash: existingMarker.storageHash,
338
- destinationStorageHash: options.plan.destination.storageHash
339
- } });
424
+ })) {
425
+ const found = await this.family.readMarker({
426
+ driver,
427
+ space
428
+ });
429
+ return runnerFailure("MIGRATION.MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
430
+ space,
431
+ expectedStorageHash: existingMarker.storageHash,
432
+ foundStorageHash: found?.storageHash ?? null,
433
+ destinationStorageHash: options.plan.destination.storageHash
434
+ } });
435
+ }
340
436
  return okVoid();
341
437
  }
342
438
  async recordLedgerEntries(driver, options, executedOperations) {
@@ -408,9 +504,9 @@ const sqliteControlTargetDescriptor = {
408
504
  createRunner(family) {
409
505
  return createSqliteMigrationRunner(family);
410
506
  },
411
- contractToSchema(contract, _frameworkComponents) {
507
+ contractToSchema(contract, frameworkComponents) {
412
508
  if (!isSqlContract(contract)) throw sqliteError("CONTRACT.TARGET_MISMATCH", "sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>");
413
- return sqliteContractToSchema(contract);
509
+ return sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));
414
510
  }
415
511
  },
416
512
  create() {
@@ -427,6 +523,6 @@ const sqliteControlTargetDescriptor = {
427
523
  }
428
524
  };
429
525
  //#endregion
430
- export { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };
526
+ export { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };
431
527
 
432
528
  //# sourceMappingURL=target__control.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-nORSZfmr.mjs\";\nimport { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from \"./planner-Cqjr2usR.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-BYR10usg.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { runnerFailure, runnerSuccess } from \"@internal/family-sql/control\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\ttypeMetadataRegistry: this.family.typeMetadataRegistry,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation);\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(\"${MARKER_TABLE_NAME}\")`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\tspace,\n\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, _frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract);\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IA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,IAAI,yBAAyB;CACjD,gBAAgB,IAAI,qBAAqB;CACzC,WAAW,OAAO;EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,sBAAsB;GAChD,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,QAAQ;EACvC;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
1
+ {"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { n as sqliteScalarTypeConstructors, t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-COSGM3xb.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CGfiGvKH.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-BAdSmooi.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-emj9Xp05.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BvwYScnt.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, failedPostcheckWhy, failedPrecheckWhy, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\n//#region src/core/migrations/runner.ts\nconst NOT_NULL_VIOLATION_SQLSTATE = \"23502\";\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: schemaCheckWhy(schemaVerifyResult.schema.issues),\n\t\t\t\tmeta: { schemaIssues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst result = await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled);\n\t\t\t\tif (!result.ok) return notOk(withDatabaseUnchanged(result.failure, true));\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn result;\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync executeSpaces(driver, perSpaceOptions, fkWasEnabled) {\n\t\tconst perSpaceResults = [];\n\t\tlet lastProcessedSpace;\n\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t...spaceOptions,\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\tif (!result.ok) return notOk(withFailingSpace(result.failure, space));\n\t\t\tperSpaceResults.push({\n\t\t\t\tspace,\n\t\t\t\tvalue: result.value\n\t\t\t});\n\t\t\tlastProcessedSpace = space;\n\t\t}\n\t\tif (fkWasEnabled) {\n\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\tif (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));\n\t\t}\n\t\treturn ok({ perSpaceResults });\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\tconst failedCheck = {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tphase,\n\t\t\t\t\tdescription: step.description,\n\t\t\t\t\t...ifDefined(\"expectation\", step.expectation)\n\t\t\t\t};\n\t\t\t\tconst unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\t...ifDefined(\"why\", unconverted ?? (phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck))),\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tfailedCheck,\n\t\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t} : {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\t...ifDefined(\"rowsWithoutValue\", rowsWithoutValue?.reports),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", failedConversion)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, error, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, error, plan) {\n\t\tif (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/migrations/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/migrations/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,8BAA8B;AACpC,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,eAAe,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,mBAAmB;EACvF,IAAI,CAAC,aAAa,IAAI,OAAO;EAC7B,MAAM,iBAAiB,MAAM,KAAK,OAAO,WAAW;GACnD;GACA;EACD,CAAC;EACD,MAAM,cAAc,KAAK,0BAA0B,gBAAgB,QAAQ,IAAI;EAC/E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,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A,MAAM,iBAAiB,QAAQ,WAAW;EACzC,MAAM,OAAO,MAAM,UAAU,KAAK,UAAU,MAAM;CACnD;AACD;;;;;;AAQA,IAAI,uBAAuB,cAAc,sBAAsB;CAC9D,sBAAsB,UAAU;EAC/B,OAAO,CAAC;CACT;CACA,uBAAuB,UAAU;EAChC,OAAO,CAAC;CACT;AACD;AAGA,SAAS,cAAc,UAAU;CAChC,OAAO,aAAa,QAAQ,SAAS,mBAAmB;AACzD;AACA,MAAM,gCAAgC;CACrC,GAAG;CACH,oBAAoB,IAAI,yBAAyB;CACjD,gBAAgB,IAAI,qBAAqB;CACzC,WAAW,OAAO;EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD"}
@@ -0,0 +1,2 @@
1
+ import { a as sqliteCharacterVarying, c as sqliteDatetime, d as sqliteJson, f as sqliteReal, i as sqliteCharacterLengthParams, l as sqliteDatetimeText, m as sqliteTextDataTypes, n as sqliteBlobFromHexText, o as sqliteDataTypeEntries, p as sqliteText, r as sqliteCharacter, s as sqliteDataTypes, t as sqliteBlob, u as sqliteInteger } from "./data-types-Dx3rHsbF.mjs";
2
+ export { sqliteBlob, sqliteBlobFromHexText, sqliteCharacter, sqliteCharacterLengthParams, sqliteCharacterVarying, sqliteDataTypeEntries, sqliteDataTypes, sqliteDatetime, sqliteDatetimeText, sqliteInteger, sqliteJson, sqliteReal, sqliteText, sqliteTextDataTypes };
@@ -0,0 +1,3 @@
1
+ import { a as sqliteCharacterVarying, c as sqliteDatetimeText, d as sqliteReal, f as sqliteText, i as sqliteCharacterLengthParams, l as sqliteInteger, n as sqliteBlobFromHexText, o as sqliteDataTypes, p as sqliteTextDataTypes, r as sqliteCharacter, s as sqliteDatetime, t as sqliteBlob, u as sqliteJson } from "./data-types-coQrCWfS-yMCe4F52.mjs";
2
+ import { t as sqliteDataTypeEntries } from "./data-type-entries-yQ-qYugg-C_NnX5WO.mjs";
3
+ export { sqliteBlob, sqliteBlobFromHexText, sqliteCharacter, sqliteCharacterLengthParams, sqliteCharacterVarying, sqliteDataTypeEntries, sqliteDataTypes, sqliteDatetime, sqliteDatetimeText, sqliteInteger, sqliteJson, sqliteReal, sqliteText, sqliteTextDataTypes };
@@ -1,3 +1,3 @@
1
- import { i as SqliteDdlVisitor, n as SqliteCreateTable, r as SqliteDdlNode, t as AnySqliteDdlNode } from "./nodes-D8EC1yCx-rpfpuJ4T.mjs";
2
- import "./ddl-CfSqNT0M.mjs";
1
+ import { i as SqliteDdlVisitor, n as SqliteCreateTable, r as SqliteDdlNode, t as AnySqliteDdlNode } from "./nodes-D8EC1yCx-BS-fKla6.mjs";
2
+ import "./ddl-31OBcTco.mjs";
3
3
  export { type AnySqliteDdlNode, SqliteCreateTable, SqliteDdlNode, type SqliteDdlVisitor };
@@ -1,2 +1,2 @@
1
- import { n as SqliteDdlNode, t as SqliteCreateTable } from "./nodes-DUZSdX86-BBEEaxXY.mjs";
1
+ import { n as SqliteDdlNode, t as SqliteCreateTable } from "./nodes-DUZSdX86-DWyLY3OW.mjs";
2
2
  export { SqliteCreateTable, SqliteDdlNode };
@@ -1,2 +1,2 @@
1
- import { t as parseSqliteDefault } from "./default-normalizer-B9V7TY5u.mjs";
2
- export { parseSqliteDefault };
1
+ import { n as readSqliteDefault, r as sqliteResolveDefault, t as SqliteReportedDefault } from "./default-normalizer-CkHy3JYk.mjs";
2
+ export { type SqliteReportedDefault, readSqliteDefault, sqliteResolveDefault };
@@ -1,2 +1,2 @@
1
- import { t as parseSqliteDefault } from "./default-normalizer-DuoHj9-O-DsK7lJZn.mjs";
2
- export { parseSqliteDefault };
1
+ import { n as sqliteResolveDefault, t as readSqliteDefault } from "./default-normalizer-DGMXypHg-CPf7oyZA.mjs";
2
+ export { readSqliteDefault, sqliteResolveDefault };
@@ -1,3 +1,3 @@
1
- import { t as SqliteMigration } from "./sqlite-migration-o23JHwzY-CwNJcqwl.mjs";
2
- import { a as fn, c as placeholder, d as unique, i as dataTransform, l as primaryKey, n as MigrationCLI, o as foreignKey, r as col, s as lit, t as DataTransformOptions, u as rawSql } from "./migration-uylRe5MP.mjs";
3
- export { type DataTransformOptions, SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
1
+ import { t as SqliteMigration } from "./sqlite-migration-CLIMaHLy-5ZjJDdDP.mjs";
2
+ import { a as fn, c as placeholder, d as sql, f as unique, i as dataTransform, l as primaryKey, n as MigrationCLI, o as foreignKey, r as col, s as lit, t as DataTransformOptions, u as rawSql } from "./migration-WJlUQmsn.mjs";
3
+ export { type DataTransformOptions, SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, sql, unique };