@prisma/orm-toolchain 0.16.0-dev.36

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-CcG-fB8r-CDs5C9vt.mjs +597 -0
  191. package/dist/migration-check-CcG-fB8r-CDs5C9vt.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-CFlzlRmu-DewBN8Ys.mjs +444 -0
  217. package/dist/migration-status-CFlzlRmu-DewBN8Ys.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-CeGMYFYX-h3OcU__O.d.mts +192 -0
  292. package/dist/schemas-CeGMYFYX-h3OcU__O.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 +127 -0
@@ -0,0 +1,597 @@
1
+ import { t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
2
+ import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs";
3
+ import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
4
+ import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
5
+ import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories } from "./verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs";
6
+ import { A as errorSpaceNotFound, I as formatErrorJson, L as formatErrorOutput, Q as mapRefResolutionError, W as formatStyledHeader, _ as errorInvalidSpaceId, at as resolveMigrationPaths, c as errorAmbiguousMigrationRef, ct as setCommandExamples, it as resolveContractPath, lt as setCommandSeeAlso, o as createTerminalUI, r as addGlobalOptions, st as setCommandDescriptions, tt as parseGlobalFlagsOrExit } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
7
+ import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
8
+ import { s as loadContractSpaceAggregate } from "./aggregate-B4mhR4Sk.mjs";
9
+ import { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
10
+ import { r as parseMigrationRef } from "./ref-resolution-BjJBWPjX.mjs";
11
+ import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-D3Sj55PI-BICblCuk.mjs";
12
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
13
+ import { notOk, ok } from "@prisma/orm-framework/utils/result";
14
+ import { join, relative } from "pathe";
15
+ import { readFile } from "node:fs/promises";
16
+ import { createControlStack } from "@prisma/orm-framework/components/control";
17
+ import { existsSync, readdirSync, statSync } from "node:fs";
18
+ import { Command } from "commander";
19
+ //#region ../../../1-framework/3-tooling/cli/dist/migration-check-CcG-fB8r.mjs
20
+ function migrationPathRelative$1(dirPath) {
21
+ return relative(process.cwd(), dirPath);
22
+ }
23
+ function migrationFileRelative$1(dirPath, fileName) {
24
+ return join(migrationPathRelative$1(dirPath), fileName);
25
+ }
26
+ /**
27
+ * Map one {@link IntegrityViolation} onto a `migration check` failure row.
28
+ * Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.
29
+ */
30
+ function integrityViolationToCheckFailure(violation, migrationsDir) {
31
+ const spaceRelative = (spaceId) => migrationPathRelative$1(join(migrationsDir, spaceId));
32
+ const packageRelative = (spaceId, dirName) => migrationPathRelative$1(join(migrationsDir, spaceId, dirName));
33
+ const refRelative = (spaceId, refName) => migrationPathRelative$1(join(migrationsDir, spaceId, "refs", `${refName}.json`));
34
+ switch (violation.kind) {
35
+ case "hashMismatch": return {
36
+ space: violation.spaceId,
37
+ code: "MIGRATION.CHECK_HASH_MISMATCH",
38
+ where: migrationFileRelative$1(join(migrationsDir, violation.spaceId, violation.dirName), "migration.json"),
39
+ why: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,
40
+ fix: "Re-emit the migration package or restore from version control."
41
+ };
42
+ case "providedInvariantsMismatch": return {
43
+ space: violation.spaceId,
44
+ code: "MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH",
45
+ where: packageRelative(violation.spaceId, violation.dirName),
46
+ why: `Migration "${violation.dirName}" providedInvariants in migration.json disagrees with ops.json.`,
47
+ fix: "Re-emit the migration package so migration.json and ops.json agree."
48
+ };
49
+ case "packageUnloadable": return {
50
+ space: violation.spaceId,
51
+ code: "MIGRATION.CHECK_PACKAGE_UNLOADABLE",
52
+ where: packageRelative(violation.spaceId, violation.dirName),
53
+ why: `Migration "${violation.dirName}" could not be loaded: ${violation.detail}`,
54
+ fix: "Re-emit the migration package or restore from version control."
55
+ };
56
+ case "sameSourceAndTarget": return {
57
+ space: violation.spaceId,
58
+ code: "MIGRATION.CHECK_NOOP_SELF_EDGE",
59
+ where: packageRelative(violation.spaceId, violation.dirName),
60
+ why: `Migration "${violation.dirName}" in space "${violation.spaceId}" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,
61
+ fix: "Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op."
62
+ };
63
+ case "orphanSpaceDir": return {
64
+ space: violation.spaceId,
65
+ code: "MIGRATION.CHECK_ORPHAN_SPACE_DIR",
66
+ where: spaceRelative(violation.spaceId),
67
+ why: `Contract-space directory "${violation.spaceId}" exists on disk but no extension declares it.`,
68
+ fix: "Remove the orphan directory, or declare the extension in `extensions`."
69
+ };
70
+ case "declaredButUnmigrated": return {
71
+ space: violation.spaceId,
72
+ code: "MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED",
73
+ where: spaceRelative(violation.spaceId),
74
+ why: `Extension "${violation.spaceId}" is declared in \`extensions\` but has no on-disk migrations directory.`,
75
+ fix: "Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused."
76
+ };
77
+ case "headRefMissing": return {
78
+ space: violation.spaceId,
79
+ code: "MIGRATION.CHECK_HEAD_REF_MISSING",
80
+ where: refRelative(violation.spaceId, "head"),
81
+ why: `Head ref \`refs/head.json\` is missing for contract space "${violation.spaceId}".`,
82
+ fix: "Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control."
83
+ };
84
+ case "headRefNotInGraph": return {
85
+ space: violation.spaceId,
86
+ code: "MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH",
87
+ where: refRelative(violation.spaceId, "head"),
88
+ why: `Head ref ${violation.hash} for contract space "${violation.spaceId}" is not present in its migration graph.`,
89
+ fix: "Re-emit the contract space migrations, or restore the missing migration package."
90
+ };
91
+ case "refUnreadable": return {
92
+ space: violation.spaceId,
93
+ code: "MIGRATION.CHECK_REF_UNREADABLE",
94
+ where: refRelative(violation.spaceId, violation.refName),
95
+ why: `Ref "${violation.refName}" for contract space "${violation.spaceId}" is unreadable: ${violation.detail}`,
96
+ fix: "Repair or remove the corrupt ref file."
97
+ };
98
+ case "targetMismatch": return {
99
+ space: violation.spaceId,
100
+ code: "MIGRATION.CHECK_TARGET_MISMATCH",
101
+ where: spaceRelative(violation.spaceId),
102
+ why: `Contract space "${violation.spaceId}" targets "${violation.actual}" but the project targets "${violation.expected}".`,
103
+ fix: "Update the extension to target the configured database, or change the project target."
104
+ };
105
+ case "disjointness": return {
106
+ space: "app",
107
+ code: "MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION",
108
+ where: migrationPathRelative$1(migrationsDir),
109
+ why: `Storage element "${violation.element}" is claimed by multiple contract spaces: ${violation.claimedBy.join(", ")}.`,
110
+ fix: "Update the contracts so each storage element is owned by exactly one contract space."
111
+ };
112
+ case "contractUnreadable": return {
113
+ space: violation.spaceId,
114
+ code: "MIGRATION.CHECK_CONTRACT_UNREADABLE",
115
+ where: migrationFileRelative$1(join(migrationsDir, violation.spaceId), "contract.json"),
116
+ why: `Contract for space "${violation.spaceId}" is unreadable: ${violation.detail}`,
117
+ fix: "Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract."
118
+ };
119
+ case "duplicateMigrationHash": return {
120
+ space: violation.spaceId,
121
+ code: "MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH",
122
+ where: spaceRelative(violation.spaceId),
123
+ why: `Multiple migrations in space "${violation.spaceId}" share migrationHash "${violation.migrationHash}" (${violation.dirNames.join(", ")}).`,
124
+ fix: "Re-emit one of the conflicting packages so each migrationHash is unique."
125
+ };
126
+ }
127
+ }
128
+ function migrationPathRelative(dirPath) {
129
+ return relative(process.cwd(), dirPath);
130
+ }
131
+ function migrationFileRelative(dirPath, fileName) {
132
+ return join(migrationPathRelative(dirPath), fileName);
133
+ }
134
+ function checkFileExists(spaceId, dirPath, dirName, fileName) {
135
+ if (!existsSync(join(dirPath, fileName))) return {
136
+ space: spaceId,
137
+ code: "MIGRATION.CHECK_FILE_MISSING",
138
+ where: migrationFileRelative(dirPath, fileName),
139
+ why: `${fileName} is missing from ${dirName}`,
140
+ fix: "Re-emit the migration package or restore from version control."
141
+ };
142
+ return null;
143
+ }
144
+ /**
145
+ * Snapshot-store consistency check for one migration package (D6.5):
146
+ * absent store entry is not an issue (runner independence, ADR 199 — a
147
+ * package dir with only `migration.json` + `ops.json` is legitimate); a
148
+ * present entry whose inner `storage.storageHash` disagrees with
149
+ * `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store
150
+ * entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.
151
+ */
152
+ async function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {
153
+ let snapshotDir;
154
+ try {
155
+ snapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);
156
+ } catch {
157
+ return {
158
+ space: spaceId,
159
+ code: "MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE",
160
+ where: migrationPathRelative(pkg.dirPath),
161
+ why: `Migration "${pkg.dirName}" declares to="${pkg.metadata.to}", which is not a well-formed contract snapshot hash.`,
162
+ fix: "Re-emit the migration package so migration.json declares a valid 64-hex to-hash."
163
+ };
164
+ }
165
+ let raw;
166
+ try {
167
+ raw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);
168
+ } catch (error) {
169
+ if (MigrationToolsError.is(error) && error.code === "MIGRATION.CONTRACT_SNAPSHOT_MISSING") return null;
170
+ return {
171
+ space: spaceId,
172
+ code: "MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE",
173
+ where: migrationPathRelative(pkg.dirPath),
174
+ why: `Migration "${pkg.dirName}" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,
175
+ fix: "Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot."
176
+ };
177
+ }
178
+ const snapshotHash = (raw !== null && typeof raw === "object" ? raw : {})["storage"]?.["storageHash"];
179
+ if (typeof snapshotHash === "string" && snapshotHash !== pkg.metadata.to) return {
180
+ space: spaceId,
181
+ code: "MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH",
182
+ where: migrationPathRelative(pkg.dirPath),
183
+ why: `Migration "${pkg.dirName}" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,
184
+ fix: "Re-emit the migration package so migration.json and its contract snapshot agree."
185
+ };
186
+ return null;
187
+ }
188
+ /**
189
+ * Project the loaded {@link ContractSpaceAggregate} into the
190
+ * {@link CheckSpace} rows the multi-space check iterates — one per on-disk
191
+ * contract-space directory, in the aggregate's `app`-first ordering. Mirrors
192
+ * `migration list`'s `migrationSpaceListEntriesFromAggregate`: space
193
+ * membership matches the on-disk directories, package / ref / graph data come
194
+ * from `aggregate.space(id)`.
195
+ */
196
+ async function enumerateCheckSpaces(aggregate, projectMigrationsDir) {
197
+ const candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);
198
+ const onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));
199
+ const spaces = [];
200
+ for (const space of aggregate.spaces()) {
201
+ const spaceId = space.spaceId;
202
+ if (!isValidSpaceId(spaceId)) continue;
203
+ if (!onDiskSpaceIds.has(spaceId)) continue;
204
+ const migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);
205
+ spaces.push({
206
+ spaceId,
207
+ packages: space.packages,
208
+ refs: space.refs,
209
+ graph: space.graph(),
210
+ migrationsDir,
211
+ refsDir: spaceRefsDirectory(migrationsDir),
212
+ projectMigrationsDir
213
+ });
214
+ }
215
+ return spaces;
216
+ }
217
+ function checkManifestFilesPresent(space) {
218
+ if (!existsSync(space.migrationsDir)) return [];
219
+ const loadedDirNames = new Set(space.packages.map((p) => p.dirName));
220
+ const failures = [];
221
+ let entries;
222
+ try {
223
+ entries = readdirSync(space.migrationsDir);
224
+ } catch {
225
+ return failures;
226
+ }
227
+ for (const entry of entries) {
228
+ if (entry.startsWith(".") || entry.startsWith("_") || entry === "refs") continue;
229
+ const entryPath = join(space.migrationsDir, entry);
230
+ try {
231
+ if (!statSync(entryPath).isDirectory()) continue;
232
+ } catch {
233
+ continue;
234
+ }
235
+ if (!loadedDirNames.has(entry)) for (const f of ["migration.json", "ops.json"]) {
236
+ const fail = checkFileExists(space.spaceId, entryPath, entry, f);
237
+ if (fail) failures.push(fail);
238
+ }
239
+ }
240
+ return failures;
241
+ }
242
+ function checkReachability(space) {
243
+ const allToHashes = new Set(space.packages.map((p) => p.metadata.to));
244
+ const failures = [];
245
+ for (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === "empty")) failures.push({
246
+ space: space.spaceId,
247
+ code: "MIGRATION.CHECK_UNREACHABLE_MIGRATION",
248
+ where: migrationPathRelative(pkg.dirPath),
249
+ why: `Migration "${pkg.dirName}" starts from ${pkg.metadata.from} which no other migration produces`,
250
+ fix: "This migration is unreachable in the graph. Delete it or re-emit a connecting migration."
251
+ });
252
+ return failures;
253
+ }
254
+ function checkDanglingRefs(space) {
255
+ const failures = [];
256
+ for (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({
257
+ space: space.spaceId,
258
+ code: "MIGRATION.CHECK_DANGLING_REF",
259
+ where: relative(process.cwd(), join(space.refsDir, `${name}.json`)),
260
+ why: `Ref "${name}" points at ${entry.hash} which does not exist in the migration graph`,
261
+ fix: `Update the ref with \`prisma-next ref set ${name} <valid-hash>\` or delete it.`
262
+ });
263
+ return failures;
264
+ }
265
+ async function checkSpace(space) {
266
+ const snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));
267
+ return [
268
+ ...checkManifestFilesPresent(space),
269
+ ...snapshotFailures.filter((f) => f !== null),
270
+ ...checkReachability(space),
271
+ ...checkDanglingRefs(space)
272
+ ];
273
+ }
274
+ /**
275
+ * Policy core of the holistic `migration check`: validates `--space`,
276
+ * narrows the pre-enumerated spaces, and runs the per-space explicit graph
277
+ * checks (file-existence, snapshot consistency, reachability, dangling
278
+ * refs), aggregating every failure into one {@link MigrationCheckResult}.
279
+ *
280
+ * `--space` validation mirrors `migration list`: an invalid id →
281
+ * {@link errorInvalidSpaceId}; an id with no on-disk space →
282
+ * {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.
283
+ * Aggregate-integrity violations (which already span every space) are folded
284
+ * in by the caller, not here.
285
+ */
286
+ async function runMigrationCheck(inputs) {
287
+ const { spaces, spaceFilter } = inputs;
288
+ if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
289
+ if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));
290
+ const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
291
+ const failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();
292
+ if (failures.length === 0) return ok({
293
+ ok: true,
294
+ failures: [],
295
+ summary: "All checks passed"
296
+ });
297
+ return ok({
298
+ ok: false,
299
+ failures,
300
+ summary: `${failures.length} integrity failure(s)`
301
+ });
302
+ }
303
+ async function loadAggregateIntegrityViolations(config, migrationsDir) {
304
+ try {
305
+ const contractJsonContent = await readFile(resolveContractPath(config), "utf-8");
306
+ const familyInstance = config.family.create(createControlStack(config));
307
+ const declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);
308
+ const parsedAppContract = JSON.parse(contractJsonContent);
309
+ return (await loadContractSpaceAggregate({
310
+ migrationsDir,
311
+ deserializeContract: (json) => familyInstance.deserializeContract(json),
312
+ appContract: familyInstance.deserializeContract(parsedAppContract)
313
+ })).checkIntegrity({
314
+ declaredExtensions,
315
+ checkContracts: true
316
+ });
317
+ } catch {
318
+ return [];
319
+ }
320
+ }
321
+ async function executeMigrationCheckCommand(target, options, flags, ui) {
322
+ const config = await loadConfig(options.config);
323
+ const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
324
+ if (!flags.json && !flags.quiet) {
325
+ const details = [{
326
+ label: "config",
327
+ value: configPath
328
+ }, {
329
+ label: "migrations",
330
+ value: appMigrationsRelative
331
+ }];
332
+ if (target) details.push({
333
+ label: "target",
334
+ value: target
335
+ });
336
+ const header = formatStyledHeader({
337
+ command: "migration check",
338
+ description: "Verify artifact and graph integrity",
339
+ details,
340
+ flags
341
+ });
342
+ ui.stderr(header);
343
+ }
344
+ const loadedAggregate = await buildReadAggregate(config, { migrationsDir });
345
+ if (!loadedAggregate.ok) return {
346
+ error: loadedAggregate.failure,
347
+ exitCode: 2
348
+ };
349
+ const spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);
350
+ if (target) return await checkSingleTarget(target, {
351
+ spaces,
352
+ ...options.space !== void 0 ? { spaceFilter: options.space } : {},
353
+ appMigrationsDir,
354
+ appMigrationsRelative
355
+ });
356
+ const checkResult = await runMigrationCheck({
357
+ spaces,
358
+ ...options.space !== void 0 ? { spaceFilter: options.space } : {}
359
+ });
360
+ if (!checkResult.ok) return {
361
+ error: checkResult.failure,
362
+ exitCode: 2
363
+ };
364
+ const failures = [...checkResult.value.failures];
365
+ const allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);
366
+ const scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== "disjointness" && v.spaceId === options.space);
367
+ for (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));
368
+ if (failures.length === 0) return {
369
+ result: {
370
+ ok: true,
371
+ failures: [],
372
+ summary: "All checks passed"
373
+ },
374
+ exitCode: 0
375
+ };
376
+ return {
377
+ result: {
378
+ ok: false,
379
+ failures,
380
+ summary: `${failures.length} integrity failure(s)`
381
+ },
382
+ exitCode: 4
383
+ };
384
+ }
385
+ /**
386
+ * Ranks ref-resolution failure kinds by how informative they are, so a
387
+ * single-target check surfaces the most useful failure across spaces instead of
388
+ * whichever space failed first. `not-found` (the input matched nothing here)
389
+ * says the least; a malformed input, a wrong grammar, or an in-space ambiguity
390
+ * all say more.
391
+ */
392
+ function refFailureSpecificity(error) {
393
+ switch (error.kind) {
394
+ case "wrong-grammar": return 3;
395
+ case "ambiguous": return 2;
396
+ case "invalid-format": return 1;
397
+ case "not-found": return 0;
398
+ }
399
+ }
400
+ /**
401
+ * Single-target (`check <ref/path>`) mode — resolves a migration reference
402
+ * across all contract spaces (or the one space narrowed by `--space <id>`).
403
+ *
404
+ * Resolution:
405
+ * - filesystem path → find the owning space by checking which space's
406
+ * `migrationsDir` contains the resolved path; falls back to app-relative
407
+ * validation when the path is outside every space dir.
408
+ * - ref → `parseMigrationRef` against each in-scope space; collect every
409
+ * (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity
410
+ * error (qualify with `--space`).
411
+ *
412
+ * `--space <id>` is validated the same way the holistic path does it:
413
+ * invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.
414
+ */
415
+ async function checkSingleTarget(target, inputs) {
416
+ const { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;
417
+ if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {
418
+ error: errorInvalidSpaceId(spaceFilter),
419
+ exitCode: 2
420
+ };
421
+ if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {
422
+ error: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),
423
+ exitCode: 2
424
+ };
425
+ const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
426
+ let matchedSpace;
427
+ let matchedPkg;
428
+ if (looksLikePath(target)) {
429
+ const resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);
430
+ if (resolvedPath !== null) for (const space of scopedSpaces) {
431
+ const found = findPackageByDirPath(space.packages, resolvedPath);
432
+ if (found) {
433
+ matchedSpace = space;
434
+ matchedPkg = found;
435
+ break;
436
+ }
437
+ }
438
+ else {
439
+ const resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);
440
+ if (!resolved.ok) return {
441
+ error: resolved.failure,
442
+ exitCode: 2
443
+ };
444
+ const appSpace = scopedSpaces.find((s) => s.spaceId === "app");
445
+ if (appSpace) {
446
+ matchedSpace = appSpace;
447
+ matchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);
448
+ }
449
+ }
450
+ } else {
451
+ const hits = [];
452
+ let bestParseFailure;
453
+ for (const space of scopedSpaces) {
454
+ const migResult = parseMigrationRef(target, {
455
+ graph: space.graph,
456
+ refs: space.refs
457
+ });
458
+ if (!migResult.ok) {
459
+ if (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;
460
+ continue;
461
+ }
462
+ const pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);
463
+ if (pkg) hits.push({
464
+ space,
465
+ pkg
466
+ });
467
+ }
468
+ if (hits.length > 1) return {
469
+ error: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),
470
+ exitCode: 2
471
+ };
472
+ if (hits.length === 1) {
473
+ matchedSpace = hits[0].space;
474
+ matchedPkg = hits[0].pkg;
475
+ } else if (bestParseFailure !== void 0) return {
476
+ error: mapRefResolutionError(bestParseFailure),
477
+ exitCode: 2
478
+ };
479
+ }
480
+ if (!matchedPkg || !matchedSpace) return {
481
+ result: {
482
+ ok: false,
483
+ failures: [],
484
+ summary: `Migration package for "${target}" not found on disk`
485
+ },
486
+ exitCode: 2
487
+ };
488
+ const failures = [...checkManifestFilesPresent(matchedSpace)];
489
+ for (const f of ["migration.json", "ops.json"]) {
490
+ const fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);
491
+ if (fail) failures.push(fail);
492
+ }
493
+ const verification = verifyMigrationHash(matchedPkg);
494
+ if (!verification.ok) failures.push({
495
+ space: matchedSpace.spaceId,
496
+ code: "MIGRATION.CHECK_HASH_MISMATCH",
497
+ where: migrationFileRelative(matchedPkg.dirPath, "migration.json"),
498
+ why: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,
499
+ fix: "Re-emit the migration package or restore from version control."
500
+ });
501
+ const snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);
502
+ if (snapshotFailure) failures.push(snapshotFailure);
503
+ const resolvedSpaceId = matchedSpace.spaceId !== "app" ? matchedSpace.spaceId : void 0;
504
+ if (failures.length === 0) return {
505
+ result: {
506
+ ok: true,
507
+ failures: [],
508
+ summary: "All checks passed"
509
+ },
510
+ exitCode: 0,
511
+ ...ifDefined("resolvedSpaceId", resolvedSpaceId)
512
+ };
513
+ return {
514
+ result: {
515
+ ok: false,
516
+ failures,
517
+ summary: `${failures.length} integrity failure(s)`
518
+ },
519
+ exitCode: 4,
520
+ ...ifDefined("resolvedSpaceId", resolvedSpaceId)
521
+ };
522
+ }
523
+ function createMigrationCheckCommand() {
524
+ const command = new Command("check");
525
+ setCommandDescriptions(command, "Verify artifact and graph integrity", "Validates that on-disk migration packages are internally consistent\n(hashes match, manifests are complete) and that the graph is well-formed\n(edges connect, refs point at valid nodes). The whole-graph check spans\nevery contract space by default; pass --space <id> to narrow to one. A\nmigration reference checks a single package, resolved across all contract\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\nOffline — does not consult the database.\nExit codes: 0 = all checks passed, 2 = precondition failed\n(unresolved target or unknown --space), 4 = integrity failure(s) found.");
526
+ setCommandExamples(command, [
527
+ "prisma-next migration check",
528
+ "prisma-next migration check --space app",
529
+ "prisma-next migration check 20260101-add-users",
530
+ "prisma-next migration check 20260101-add-users --space app",
531
+ "prisma-next migration check --json"
532
+ ]);
533
+ setCommandSeeAlso(command, [
534
+ {
535
+ verb: "migration status",
536
+ oneLiner: "Show migration path and pending status"
537
+ },
538
+ {
539
+ verb: "migration list",
540
+ oneLiner: "List on-disk migrations"
541
+ },
542
+ {
543
+ verb: "migration graph",
544
+ oneLiner: "Show the migration graph topology"
545
+ },
546
+ {
547
+ verb: "migration show",
548
+ oneLiner: "Display migration package contents"
549
+ }
550
+ ]);
551
+ command.exitOverride();
552
+ addGlobalOptions(command).argument("[target]", "Migration reference: directory name, hash/prefix, ref, or path").option("--config <path>", "Path to prisma-next.config.ts").option("--space <id>", "Narrow output to a single contract space").action(async (target, options) => {
553
+ const flags = parseGlobalFlagsOrExit(options);
554
+ const ui = createTerminalUI(flags);
555
+ let outcome;
556
+ try {
557
+ outcome = await executeMigrationCheckCommand(target, options, flags, ui);
558
+ } catch (error) {
559
+ outcome = {
560
+ result: {
561
+ ok: false,
562
+ failures: [],
563
+ summary: error instanceof Error ? error.message : String(error)
564
+ },
565
+ exitCode: 2
566
+ };
567
+ }
568
+ if (outcome.error) {
569
+ const envelope = outcome.error.toEnvelope();
570
+ if (flags.json) ui.output(formatErrorJson(envelope));
571
+ else if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));
572
+ process.exit(outcome.exitCode);
573
+ }
574
+ const result = outcome.result ?? {
575
+ ok: false,
576
+ failures: [],
577
+ summary: "No check result produced"
578
+ };
579
+ if (flags.json) ui.output(JSON.stringify(result, null, 2));
580
+ else if (!flags.quiet) if (result.ok) {
581
+ const spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : "";
582
+ ui.log(`✔ ${result.summary}${spaceSuffix}`);
583
+ } else {
584
+ for (const f of result.failures) {
585
+ ui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);
586
+ ui.log(` fix: ${f.fix}`);
587
+ }
588
+ ui.log(`\n${result.summary}`);
589
+ }
590
+ process.exit(outcome.exitCode);
591
+ });
592
+ return command;
593
+ }
594
+ //#endregion
595
+ export { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };
596
+
597
+ //# sourceMappingURL=migration-check-CcG-fB8r-CDs5C9vt.mjs.map