@prisma/orm-toolchain 8.0.0-rc.1-dev.44 → 8.0.0-rc.1-dev.46
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.
- package/README.md +3 -3
- package/dist/{aggregate-BBsCbXgJ.mjs → aggregate-CPZB020V.mjs} +9 -9
- package/dist/{aggregate-BBsCbXgJ.mjs.map → aggregate-CPZB020V.mjs.map} +1 -1
- package/dist/{aggregate-CA6bJ8UO.d.mts → aggregate-DLUJLq5Y.d.mts} +3 -3
- package/dist/{aggregate-CA6bJ8UO.d.mts.map → aggregate-DLUJLq5Y.d.mts.map} +1 -1
- package/dist/cli-telemetry.d.mts +19 -5
- package/dist/cli-telemetry.d.mts.map +1 -1
- package/dist/cli-telemetry.mjs +287 -8
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +11 -13
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +5382 -1095
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +298 -27
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -19
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__control-api__testing.mjs.map +1 -1
- package/dist/cli__init-output.d.mts +0 -1
- package/dist/cli__init-output.d.mts.map +1 -1
- package/dist/cli__init-output.mjs +1 -1
- package/dist/cli__migration-cli.mjs +9 -9
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs → contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs} +4 -4
- package/dist/{contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs.map → contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map} +1 -1
- package/dist/{cli-errors-iquUoY6O-BFboxglv.d.mts → db-verify-BwgNK50T-DGvKgFCK.d.mts} +81 -81
- package/dist/db-verify-BwgNK50T-DGvKgFCK.d.mts.map +1 -0
- package/dist/emitter.d.mts +1 -1
- package/dist/{errors-CXbGUWGu-BQi6YS-H.mjs → errors-CXbGUWGu-CstQHPh6.mjs} +2 -2
- package/dist/{errors-CXbGUWGu-BQi6YS-H.mjs.map → errors-CXbGUWGu-CstQHPh6.mjs.map} +1 -1
- package/dist/{errors-KWM8yBAL.d.mts → errors-D59OCpoI.d.mts} +2 -2
- package/dist/{errors-KWM8yBAL.d.mts.map → errors-D59OCpoI.d.mts.map} +1 -1
- package/dist/{exports-B3xY_FHp.mjs → exports-8ZUN43ve.mjs} +6 -6
- package/dist/exports-8ZUN43ve.mjs.map +1 -0
- package/dist/{exports-BZLNbtkY.mjs → exports-BZaG8_w_.mjs} +64 -36
- package/dist/exports-BZaG8_w_.mjs.map +1 -0
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs → graph-membership-BViWUMpP-C4lYYJdU.mjs} +2 -2
- package/dist/{graph-membership-BViWUMpP-Cgu4Z2ox.mjs.map → graph-membership-BViWUMpP-C4lYYJdU.mjs.map} +1 -1
- package/dist/{import-roots-NDOIEDVj.mjs → import-roots-CNFBPAT1.mjs} +10 -3
- package/dist/{import-roots-NDOIEDVj.mjs.map → import-roots-CNFBPAT1.mjs.map} +1 -1
- package/dist/{import-roots-B6CtsWXb.d.mts → import-roots-CfoYgejL.d.mts} +2 -2
- package/dist/{import-roots-B6CtsWXb.d.mts.map → import-roots-CfoYgejL.d.mts.map} +1 -1
- package/dist/{index-mCsi_ND5.d.mts → index-DRs7L6N0.d.mts} +11 -3
- package/dist/index-DRs7L6N0.d.mts.map +1 -0
- package/dist/{index-CnOyYxmv.d.mts → index-Dgwl8Tzs.d.mts} +2 -2
- package/dist/{index-CnOyYxmv.d.mts.map → index-Dgwl8Tzs.d.mts.map} +1 -1
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs → invariants-CTHy88OP-CYI2a8IO.mjs} +2 -2
- package/dist/{invariants-CTHy88OP-DJ-i5yTz.mjs.map → invariants-CTHy88OP-CYI2a8IO.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D94PxRc-.mjs → io-635GlNx1-D3zrw2qu.mjs} +4 -4
- package/dist/{io-635GlNx1-D94PxRc-.mjs.map → io-635GlNx1-D3zrw2qu.mjs.map} +1 -1
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs → migration-graph-_SJImD5V-BURyY1KM.mjs} +2 -2
- package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs.map → migration-graph-_SJImD5V-BURyY1KM.mjs.map} +1 -1
- package/dist/{migration-gubSSeMk.mjs → migration-hspPIEeV.mjs} +4 -4
- package/dist/{migration-gubSSeMk.mjs.map → migration-hspPIEeV.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +4 -4
- package/dist/migration-tools.mjs +13 -13
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.d.mts +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration-ts.mjs +1 -1
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.d.mts +2 -2
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{migration-ts-BoHxxGvi.mjs → migration-ts-DdVm0rws.mjs} +2 -2
- package/dist/{migration-ts-BoHxxGvi.mjs.map → migration-ts-DdVm0rws.mjs.map} +1 -1
- package/dist/{output-DP3woAjV-BxCr9nHA.mjs → output-CovTDY14-CUoAqLML.mjs} +3 -45
- package/dist/output-CovTDY14-CUoAqLML.mjs.map +1 -0
- package/dist/publish-surface.d.mts +2 -2
- package/dist/publish-surface.mjs +2 -2
- package/dist/publish-surface__import-roots.d.mts +1 -1
- package/dist/publish-surface__import-roots.mjs +1 -1
- package/dist/publish-surface__shells.d.mts +1 -1
- package/dist/publish-surface__shells.mjs +1 -1
- package/dist/quick-reference-mongo.md +12 -9
- package/dist/quick-reference-postgres.md +12 -9
- package/dist/readme-mongo.md +2 -2
- package/dist/readme-postgres.md +2 -2
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs +4686 -0
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs.map +1 -0
- package/dist/{ref-resolution-sGcINe7o.mjs → ref-resolution-HeNBXW53.mjs} +2 -2
- package/dist/{ref-resolution-sGcINe7o.mjs.map → ref-resolution-HeNBXW53.mjs.map} +1 -1
- package/dist/{refs-WK86uYYp-B6EZkmmT.mjs → refs-WK86uYYp-gM8tvWQP.mjs} +2 -2
- package/dist/{refs-WK86uYYp-B6EZkmmT.mjs.map → refs-WK86uYYp-gM8tvWQP.mjs.map} +1 -1
- package/dist/{shells-BenrJHp2.mjs → shells-C4HbRAr5.mjs} +13 -14
- package/dist/shells-C4HbRAr5.mjs.map +1 -0
- package/dist/{shells-COHV_Ozf.d.mts → shells-CIUmT4u4.d.mts} +14 -20
- package/dist/shells-CIUmT4u4.d.mts.map +1 -0
- package/dist/{spaces-BG2w0P8d.mjs → spaces-4qMOAYE9.mjs} +7 -7
- package/dist/{spaces-BG2w0P8d.mjs.map → spaces-4qMOAYE9.mjs.map} +1 -1
- package/dist/{spaces-tWQi7CUv.d.mts → spaces-Dj65JrwZ.d.mts} +2 -2
- package/dist/{spaces-tWQi7CUv.d.mts.map → spaces-Dj65JrwZ.d.mts.map} +1 -1
- package/dist/{verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts → verify-contract-spaces-C3PiFBk3-DfomYyOE.d.mts} +3 -3
- package/dist/{verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map → verify-contract-spaces-C3PiFBk3-DfomYyOE.d.mts.map} +1 -1
- package/dist/{verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs → verify-contract-spaces-DhJTb0zM-B62maCfE.mjs} +4 -4
- package/dist/{verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs.map → verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +2 -2
- package/dist/vite-plugin-contract-emit.mjs +5 -5
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +14 -38
- package/dist/bin__prisma-next.mjs +0 -512
- package/dist/bin__prisma-next.mjs.map +0 -1
- package/dist/caught-errors-BZo7zcRc-C-pIEasG.mjs +0 -14
- package/dist/caught-errors-BZo7zcRc-C-pIEasG.mjs.map +0 -1
- package/dist/cli-errors-B4zTLaqQ-CXgjO9t4.mjs +0 -347
- package/dist/cli-errors-B4zTLaqQ-CXgjO9t4.mjs.map +0 -1
- package/dist/cli-errors-iquUoY6O-BFboxglv.d.mts.map +0 -1
- package/dist/cli__commands__contract-emit.d.mts +0 -2
- package/dist/cli__commands__contract-emit.mjs +0 -2
- package/dist/cli__commands__contract-infer.d.mts +0 -7
- package/dist/cli__commands__contract-infer.d.mts.map +0 -1
- package/dist/cli__commands__contract-infer.mjs +0 -2
- package/dist/cli__commands__db-init.d.mts +0 -7
- package/dist/cli__commands__db-init.d.mts.map +0 -1
- package/dist/cli__commands__db-init.mjs +0 -2
- package/dist/cli__commands__db-schema.d.mts +0 -7
- package/dist/cli__commands__db-schema.d.mts.map +0 -1
- package/dist/cli__commands__db-schema.mjs +0 -2
- package/dist/cli__commands__db-sign.d.mts +0 -7
- package/dist/cli__commands__db-sign.d.mts.map +0 -1
- package/dist/cli__commands__db-sign.mjs +0 -2
- package/dist/cli__commands__db-update.d.mts +0 -7
- package/dist/cli__commands__db-update.d.mts.map +0 -1
- package/dist/cli__commands__db-update.mjs +0 -2
- package/dist/cli__commands__db-verify.d.mts +0 -7
- package/dist/cli__commands__db-verify.d.mts.map +0 -1
- package/dist/cli__commands__db-verify.mjs +0 -2
- package/dist/cli__commands__migrate.d.mts +0 -57
- package/dist/cli__commands__migrate.d.mts.map +0 -1
- package/dist/cli__commands__migrate.mjs +0 -2
- package/dist/cli__commands__migration-check.d.mts +0 -8
- package/dist/cli__commands__migration-check.d.mts.map +0 -1
- package/dist/cli__commands__migration-check.mjs +0 -3
- package/dist/cli__commands__migration-graph.d.mts +0 -38
- package/dist/cli__commands__migration-graph.d.mts.map +0 -1
- package/dist/cli__commands__migration-graph.mjs +0 -2
- package/dist/cli__commands__migration-list.d.mts +0 -39
- package/dist/cli__commands__migration-list.d.mts.map +0 -1
- package/dist/cli__commands__migration-list.mjs +0 -2
- package/dist/cli__commands__migration-log.d.mts +0 -20
- package/dist/cli__commands__migration-log.d.mts.map +0 -1
- package/dist/cli__commands__migration-log.mjs +0 -2
- package/dist/cli__commands__migration-new.d.mts +0 -7
- package/dist/cli__commands__migration-new.d.mts.map +0 -1
- package/dist/cli__commands__migration-new.mjs +0 -2
- package/dist/cli__commands__migration-plan.d.mts +0 -34
- package/dist/cli__commands__migration-plan.d.mts.map +0 -1
- package/dist/cli__commands__migration-plan.mjs +0 -2
- package/dist/cli__commands__migration-show.d.mts +0 -27
- package/dist/cli__commands__migration-show.d.mts.map +0 -1
- package/dist/cli__commands__migration-show.mjs +0 -2
- package/dist/cli__commands__migration-status.d.mts +0 -55
- package/dist/cli__commands__migration-status.d.mts.map +0 -1
- package/dist/cli__commands__migration-status.mjs +0 -3
- package/dist/cli__commands__ref.d.mts +0 -7
- package/dist/cli__commands__ref.d.mts.map +0 -1
- package/dist/cli__commands__ref.mjs +0 -2
- package/dist/cli__commands__telemetry.d.mts +0 -7
- package/dist/cli__commands__telemetry.d.mts.map +0 -1
- package/dist/cli__commands__telemetry.mjs +0 -2
- package/dist/client-C6Qp5ujC-Dxb7r79B.mjs +0 -1653
- package/dist/client-C6Qp5ujC-Dxb7r79B.mjs.map +0 -1
- package/dist/code-templates-D_sGnEF6-DRLPzlq8.mjs +0 -295
- package/dist/code-templates-D_sGnEF6-DRLPzlq8.mjs.map +0 -1
- package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs +0 -65
- package/dist/combine-verify-results-B87B_pMc-D4l22OqY.mjs.map +0 -1
- package/dist/command-helpers-BCgwcqTe-lNCtppzM.mjs +0 -776
- package/dist/command-helpers-BCgwcqTe-lNCtppzM.mjs.map +0 -1
- package/dist/contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs +0 -44
- package/dist/contract-at-errors-BSoDI0Hw-BXeUNE3s.mjs.map +0 -1
- package/dist/contract-emit-BG7KL4zk-_a0J310Z.mjs +0 -331
- package/dist/contract-emit-BG7KL4zk-_a0J310Z.mjs.map +0 -1
- package/dist/contract-emit-BkEj3siG-C8M-IyvS.mjs +0 -2
- package/dist/contract-emit-CvwNE4R1-DEn1V1Zo.d.mts +0 -7
- package/dist/contract-emit-CvwNE4R1-DEn1V1Zo.d.mts.map +0 -1
- package/dist/contract-emit-GknCmgn_-BSWdFprC.mjs +0 -154
- package/dist/contract-emit-GknCmgn_-BSWdFprC.mjs.map +0 -1
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +0 -56
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +0 -1
- package/dist/contract-infer-BwIDGl7v-CZrdWXAr.mjs +0 -74
- package/dist/contract-infer-BwIDGl7v-CZrdWXAr.mjs.map +0 -1
- package/dist/contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs +0 -82
- package/dist/contract-snapshot-resolution-De2VvOJn-DqIAV9cr.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs +0 -303
- package/dist/contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs.map +0 -1
- package/dist/db-init-BolXrKAI-CwG-zEDW.mjs +0 -109
- package/dist/db-init-BolXrKAI-CwG-zEDW.mjs.map +0 -1
- package/dist/db-init-failure-B5cQML4A-5zr-99Ek.mjs +0 -44
- package/dist/db-init-failure-B5cQML4A-5zr-99Ek.mjs.map +0 -1
- package/dist/db-schema-DvdLBdEY-Dl6e1d_Y.mjs +0 -48
- package/dist/db-schema-DvdLBdEY-Dl6e1d_Y.mjs.map +0 -1
- package/dist/db-sign-DCp4c8CA-B3tun-kh.mjs +0 -172
- package/dist/db-sign-DCp4c8CA-B3tun-kh.mjs.map +0 -1
- package/dist/db-update-CfayE8WE-CPhQyDaZ.mjs +0 -171
- package/dist/db-update-CfayE8WE-CPhQyDaZ.mjs.map +0 -1
- package/dist/db-verify-BN7IrOAL-kEzRNJUl.mjs +0 -358
- package/dist/db-verify-BN7IrOAL-kEzRNJUl.mjs.map +0 -1
- package/dist/exports-B3xY_FHp.mjs.map +0 -1
- package/dist/exports-BZLNbtkY.mjs.map +0 -1
- package/dist/exports-CqNUihkI.mjs +0 -276
- package/dist/exports-CqNUihkI.mjs.map +0 -1
- package/dist/format-Ca7dUE6B-BMFqrc6D.mjs +0 -110
- package/dist/format-Ca7dUE6B-BMFqrc6D.mjs.map +0 -1
- package/dist/framework-components-Bau7o1-J-DTp6AUoq.mjs +0 -60
- package/dist/framework-components-Bau7o1-J-DTp6AUoq.mjs.map +0 -1
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +0 -35
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +0 -1
- package/dist/index-mCsi_ND5.d.mts.map +0 -1
- package/dist/init-B86mXFNC-C2HAUCRn.mjs +0 -800
- package/dist/init-B86mXFNC-C2HAUCRn.mjs.map +0 -1
- package/dist/inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs +0 -95
- package/dist/inspect-live-schema-BPHXdvqW-DrzL2ZkQ.mjs.map +0 -1
- package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs +0 -115
- package/dist/integrity-violation-to-check-failure-BmWMLAae-DqiC4_3p.mjs.map +0 -1
- package/dist/invariants-Bltd8DyA-Cg_1Lu0q.mjs +0 -53
- package/dist/invariants-Bltd8DyA-Cg_1Lu0q.mjs.map +0 -1
- package/dist/legend-DGv9e2_0-BtetgRz4.mjs +0 -22
- package/dist/legend-DGv9e2_0-BtetgRz4.mjs.map +0 -1
- package/dist/migrate-BXATUjYE-Do79Imf-.mjs +0 -343
- package/dist/migrate-BXATUjYE-Do79Imf-.mjs.map +0 -1
- package/dist/migrate-failure-D4NvkoCk-0bttmQs2.mjs +0 -96
- package/dist/migrate-failure-D4NvkoCk-0bttmQs2.mjs.map +0 -1
- package/dist/migrate-show-B8UJ9dmb-C4RTPbDk.d.mts +0 -63
- package/dist/migrate-show-B8UJ9dmb-C4RTPbDk.d.mts.map +0 -1
- package/dist/migrate-show-C_9xR4Qt-B-Y0PGKw.mjs +0 -199
- package/dist/migrate-show-C_9xR4Qt-B-Y0PGKw.mjs.map +0 -1
- package/dist/migration-check-Bbdw7t-r-C2VTMK61.mjs +0 -358
- package/dist/migration-check-Bbdw7t-r-C2VTMK61.mjs.map +0 -1
- package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs +0 -163
- package/dist/migration-check-DbHgYK7F-7mtYNVFu.mjs.map +0 -1
- package/dist/migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs +0 -121
- package/dist/migration-command-scaffold-SzjR2naH-Yi3-rNfX.mjs.map +0 -1
- package/dist/migration-graph-B8WxW_tm-qGNf7jQh.mjs +0 -35
- package/dist/migration-graph-B8WxW_tm-qGNf7jQh.mjs.map +0 -1
- package/dist/migration-graph-BOwu76mF-kOTWFvfV.mjs +0 -144
- package/dist/migration-graph-BOwu76mF-kOTWFvfV.mjs.map +0 -1
- package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs +0 -2127
- package/dist/migration-graph-command-render-h0VdTkSM-C3rPZEw1.mjs.map +0 -1
- package/dist/migration-graph-sections-BBHPOFN--COKyUKQ4.mjs +0 -69
- package/dist/migration-graph-sections-BBHPOFN--COKyUKQ4.mjs.map +0 -1
- package/dist/migration-list-CKuYcMQq-CubZzE9i.mjs +0 -130
- package/dist/migration-list-CKuYcMQq-CubZzE9i.mjs.map +0 -1
- package/dist/migration-list-CY08bD8I-PoXuv94c.mjs +0 -102
- package/dist/migration-list-CY08bD8I-PoXuv94c.mjs.map +0 -1
- package/dist/migration-log-CUbGla-9-BLIrWjwN.mjs +0 -123
- package/dist/migration-log-CUbGla-9-BLIrWjwN.mjs.map +0 -1
- package/dist/migration-log-table-eES9lPjv-BCFm8qJr.mjs +0 -116
- package/dist/migration-log-table-eES9lPjv-BCFm8qJr.mjs.map +0 -1
- package/dist/migration-new-ChvZjf5X-BFhEM0BF.mjs +0 -70
- package/dist/migration-new-ChvZjf5X-BFhEM0BF.mjs.map +0 -1
- package/dist/migration-new-DXMvJdbB-BkrpDfcr.mjs +0 -130
- package/dist/migration-new-DXMvJdbB-BkrpDfcr.mjs.map +0 -1
- package/dist/migration-path-target-JDWqF9kj-B7zoMq6X.mjs +0 -38
- package/dist/migration-path-target-JDWqF9kj-B7zoMq6X.mjs.map +0 -1
- package/dist/migration-plan-BV9f5Xjq-DiyscOMc.d.mts +0 -164
- package/dist/migration-plan-BV9f5Xjq-DiyscOMc.d.mts.map +0 -1
- package/dist/migration-plan-Bz1hOTHF-CFCtPuOv.mjs +0 -192
- package/dist/migration-plan-Bz1hOTHF-CFCtPuOv.mjs.map +0 -1
- package/dist/migration-plan-Cfz0efEL-DMNFq5b2.mjs +0 -621
- package/dist/migration-plan-Cfz0efEL-DMNFq5b2.mjs.map +0 -1
- package/dist/migration-show-BGdR1xnT-Cg3M0FPh.mjs +0 -178
- package/dist/migration-show-BGdR1xnT-Cg3M0FPh.mjs.map +0 -1
- package/dist/migration-status-BIrAJ5af-D-_mMBUA.mjs +0 -427
- package/dist/migration-status-BIrAJ5af-D-_mMBUA.mjs.map +0 -1
- package/dist/output-DP3woAjV-BxCr9nHA.mjs.map +0 -1
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +0 -43
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +0 -1
- package/dist/project-import-root-B4nM-VWX-D__g0hTb.mjs +0 -101
- package/dist/project-import-root-B4nM-VWX-D__g0hTb.mjs.map +0 -1
- package/dist/redact-secrets-ojVi2cpy-CLyiSDk5.mjs +0 -1476
- package/dist/redact-secrets-ojVi2cpy-CLyiSDk5.mjs.map +0 -1
- package/dist/ref-4x6BGSsd-ClaoZIQh.mjs +0 -95
- package/dist/ref-4x6BGSsd-ClaoZIQh.mjs.map +0 -1
- package/dist/ref-WXLIR9Xm-12IUtoBU.mjs +0 -104
- package/dist/ref-WXLIR9Xm-12IUtoBU.mjs.map +0 -1
- package/dist/ref-advancement-DaZBzm7m-WoqnFAyr.mjs +0 -96
- package/dist/ref-advancement-DaZBzm7m-WoqnFAyr.mjs.map +0 -1
- package/dist/ref-resolution-BSN1amKm-C6-TTM2N.mjs +0 -16
- package/dist/ref-resolution-BSN1amKm-C6-TTM2N.mjs.map +0 -1
- package/dist/refs-fQLFcMoq-aTBeUU9H.mjs +0 -47
- package/dist/refs-fQLFcMoq-aTBeUU9H.mjs.map +0 -1
- package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts +0 -206
- package/dist/schemas-BGgjiKV0-Rh8RlMCl.d.mts.map +0 -1
- package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs +0 -119
- package/dist/schemas-CYSD83Cu-Bff4PPoi.mjs.map +0 -1
- package/dist/shells-BenrJHp2.mjs.map +0 -1
- package/dist/shells-COHV_Ozf.d.mts.map +0 -1
- package/dist/telemetry-BD52LETE-Cqeb7ebh.mjs +0 -121
- package/dist/telemetry-BD52LETE-Cqeb7ebh.mjs.map +0 -1
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +0 -133
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +0 -1
- package/dist/terminal-ui-Cqz4LVL7-B0mcVdLy.mjs +0 -676
- package/dist/terminal-ui-Cqz4LVL7-B0mcVdLy.mjs.map +0 -1
- package/dist/verify-Cogr_Fj9-D3lCWA6t.mjs +0 -283
- package/dist/verify-Cogr_Fj9-D3lCWA6t.mjs.map +0 -1
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { A as errorRuntime$1, F as errorUnexpected, I as mapRefResolutionError, L as requireLiveDatabase, t as CliStructuredError$1, u as errorDatabaseConnectionRequired, w as errorPathUnreachable } from "./cli-errors-B4zTLaqQ-CXgjO9t4.mjs";
|
|
2
|
-
import { t as MigrationToolsError } from "./errors-CXbGUWGu-BQi6YS-H.mjs";
|
|
3
|
-
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
4
|
-
import { _ as resolveMigrationPaths, n as closeQuietly } from "./command-helpers-BCgwcqTe-lNCtppzM.mjs";
|
|
5
|
-
import { i as readRefs } from "./refs-WK86uYYp-B6EZkmmT.mjs";
|
|
6
|
-
import { u as requireHeadRef } from "./aggregate-BBsCbXgJ.mjs";
|
|
7
|
-
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs";
|
|
8
|
-
import { a as planSpacePath, t as createControlClient } from "./client-C6Qp5ujC-Dxb7r79B.mjs";
|
|
9
|
-
import { n as parseContractRef } from "./ref-resolution-sGcINe7o.mjs";
|
|
10
|
-
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
11
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migrate-show-C_9xR4Qt.mjs
|
|
12
|
-
/**
|
|
13
|
-
* Computes the path through the SAME seam as `executeMigrate`:
|
|
14
|
-
* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving
|
|
15
|
-
* the full marker including `invariants` (not just `storageHash`).
|
|
16
|
-
* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,
|
|
17
|
-
* which feeds `resolveRecordedPath()` with the same target hash, target invariants,
|
|
18
|
-
* and current marker as the real apply path uses.
|
|
19
|
-
*
|
|
20
|
-
* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No
|
|
21
|
-
* DB state is mutated.
|
|
22
|
-
*/
|
|
23
|
-
async function executeMigrateShowPlan(options) {
|
|
24
|
-
const config = options.config;
|
|
25
|
-
const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.configPath, config, options.cwd);
|
|
26
|
-
const dbConnection = options.db ?? config.db?.connection;
|
|
27
|
-
const hasDriver = !!config.driver;
|
|
28
|
-
const hasExplicitFrom = options.from !== void 0;
|
|
29
|
-
if (!hasExplicitFrom) {
|
|
30
|
-
const missingDb = requireLiveDatabase({
|
|
31
|
-
dbConnection,
|
|
32
|
-
hasDriver,
|
|
33
|
-
why: "migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)",
|
|
34
|
-
retryCommand: "prisma-next migrate --show --from <contract>"
|
|
35
|
-
});
|
|
36
|
-
if (missingDb) return notOk(missingDb);
|
|
37
|
-
}
|
|
38
|
-
let allRefs = {};
|
|
39
|
-
try {
|
|
40
|
-
allRefs = await readRefs(refsDir);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (MigrationToolsError.is(error)) return notOk(error);
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
46
|
-
if (!loaded.ok) return notOk(loaded.failure);
|
|
47
|
-
const { aggregate, contractHash } = loaded.value;
|
|
48
|
-
const appGraph = aggregate.app.graph();
|
|
49
|
-
let targetHash = contractHash;
|
|
50
|
-
let refInvariants;
|
|
51
|
-
if (options.to) {
|
|
52
|
-
const toResult = parseContractRef(options.to, {
|
|
53
|
-
graph: appGraph,
|
|
54
|
-
refs: allRefs,
|
|
55
|
-
contractHash
|
|
56
|
-
});
|
|
57
|
-
if (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));
|
|
58
|
-
if (toResult.value.provenance.kind === "reserved-db") return notOk(errorDatabaseConnectionRequired({
|
|
59
|
-
why: "@db is not valid as a --to target; it names the live database state, not a target contract.",
|
|
60
|
-
commandName: "migrate --show"
|
|
61
|
-
}));
|
|
62
|
-
targetHash = toResult.value.hash;
|
|
63
|
-
if (toResult.value.provenance.kind === "ref") {
|
|
64
|
-
const refEntry = allRefs[toResult.value.provenance.refName];
|
|
65
|
-
if (refEntry) refInvariants = refEntry.invariants;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
options.onPreflightComplete?.({
|
|
69
|
-
configPath,
|
|
70
|
-
migrationsRelative,
|
|
71
|
-
dbConnection,
|
|
72
|
-
hasExplicitFrom
|
|
73
|
-
});
|
|
74
|
-
const markerBySpace = /* @__PURE__ */ new Map();
|
|
75
|
-
const allSpaces = [aggregate.app, ...aggregate.extensions];
|
|
76
|
-
if (hasExplicitFrom) if (options.from === "@db") {
|
|
77
|
-
const missingDb = requireLiveDatabase({
|
|
78
|
-
dbConnection,
|
|
79
|
-
hasDriver,
|
|
80
|
-
why: "@db resolves to the live database marker and requires a --db connection",
|
|
81
|
-
retryCommand: "prisma-next migrate --show --from @db --db $DATABASE_URL"
|
|
82
|
-
});
|
|
83
|
-
if (missingDb) return notOk(missingDb);
|
|
84
|
-
} else {
|
|
85
|
-
const fromResult = parseContractRef(options.from, {
|
|
86
|
-
graph: appGraph,
|
|
87
|
-
refs: allRefs,
|
|
88
|
-
contractHash
|
|
89
|
-
});
|
|
90
|
-
if (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));
|
|
91
|
-
if (fromResult.value.provenance.kind === "reserved-db") {
|
|
92
|
-
const missingDb = requireLiveDatabase({
|
|
93
|
-
dbConnection,
|
|
94
|
-
hasDriver,
|
|
95
|
-
why: "@db resolves to the live database marker and requires a --db connection"
|
|
96
|
-
});
|
|
97
|
-
if (missingDb) return notOk(missingDb);
|
|
98
|
-
} else {
|
|
99
|
-
const fromHash = fromResult.value.hash;
|
|
100
|
-
const offlineMarker = fromHash === "empty" ? null : {
|
|
101
|
-
storageHash: fromHash,
|
|
102
|
-
invariants: []
|
|
103
|
-
};
|
|
104
|
-
markerBySpace.set(aggregate.app.spaceId, offlineMarker);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const needsLiveMarker = !hasExplicitFrom || options.from === "@db";
|
|
108
|
-
if (needsLiveMarker) {
|
|
109
|
-
if (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({
|
|
110
|
-
why: "A database connection is required to read the live marker for migrate --show",
|
|
111
|
-
commandName: "migrate --show"
|
|
112
|
-
}));
|
|
113
|
-
const client = (options.createClient ?? createControlClient)({
|
|
114
|
-
family: config.family,
|
|
115
|
-
target: config.target,
|
|
116
|
-
adapter: config.adapter,
|
|
117
|
-
driver: config.driver,
|
|
118
|
-
extensions: config.extensions ?? []
|
|
119
|
-
});
|
|
120
|
-
try {
|
|
121
|
-
await client.connect(dbConnection);
|
|
122
|
-
const allMarkers = await client.readAllMarkers();
|
|
123
|
-
for (const space of allSpaces) {
|
|
124
|
-
const marker = allMarkers.get(space.spaceId);
|
|
125
|
-
markerBySpace.set(space.spaceId, marker ?? null);
|
|
126
|
-
}
|
|
127
|
-
} catch (error) {
|
|
128
|
-
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
129
|
-
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));
|
|
130
|
-
} finally {
|
|
131
|
-
await closeQuietly(client);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];
|
|
135
|
-
const orderedMigrations = [];
|
|
136
|
-
for (const space of canonicalOrderSpaces) {
|
|
137
|
-
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
138
|
-
const headRef = requireHeadRef(space);
|
|
139
|
-
const outcome = planSpacePath({
|
|
140
|
-
space,
|
|
141
|
-
aggregate,
|
|
142
|
-
targetHash: isAppSpace ? targetHash : headRef.hash,
|
|
143
|
-
refInvariants: isAppSpace ? refInvariants : void 0,
|
|
144
|
-
liveMarker: markerBySpace.get(space.spaceId) ?? null
|
|
145
|
-
});
|
|
146
|
-
if (outcome.kind === "at-head") continue;
|
|
147
|
-
if (outcome.kind === "never-planned") return notOk(errorPathUnreachable({
|
|
148
|
-
code: "MIGRATION_PATH_NOT_FOUND",
|
|
149
|
-
summary: `No on-disk migrations for contract space "${outcome.spaceId}"`,
|
|
150
|
-
why: `migrate is replay-only: space "${outcome.spaceId}" has no on-disk migrations but its head ref targets "${outcome.targetHash}".`,
|
|
151
|
-
meta: {
|
|
152
|
-
spaceId: outcome.spaceId,
|
|
153
|
-
target: outcome.targetHash,
|
|
154
|
-
kind: "neverPlanned"
|
|
155
|
-
}
|
|
156
|
-
}));
|
|
157
|
-
if (outcome.kind === "unreachable") {
|
|
158
|
-
const fromHash = outcome.liveMarker?.storageHash ?? "empty";
|
|
159
|
-
return notOk(errorPathUnreachable({
|
|
160
|
-
code: "MIGRATION_PATH_NOT_FOUND",
|
|
161
|
-
summary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space "${outcome.spaceId}".`,
|
|
162
|
-
why: `The migration graph has no path from the from-state to the target in space "${outcome.spaceId}".`,
|
|
163
|
-
meta: {
|
|
164
|
-
spaceId: outcome.spaceId,
|
|
165
|
-
from: fromHash,
|
|
166
|
-
to: outcome.targetHash
|
|
167
|
-
}
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
if (outcome.kind === "unsatisfiable") return notOk(errorRuntime$1("MIGRATION.NO_INVARIANT_PATH", `Missing required invariants for space "${outcome.spaceId}"`, {
|
|
171
|
-
why: `The path requires invariants not available on disk: ${outcome.missing.join(", ")}`,
|
|
172
|
-
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.",
|
|
173
|
-
meta: {
|
|
174
|
-
spaceId: outcome.spaceId,
|
|
175
|
-
missing: [...outcome.missing]
|
|
176
|
-
}
|
|
177
|
-
}));
|
|
178
|
-
for (const edge of outcome.plan.migrationEdges) orderedMigrations.push({
|
|
179
|
-
spaceId: space.spaceId,
|
|
180
|
-
dirName: edge.dirName,
|
|
181
|
-
migrationHash: edge.migrationHash,
|
|
182
|
-
from: edge.from,
|
|
183
|
-
to: edge.to
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
const count = orderedMigrations.length;
|
|
187
|
-
return ok({
|
|
188
|
-
aggregate,
|
|
189
|
-
contractHash,
|
|
190
|
-
migrations: orderedMigrations,
|
|
191
|
-
summary: count === 0 ? "Already up to date — nothing to run" : `${count} migration${count === 1 ? "" : "s"} will run`,
|
|
192
|
-
renderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? "empty"])),
|
|
193
|
-
usedLiveMarker: needsLiveMarker
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
//#endregion
|
|
197
|
-
export { executeMigrateShowPlan as t };
|
|
198
|
-
|
|
199
|
-
//# sourceMappingURL=migrate-show-C_9xR4Qt-B-Y0PGKw.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-show-C_9xR4Qt-B-Y0PGKw.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-show-C_9xR4Qt.mjs"],"sourcesContent":["import { C as errorPathUnreachable, F as mapRefResolutionError, I as requireLiveDatabase, P as errorUnexpected, k as errorRuntime, l as errorDatabaseConnectionRequired, t as CliStructuredError } from \"./cli-errors-B4zTLaqQ.mjs\";\nimport { c as resolveMigrationPaths, n as closeQuietly } from \"./command-helpers-BCgwcqTe.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-fa04OIaL.mjs\";\nimport { n as planSpacePath, t as createControlClient } from \"./client-C6Qp5ujC.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { requireHeadRef } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/migrate-show.ts\n/**\n* Computes the path through the SAME seam as `executeMigrate`:\n* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n* the full marker including `invariants` (not just `storageHash`).\n* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,\n* which feeds `resolveRecordedPath()` with the same target hash, target invariants,\n* and current marker as the real apply path uses.\n*\n* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n* DB state is mutated.\n*/\nasync function executeMigrateShowPlan(options) {\n\tconst config = options.config;\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.configPath, config, options.cwd);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst hasExplicitFrom = options.from !== void 0;\n\tif (!hasExplicitFrom) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tlet targetHash = contractHash;\n\tlet refInvariants;\n\tif (options.to) {\n\t\tconst toResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));\n\t\tif (toResult.value.provenance.kind === \"reserved-db\") return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"@db is not valid as a --to target; it names the live database state, not a target contract.\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\ttargetHash = toResult.value.hash;\n\t\tif (toResult.value.provenance.kind === \"ref\") {\n\t\t\tconst refEntry = allRefs[toResult.value.provenance.refName];\n\t\t\tif (refEntry) refInvariants = refEntry.invariants;\n\t\t}\n\t}\n\toptions.onPreflightComplete?.({\n\t\tconfigPath,\n\t\tmigrationsRelative,\n\t\tdbConnection,\n\t\thasExplicitFrom\n\t});\n\tconst markerBySpace = /* @__PURE__ */ new Map();\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tif (hasExplicitFrom) if (options.from === \"@db\") {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from @db --db $DATABASE_URL\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t} else {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tif (fromResult.value.provenance.kind === \"reserved-db\") {\n\t\t\tconst missingDb = requireLiveDatabase({\n\t\t\t\tdbConnection,\n\t\t\t\thasDriver,\n\t\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\"\n\t\t\t});\n\t\t\tif (missingDb) return notOk(missingDb);\n\t\t} else {\n\t\t\tconst fromHash = fromResult.value.hash;\n\t\t\tconst offlineMarker = fromHash === EMPTY_CONTRACT_HASH ? null : {\n\t\t\t\tstorageHash: fromHash,\n\t\t\t\tinvariants: []\n\t\t\t};\n\t\t\tmarkerBySpace.set(aggregate.app.spaceId, offlineMarker);\n\t\t}\n\t}\n\tconst needsLiveMarker = !hasExplicitFrom || options.from === \"@db\";\n\tif (needsLiveMarker) {\n\t\tif (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"A database connection is required to read the live marker for migrate --show\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\tconst client = (options.createClient ?? createControlClient)({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconst allMarkers = await client.readAllMarkers();\n\t\t\tfor (const space of allSpaces) {\n\t\t\t\tconst marker = allMarkers.get(space.spaceId);\n\t\t\t\tmarkerBySpace.set(space.spaceId, marker ?? null);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait closeQuietly(client);\n\t\t}\n\t}\n\tconst canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];\n\tconst orderedMigrations = [];\n\tfor (const space of canonicalOrderSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: isAppSpace ? targetHash : headRef.hash,\n\t\t\trefInvariants: isAppSpace ? refInvariants : void 0,\n\t\t\tliveMarker: markerBySpace.get(space.spaceId) ?? null\n\t\t});\n\t\tif (outcome.kind === \"at-head\") continue;\n\t\tif (outcome.kind === \"never-planned\") return notOk(errorPathUnreachable({\n\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\tsummary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n\t\t\twhy: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\ttarget: outcome.targetHash,\n\t\t\t\tkind: \"neverPlanned\"\n\t\t\t}\n\t\t}));\n\t\tif (outcome.kind === \"unreachable\") {\n\t\t\tconst fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\treturn notOk(errorPathUnreachable({\n\t\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\t\tsummary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n\t\t\t\twhy: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n\t\t\t\tmeta: {\n\t\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: outcome.targetHash\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (outcome.kind === \"unsatisfiable\") return notOk(errorRuntime(\"MIGRATION.NO_INVARIANT_PATH\", `Missing required invariants for space \"${outcome.spaceId}\"`, {\n\t\t\twhy: `The path requires invariants not available on disk: ${outcome.missing.join(\", \")}`,\n\t\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\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\tmissing: [...outcome.missing]\n\t\t\t}\n\t\t}));\n\t\tfor (const edge of outcome.plan.migrationEdges) orderedMigrations.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to\n\t\t});\n\t}\n\tconst count = orderedMigrations.length;\n\treturn ok({\n\t\taggregate,\n\t\tcontractHash,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`,\n\t\trenderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH])),\n\t\tusedLiveMarker: needsLiveMarker\n\t});\n}\n//#endregion\nexport { executeMigrateShowPlan as t };\n\n//# sourceMappingURL=migrate-show-C_9xR4Qt.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,eAAe,uBAAuB,SAAS;CAC9C,MAAM,SAAS,QAAQ;CACvB,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBAAsB,QAAQ,YAAY,QAAQ,QAAQ,GAAG;CAChI,MAAM,eAAe,QAAQ,MAAM,OAAO,IAAI;CAC9C,MAAM,YAAY,CAAC,CAAC,OAAO;CAC3B,MAAM,kBAAkB,QAAQ,SAAS,KAAK;CAC9C,IAAI,CAAC,iBAAiB;EACrB,MAAM,YAAY,oBAAoB;GACrC;GACA;GACA,KAAK;GACL,cAAc;EACf,CAAC;EACD,IAAI,WAAW,OAAO,MAAM,SAAS;CACtC;CACA,IAAI,UAAU,CAAC;CACf,IAAI;EACH,UAAU,MAAM,SAAS,OAAO;CACjC,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACrD,MAAM;CACP;CACA,MAAM,SAAS,MAAM,mBAAmB,QAAQ,EAAE,cAAc,CAAC;CACjE,IAAI,CAAC,OAAO,IAAI,OAAO,MAAM,OAAO,OAAO;CAC3C,MAAM,EAAE,WAAW,iBAAiB,OAAO;CAC3C,MAAM,WAAW,UAAU,IAAI,MAAM;CACrC,IAAI,aAAa;CACjB,IAAI;CACJ,IAAI,QAAQ,IAAI;EACf,MAAM,WAAW,iBAAiB,QAAQ,IAAI;GAC7C,OAAO;GACP,MAAM;GACN;EACD,CAAC;EACD,IAAI,CAAC,SAAS,IAAI,OAAO,MAAM,sBAAsB,SAAS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e;GACnC,MAAM,WAAW,QAAQ,YAAY,eAAA;GACrC,OAAO,MAAM,qBAAqB;IACjC,MAAM;IACN,SAAS,0BAA0B,SAAS,MAAM,GAAG,EAAE,EAAE,MAAM,QAAQ,WAAW,MAAM,GAAG,EAAE,EAAE,aAAa,QAAQ,QAAQ;IAC5H,KAAK,+EAA+E,QAAQ,QAAQ;IACpG,MAAM;KACL,SAAS,QAAQ;KACjB,MAAM;KACN,IAAI,QAAQ;IACb;GACD,CAAC,CAAC;EACH;EACA,IAAI,QAAQ,SAAS,iBAAiB,OAAO,MAAMC,eAAa,+BAA+B,0CAA0C,QAAQ,QAAQ,IAAI;GAC5J,KAAK,uDAAuD,QAAQ,QAAQ,KAAK,IAAI;GACrF,KAAK;GACL,MAAM;IACL,SAAS,QAAQ;IACjB,SAAS,CAAC,GAAG,QAAQ,OAAO;GAC7B;EACD,CAAC,CAAC;EACF,KAAK,MAAM,QAAQ,QAAQ,KAAK,gBAAgB,kBAAkB,KAAK;GACtE,SAAS,MAAM;GACf,SAAS,KAAK;GACd,eAAe,KAAK;GACpB,MAAM,KAAK;GACX,IAAI,KAAK;EACV,CAAC;CACF;CACA,MAAM,QAAQ,kBAAkB;CAChC,OAAO,GAAG;EACT;EACA;EACA,YAAY;EACZ,SAAS,UAAU,IAAI,wCAAwC,GAAG,MAAM,YAAY,UAAU,IAAI,KAAK,IAAI;EAC3G,yBAAyB,IAAI,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,SAAS,cAAc,IAAI,EAAE,OAAO,CAAC,EAAE,eAAA,OAAkC,CAAC,CAAC;EACpI,gBAAgB;CACjB,CAAC;AACF"}
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
import { I as mapRefResolutionError, M as errorSpaceNotFound, R as runCommandAction, g as errorInvalidSpaceId, i as errorAmbiguousMigrationRef, r as chooseAction } from "./cli-errors-B4zTLaqQ-CXgjO9t4.mjs";
|
|
2
|
-
import { t as MigrationToolsError } from "./errors-CXbGUWGu-BQi6YS-H.mjs";
|
|
3
|
-
import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-B0G1Fw_F-C4JjmWEA.mjs";
|
|
4
|
-
import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
5
|
-
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
6
|
-
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories } from "./verify-contract-spaces-DhJTb0zM-_oh6W6lp.mjs";
|
|
7
|
-
import { g as resolveContractPath } from "./command-helpers-BCgwcqTe-lNCtppzM.mjs";
|
|
8
|
-
import { s as loadContractSpaceAggregate } from "./aggregate-BBsCbXgJ.mjs";
|
|
9
|
-
import { u as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-fa04OIaL-B7LXHle3.mjs";
|
|
10
|
-
import { r as parseMigrationRef } from "./ref-resolution-sGcINe7o.mjs";
|
|
11
|
-
import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-JDWqF9kj-B7zoMq6X.mjs";
|
|
12
|
-
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
13
|
-
import { join, relative } from "pathe";
|
|
14
|
-
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
15
|
-
import { readFile } from "node:fs/promises";
|
|
16
|
-
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
17
|
-
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
18
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-check-Bbdw7t-r.mjs
|
|
19
|
-
/**
|
|
20
|
-
* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.
|
|
21
|
-
*/
|
|
22
|
-
function migrationPathRelative(cwd, dirPath) {
|
|
23
|
-
return relative(cwd, dirPath);
|
|
24
|
-
}
|
|
25
|
-
function migrationFileRelative(cwd, dirPath, fileName) {
|
|
26
|
-
return join(migrationPathRelative(cwd, dirPath), fileName);
|
|
27
|
-
}
|
|
28
|
-
function checkFileExists(space, dirPath, dirName, fileName) {
|
|
29
|
-
if (!existsSync(join(dirPath, fileName))) return {
|
|
30
|
-
space: space.spaceId,
|
|
31
|
-
code: "MIGRATION.CHECK_FILE_MISSING",
|
|
32
|
-
where: migrationFileRelative(space.cwd, dirPath, fileName),
|
|
33
|
-
why: `${fileName} is missing from ${dirName}`,
|
|
34
|
-
nextActions: [chooseAction("Re-emit the migration package, or restore it from version control")]
|
|
35
|
-
};
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Snapshot-store consistency check for one migration package (D6.5):
|
|
40
|
-
* absent store entry is not an issue (runner independence, ADR 199 — a
|
|
41
|
-
* package dir with only `migration.json` + `ops.json` is legitimate); a
|
|
42
|
-
* present entry whose inner `storage.storageHash` disagrees with
|
|
43
|
-
* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store
|
|
44
|
-
* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.
|
|
45
|
-
*/
|
|
46
|
-
async function checkSnapshotConsistency(space, pkg, migrationsDir) {
|
|
47
|
-
const spaceId = space.spaceId;
|
|
48
|
-
let snapshotDir;
|
|
49
|
-
try {
|
|
50
|
-
snapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);
|
|
51
|
-
} catch {
|
|
52
|
-
return {
|
|
53
|
-
space: spaceId,
|
|
54
|
-
code: "MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE",
|
|
55
|
-
where: migrationPathRelative(space.cwd, pkg.dirPath),
|
|
56
|
-
why: `Migration "${pkg.dirName}" declares to="${pkg.metadata.to}", which is not a well-formed contract snapshot hash.`,
|
|
57
|
-
nextActions: [chooseAction("Re-emit the migration package so migration.json declares a valid 64-hex to-hash")]
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
let raw;
|
|
61
|
-
try {
|
|
62
|
-
raw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
if (MigrationToolsError.is(error) && error.code === "MIGRATION.CONTRACT_SNAPSHOT_MISSING") return null;
|
|
65
|
-
return {
|
|
66
|
-
space: spaceId,
|
|
67
|
-
code: "MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE",
|
|
68
|
-
where: migrationPathRelative(space.cwd, pkg.dirPath),
|
|
69
|
-
why: `Migration "${pkg.dirName}" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,
|
|
70
|
-
nextActions: [chooseAction("Restore migrations/snapshots/ from version control"), chooseAction("Or re-run the command that produced this migration to regenerate its snapshot")]
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const snapshotHash = (raw !== null && typeof raw === "object" ? raw : {})["storage"]?.["storageHash"];
|
|
74
|
-
if (typeof snapshotHash === "string" && snapshotHash !== pkg.metadata.to) return {
|
|
75
|
-
space: spaceId,
|
|
76
|
-
code: "MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH",
|
|
77
|
-
where: migrationPathRelative(space.cwd, pkg.dirPath),
|
|
78
|
-
why: `Migration "${pkg.dirName}" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,
|
|
79
|
-
nextActions: [chooseAction("Re-emit the migration package so migration.json and its contract snapshot agree")]
|
|
80
|
-
};
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Project the loaded {@link ContractSpaceAggregate} into the
|
|
85
|
-
* {@link CheckSpace} rows the multi-space check iterates — one per on-disk
|
|
86
|
-
* contract-space directory, in the aggregate's `app`-first ordering. Mirrors
|
|
87
|
-
* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space
|
|
88
|
-
* membership matches the on-disk directories, package / ref / graph data come
|
|
89
|
-
* from `aggregate.space(id)`.
|
|
90
|
-
*/
|
|
91
|
-
async function enumerateCheckSpaces(aggregate, projectMigrationsDir, cwd) {
|
|
92
|
-
const candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);
|
|
93
|
-
const onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));
|
|
94
|
-
const spaces = [];
|
|
95
|
-
for (const space of aggregate.spaces()) {
|
|
96
|
-
const spaceId = space.spaceId;
|
|
97
|
-
if (!isValidSpaceId(spaceId)) continue;
|
|
98
|
-
if (!onDiskSpaceIds.has(spaceId)) continue;
|
|
99
|
-
const migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);
|
|
100
|
-
spaces.push({
|
|
101
|
-
spaceId,
|
|
102
|
-
packages: space.packages,
|
|
103
|
-
refs: space.refs,
|
|
104
|
-
graph: space.graph(),
|
|
105
|
-
migrationsDir,
|
|
106
|
-
refsDir: spaceRefsDirectory(migrationsDir),
|
|
107
|
-
projectMigrationsDir,
|
|
108
|
-
cwd
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return spaces;
|
|
112
|
-
}
|
|
113
|
-
function checkManifestFilesPresent(space) {
|
|
114
|
-
if (!existsSync(space.migrationsDir)) return [];
|
|
115
|
-
const loadedDirNames = new Set(space.packages.map((p) => p.dirName));
|
|
116
|
-
const failures = [];
|
|
117
|
-
let entries;
|
|
118
|
-
try {
|
|
119
|
-
entries = readdirSync(space.migrationsDir);
|
|
120
|
-
} catch {
|
|
121
|
-
return failures;
|
|
122
|
-
}
|
|
123
|
-
for (const entry of entries) {
|
|
124
|
-
if (entry.startsWith(".") || entry.startsWith("_") || entry === "refs") continue;
|
|
125
|
-
const entryPath = join(space.migrationsDir, entry);
|
|
126
|
-
try {
|
|
127
|
-
if (!statSync(entryPath).isDirectory()) continue;
|
|
128
|
-
} catch {
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (!loadedDirNames.has(entry)) for (const f of ["migration.json", "ops.json"]) {
|
|
132
|
-
const fail = checkFileExists(space, entryPath, entry, f);
|
|
133
|
-
if (fail) failures.push(fail);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return failures;
|
|
137
|
-
}
|
|
138
|
-
function checkReachability(space) {
|
|
139
|
-
const allToHashes = new Set(space.packages.map((p) => p.metadata.to));
|
|
140
|
-
const failures = [];
|
|
141
|
-
for (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === "empty")) failures.push({
|
|
142
|
-
space: space.spaceId,
|
|
143
|
-
code: "MIGRATION.CHECK_UNREACHABLE_MIGRATION",
|
|
144
|
-
where: migrationPathRelative(space.cwd, pkg.dirPath),
|
|
145
|
-
why: `Migration "${pkg.dirName}" starts from ${pkg.metadata.from} which no other migration produces`,
|
|
146
|
-
nextActions: [chooseAction("Delete the unreachable migration"), chooseAction("Or re-emit a migration that connects it to the graph")]
|
|
147
|
-
});
|
|
148
|
-
return failures;
|
|
149
|
-
}
|
|
150
|
-
function checkDanglingRefs(space) {
|
|
151
|
-
const failures = [];
|
|
152
|
-
for (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({
|
|
153
|
-
space: space.spaceId,
|
|
154
|
-
code: "MIGRATION.CHECK_DANGLING_REF",
|
|
155
|
-
where: relative(space.cwd, join(space.refsDir, `${name}.json`)),
|
|
156
|
-
why: `Ref "${name}" points at ${entry.hash} which does not exist in the migration graph`,
|
|
157
|
-
nextActions: [runCommandAction("Point the ref at a graph node", `prisma-next ref set ${name} <valid-hash>`), chooseAction("Or delete the ref")]
|
|
158
|
-
});
|
|
159
|
-
return failures;
|
|
160
|
-
}
|
|
161
|
-
async function checkSpace(space) {
|
|
162
|
-
const snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space, pkg, space.projectMigrationsDir)));
|
|
163
|
-
return [
|
|
164
|
-
...checkManifestFilesPresent(space),
|
|
165
|
-
...snapshotFailures.filter((f) => f !== null),
|
|
166
|
-
...checkReachability(space),
|
|
167
|
-
...checkDanglingRefs(space)
|
|
168
|
-
];
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Policy core of the holistic `migration check`: validates `--space`,
|
|
172
|
-
* narrows the pre-enumerated spaces, and runs the per-space explicit graph
|
|
173
|
-
* checks (file-existence, snapshot consistency, reachability, dangling
|
|
174
|
-
* refs), aggregating every failure into one {@link MigrationCheckResult}.
|
|
175
|
-
*
|
|
176
|
-
* `--space` validation mirrors `migration list`: an invalid id →
|
|
177
|
-
* {@link errorInvalidSpaceId}; an id with no on-disk space →
|
|
178
|
-
* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.
|
|
179
|
-
* Aggregate-integrity violations (which already span every space) are folded
|
|
180
|
-
* in by the caller, not here.
|
|
181
|
-
*/
|
|
182
|
-
async function runMigrationCheck(inputs) {
|
|
183
|
-
const { spaces, spaceFilter } = inputs;
|
|
184
|
-
if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
|
|
185
|
-
if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));
|
|
186
|
-
const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
|
|
187
|
-
const failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();
|
|
188
|
-
if (failures.length === 0) return ok({
|
|
189
|
-
ok: true,
|
|
190
|
-
failures: [],
|
|
191
|
-
summary: "All checks passed"
|
|
192
|
-
});
|
|
193
|
-
return ok({
|
|
194
|
-
ok: false,
|
|
195
|
-
failures,
|
|
196
|
-
summary: `${failures.length} integrity failure(s)`
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
async function loadAggregateIntegrityViolations(config, migrationsDir) {
|
|
200
|
-
try {
|
|
201
|
-
const contractJsonContent = await readFile(resolveContractPath(config), "utf-8");
|
|
202
|
-
const familyInstance = config.family.create(createControlStack(config));
|
|
203
|
-
const declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);
|
|
204
|
-
const parsedAppContract = JSON.parse(contractJsonContent);
|
|
205
|
-
return (await loadContractSpaceAggregate({
|
|
206
|
-
migrationsDir,
|
|
207
|
-
deserializeContract: (json) => familyInstance.deserializeContract(json),
|
|
208
|
-
appContract: familyInstance.deserializeContract(parsedAppContract)
|
|
209
|
-
})).checkIntegrity({
|
|
210
|
-
declaredExtensions,
|
|
211
|
-
checkContracts: true
|
|
212
|
-
});
|
|
213
|
-
} catch {
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Ranks ref-resolution failure kinds by how informative they are, so a
|
|
219
|
-
* single-target check surfaces the most useful failure across spaces instead of
|
|
220
|
-
* whichever space failed first. `not-found` (the input matched nothing here)
|
|
221
|
-
* says the least; a malformed input, a wrong grammar, or an in-space ambiguity
|
|
222
|
-
* all say more.
|
|
223
|
-
*/
|
|
224
|
-
function refFailureSpecificity(error) {
|
|
225
|
-
switch (error.kind) {
|
|
226
|
-
case "wrong-grammar": return 3;
|
|
227
|
-
case "ambiguous": return 2;
|
|
228
|
-
case "invalid-format": return 1;
|
|
229
|
-
case "not-found": return 0;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Single-target (`check <ref/path>`) mode — resolves a migration reference
|
|
234
|
-
* across all contract spaces (or the one space narrowed by `--space <id>`).
|
|
235
|
-
*
|
|
236
|
-
* Resolution:
|
|
237
|
-
* - filesystem path → find the owning space by checking which space's
|
|
238
|
-
* `migrationsDir` contains the resolved path; falls back to app-relative
|
|
239
|
-
* validation when the path is outside every space dir.
|
|
240
|
-
* - ref → `parseMigrationRef` against each in-scope space; collect every
|
|
241
|
-
* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity
|
|
242
|
-
* error (qualify with `--space`).
|
|
243
|
-
*
|
|
244
|
-
* `--space <id>` is validated the same way the holistic path does it:
|
|
245
|
-
* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.
|
|
246
|
-
*/
|
|
247
|
-
async function checkSingleTarget(target, inputs) {
|
|
248
|
-
const { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative, cwd } = inputs;
|
|
249
|
-
if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {
|
|
250
|
-
error: errorInvalidSpaceId(spaceFilter),
|
|
251
|
-
exitCode: 2
|
|
252
|
-
};
|
|
253
|
-
if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {
|
|
254
|
-
error: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),
|
|
255
|
-
exitCode: 2
|
|
256
|
-
};
|
|
257
|
-
const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
|
|
258
|
-
let matchedSpace;
|
|
259
|
-
let matchedPkg;
|
|
260
|
-
if (looksLikePath(target)) {
|
|
261
|
-
const resolvedPath = resolveTargetPathAcrossSpaces(cwd, target, scopedSpaces);
|
|
262
|
-
if (resolvedPath !== null) for (const space of scopedSpaces) {
|
|
263
|
-
const found = findPackageByDirPath(space.packages, resolvedPath);
|
|
264
|
-
if (found) {
|
|
265
|
-
matchedSpace = space;
|
|
266
|
-
matchedPkg = found;
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
const resolved = resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative);
|
|
272
|
-
if (!resolved.ok) return {
|
|
273
|
-
error: resolved.failure,
|
|
274
|
-
exitCode: 2
|
|
275
|
-
};
|
|
276
|
-
const appSpace = scopedSpaces.find((s) => s.spaceId === "app");
|
|
277
|
-
if (appSpace) {
|
|
278
|
-
matchedSpace = appSpace;
|
|
279
|
-
matchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
} else {
|
|
283
|
-
const hits = [];
|
|
284
|
-
let bestParseFailure;
|
|
285
|
-
for (const space of scopedSpaces) {
|
|
286
|
-
const migResult = parseMigrationRef(target, {
|
|
287
|
-
graph: space.graph,
|
|
288
|
-
refs: space.refs
|
|
289
|
-
});
|
|
290
|
-
if (!migResult.ok) {
|
|
291
|
-
if (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
const pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);
|
|
295
|
-
if (pkg) hits.push({
|
|
296
|
-
space,
|
|
297
|
-
pkg
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
if (hits.length > 1) return {
|
|
301
|
-
error: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),
|
|
302
|
-
exitCode: 2
|
|
303
|
-
};
|
|
304
|
-
if (hits.length === 1) {
|
|
305
|
-
matchedSpace = hits[0].space;
|
|
306
|
-
matchedPkg = hits[0].pkg;
|
|
307
|
-
} else if (bestParseFailure !== void 0) return {
|
|
308
|
-
error: mapRefResolutionError(bestParseFailure),
|
|
309
|
-
exitCode: 2
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
if (!matchedPkg || !matchedSpace) return {
|
|
313
|
-
result: {
|
|
314
|
-
ok: false,
|
|
315
|
-
failures: [],
|
|
316
|
-
summary: `Migration package for "${target}" not found on disk`
|
|
317
|
-
},
|
|
318
|
-
exitCode: 2
|
|
319
|
-
};
|
|
320
|
-
const failures = [...checkManifestFilesPresent(matchedSpace)];
|
|
321
|
-
for (const f of ["migration.json", "ops.json"]) {
|
|
322
|
-
const fail = checkFileExists(matchedSpace, matchedPkg.dirPath, matchedPkg.dirName, f);
|
|
323
|
-
if (fail) failures.push(fail);
|
|
324
|
-
}
|
|
325
|
-
const verification = verifyMigrationHash(matchedPkg);
|
|
326
|
-
if (!verification.ok) failures.push({
|
|
327
|
-
space: matchedSpace.spaceId,
|
|
328
|
-
code: "MIGRATION.CHECK_HASH_MISMATCH",
|
|
329
|
-
where: migrationFileRelative(matchedSpace.cwd, matchedPkg.dirPath, "migration.json"),
|
|
330
|
-
why: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,
|
|
331
|
-
nextActions: [chooseAction("Re-emit the migration package, or restore it from version control")]
|
|
332
|
-
});
|
|
333
|
-
const snapshotFailure = await checkSnapshotConsistency(matchedSpace, matchedPkg, matchedSpace.projectMigrationsDir);
|
|
334
|
-
if (snapshotFailure) failures.push(snapshotFailure);
|
|
335
|
-
const resolvedSpaceId = matchedSpace.spaceId !== "app" ? matchedSpace.spaceId : void 0;
|
|
336
|
-
if (failures.length === 0) return {
|
|
337
|
-
result: {
|
|
338
|
-
ok: true,
|
|
339
|
-
failures: [],
|
|
340
|
-
summary: "All checks passed"
|
|
341
|
-
},
|
|
342
|
-
exitCode: 0,
|
|
343
|
-
...ifDefined("resolvedSpaceId", resolvedSpaceId)
|
|
344
|
-
};
|
|
345
|
-
return {
|
|
346
|
-
result: {
|
|
347
|
-
ok: false,
|
|
348
|
-
failures,
|
|
349
|
-
summary: `${failures.length} integrity failure(s)`
|
|
350
|
-
},
|
|
351
|
-
exitCode: 4,
|
|
352
|
-
...ifDefined("resolvedSpaceId", resolvedSpaceId)
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
//#endregion
|
|
356
|
-
export { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };
|
|
357
|
-
|
|
358
|
-
//# sourceMappingURL=migration-check-Bbdw7t-r-C2VTMK61.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-check-Bbdw7t-r-C2VTMK61.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-Bbdw7t-r.mjs"],"sourcesContent":["import { F as mapRefResolutionError, L as chooseAction, R as runCommandAction, h as errorInvalidSpaceId, j as errorSpaceNotFound, r as errorAmbiguousMigrationRef } from \"./cli-errors-B4zTLaqQ.mjs\";\nimport { s as resolveContractPath } from \"./command-helpers-BCgwcqTe.mjs\";\nimport { u as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-fa04OIaL.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-JDWqF9kj.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/control-api/operations/migration-check.ts\n/**\n* Policy core of `migration check`: per-space explicit graph checks, aggregate-integrity loading, and single-target resolution.\n*/\nfunction migrationPathRelative(cwd, dirPath) {\n\treturn relative(cwd, dirPath);\n}\nfunction migrationFileRelative(cwd, dirPath, fileName) {\n\treturn join(migrationPathRelative(cwd, dirPath), fileName);\n}\nfunction checkFileExists(space, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(space.cwd, dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(space, pkg, migrationsDir) {\n\tconst spaceId = space.spaceId;\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json declares a valid 64-hex to-hash\")]\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or re-run the command that produced this migration to regenerate its snapshot\")]\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package so migration.json and its contract snapshot agree\")]\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir, cwd) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir,\n\t\t\tcwd\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(space.cwd, pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tnextActions: [chooseAction(\"Delete the unreachable migration\"), chooseAction(\"Or re-emit a migration that connects it to the graph\")]\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(space.cwd, join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tnextActions: [runCommandAction(\"Point the ref at a graph node\", `prisma-next ref set ${name} <valid-hash>`), chooseAction(\"Or delete the ref\")]\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative, cwd } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(cwd, target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(cwd, target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedSpace.cwd, matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tnextActions: [chooseAction(\"Re-emit the migration package, or restore it from version control\")]\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\n//#endregion\nexport { runMigrationCheck as i, enumerateCheckSpaces as n, loadAggregateIntegrityViolations as r, checkSingleTarget as t };\n\n//# sourceMappingURL=migration-check-Bbdw7t-r.m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