@prisma/orm-toolchain 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +28 -0
  3. package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
  4. package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
  5. package/dist/aggregate-BflrjWPO.d.mts +803 -0
  6. package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
  7. package/dist/bin__prisma-next.mjs +800 -0
  8. package/dist/bin__prisma-next.mjs.map +1 -0
  9. package/dist/cli-telemetry.d.mts +367 -0
  10. package/dist/cli-telemetry.d.mts.map +1 -0
  11. package/dist/cli-telemetry.mjs +48 -0
  12. package/dist/cli-telemetry.mjs.map +1 -0
  13. package/dist/cli-telemetry__sender.d.mts +1 -0
  14. package/dist/cli-telemetry__sender.mjs +1 -0
  15. package/dist/cli.d.mts +31 -0
  16. package/dist/cli.d.mts.map +1 -0
  17. package/dist/cli.mjs +180 -0
  18. package/dist/cli.mjs.map +1 -0
  19. package/dist/cli__commands__contract-emit.d.mts +2 -0
  20. package/dist/cli__commands__contract-emit.mjs +2 -0
  21. package/dist/cli__commands__contract-infer.d.mts +7 -0
  22. package/dist/cli__commands__contract-infer.d.mts.map +1 -0
  23. package/dist/cli__commands__contract-infer.mjs +2 -0
  24. package/dist/cli__commands__db-init.d.mts +7 -0
  25. package/dist/cli__commands__db-init.d.mts.map +1 -0
  26. package/dist/cli__commands__db-init.mjs +2 -0
  27. package/dist/cli__commands__db-schema.d.mts +7 -0
  28. package/dist/cli__commands__db-schema.d.mts.map +1 -0
  29. package/dist/cli__commands__db-schema.mjs +2 -0
  30. package/dist/cli__commands__db-sign.d.mts +7 -0
  31. package/dist/cli__commands__db-sign.d.mts.map +1 -0
  32. package/dist/cli__commands__db-sign.mjs +2 -0
  33. package/dist/cli__commands__db-update.d.mts +7 -0
  34. package/dist/cli__commands__db-update.d.mts.map +1 -0
  35. package/dist/cli__commands__db-update.mjs +2 -0
  36. package/dist/cli__commands__db-verify.d.mts +7 -0
  37. package/dist/cli__commands__db-verify.d.mts.map +1 -0
  38. package/dist/cli__commands__db-verify.mjs +2 -0
  39. package/dist/cli__commands__migrate.d.mts +66 -0
  40. package/dist/cli__commands__migrate.d.mts.map +1 -0
  41. package/dist/cli__commands__migrate.mjs +2 -0
  42. package/dist/cli__commands__migration-check.d.mts +64 -0
  43. package/dist/cli__commands__migration-check.d.mts.map +1 -0
  44. package/dist/cli__commands__migration-check.mjs +3 -0
  45. package/dist/cli__commands__migration-graph.d.mts +36 -0
  46. package/dist/cli__commands__migration-graph.d.mts.map +1 -0
  47. package/dist/cli__commands__migration-graph.mjs +2 -0
  48. package/dist/cli__commands__migration-list.d.mts +79 -0
  49. package/dist/cli__commands__migration-list.d.mts.map +1 -0
  50. package/dist/cli__commands__migration-list.mjs +2 -0
  51. package/dist/cli__commands__migration-log.d.mts +20 -0
  52. package/dist/cli__commands__migration-log.d.mts.map +1 -0
  53. package/dist/cli__commands__migration-log.mjs +2 -0
  54. package/dist/cli__commands__migration-new.d.mts +7 -0
  55. package/dist/cli__commands__migration-new.d.mts.map +1 -0
  56. package/dist/cli__commands__migration-new.mjs +2 -0
  57. package/dist/cli__commands__migration-plan.d.mts +79 -0
  58. package/dist/cli__commands__migration-plan.d.mts.map +1 -0
  59. package/dist/cli__commands__migration-plan.mjs +2 -0
  60. package/dist/cli__commands__migration-show.d.mts +27 -0
  61. package/dist/cli__commands__migration-show.d.mts.map +1 -0
  62. package/dist/cli__commands__migration-show.mjs +2 -0
  63. package/dist/cli__commands__migration-status.d.mts +55 -0
  64. package/dist/cli__commands__migration-status.d.mts.map +1 -0
  65. package/dist/cli__commands__migration-status.mjs +3 -0
  66. package/dist/cli__commands__ref.d.mts +34 -0
  67. package/dist/cli__commands__ref.d.mts.map +1 -0
  68. package/dist/cli__commands__ref.mjs +2 -0
  69. package/dist/cli__commands__telemetry.d.mts +7 -0
  70. package/dist/cli__commands__telemetry.d.mts.map +1 -0
  71. package/dist/cli__commands__telemetry.mjs +2 -0
  72. package/dist/cli__config-types.d.mts +2 -0
  73. package/dist/cli__config-types.mjs +2 -0
  74. package/dist/cli__control-api.d.mts +141 -0
  75. package/dist/cli__control-api.d.mts.map +1 -0
  76. package/dist/cli__control-api.mjs +4 -0
  77. package/dist/cli__init-output.d.mts +37 -0
  78. package/dist/cli__init-output.d.mts.map +1 -0
  79. package/dist/cli__init-output.mjs +2 -0
  80. package/dist/cli__migration-cli.d.mts +79 -0
  81. package/dist/cli__migration-cli.d.mts.map +1 -0
  82. package/dist/cli__migration-cli.mjs +407 -0
  83. package/dist/cli__migration-cli.mjs.map +1 -0
  84. package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
  85. package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
  86. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
  87. package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
  88. package/dist/config-loader.d.mts +18 -0
  89. package/dist/config-loader.d.mts.map +1 -0
  90. package/dist/config-loader.mjs +2 -0
  91. package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
  92. package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
  93. package/dist/constants-Dkcn8Qu4.d.mts +10 -0
  94. package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
  95. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
  96. package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
  97. package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
  98. package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
  99. package/dist/contract-emit-B65_UiFn.d.mts +7 -0
  100. package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
  101. package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
  102. package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
  103. package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
  104. package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
  105. package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
  106. package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
  107. package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
  108. package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
  109. package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
  110. package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
  111. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
  112. package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
  113. package/dist/db-init-Vbkb_TKZ.mjs +153 -0
  114. package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
  115. package/dist/db-schema-ClQCu3xY.mjs +47 -0
  116. package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
  117. package/dist/db-sign-jjXDgQ1u.mjs +175 -0
  118. package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
  119. package/dist/db-update-BQlrqtDD.mjs +183 -0
  120. package/dist/db-update-BQlrqtDD.mjs.map +1 -0
  121. package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
  122. package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
  123. package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
  124. package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
  125. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
  126. package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
  127. package/dist/emitter.d.mts +75 -0
  128. package/dist/emitter.d.mts.map +1 -0
  129. package/dist/emitter.mjs +3 -0
  130. package/dist/emitter__domain-type-generation.d.mts +2 -0
  131. package/dist/emitter__domain-type-generation.mjs +2 -0
  132. package/dist/emitter__type-expression-safety.d.mts +6 -0
  133. package/dist/emitter__type-expression-safety.d.mts.map +1 -0
  134. package/dist/emitter__type-expression-safety.mjs +2 -0
  135. package/dist/errors--qsXZUtL.d.mts +72 -0
  136. package/dist/errors--qsXZUtL.d.mts.map +1 -0
  137. package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
  138. package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
  139. package/dist/exports-BN0vFTxG.mjs +276 -0
  140. package/dist/exports-BN0vFTxG.mjs.map +1 -0
  141. package/dist/exports-B_xhKZmC.mjs +1436 -0
  142. package/dist/exports-B_xhKZmC.mjs.map +1 -0
  143. package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
  144. package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
  145. package/dist/exports-Dl2aGAk7.mjs +119 -0
  146. package/dist/exports-Dl2aGAk7.mjs.map +1 -0
  147. package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
  148. package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
  149. package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
  150. package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
  151. package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
  152. package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
  153. package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
  154. package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
  155. package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
  156. package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
  157. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
  158. package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
  159. package/dist/hash-XZYYKJ-i.d.mts +53 -0
  160. package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
  161. package/dist/import-roots-B6CtsWXb.d.mts +119 -0
  162. package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
  163. package/dist/import-roots-NDOIEDVj.mjs +217 -0
  164. package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
  165. package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
  166. package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
  167. package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
  168. package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
  169. package/dist/invariants-B5wLrgQS.d.mts +39 -0
  170. package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
  171. package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
  172. package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
  173. package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
  174. package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
  175. package/dist/io-DYfeLJxR.d.mts +1 -0
  176. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
  177. package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
  178. package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
  179. package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
  180. package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
  181. package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
  182. package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
  183. package/dist/metadata-BtscDay2.d.mts +1 -0
  184. package/dist/migrate-Cb_iv264.mjs +500 -0
  185. package/dist/migrate-Cb_iv264.mjs.map +1 -0
  186. package/dist/migration-B2ljMJim.d.mts +155 -0
  187. package/dist/migration-B2ljMJim.d.mts.map +1 -0
  188. package/dist/migration-BuUmO7It.mjs +209 -0
  189. package/dist/migration-BuUmO7It.mjs.map +1 -0
  190. package/dist/migration-check-DcwUnadt-B6Qoh0ot.mjs +597 -0
  191. package/dist/migration-check-DcwUnadt-B6Qoh0ot.mjs.map +1 -0
  192. package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
  193. package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
  194. package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
  195. package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
  196. package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
  197. package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
  198. package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
  199. package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
  200. package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
  201. package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
  202. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
  203. package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
  204. package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
  205. package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
  206. package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
  207. package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
  208. package/dist/migration-new-BurCjyaQ.mjs +168 -0
  209. package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
  210. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
  211. package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
  212. package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
  213. package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
  214. package/dist/migration-show-Bx5I5aW9.mjs +171 -0
  215. package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
  216. package/dist/migration-status-CE7cQLDq-B1jDVmqG.mjs +444 -0
  217. package/dist/migration-status-CE7cQLDq-B1jDVmqG.mjs.map +1 -0
  218. package/dist/migration-tools.d.mts +23 -0
  219. package/dist/migration-tools.mjs +17 -0
  220. package/dist/migration-tools__aggregate.d.mts +2 -0
  221. package/dist/migration-tools__aggregate.mjs +2 -0
  222. package/dist/migration-tools__constants.d.mts +2 -0
  223. package/dist/migration-tools__constants.mjs +2 -0
  224. package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
  225. package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
  226. package/dist/migration-tools__errors.d.mts +2 -0
  227. package/dist/migration-tools__errors.mjs +2 -0
  228. package/dist/migration-tools__graph.d.mts +2 -0
  229. package/dist/migration-tools__graph.mjs +1 -0
  230. package/dist/migration-tools__hash.d.mts +2 -0
  231. package/dist/migration-tools__hash.mjs +2 -0
  232. package/dist/migration-tools__invariants.d.mts +2 -0
  233. package/dist/migration-tools__invariants.mjs +2 -0
  234. package/dist/migration-tools__io.d.mts +3 -0
  235. package/dist/migration-tools__io.mjs +2 -0
  236. package/dist/migration-tools__ledger-origin.d.mts +2 -0
  237. package/dist/migration-tools__ledger-origin.mjs +2 -0
  238. package/dist/migration-tools__metadata.d.mts +3 -0
  239. package/dist/migration-tools__metadata.mjs +1 -0
  240. package/dist/migration-tools__migration-graph.d.mts +3 -0
  241. package/dist/migration-tools__migration-graph.mjs +3 -0
  242. package/dist/migration-tools__migration-ts.d.mts +2 -0
  243. package/dist/migration-tools__migration-ts.mjs +2 -0
  244. package/dist/migration-tools__migration.d.mts +2 -0
  245. package/dist/migration-tools__migration.mjs +2 -0
  246. package/dist/migration-tools__package.d.mts +3 -0
  247. package/dist/migration-tools__package.mjs +1 -0
  248. package/dist/migration-tools__ref-resolution.d.mts +2 -0
  249. package/dist/migration-tools__ref-resolution.mjs +2 -0
  250. package/dist/migration-tools__refs.d.mts +2 -0
  251. package/dist/migration-tools__refs.mjs +2 -0
  252. package/dist/migration-tools__spaces.d.mts +3 -0
  253. package/dist/migration-tools__spaces.mjs +3 -0
  254. package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
  255. package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
  256. package/dist/migration-ts-FyF55c4M.mjs +67 -0
  257. package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
  258. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
  259. package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
  260. package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
  261. package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
  262. package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
  263. package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
  264. package/dist/package-N9PPdFV_.d.mts +3 -0
  265. package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
  266. package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
  267. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
  268. package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
  269. package/dist/publish-surface.d.mts +3 -0
  270. package/dist/publish-surface.mjs +3 -0
  271. package/dist/publish-surface__import-roots.d.mts +2 -0
  272. package/dist/publish-surface__import-roots.mjs +2 -0
  273. package/dist/publish-surface__shells.d.mts +2 -0
  274. package/dist/publish-surface__shells.mjs +2 -0
  275. package/dist/quick-reference-mongo.md +114 -0
  276. package/dist/quick-reference-postgres.md +93 -0
  277. package/dist/readme-mongo.md +35 -0
  278. package/dist/readme-postgres.md +34 -0
  279. package/dist/ref-B6cTthTi.mjs +171 -0
  280. package/dist/ref-B6cTthTi.mjs.map +1 -0
  281. package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
  282. package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
  283. package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
  284. package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
  285. package/dist/ref-resolution-COGOSL57.d.mts +127 -0
  286. package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
  287. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
  288. package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
  289. package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
  290. package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
  291. package/dist/schemas-CfGSxH5b-BSjB3nZS.d.mts +192 -0
  292. package/dist/schemas-CfGSxH5b-BSjB3nZS.d.mts.map +1 -0
  293. package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
  294. package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
  295. package/dist/shells-BenrJHp2.mjs +602 -0
  296. package/dist/shells-BenrJHp2.mjs.map +1 -0
  297. package/dist/shells-COHV_Ozf.d.mts +135 -0
  298. package/dist/shells-COHV_Ozf.d.mts.map +1 -0
  299. package/dist/spaces-C27bA-xc.mjs +267 -0
  300. package/dist/spaces-C27bA-xc.mjs.map +1 -0
  301. package/dist/spaces-DxFj5y8l.d.mts +415 -0
  302. package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
  303. package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
  304. package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
  305. package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
  306. package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
  307. package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
  308. package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
  309. package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
  310. package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
  311. package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
  312. package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
  313. package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
  314. package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
  315. package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
  316. package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
  317. package/dist/vite-plugin-contract-emit.d.mts +54 -0
  318. package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
  319. package/dist/vite-plugin-contract-emit.mjs +303 -0
  320. package/dist/vite-plugin-contract-emit.mjs.map +1 -0
  321. package/package.json +122 -0
@@ -0,0 +1,72 @@
1
+ //#region ../../../1-framework/3-tooling/migration/dist/exports/errors.d.mts
2
+ //#region src/errors.d.ts
3
+ /**
4
+ * Structured error for migration tooling operations.
5
+ *
6
+ * Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under
7
+ * the MIGRATION namespace. These are tooling-time errors (file I/O, hash
8
+ * verification, migration history reconstruction), distinct from the runtime
9
+ * MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,
10
+ * etc.).
11
+ *
12
+ * Fields:
13
+ * - code: Stable machine-readable code (MIGRATION.SUBCODE)
14
+ * - category: Always 'MIGRATION'
15
+ * - why: Explains the cause in plain language
16
+ * - fix: Actionable remediation step
17
+ * - details: Machine-readable structured data for agents
18
+ */
19
+ declare class MigrationToolsError extends Error {
20
+ readonly code: string;
21
+ readonly category: "MIGRATION";
22
+ readonly why: string;
23
+ readonly fix: string;
24
+ readonly details: Record<string, unknown> | undefined;
25
+ constructor(code: string, summary: string, options: {
26
+ readonly why: string;
27
+ readonly fix: string;
28
+ readonly details?: Record<string, unknown>;
29
+ });
30
+ static is(error: unknown): error is MigrationToolsError;
31
+ }
32
+ declare function errorInvalidJson(filePath: string, parseError: string): MigrationToolsError;
33
+ declare function errorDescriptorHeadHashMismatch(args: {
34
+ readonly extensionId: string;
35
+ readonly recomputedHash: string;
36
+ readonly headRefHash: string;
37
+ }): MigrationToolsError;
38
+ declare function errorInvalidRefName(refName: string): MigrationToolsError;
39
+ /**
40
+ * Wire-shape edge surfaced through the JSON envelope's
41
+ * `meta.structuralPath` of `MIGRATION.NO_INVARIANT_PATH`. Slim by design —
42
+ * authoring metadata (`createdAt`) lives on `MigrationEdge` but is
43
+ * intentionally dropped here so the envelope stays stable across
44
+ * graph-internal refactors.
45
+ *
46
+ * Stability: any field added here is part of the public CLI JSON contract.
47
+ * Callers (CLI consumers, agents) must be able to treat
48
+ * `(dirName, migrationHash, from, to, invariants)` as the canonical shape.
49
+ */
50
+ interface NoInvariantPathStructuralEdge {
51
+ readonly dirName: string;
52
+ readonly migrationHash: string;
53
+ readonly from: string;
54
+ readonly to: string;
55
+ readonly invariants: readonly string[];
56
+ }
57
+ declare function errorNoInvariantPath(args: {
58
+ readonly refName?: string;
59
+ readonly required: readonly string[];
60
+ readonly missing: readonly string[];
61
+ readonly structuralPath: readonly NoInvariantPathStructuralEdge[];
62
+ }): MigrationToolsError;
63
+ declare function errorUnknownInvariant(args: {
64
+ readonly refName?: string;
65
+ readonly unknown: readonly string[];
66
+ readonly declared: readonly string[];
67
+ }): MigrationToolsError;
68
+ declare function errorContractSnapshotMissing(storageHash: string, expectedPath: string): MigrationToolsError;
69
+ declare function errorContractSnapshotHashMismatch(storageHash: string, actualHash: string, dir: string): MigrationToolsError;
70
+ //#endregion
71
+ export { errorDescriptorHeadHashMismatch as a, errorNoInvariantPath as c, errorContractSnapshotMissing as i, errorUnknownInvariant as l, NoInvariantPathStructuralEdge as n, errorInvalidJson as o, errorContractSnapshotHashMismatch as r, errorInvalidRefName as s, MigrationToolsError as t };
72
+ //# sourceMappingURL=errors--qsXZUtL.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors--qsXZUtL.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/errors.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;cAiBc,4BAA4B;WAC/B;WACA;WACA;WACA;WACA,SAAS;EAClB,YAAY,cAAc,iBAAiB;aAChC;aACA;aACA,UAAU;;SAEd,GAAG,iBAAiB,SAAS;;iBAErB,iBAAiB,kBAAkB,qBAAqB;iBACxD,gCAAgC;WACtC;WACA;WACA;IACP;iBACa,oBAAoB,kBAAkB;;;;;;;;;;;;UAY7C;WACC;WACA;WACA;WACA;WACA;;iBAEM,qBAAqB;WAC3B;WACA;WACA;WACA,yBAAyB;IAChC;iBACa,sBAAsB;WAC5B;WACA;WACA;IACP;iBACa,6BAA6B,qBAAqB,uBAAuB;iBACzE,kCAAkC,qBAAqB,oBAAoB,cAAc"}
@@ -0,0 +1,378 @@
1
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
+ import { dirname, relative } from "pathe";
3
+ //#region ../../../1-framework/3-tooling/migration/dist/errors-IpZm1Skp.mjs
4
+ /**
5
+ * Build the canonical "re-emit this package" remediation hint.
6
+ *
7
+ * Every on-disk migration package ships its own `migration.ts` author-time
8
+ * file. Running it regenerates `migration.json` and `ops.json` with the
9
+ * correct hash + metadata, so it is the right primitive whenever a single
10
+ * package's on-disk artifacts are missing, malformed, or otherwise corrupt.
11
+ * Pointing users at `migration plan` would emit a *new* package rather than
12
+ * heal the broken one.
13
+ */
14
+ function reemitHint(dir, fallback) {
15
+ const reemit = `Re-emit the package by running \`node "${relative(process.cwd(), dir)}/migration.ts"\``;
16
+ return fallback ? `${reemit}, ${fallback}` : `${reemit}.`;
17
+ }
18
+ /**
19
+ * Structured error for migration tooling operations.
20
+ *
21
+ * Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under
22
+ * the MIGRATION namespace. These are tooling-time errors (file I/O, hash
23
+ * verification, migration history reconstruction), distinct from the runtime
24
+ * MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,
25
+ * etc.).
26
+ *
27
+ * Fields:
28
+ * - code: Stable machine-readable code (MIGRATION.SUBCODE)
29
+ * - category: Always 'MIGRATION'
30
+ * - why: Explains the cause in plain language
31
+ * - fix: Actionable remediation step
32
+ * - details: Machine-readable structured data for agents
33
+ */
34
+ var MigrationToolsError = class extends Error {
35
+ code;
36
+ category = "MIGRATION";
37
+ why;
38
+ fix;
39
+ details;
40
+ constructor(code, summary, options) {
41
+ super(summary);
42
+ this.name = "MigrationToolsError";
43
+ this.code = code;
44
+ this.why = options.why;
45
+ this.fix = options.fix;
46
+ this.details = options.details;
47
+ }
48
+ static is(error) {
49
+ if (!(error instanceof Error)) return false;
50
+ const candidate = error;
51
+ return candidate.name === "MigrationToolsError" && typeof candidate.code === "string";
52
+ }
53
+ };
54
+ function errorDirectoryExists(dir) {
55
+ return new MigrationToolsError("MIGRATION.DIR_EXISTS", "Migration directory already exists", {
56
+ why: `The directory "${dir}" already exists. Each migration must have a unique directory.`,
57
+ fix: "Use --name to pick a different name, or delete the existing directory and re-run.",
58
+ details: { dir }
59
+ });
60
+ }
61
+ function errorMissingFile(file, dir) {
62
+ return new MigrationToolsError("MIGRATION.FILE_MISSING", `Missing ${file}`, {
63
+ why: `Expected "${file}" in "${dir}" but the file does not exist.`,
64
+ fix: reemitHint(dir, "or delete the directory if the migration is unwanted and the source TypeScript is gone."),
65
+ details: {
66
+ file,
67
+ dir
68
+ }
69
+ });
70
+ }
71
+ function errorInvalidJson(filePath, parseError) {
72
+ return new MigrationToolsError("MIGRATION.INVALID_JSON", "Invalid JSON in migration file", {
73
+ why: `Failed to parse "${filePath}": ${parseError}`,
74
+ fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
75
+ details: {
76
+ filePath,
77
+ parseError
78
+ }
79
+ });
80
+ }
81
+ function errorInvalidManifest(filePath, reason) {
82
+ return new MigrationToolsError("MIGRATION.INVALID_MANIFEST", "Invalid migration manifest", {
83
+ why: `Migration manifest at "${filePath}" is invalid: ${reason}`,
84
+ fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
85
+ details: {
86
+ filePath,
87
+ reason
88
+ }
89
+ });
90
+ }
91
+ function errorDescribeMissingEndContract() {
92
+ return new MigrationToolsError("MIGRATION.DESCRIBE_INVALID", "Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.", {
93
+ why: "Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.",
94
+ fix: "Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.",
95
+ details: { reason: "missing-end-contract" }
96
+ });
97
+ }
98
+ function errorDescribeInvalidMetadata(summary) {
99
+ return new MigrationToolsError("MIGRATION.DESCRIBE_INVALID", `describe() returned invalid metadata: ${summary}`, {
100
+ why: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,
101
+ fix: "Ensure describe() returns { from: string | null, to: string } with valid contract hashes.",
102
+ details: {
103
+ reason: "invalid-metadata",
104
+ summary
105
+ }
106
+ });
107
+ }
108
+ function errorOperationsNotArray() {
109
+ return new MigrationToolsError("MIGRATION.PLAN_NOT_ARRAY", "operations must be an array", {
110
+ why: "The migration instance's `operations` getter returned a non-array value.",
111
+ fix: "Ensure the `operations` getter returns an array of migration operations.",
112
+ details: {}
113
+ });
114
+ }
115
+ function errorSpaceHeadRefMissing(spaceId) {
116
+ return new MigrationToolsError("MIGRATION.CHECK_HEAD_REF_MISSING", `Contract space "${spaceId}" has no head ref; its contract cannot be resolved from the snapshot store without one.`, {
117
+ why: `Contract space "${spaceId}" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,
118
+ fix: "Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.",
119
+ details: { spaceId }
120
+ });
121
+ }
122
+ function errorInvalidOperationEntry(index, reason) {
123
+ return new MigrationToolsError("MIGRATION.INVALID_OPERATION_ENTRY", "Migration operation entry is malformed", {
124
+ why: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,
125
+ fix: "Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').",
126
+ details: {
127
+ index,
128
+ reason
129
+ }
130
+ });
131
+ }
132
+ function errorInvalidSlug(slug) {
133
+ return new MigrationToolsError("MIGRATION.INVALID_NAME", "Invalid migration name", {
134
+ why: `The slug "${slug}" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,
135
+ fix: "Provide a name with at least one alphanumeric character, e.g. --name add_users.",
136
+ details: { slug }
137
+ });
138
+ }
139
+ function errorInvalidDestName(destName) {
140
+ return new MigrationToolsError("MIGRATION.INVALID_DEST_NAME", "Invalid copy destination name", {
141
+ why: `The destination name "${destName}" must be a single path segment (no ".." or directory separators).`,
142
+ fix: "Use a simple file name such as \"contract.json\" for each destination in the copy list.",
143
+ details: { destName }
144
+ });
145
+ }
146
+ function errorInvalidSpaceId(spaceId) {
147
+ return new MigrationToolsError("MIGRATION.INVALID_SPACE_ID", "Invalid contract space identifier", {
148
+ why: `The space id "${spaceId}" does not match the required pattern /^[a-z][a-z0-9_-]{0,63}$/. Space ids are used as filesystem directory names under \`migrations/\`, so the pattern is conservative on purpose.`,
149
+ fix: "Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.",
150
+ details: { spaceId }
151
+ });
152
+ }
153
+ function errorDescriptorHeadHashMismatch(args) {
154
+ const { extensionId, recomputedHash, headRefHash } = args;
155
+ return new MigrationToolsError("MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH", "Extension descriptor's headRef.hash does not match its contractJson", {
156
+ why: `Extension "${extensionId}" publishes a \`contractSpace\` whose \`headRef.hash\` (${headRefHash}) does not match the canonical hash recomputed from \`contractSpace.contractJson\` (${recomputedHash}). This means the extension descriptor was published with stale \`headRef.hash\` — typically because the contract was bumped without rerunning the extension's emit pipeline.`,
157
+ fix: "Re-run the extension authoring pipeline so `contractJson.storage.storageHash` and `headRef.hash` agree, then republish the extension. If you are the extension author and you intentionally bumped `contractJson`, recompute and update `headRef.hash` (and refresh any on-disk migration metadata that derives from it).",
158
+ details: {
159
+ extensionId,
160
+ recomputedHash,
161
+ headRefHash
162
+ }
163
+ });
164
+ }
165
+ function errorDuplicateSpaceId(spaceId) {
166
+ return new MigrationToolsError("MIGRATION.DUPLICATE_SPACE_ID", "Duplicate contract space identifier", {
167
+ why: `The space id "${spaceId}" appears more than once in the per-space planner input. Each space id must be unique across the inputs (the per-space planner emits one output entry per id).`,
168
+ fix: "Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.",
169
+ details: { spaceId }
170
+ });
171
+ }
172
+ function errorAmbiguousTarget(branchTips, context) {
173
+ const divergenceInfo = context ? `\nDivergence point: ${context.divergencePoint}\nBranches:\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(" → ") || "direct"})`).join("\n")}` : "";
174
+ return new MigrationToolsError("MIGRATION.AMBIGUOUS_TARGET", "Ambiguous migration target", {
175
+ why: `The migration history has diverged into multiple branches: ${branchTips.join(", ")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,
176
+ fix: "Use `ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `migration plan`, or use --from <hash> to explicitly select a starting point.",
177
+ details: {
178
+ branchTips,
179
+ ...context ? {
180
+ divergencePoint: context.divergencePoint,
181
+ branches: context.branches
182
+ } : {}
183
+ }
184
+ });
185
+ }
186
+ function errorNoInitialMigration(nodes) {
187
+ return new MigrationToolsError("MIGRATION.NO_INITIAL_MIGRATION", "No initial migration found", {
188
+ why: `No migration starts from the empty contract state (known hashes: ${nodes.join(", ")}). At least one migration must originate from the empty state.`,
189
+ fix: "Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.",
190
+ details: { nodes }
191
+ });
192
+ }
193
+ function errorInvalidRefFile(filePath, reason) {
194
+ return new MigrationToolsError("MIGRATION.INVALID_REF_FILE", "Invalid ref file", {
195
+ why: `Ref file at "${filePath}" is invalid: ${reason}`,
196
+ fix: "Ensure the ref file contains valid JSON with { \"hash\": \"<64 hex chars>\", \"invariants\": [\"...\"] }.",
197
+ details: {
198
+ path: filePath,
199
+ reason
200
+ }
201
+ });
202
+ }
203
+ function errorInvalidRefName(refName) {
204
+ return new MigrationToolsError("MIGRATION.INVALID_REF_NAME", "Invalid ref name", {
205
+ why: `Ref name "${refName}" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no "." or ".." segments).`,
206
+ fix: `Use a valid ref name (e.g., "staging", "envs/production").`,
207
+ details: { refName }
208
+ });
209
+ }
210
+ function errorNoTarget(reachableHashes) {
211
+ return new MigrationToolsError("MIGRATION.NO_TARGET", "No migration target could be resolved", {
212
+ why: `The migration history contains cycles and no target can be resolved automatically (reachable hashes: ${reachableHashes.join(", ")}). This typically happens after rollback migrations (e.g., C1→C2→C1).`,
213
+ fix: "Use --from <hash> to specify the planning origin explicitly.",
214
+ details: { reachableHashes }
215
+ });
216
+ }
217
+ function errorInvalidRefValue(value) {
218
+ return new MigrationToolsError("MIGRATION.INVALID_REF_VALUE", "Invalid ref value", {
219
+ why: `Ref value "${value}" is not a valid contract hash. Values must be a 64-character hex digest or "empty".`,
220
+ fix: "Use a valid storage hash from `prisma-next contract emit` output or an existing migration.",
221
+ details: { value }
222
+ });
223
+ }
224
+ function errorInvalidInvariantId(invariantId) {
225
+ return new MigrationToolsError("MIGRATION.INVALID_INVARIANT_ID", "Invalid invariantId", {
226
+ why: `invariantId ${JSON.stringify(invariantId)} is invalid. Ids must be non-empty and contain no whitespace or control characters (including Unicode whitespace like NBSP); other content (kebab-case, camelCase, namespaced, Unicode letters) is allowed.`,
227
+ fix: "Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \"backfill-user-phone\", \"users/backfill-phone\", or \"BackfillUserPhone\".",
228
+ details: { invariantId }
229
+ });
230
+ }
231
+ function errorDuplicateInvariantInEdge(invariantId) {
232
+ return new MigrationToolsError("MIGRATION.DUPLICATE_INVARIANT_IN_EDGE", "Duplicate invariantId on a single migration", {
233
+ why: `invariantId "${invariantId}" is declared by more than one dataTransform on the same migration. The marker stores invariants as a set and the routing layer treats them as edge-level, so two ops cannot share a routing identity.`,
234
+ fix: "Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.",
235
+ details: { invariantId }
236
+ });
237
+ }
238
+ function errorProvidedInvariantsMismatch(filePath, stored, derived) {
239
+ const storedSet = new Set(stored);
240
+ const derivedSet = new Set(derived);
241
+ const missing = [...derivedSet].filter((id) => !storedSet.has(id));
242
+ const extra = [...storedSet].filter((id) => !derivedSet.has(id));
243
+ return new MigrationToolsError("MIGRATION.PROVIDED_INVARIANTS_MISMATCH", "providedInvariants on migration.json disagrees with ops.json", {
244
+ why: missing.length === 0 && extra.length === 0 ? `migration.json at "${filePath}" stores providedInvariants ${JSON.stringify(stored)}, but the canonical value derived from ops.json is ${JSON.stringify(derived)} — same ids, different order. Canonical providedInvariants is sorted ascending.` : `migration.json at "${filePath}" stores providedInvariants ${JSON.stringify(stored)}, but the value derived from ops.json is ${JSON.stringify(derived)}. The manifest copy was likely hand-edited without re-emitting.`,
245
+ fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
246
+ details: {
247
+ filePath,
248
+ stored,
249
+ derived,
250
+ difference: {
251
+ missing,
252
+ extra
253
+ }
254
+ }
255
+ });
256
+ }
257
+ function errorNoInvariantPath(args) {
258
+ const { refName, required, missing, structuralPath } = args;
259
+ const refClause = refName ? `Ref "${refName}"` : "Target";
260
+ const missingList = missing.map((id) => JSON.stringify(id)).join(", ");
261
+ return new MigrationToolsError("MIGRATION.NO_INVARIANT_PATH", "No path covers the required invariants", {
262
+ why: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(", ")}], missing=[${missingList}].`,
263
+ fix: "Add a migration on the path that runs `dataTransform({ invariantId: \"<id>\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.",
264
+ details: {
265
+ required,
266
+ missing,
267
+ structuralPath,
268
+ ...ifDefined("refName", refName)
269
+ }
270
+ });
271
+ }
272
+ function errorUnknownInvariant(args) {
273
+ const { refName, unknown, declared } = args;
274
+ return new MigrationToolsError("MIGRATION.UNKNOWN_INVARIANT", "Ref declares invariants no migration in the graph provides", {
275
+ why: `${refName ? `Ref "${refName}" declares` : "Declares"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(", ")}].`,
276
+ fix: "Either the ref has a typo, or the declaring migration has not been authored/attested yet. Re-check the ref file and the migrations directory.",
277
+ details: {
278
+ unknown,
279
+ declared,
280
+ ...ifDefined("refName", refName)
281
+ }
282
+ });
283
+ }
284
+ function errorMigrationHashMismatch(dir, storedHash, computedHash) {
285
+ return new MigrationToolsError("MIGRATION.HASH_MISMATCH", "Migration package is corrupt", {
286
+ why: `Stored migrationHash "${storedHash}" does not match the recomputed hash "${computedHash}" for "${relative(process.cwd(), dir)}". The migration.json or ops.json has been edited or partially written since emit.`,
287
+ fix: reemitHint(dir, "or restore the directory from version control."),
288
+ details: {
289
+ dir,
290
+ storedHash,
291
+ computedHash
292
+ }
293
+ });
294
+ }
295
+ /**
296
+ * A ref name that resolves to nothing: no pointer file named `refName`
297
+ * exists, and the hash being resolved (the `contractAt` argument, used as a
298
+ * fallback when the pointer is absent) is not a node in the migration graph
299
+ * either. There is no contract to materialize.
300
+ */
301
+ function errorRefNotResolvable(refName) {
302
+ return new MigrationToolsError("MIGRATION.REF_NOT_RESOLVABLE", `Ref "${refName}" is not resolvable`, {
303
+ why: `Ref "${refName}" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,
304
+ fix: `Create the ref with "prisma-next ref set ${refName} <hash>" (or advance it via "prisma-next db update --advance-ref ${refName}"), or pass a hash that is a node in the migration graph.`,
305
+ details: {
306
+ refName,
307
+ identifier: refName
308
+ }
309
+ });
310
+ }
311
+ function errorBundleNotFoundForGraphNode(hash, explicitLabel) {
312
+ return new MigrationToolsError("MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE", explicitLabel ? `No migration bundle found for reference "${explicitLabel}" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {
313
+ why: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\`to\`) hash matching it.`,
314
+ fix: "Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.",
315
+ details: {
316
+ hash,
317
+ ...explicitLabel ? { explicitLabel } : {}
318
+ }
319
+ });
320
+ }
321
+ function errorContractDeserializationFailed(filePath, message) {
322
+ return new MigrationToolsError("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract failed to deserialize", {
323
+ why: `Contract at "${filePath}" failed to deserialize: ${message}`,
324
+ fix: reemitHint(dirname(filePath), "or restore the directory from version control."),
325
+ details: {
326
+ filePath,
327
+ message
328
+ }
329
+ });
330
+ }
331
+ function errorHashNotInGraph(hash, graph) {
332
+ const reachableHashes = [...graph.nodes].sort();
333
+ const reachableList = reachableHashes.length > 0 ? reachableHashes.join(", ") : "(none)";
334
+ return new MigrationToolsError("MIGRATION.HASH_NOT_IN_GRAPH", `Hash "${hash}" is not a node in the migration graph`, {
335
+ why: `The migration graph contains nodes ${reachableList}; "${hash}" isn't one of them.`,
336
+ fix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run "prisma-next migration plan" to introduce it.`,
337
+ details: {
338
+ hash,
339
+ reachableHashes
340
+ }
341
+ });
342
+ }
343
+ function errorContractSnapshotMissing(storageHash, expectedPath) {
344
+ return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_MISSING", "Contract snapshot is missing", {
345
+ why: `Expected a contract snapshot for ${storageHash} at "${expectedPath}" but the file does not exist.`,
346
+ fix: "Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`prisma-next migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.",
347
+ details: {
348
+ storageHash,
349
+ expectedPath
350
+ }
351
+ });
352
+ }
353
+ function errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {
354
+ return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH", "Contract snapshot hash mismatch", {
355
+ why: `The contract JSON's inner storage.storageHash ("${actualHash}") does not match the requested storage hash ("${storageHash}") for snapshot directory "${dir}".`,
356
+ fix: "Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.",
357
+ details: {
358
+ storageHash,
359
+ actualHash,
360
+ dir
361
+ }
362
+ });
363
+ }
364
+ function errorMigrationContractViewMissing(className, accessor, jsonField) {
365
+ return new MigrationToolsError("MIGRATION.CONTRACT_VIEW_MISSING", `${className}.${accessor} requires ${jsonField}`, {
366
+ why: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,
367
+ fix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,
368
+ details: {
369
+ className,
370
+ accessor,
371
+ jsonField
372
+ }
373
+ });
374
+ }
375
+ //#endregion
376
+ export { errorOperationsNotArray as A, errorInvalidSpaceId as C, errorNoInitialMigration as D, errorMissingFile as E, errorRefNotResolvable as M, errorSpaceHeadRefMissing as N, errorNoInvariantPath as O, errorUnknownInvariant as P, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractDeserializationFailed as i, errorProvidedInvariantsMismatch as j, errorNoTarget as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorAmbiguousTarget as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorBundleNotFoundForGraphNode as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };
377
+
378
+ //# sourceMappingURL=errors-IpZm1Skp-BH495dRd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-IpZm1Skp-BH495dRd.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/errors-IpZm1Skp.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { dirname, relative } from \"pathe\";\n//#region src/errors.ts\n/**\n* Build the canonical \"re-emit this package\" remediation hint.\n*\n* Every on-disk migration package ships its own `migration.ts` author-time\n* file. Running it regenerates `migration.json` and `ops.json` with the\n* correct hash + metadata, so it is the right primitive whenever a single\n* package's on-disk artifacts are missing, malformed, or otherwise corrupt.\n* Pointing users at `migration plan` would emit a *new* package rather than\n* heal the broken one.\n*/\nfunction reemitHint(dir, fallback) {\n\tconst reemit = `Re-emit the package by running \\`node \"${relative(process.cwd(), dir)}/migration.ts\"\\``;\n\treturn fallback ? `${reemit}, ${fallback}` : `${reemit}.`;\n}\n/**\n* Structured error for migration tooling operations.\n*\n* Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under\n* the MIGRATION namespace. These are tooling-time errors (file I/O, hash\n* verification, migration history reconstruction), distinct from the runtime\n* MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,\n* etc.).\n*\n* Fields:\n* - code: Stable machine-readable code (MIGRATION.SUBCODE)\n* - category: Always 'MIGRATION'\n* - why: Explains the cause in plain language\n* - fix: Actionable remediation step\n* - details: Machine-readable structured data for agents\n*/\nvar MigrationToolsError = class extends Error {\n\tcode;\n\tcategory = \"MIGRATION\";\n\twhy;\n\tfix;\n\tdetails;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary);\n\t\tthis.name = \"MigrationToolsError\";\n\t\tthis.code = code;\n\t\tthis.why = options.why;\n\t\tthis.fix = options.fix;\n\t\tthis.details = options.details;\n\t}\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = error;\n\t\treturn candidate.name === \"MigrationToolsError\" && typeof candidate.code === \"string\";\n\t}\n};\nfunction errorDirectoryExists(dir) {\n\treturn new MigrationToolsError(\"MIGRATION.DIR_EXISTS\", \"Migration directory already exists\", {\n\t\twhy: `The directory \"${dir}\" already exists. Each migration must have a unique directory.`,\n\t\tfix: \"Use --name to pick a different name, or delete the existing directory and re-run.\",\n\t\tdetails: { dir }\n\t});\n}\nfunction errorMissingFile(file, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.FILE_MISSING\", `Missing ${file}`, {\n\t\twhy: `Expected \"${file}\" in \"${dir}\" but the file does not exist.`,\n\t\tfix: reemitHint(dir, \"or delete the directory if the migration is unwanted and the source TypeScript is gone.\"),\n\t\tdetails: {\n\t\t\tfile,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorInvalidJson(filePath, parseError) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_JSON\", \"Invalid JSON in migration file\", {\n\t\twhy: `Failed to parse \"${filePath}\": ${parseError}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tdetails: {\n\t\t\tfilePath,\n\t\t\tparseError\n\t\t}\n\t});\n}\nfunction errorInvalidManifest(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_MANIFEST\", \"Invalid migration manifest\", {\n\t\twhy: `Migration manifest at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tdetails: {\n\t\t\tfilePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorDescribeMissingEndContract() {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", \"Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.\", {\n\t\twhy: \"Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.\",\n\t\tfix: \"Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.\",\n\t\tdetails: { reason: \"missing-end-contract\" }\n\t});\n}\nfunction errorDescribeInvalidMetadata(summary) {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", `describe() returned invalid metadata: ${summary}`, {\n\t\twhy: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,\n\t\tfix: \"Ensure describe() returns { from: string | null, to: string } with valid contract hashes.\",\n\t\tdetails: {\n\t\t\treason: \"invalid-metadata\",\n\t\t\tsummary\n\t\t}\n\t});\n}\nfunction errorOperationsNotArray() {\n\treturn new MigrationToolsError(\"MIGRATION.PLAN_NOT_ARRAY\", \"operations must be an array\", {\n\t\twhy: \"The migration instance's `operations` getter returned a non-array value.\",\n\t\tfix: \"Ensure the `operations` getter returns an array of migration operations.\",\n\t\tdetails: {}\n\t});\n}\nfunction errorSpaceHeadRefMissing(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.CHECK_HEAD_REF_MISSING\", `Contract space \"${spaceId}\" has no head ref; its contract cannot be resolved from the snapshot store without one.`, {\n\t\twhy: `Contract space \"${spaceId}\" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,\n\t\tfix: \"Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.\",\n\t\tdetails: { spaceId }\n\t});\n}\nfunction errorInvalidOperationEntry(index, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Migration operation entry is malformed\", {\n\t\twhy: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,\n\t\tfix: \"Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').\",\n\t\tdetails: {\n\t\t\tindex,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidSlug(slug) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_NAME\", \"Invalid migration name\", {\n\t\twhy: `The slug \"${slug}\" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,\n\t\tfix: \"Provide a name with at least one alphanumeric character, e.g. --name add_users.\",\n\t\tdetails: { slug }\n\t});\n}\nfunction errorInvalidDestName(destName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_DEST_NAME\", \"Invalid copy destination name\", {\n\t\twhy: `The destination name \"${destName}\" must be a single path segment (no \"..\" or directory separators).`,\n\t\tfix: \"Use a simple file name such as \\\"contract.json\\\" for each destination in the copy list.\",\n\t\tdetails: { destName }\n\t});\n}\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_SPACE_ID\", \"Invalid contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" does not match the required pattern /^[a-z][a-z0-9_-]{0,63}$/. Space ids are used as filesystem directory names under \\`migrations/\\`, so the pattern is conservative on purpose.`,\n\t\tfix: \"Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.\",\n\t\tdetails: { spaceId }\n\t});\n}\nfunction errorDescriptorHeadHashMismatch(args) {\n\tconst { extensionId, recomputedHash, headRefHash } = args;\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH\", \"Extension descriptor's headRef.hash does not match its contractJson\", {\n\t\twhy: `Extension \"${extensionId}\" publishes a \\`contractSpace\\` whose \\`headRef.hash\\` (${headRefHash}) does not match the canonical hash recomputed from \\`contractSpace.contractJson\\` (${recomputedHash}). This means the extension descriptor was published with stale \\`headRef.hash\\` — typically because the contract was bumped without rerunning the extension's emit pipeline.`,\n\t\tfix: \"Re-run the extension authoring pipeline so `contractJson.storage.storageHash` and `headRef.hash` agree, then republish the extension. If you are the extension author and you intentionally bumped `contractJson`, recompute and update `headRef.hash` (and refresh any on-disk migration metadata that derives from it).\",\n\t\tdetails: {\n\t\t\textensionId,\n\t\t\trecomputedHash,\n\t\t\theadRefHash\n\t\t}\n\t});\n}\nfunction errorDuplicateSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_SPACE_ID\", \"Duplicate contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" appears more than once in the per-space planner input. Each space id must be unique across the inputs (the per-space planner emits one output entry per id).`,\n\t\tfix: \"Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.\",\n\t\tdetails: { spaceId }\n\t});\n}\nfunction errorAmbiguousTarget(branchTips, context) {\n\tconst divergenceInfo = context ? `\\nDivergence point: ${context.divergencePoint}\\nBranches:\\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(\" → \") || \"direct\"})`).join(\"\\n\")}` : \"\";\n\treturn new MigrationToolsError(\"MIGRATION.AMBIGUOUS_TARGET\", \"Ambiguous migration target\", {\n\t\twhy: `The migration history has diverged into multiple branches: ${branchTips.join(\", \")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,\n\t\tfix: \"Use `ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `migration plan`, or use --from <hash> to explicitly select a starting point.\",\n\t\tdetails: {\n\t\t\tbranchTips,\n\t\t\t...context ? {\n\t\t\t\tdivergencePoint: context.divergencePoint,\n\t\t\t\tbranches: context.branches\n\t\t\t} : {}\n\t\t}\n\t});\n}\nfunction errorNoInitialMigration(nodes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_INITIAL_MIGRATION\", \"No initial migration found\", {\n\t\twhy: `No migration starts from the empty contract state (known hashes: ${nodes.join(\", \")}). At least one migration must originate from the empty state.`,\n\t\tfix: \"Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.\",\n\t\tdetails: { nodes }\n\t});\n}\nfunction errorInvalidRefFile(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_FILE\", \"Invalid ref file\", {\n\t\twhy: `Ref file at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: \"Ensure the ref file contains valid JSON with { \\\"hash\\\": \\\"<64 hex chars>\\\", \\\"invariants\\\": [\\\"...\\\"] }.\",\n\t\tdetails: {\n\t\t\tpath: filePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidRefName(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_NAME\", \"Invalid ref name\", {\n\t\twhy: `Ref name \"${refName}\" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no \".\" or \"..\" segments).`,\n\t\tfix: `Use a valid ref name (e.g., \"staging\", \"envs/production\").`,\n\t\tdetails: { refName }\n\t});\n}\nfunction errorNoTarget(reachableHashes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_TARGET\", \"No migration target could be resolved\", {\n\t\twhy: `The migration history contains cycles and no target can be resolved automatically (reachable hashes: ${reachableHashes.join(\", \")}). This typically happens after rollback migrations (e.g., C1→C2→C1).`,\n\t\tfix: \"Use --from <hash> to specify the planning origin explicitly.\",\n\t\tdetails: { reachableHashes }\n\t});\n}\nfunction errorInvalidRefValue(value) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_VALUE\", \"Invalid ref value\", {\n\t\twhy: `Ref value \"${value}\" is not a valid contract hash. Values must be a 64-character hex digest or \"empty\".`,\n\t\tfix: \"Use a valid storage hash from `prisma-next contract emit` output or an existing migration.\",\n\t\tdetails: { value }\n\t});\n}\nfunction errorInvalidInvariantId(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_INVARIANT_ID\", \"Invalid invariantId\", {\n\t\twhy: `invariantId ${JSON.stringify(invariantId)} is invalid. Ids must be non-empty and contain no whitespace or control characters (including Unicode whitespace like NBSP); other content (kebab-case, camelCase, namespaced, Unicode letters) is allowed.`,\n\t\tfix: \"Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \\\"backfill-user-phone\\\", \\\"users/backfill-phone\\\", or \\\"BackfillUserPhone\\\".\",\n\t\tdetails: { invariantId }\n\t});\n}\nfunction errorDuplicateInvariantInEdge(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_INVARIANT_IN_EDGE\", \"Duplicate invariantId on a single migration\", {\n\t\twhy: `invariantId \"${invariantId}\" is declared by more than one dataTransform on the same migration. The marker stores invariants as a set and the routing layer treats them as edge-level, so two ops cannot share a routing identity.`,\n\t\tfix: \"Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.\",\n\t\tdetails: { invariantId }\n\t});\n}\nfunction errorProvidedInvariantsMismatch(filePath, stored, derived) {\n\tconst storedSet = new Set(stored);\n\tconst derivedSet = new Set(derived);\n\tconst missing = [...derivedSet].filter((id) => !storedSet.has(id));\n\tconst extra = [...storedSet].filter((id) => !derivedSet.has(id));\n\treturn new MigrationToolsError(\"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\", \"providedInvariants on migration.json disagrees with ops.json\", {\n\t\twhy: missing.length === 0 && extra.length === 0 ? `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the canonical value derived from ops.json is ${JSON.stringify(derived)} — same ids, different order. Canonical providedInvariants is sorted ascending.` : `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the value derived from ops.json is ${JSON.stringify(derived)}. The manifest copy was likely hand-edited without re-emitting.`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tdetails: {\n\t\t\tfilePath,\n\t\t\tstored,\n\t\t\tderived,\n\t\t\tdifference: {\n\t\t\t\tmissing,\n\t\t\t\textra\n\t\t\t}\n\t\t}\n\t});\n}\nfunction errorNoInvariantPath(args) {\n\tconst { refName, required, missing, structuralPath } = args;\n\tconst refClause = refName ? `Ref \"${refName}\"` : \"Target\";\n\tconst missingList = missing.map((id) => JSON.stringify(id)).join(\", \");\n\treturn new MigrationToolsError(\"MIGRATION.NO_INVARIANT_PATH\", \"No path covers the required invariants\", {\n\t\twhy: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(\", \")}], missing=[${missingList}].`,\n\t\tfix: \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\tdetails: {\n\t\t\trequired,\n\t\t\tmissing,\n\t\t\tstructuralPath,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorUnknownInvariant(args) {\n\tconst { refName, unknown, declared } = args;\n\treturn new MigrationToolsError(\"MIGRATION.UNKNOWN_INVARIANT\", \"Ref declares invariants no migration in the graph provides\", {\n\t\twhy: `${refName ? `Ref \"${refName}\" declares` : \"Declares\"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(\", \")}].`,\n\t\tfix: \"Either the ref has a typo, or the declaring migration has not been authored/attested yet. Re-check the ref file and the migrations directory.\",\n\t\tdetails: {\n\t\t\tunknown,\n\t\t\tdeclared,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorMigrationHashMismatch(dir, storedHash, computedHash) {\n\treturn new MigrationToolsError(\"MIGRATION.HASH_MISMATCH\", \"Migration package is corrupt\", {\n\t\twhy: `Stored migrationHash \"${storedHash}\" does not match the recomputed hash \"${computedHash}\" for \"${relative(process.cwd(), dir)}\". The migration.json or ops.json has been edited or partially written since emit.`,\n\t\tfix: reemitHint(dir, \"or restore the directory from version control.\"),\n\t\tdetails: {\n\t\t\tdir,\n\t\t\tstoredHash,\n\t\t\tcomputedHash\n\t\t}\n\t});\n}\n/**\n* A ref name that resolves to nothing: no pointer file named `refName`\n* exists, and the hash being resolved (the `contractAt` argument, used as a\n* fallback when the pointer is absent) is not a node in the migration graph\n* either. There is no contract to materialize.\n*/\nfunction errorRefNotResolvable(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.REF_NOT_RESOLVABLE\", `Ref \"${refName}\" is not resolvable`, {\n\t\twhy: `Ref \"${refName}\" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,\n\t\tfix: `Create the ref with \"prisma-next ref set ${refName} <hash>\" (or advance it via \"prisma-next db update --advance-ref ${refName}\"), or pass a hash that is a node in the migration graph.`,\n\t\tdetails: {\n\t\t\trefName,\n\t\t\tidentifier: refName\n\t\t}\n\t});\n}\nfunction errorBundleNotFoundForGraphNode(hash, explicitLabel) {\n\treturn new MigrationToolsError(\"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\", explicitLabel ? `No migration bundle found for reference \"${explicitLabel}\" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {\n\t\twhy: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\\`to\\`) hash matching it.`,\n\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.\",\n\t\tdetails: {\n\t\t\thash,\n\t\t\t...explicitLabel ? { explicitLabel } : {}\n\t\t}\n\t});\n}\nfunction errorContractDeserializationFailed(filePath, message) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract failed to deserialize\", {\n\t\twhy: `Contract at \"${filePath}\" failed to deserialize: ${message}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tdetails: {\n\t\t\tfilePath,\n\t\t\tmessage\n\t\t}\n\t});\n}\nfunction errorHashNotInGraph(hash, graph) {\n\tconst reachableHashes = [...graph.nodes].sort();\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none)\";\n\treturn new MigrationToolsError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Hash \"${hash}\" is not a node in the migration graph`, {\n\t\twhy: `The migration graph contains nodes ${reachableList}; \"${hash}\" isn't one of them.`,\n\t\tfix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run \"prisma-next migration plan\" to introduce it.`,\n\t\tdetails: {\n\t\t\thash,\n\t\t\treachableHashes\n\t\t}\n\t});\n}\nfunction errorContractSnapshotMissing(storageHash, expectedPath) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_MISSING\", \"Contract snapshot is missing\", {\n\t\twhy: `Expected a contract snapshot for ${storageHash} at \"${expectedPath}\" but the file does not exist.`,\n\t\tfix: \"Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`prisma-next migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.\",\n\t\tdetails: {\n\t\t\tstorageHash,\n\t\t\texpectedPath\n\t\t}\n\t});\n}\nfunction errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH\", \"Contract snapshot hash mismatch\", {\n\t\twhy: `The contract JSON's inner storage.storageHash (\"${actualHash}\") does not match the requested storage hash (\"${storageHash}\") for snapshot directory \"${dir}\".`,\n\t\tfix: \"Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.\",\n\t\tdetails: {\n\t\t\tstorageHash,\n\t\t\tactualHash,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorMigrationContractViewMissing(className, accessor, jsonField) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_VIEW_MISSING\", `${className}.${accessor} requires ${jsonField}`, {\n\t\twhy: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,\n\t\tfix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,\n\t\tdetails: {\n\t\t\tclassName,\n\t\t\taccessor,\n\t\t\tjsonField\n\t\t}\n\t});\n}\n//#endregion\nexport { errorOperationsNotArray as A, errorInvalidSpaceId as C, errorNoInitialMigration as D, errorMissingFile as E, errorRefNotResolvable as M, errorSpaceHeadRefMissing as N, errorNoInvariantPath as O, errorUnknownInvariant as P, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractDeserializationFailed as i, errorProvidedInvariantsMismatch as j, errorNoTarget as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorAmbiguousTarget as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorBundleNotFoundForGraphNode as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };\n\n//# sourceMappingURL=errors-IpZm1Skp.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,WAAW,KAAK,UAAU;CAClC,MAAM,SAAS,0CAA0C,SAAS,QAAQ,IAAI,GAAG,GAAG,EAAE;CACtF,OAAO,WAAW,GAAG,OAAO,IAAI,aAAa,GAAG,OAAO;AACxD;;;;;;;;;;;;;;;;;AAiBA,IAAI,sBAAsB,cAAc,MAAM;CAC7C;CACA,WAAW;CACX;CACA;CACA;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,MAAM,QAAQ;EACnB,KAAK,MAAM,QAAQ;EACnB,KAAK,UAAU,QAAQ;CACxB;CACA,OAAO,GAAG,OAAO;EAChB,IAAI,EAAE,iBAAiB,QAAQ,OAAO;EACtC,MAAM,YAAY;EAClB,OAAO,UAAU,SAAS,yBAAyB,OAAO,UAAU,SAAS;CAC9E;AACD;AACA,SAAS,qBAAqB,KAAK;CAClC,OAAO,IAAI,oBAAoB,wBAAwB,sCAAsC;EAC5F,KAAK,kBAAkB,IAAI;EAC3B,KAAK;EACL,SAAS,EAAE,IAAI;CAChB,CAAC;AACF;AACA,SAAS,iBAAiB,MAAM,KAAK;CACpC,OAAO,IAAI,oBAAoB,0BAA0B,WAAW,QA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