@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-roots-NDOIEDVj.mjs","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.mjs"],"sourcesContent":["import { publicShells } from \"./shells.mjs\";\n//#region src/import-roots.ts\n/**\n* Import-root resolution: the one place that turns an internal workspace\n* specifier into the name generated code should carry.\n*\n* Emission writes package names into files the user keeps — generated\n* contract types, scaffolded migrations, `prisma-next init` output. Which\n* name is correct depends on how the application installed Prisma Next, so\n* every emitter resolves through an {@link ImportRoot} rather than hardcoding\n* a specifier. The mapping itself is `./shells`; nothing here duplicates it.\n*/\nconst INTERNAL_SCOPE = \"@internal/\";\nconst PUBLISHED_SCOPE = \"@prisma/\";\n/** An import root that emitted code cannot express. */\nvar ImportRootError = class extends Error {};\nconst internalImportRoot = { mode: \"internal\" };\n/**\n* The import root an application's own dependency list expresses.\n*\n* Emission has to name packages the application can actually resolve, and the\n* application already states which those are. Reading its manifest keeps the\n* two from drifting and lets consumers move to published names one project at\n* a time instead of behind a repository-wide switch.\n*\n* A project that names exactly one facade is on the facade root; one that\n* names platform shells without a facade is a decomposed install; anything\n* else — including a project with no `@prisma/orm-*` dependency at all — is on\n* the internal root, which emits workspace names unchanged.\n*\n* @throws {ImportRootError} when the project depends on two facades, which no\n* single generated file can be emitted for.\n*/\nfunction importRootForDependencies(dependencies) {\n\tconst named = new Set(dependencies);\n\tconst facades = [];\n\tlet hasPlatform = false;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (!named.has(shell)) continue;\n\t\tif (definition.kind === \"facade\") facades.push(shell);\n\t\tif (definition.kind === \"platform\") hasPlatform = true;\n\t}\n\tif (facades.length > 1) throw new ImportRootError(`an application may depend on only one database facade, but this one depends on ${facades.join(\" and \")}`);\n\tconst [facade] = facades;\n\tif (facade !== void 0) return {\n\t\tmode: \"facade\",\n\t\tfacade\n\t};\n\treturn hasPlatform ? { mode: \"platform\" } : internalImportRoot;\n}\nconst owners = buildOwnerIndex(publicShells);\n/**\n* Takes the shell map as an argument rather than closing over `publicShells`\n* so the duplicate-owner guard is reachable from a test: the real map is\n* valid by construction, and a guard nothing can exercise is a guard nobody\n* knows still works.\n*/\nfunction buildOwnerIndex(shells) {\n\tconst index = /* @__PURE__ */ new Map();\n\tfor (const [shell, definition] of shells) for (const pkg of definition.packages) {\n\t\tconst existing = index.get(pkg.name);\n\t\tif (existing !== void 0) throw new ImportRootError(`${pkg.name} is mapped to both ${existing.shell} and ${shell}; one module may live in only one published package (ADR 242)`);\n\t\tindex.set(pkg.name, {\n\t\t\tshell,\n\t\t\tentry: pkg.entry\n\t\t});\n\t}\n\treturn index;\n}\nfunction splitSpecifier(specifier) {\n\tconst [scope, pkg, ...rest] = specifier.split(\"/\");\n\treturn {\n\t\tname: `${scope}/${pkg}`,\n\t\tsubpath: rest.join(\"/\")\n\t};\n}\nfunction joinEntrypoint(shell, entry, subpath) {\n\tconst tail = [entry, subpath].filter(Boolean).join(\"/\");\n\treturn tail === \"\" ? shell : `${shell}/${tail}`;\n}\n/**\n* The shells an application installs directly under this root. Emitted code\n* may name only these: a package manager puts a package's own dependencies in\n* its own `node_modules`, so importing a transitively installed package fails\n* to resolve at run time even though the files are on disk.\n*/\nfunction directDependencyShells(root) {\n\tconst direct = /* @__PURE__ */ new Set();\n\tif (root.mode === \"internal\") return direct;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (definition.kind === \"extension\") direct.add(shell);\n\t\tif (root.mode === \"platform\" && definition.kind === \"platform\") direct.add(shell);\n\t}\n\tif (root.mode === \"facade\") direct.add(root.facade);\n\treturn direct;\n}\nfunction owningShell(specifier, name) {\n\tconst owner = owners.get(name);\n\tif (owner === void 0) throw new ImportRootError(`${specifier} is not mapped to any published shell`);\n\treturn owner;\n}\n/**\n* The platform-install name for an internal specifier, with the shell that\n* owns it. The shell build needs both: an import that stays inside the shell\n* being built is bundled rather than externalized.\n*/\nfunction platformEntrypointOf(specifier) {\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tconst owner = owningShell(specifier, name);\n\treturn {\n\t\tshell: owner.shell,\n\t\tid: joinEntrypoint(owner.shell, owner.entry, subpath)\n\t};\n}\n/**\n* The facade's own name for an internal specifier it republishes, or\n* `undefined` when the facade does not carry that surface.\n*/\nfunction facadeEntrypoint(facade, name, subpath) {\n\tconst definition = publicShells.get(facade);\n\t/* v8 ignore next -- @preserve: every ShellName is a key of publicShells */\n\tif (definition === void 0) throw new ImportRootError(`unknown shell ${facade}`);\n\tif (definition.kind !== \"facade\") throw new ImportRootError(`${facade} is a ${definition.kind} shell, not a facade`);\n\tfor (const reexport of definition.reexports ?? []) {\n\t\tif (reexport.package !== name) continue;\n\t\tif (subpath === \"\" && reexport.root === false) return void 0;\n\t\tif (reexport.subpaths !== void 0 && !reexport.subpaths.includes(subpath)) return void 0;\n\t\treturn joinEntrypoint(facade, reexport.entry, subpath);\n\t}\n}\nfunction describe(root) {\n\treturn root.mode === \"facade\" ? `${root.mode} (${root.facade})` : root.mode;\n}\nfunction resolveImportSpecifier(specifier, root) {\n\tif (root.mode === \"internal\") return specifier;\n\tif (!specifier.startsWith(INTERNAL_SCOPE)) return specifier;\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tif (root.mode === \"facade\") {\n\t\tconst republished = facadeEntrypoint(root.facade, name, subpath);\n\t\tif (republished !== void 0) return republished;\n\t}\n\tconst owner = owningShell(specifier, name);\n\tconst published = joinEntrypoint(owner.shell, owner.entry, subpath);\n\tif (!directDependencyShells(root).has(owner.shell)) throw new ImportRootError(unreachableUnder(specifier, published, root));\n\treturn published;\n}\n/**\n* Why a specifier has no name under `root`.\n*\n* The facade wording deliberately does not say \"not a direct dependency\":\n* under ADR 242 the answer to that is never \"install the platform package\n* too\", it is that the facade has to republish the surface.\n*/\nfunction unreachableUnder(specifier, published, root) {\n\tif (root.mode === \"facade\") return `${specifier} has no name under ${root.facade}: the facade does not republish ${published}. An application installs one facade and nothing else, so every surface it reaches has to be one of that facade’s own entrypoints (ADR 242).`;\n\treturn `${specifier} resolves to ${published}, which an application on the ${describe(root)} import root does not depend on directly. Emitted code may name only direct dependencies (ADR 242).`;\n}\nfunction createImportSpecifierResolver(root) {\n\tif (root.mode === \"internal\") return (specifier) => specifier;\n\treturn (specifier) => resolveImportSpecifier(specifier, root);\n}\n/**\n* Builds the resolver `prisma-next init` scaffolds with. Identical to\n* {@link createImportSpecifierResolver} except that it will not accept a root\n* a scaffold cannot express, so the impossible case is rejected where the\n* resolver is made rather than when a template happens to hit a name.\n*/\nfunction createScaffoldSpecifierResolver(root) {\n\treturn createImportSpecifierResolver(root);\n}\nconst MODULE_SPECIFIER = /\\b(?:from|import)\\s*\\(?\\s*(['\"])([^'\"\\n]+)\\1/g;\n/**\n* True when `source` contains module syntax that must carry a quoted\n* specifier: `import '<s>'`, `import('<s>')`, or an import/export clause\n* followed by `from '<s>'`.\n*\n* Deliberately independent of {@link MODULE_SPECIFIER} — it exists to notice\n* when that scanner has stopped matching, so it accepts any quote character,\n* including the backtick a renderer must never emit. It does still require a\n* quote: the word \"import\" on its own appears in prose and comments all the\n* time, and treating that as module syntax made the check below fire on files\n* that have no imports at all.\n*/\nconst HAS_IMPORT_SYNTAX = /(?:^|[\\s(;}])import\\s*[('\"`]|(?:^|[\\s;}])(?:import|export)\\b[\\w$*,{}\\s]*?\\bfrom\\s*['\"`]/;\n/** The module specifiers a generated source file names. */\nfunction importedSpecifiers(source) {\n\treturn [...source.matchAll(MODULE_SPECIFIER)].map(([, , specifier]) => specifier ?? \"\");\n}\n/**\n* The specifiers in a generated file that the application would not have as a\n* direct dependency under `root` — the thing no emitted file may contain.\n*\n* Under the `internal` root nothing is reported: those names are the\n* repository's own, and every in-repo consumer resolves them through the\n* workspace.\n*\n* Throws rather than returning `[]` when the source plainly has imports but\n* the scan found none. An audit whose scanner has stopped matching would\n* otherwise report every file as clean, which is the one failure mode that\n* makes the audit worse than not having it.\n*/\nfunction transitiveImports(source, root) {\n\tconst specifiers = importedSpecifiers(source);\n\tif (specifiers.length === 0 && HAS_IMPORT_SYNTAX.test(source)) throw new ImportRootError(\"source contains import syntax but no specifier was recognised; the audit would pass vacuously\");\n\tif (root.mode === \"internal\") return [];\n\tconst direct = new Set(directDependencyShells(root));\n\treturn specifiers.filter((specifier) => {\n\t\tif (specifier.startsWith(INTERNAL_SCOPE)) return true;\n\t\tif (!specifier.startsWith(PUBLISHED_SCOPE)) return false;\n\t\tconst [scope, shell] = specifier.split(\"/\");\n\t\treturn !direct.has(`${scope}/${shell}`);\n\t});\n}\n//#endregion\nexport { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };\n\n//# sourceMappingURL=import-roots.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;;AAExB,IAAI,kBAAkB,cAAc,MAAM,CAAC;AAC3C,MAAM,qBAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAiB9C,SAAS,0BAA0B,cAAc;CAChD,MAAM,QAAQ,IAAI,IAAI,YAAY;CAClC,MAAM,UAAU,CAAC;CACjB,IAAI,cAAc;CAClB,KAAK,MAAM,CAAC,OAAO,eAAe,cAAc;EAC/C,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG;EACvB,IAAI,WAAW,SAAS,UAAU,QAAQ,KAAK,KAAK;EACpD,IAAI,WAAW,SAAS,YAAY,cAAc;CACnD;CACA,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,gBAAgB,kFAAkF,QAAQ,KAAK,OAAO,GAAG;CAC3J,MAAM,CAAC,UAAU;CACjB,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,OAAO,cAAc,EAAE,MAAM,WAAW,IAA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NFBPAT1.mjs","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.mjs"],"sourcesContent":["import { publicShells } from \"./shells.mjs\";\n//#region src/import-roots.ts\n/**\n* Import-root resolution: the one place that turns an internal workspace\n* specifier into the name generated code should carry.\n*\n* Emission writes package names into files the user keeps — generated\n* contract types, scaffolded migrations, `prisma-next init` output. Which\n* name is correct depends on how the application installed Prisma Next, so\n* every emitter resolves through an {@link ImportRoot} rather than hardcoding\n* a specifier. The mapping itself is `./shells`; nothing here duplicates it.\n*/\nconst INTERNAL_SCOPE = \"@internal/\";\nconst PUBLISHED_SCOPE = \"@prisma/\";\n/** An import root that emitted code cannot express. */\nvar ImportRootError = class extends Error {};\nconst internalImportRoot = { mode: \"internal\" };\n/**\n* The import root an application's own dependency list expresses.\n*\n* Emission has to name packages the application can actually resolve, and the\n* application already states which those are. Reading its manifest keeps the\n* two from drifting and lets consumers move to published names one project at\n* a time instead of behind a repository-wide switch.\n*\n* A project that names exactly one facade is on the facade root; one that\n* names platform shells without a facade is a decomposed install; anything\n* else — including a project with no `@prisma/orm-*` dependency at all — is on\n* the internal root, which emits workspace names unchanged.\n*\n* @throws {ImportRootError} when the project depends on two facades, which no\n* single generated file can be emitted for.\n*/\nfunction importRootForDependencies(dependencies) {\n\tconst named = new Set(dependencies);\n\tconst facades = [];\n\tlet hasPlatform = false;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (!named.has(shell)) continue;\n\t\tif (definition.kind === \"facade\") facades.push(shell);\n\t\tif (definition.kind === \"platform\") hasPlatform = true;\n\t}\n\tif (facades.length > 1) throw new ImportRootError(`an application may depend on only one database facade, but this one depends on ${facades.join(\" and \")}`);\n\tconst [facade] = facades;\n\tif (facade !== void 0) return {\n\t\tmode: \"facade\",\n\t\tfacade\n\t};\n\treturn hasPlatform ? { mode: \"platform\" } : internalImportRoot;\n}\nconst owners = buildOwnerIndex(publicShells);\n/**\n* Takes the shell map as an argument rather than closing over `publicShells`\n* so the duplicate-owner guard is reachable from a test: the real map is\n* valid by construction, and a guard nothing can exercise is a guard nobody\n* knows still works.\n*/\nfunction buildOwnerIndex(shells) {\n\tconst index = /* @__PURE__ */ new Map();\n\tfor (const [shell, definition] of shells) for (const pkg of definition.packages) {\n\t\tconst existing = index.get(pkg.name);\n\t\tif (existing !== void 0) throw new ImportRootError(`${pkg.name} is mapped to both ${existing.shell} and ${shell}; one module may live in only one published package (ADR 242)`);\n\t\tindex.set(pkg.name, {\n\t\t\tshell,\n\t\t\tentry: pkg.entry\n\t\t});\n\t}\n\treturn index;\n}\nfunction splitSpecifier(specifier) {\n\tconst [scope, pkg, ...rest] = specifier.split(\"/\");\n\treturn {\n\t\tname: `${scope}/${pkg}`,\n\t\tsubpath: rest.join(\"/\")\n\t};\n}\nfunction joinEntrypoint(shell, entry, subpath) {\n\tconst tail = [entry, subpath].filter(Boolean).join(\"/\");\n\treturn tail === \"\" ? shell : `${shell}/${tail}`;\n}\n/**\n* The shells an application installs directly under this root. Emitted code\n* may name only these: a package manager puts a package's own dependencies in\n* its own `node_modules`, so importing a transitively installed package fails\n* to resolve at run time even though the files are on disk.\n*/\nfunction directDependencyShells(root) {\n\tconst direct = /* @__PURE__ */ new Set();\n\tif (root.mode === \"internal\") return direct;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (definition.kind === \"extension\") direct.add(shell);\n\t\tif (root.mode === \"platform\" && definition.kind === \"platform\") direct.add(shell);\n\t}\n\tif (root.mode === \"facade\") direct.add(root.facade);\n\treturn direct;\n}\nfunction owningShell(specifier, name) {\n\tconst owner = owners.get(name);\n\tif (owner === void 0) throw new ImportRootError(`${specifier} is not mapped to any published shell`);\n\treturn owner;\n}\n/**\n* The platform-install name for an internal specifier, with the shell that\n* owns it. The shell build needs both: an import that stays inside the shell\n* being built is bundled rather than externalized.\n*/\nfunction platformEntrypointOf(specifier) {\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tconst owner = owningShell(specifier, name);\n\treturn {\n\t\tshell: owner.shell,\n\t\tid: joinEntrypoint(owner.shell, owner.entry, subpath)\n\t};\n}\n/**\n* The facade's own name for an internal specifier it republishes, or\n* `undefined` when the facade does not carry that surface.\n*/\nfunction facadeEntrypoint(facade, name, subpath) {\n\tconst definition = publicShells.get(facade);\n\t/* v8 ignore next -- @preserve: every ShellName is a key of publicShells */\n\tif (definition === void 0) throw new ImportRootError(`unknown shell ${facade}`);\n\tif (definition.kind !== \"facade\") throw new ImportRootError(`${facade} is a ${definition.kind} shell, not a facade`);\n\tfor (const reexport of definition.reexports ?? []) {\n\t\tif (reexport.package !== name) continue;\n\t\tif (subpath === \"\" && reexport.root === false) return void 0;\n\t\tif (reexport.subpaths !== void 0 && !reexport.subpaths.includes(subpath)) return void 0;\n\t\treturn joinEntrypoint(facade, reexport.entry, subpath);\n\t}\n}\nfunction describe(root) {\n\treturn root.mode === \"facade\" ? `${root.mode} (${root.facade})` : root.mode;\n}\nfunction resolveImportSpecifier(specifier, root) {\n\tif (root.mode === \"internal\") return specifier;\n\tif (!specifier.startsWith(INTERNAL_SCOPE)) return specifier;\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tif (root.mode === \"facade\") {\n\t\tconst republished = facadeEntrypoint(root.facade, name, subpath);\n\t\tif (republished !== void 0) return republished;\n\t}\n\tconst owner = owningShell(specifier, name);\n\tconst published = joinEntrypoint(owner.shell, owner.entry, subpath);\n\tif (!directDependencyShells(root).has(owner.shell)) throw new ImportRootError(unreachableUnder(specifier, published, root));\n\treturn published;\n}\n/**\n* Why a specifier has no name under `root`.\n*\n* The facade wording deliberately does not say \"not a direct dependency\":\n* under ADR 242 the answer to that is never \"install the platform package\n* too\", it is that the facade has to republish the surface.\n*/\nfunction unreachableUnder(specifier, published, root) {\n\tif (root.mode === \"facade\") return `${specifier} has no name under ${root.facade}: the facade does not republish ${published}. An application installs one facade and nothing else, so every surface it reaches has to be one of that facade’s own entrypoints (ADR 242).`;\n\treturn `${specifier} resolves to ${published}, which an application on the ${describe(root)} import root does not depend on directly. Emitted code may name only direct dependencies (ADR 242).`;\n}\nfunction createImportSpecifierResolver(root) {\n\tif (root.mode === \"internal\") return (specifier) => specifier;\n\treturn (specifier) => resolveImportSpecifier(specifier, root);\n}\n/**\n* Builds the resolver `prisma-next init` scaffolds with. Identical to\n* {@link createImportSpecifierResolver} except that it will not accept a root\n* a scaffold cannot express, so the impossible case is rejected where the\n* resolver is made rather than when a template happens to hit a name.\n*/\nfunction createScaffoldSpecifierResolver(root) {\n\treturn createImportSpecifierResolver(root);\n}\nconst MODULE_SPECIFIER = /\\b(?:from|import)\\s*\\(?\\s*(['\"])([^'\"\\n]+)\\1/g;\n/**\n* True when `source` contains module syntax that must carry a quoted\n* specifier: `import '<s>'`, `import('<s>')`, or an import/export clause\n* followed by `from '<s>'`.\n*\n* Deliberately independent of {@link MODULE_SPECIFIER} — it exists to notice\n* when that scanner has stopped matching, so it accepts any quote character,\n* including the backtick a renderer must never emit. It does still require a\n* quote: the word \"import\" on its own appears in prose and comments all the\n* time, and treating that as module syntax made the check below fire on files\n* that have no imports at all.\n*/\nconst HAS_IMPORT_SYNTAX = /(?:^|[\\s(;}])import\\s*[('\"`]|(?:^|[\\s;}])(?:import|export)\\b[\\w$*,{}\\s]*?\\bfrom\\s*['\"`]/;\n/** The module specifiers a generated source file names. */\nfunction importedSpecifiers(source) {\n\treturn [...source.matchAll(MODULE_SPECIFIER)].map(([, , specifier]) => specifier ?? \"\");\n}\n/**\n* The specifiers in a generated file that the application would not have as a\n* direct dependency under `root` — the thing no emitted file may contain.\n*\n* Under the `internal` root nothing is reported: those names are the\n* repository's own, and every in-repo consumer resolves them through the\n* workspace.\n*\n* Throws rather than returning `[]` when the source plainly has imports but\n* the scan found none. An audit whose scanner has stopped matching would\n* otherwise report every file as clean, which is the one failure mode that\n* makes the audit worse than not having it.\n*/\nfunction transitiveImports(source, root) {\n\tconst specifiers = importedSpecifiers(source);\n\tif (specifiers.length === 0 && HAS_IMPORT_SYNTAX.test(source)) throw new ImportRootError(\"source contains import syntax but no specifier was recognised; the audit would pass vacuously\");\n\tif (root.mode === \"internal\") return [];\n\tconst direct = new Set(directDependencyShells(root));\n\treturn specifiers.filter((specifier) => {\n\t\tif (specifier.startsWith(INTERNAL_SCOPE)) return true;\n\t\tif (!specifier.startsWith(PUBLISHED_SCOPE)) return false;\n\t\tconst [scope, shell] = specifier.split(\"/\");\n\t\tconst name = `${scope}/${shell}`;\n\t\treturn !direct.has(name) && !EXTERNAL_DIRECT_DEPENDENCIES.has(name);\n\t});\n}\n/**\n* Published packages this workspace does not own but `init` installs into a\n* scaffolded application directly, so its files may import them:\n* `@prisma/cli-engine` is the config file's `defineConfig` import.\n*/\nconst EXTERNAL_DIRECT_DEPENDENCIES = /* @__PURE__ */ new Set([\"@prisma/cli-engine\"]);\n//#endregion\nexport { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };\n\n//# sourceMappingURL=import-roots.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;;AAExB,IAAI,kBAAkB,cAAc,MAAM,CAAC;AAC3C,MAAM,qBAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAiB9C,SAAS,0BAA0B,cAAc;CAChD,MAAM,QAAQ,IAAI,IAAI,YAAY;CAClC,MAAM,UAAU,CAAC;CACjB,IAAI,cAAc;CAClB,KAAK,MAAM,CAAC,OAAO,eAAe,cAAc;EAC/C,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG;EACvB,IAAI,WAAW,SAAS,UAAU,QAAQ,KAAK,KAAK;EACpD,IAAI,WAAW,SAAS,YAAY,cAAc;CACnD;CACA,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,gBAAgB,kFAAkF,QAAQ,KAAK,OAAO,GAAG;CAC3J,MAAM,CAAC,UAAU;CACjB,IAAI,WAAW,KAAK,G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AG;EACzB,OAAO,CAAC,OAAO,IAAI,IAAI,KAAK,CAAC,6BAA6B,IAAI,IAAI;CACnE,CAAC;AACF;;;;;;AAMA,MAAM,+CAA+C,IAAI,IAAI,CAAC,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as ShellName, t as ShellDefinition } from "./shells-
|
|
1
|
+
import { r as ShellName, t as ShellDefinition } from "./shells-CIUmT4u4.mjs";
|
|
2
2
|
//#region ../../../0-shared/publish-surface/dist/import-roots.d.mts
|
|
3
3
|
//#region src/import-roots.d.ts
|
|
4
4
|
/** An import root that emitted code cannot express. */
|
|
@@ -116,4 +116,4 @@ declare function importedSpecifiers(source: string): string[];
|
|
|
116
116
|
declare function transitiveImports(source: string, root: ImportRoot): string[];
|
|
117
117
|
//#endregion
|
|
118
118
|
export { ScaffoldImportRoot as a, createScaffoldSpecifierResolver as c, importedSpecifiers as d, internalImportRoot as f, transitiveImports as h, ImportSpecifierResolver as i, directDependencyShells as l, resolveImportSpecifier as m, ImportRootError as n, buildOwnerIndex as o, platformEntrypointOf as p, ImportRootMode as r, createImportSpecifierResolver as s, ImportRoot as t, importRootForDependencies as u };
|
|
119
|
-
//# sourceMappingURL=import-roots-
|
|
119
|
+
//# sourceMappingURL=import-roots-CfoYgejL.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-roots-
|
|
1
|
+
{"version":3,"file":"import-roots-CfoYgejL.d.mts","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.d.mts"],"mappings":";;;;cAGc,wBAAwB;KACjC;;;;;;;;;;;KAWA;WACM;;WAEA;WACA,QAAQ;;WAER;;cAEG,oBAAoB,QAAQ;EACxC;;;;;;;KAOG,2BAA2B;;;;;;;;;;;;;;;;;iBAiBf,0BAA0B,cAAc,mBAAmB;UAClE;WACC,OAAO;WACP;;;;;;;;iBAQM,gBAAgB,QAAQ,YAAY,WAAW,mBAAmB,YAAY;;;;;;;iBAO9E,uBAAuB,MAAM,aAAa,YAAY;;;;;;iBAMtD,qBAAqB;EACpC,OAAO;EACP;;iBAEe,uBAAuB,mBAAmB,MAAM;iBAChD,8BAA8B,MAAM,aAAa;;;;;;;;;;;;KAY7D,qBAAqB,QAAQ;EAChC;;;;;;;;iBAQe,gCAAgC,MAAM,qBAAqB;;iBAE3D,mBAAmB;;;;;;;;;;;;;;iBAcnB,kBAAkB,gBAAgB,MAAM"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
2
2
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
3
|
-
import { PrismaNextConfig, PrismaNextConfig as PrismaNextConfig$1 } from "@prisma/orm-framework/config/config-types";
|
|
4
3
|
import { ConfigSection } from "@prisma/orm-framework/config/config-validation";
|
|
4
|
+
import { PrismaNextConfig, PrismaNextConfig as PrismaNextConfig$1 } from "@prisma/orm-framework/config/config-types";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/config-loader/dist/exports/index.d.mts
|
|
6
6
|
//#region src/finalize-config.d.ts
|
|
7
7
|
declare function finalizeConfig(config: PrismaNextConfig, configDir: string): PrismaNextConfig;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/load.d.ts
|
|
10
|
+
/** A deprecated spelling the loader accepted; callers surface it as a warning. */
|
|
11
|
+
interface ConfigDeprecation {
|
|
12
|
+
readonly code: 'CONFIG.DEPRECATED_FILENAME' | 'CONFIG.DEPRECATED_SHAPE';
|
|
13
|
+
readonly message: string;
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* A successfully evaluated config plus the structural diagnostics found in it.
|
|
12
17
|
* Diagnostics are tagged with the config section they concern
|
|
@@ -17,6 +22,7 @@ declare function finalizeConfig(config: PrismaNextConfig, configDir: string): Pr
|
|
|
17
22
|
interface LoadedConfig {
|
|
18
23
|
readonly config: PrismaNextConfig;
|
|
19
24
|
readonly diagnostics: readonly CliStructuredError[];
|
|
25
|
+
readonly deprecations: readonly ConfigDeprecation[];
|
|
20
26
|
}
|
|
21
27
|
declare function findNearestConfigPathForFile(filePath: string): Promise<string | undefined>;
|
|
22
28
|
/**
|
|
@@ -42,8 +48,10 @@ declare function requireConfigSections(loaded: LoadedConfig, sections: readonly
|
|
|
42
48
|
* {@link requireConfigSections} for commands that read a fixed set of
|
|
43
49
|
* sections and have no use for diagnostics outside them.
|
|
44
50
|
*/
|
|
45
|
-
declare function loadConfigForSections(configPath: string | undefined, sections: readonly ConfigSection[]
|
|
51
|
+
declare function loadConfigForSections(configPath: string | undefined, sections: readonly ConfigSection[], options?: {
|
|
52
|
+
readonly onDeprecation?: (deprecation: ConfigDeprecation) => void;
|
|
53
|
+
}): Promise<Result<PrismaNextConfig, CliStructuredError>>;
|
|
46
54
|
declare function loadConfigForFile(filePath: string): Promise<Result<LoadedConfig, CliStructuredError>>;
|
|
47
55
|
//#endregion
|
|
48
56
|
export { findNearestConfigPathForFile as a, loadConfigForSections as c, finalizeConfig as i, requireConfigSections as l, LoadedConfig as n, loadConfig as o, PrismaNextConfig$1 as r, loadConfigForFile as s, ConfigSection as t };
|
|
49
|
-
//# sourceMappingURL=index-
|
|
57
|
+
//# sourceMappingURL=index-DRs7L6N0.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DRs7L6N0.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.d.mts"],"mappings":";;;;;;iBAKiB,eAAe,QAAQ,kBAAoB,oBAAoB;;;;UAItE;WACC;WACA;;;;;;;;;UASD;WACC,QAAQ;WACR,sBAAsB;WACtB,uBAAuB;;iBAEjB,6BAA6B,mBAAmB;;;;;;;;;;iBAUhD,WAAW,qBAAqB;WACtC;IACP,QAAQ,OAAO,cAAc;;;;;;iBAMhB,sBAAsB,QAAQ,cAAc,mBAAmB,kBAAkB,OAAO,kBAAoB;;;;;;iBAM5G,sBAAsB,gCAAgC,mBAAmB,iBAAiB;WAChG,iBAAiB,aAAa;IACrC,QAAQ,OAAO,kBAAoB;iBACtB,kBAAkB,mBAAmB,QAAQ,OAAO,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./domain-type-generation-PkAb39ob-Ct8AGqow.mjs";
|
|
2
|
-
import { AggregateDescriptor } from "@prisma/orm-framework/components/components";
|
|
3
2
|
import { EmissionSpi, GenerateContractTypesOptions, ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
4
3
|
import { PreserveEmptyPredicate, SerializeContract, StorageSort } from "@prisma/orm-framework/contract/hashing";
|
|
4
|
+
import { AggregateDescriptor } from "@prisma/orm-framework/components/components";
|
|
5
5
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
6
6
|
import { AnyCodecDescriptor, CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
7
7
|
//#region ../../../1-framework/3-tooling/emitter/dist/index-uXQjRiyo.d.mts
|
|
@@ -75,4 +75,4 @@ declare function generateContractDts(contract: Contract, emitter: EmissionSpi, c
|
|
|
75
75
|
}, options?: GenerateContractTypesOptions, codecLookup?: CodecLookup, resolveImportSpecifier?: ImportSpecifierResolver): string;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { emit as a, EmittedArtifactPaths as i, EmitResult as n, generateContractDts as o, EmitStackInput as r, getEmittedArtifactPaths as s, EmitOptions as t };
|
|
78
|
-
//# sourceMappingURL=index-
|
|
78
|
+
//# sourceMappingURL=index-Dgwl8Tzs.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Dgwl8Tzs.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/index-uXQjRiyo.d.mts"],"mappings":";;;;;;;;UAOU;WACC;WACA;;iBAEM,wBAAwB,yBAAyB;;;;;;;;UAQxD;WACC,mBAAmB,cAAc;WACjC,4BAA4B,cAAc;WAC1C,eAAe;WACf,cAAc;WACd,mBAAmB,cAAc;WACjC,uBAAuB,cAAc;;UAEtC;WACC;;;;;;;;;;WAUA,mBAAmB;;;;;WAKnB,sBAAsB;;;;;WAKtB,cAAc;;;;;;;WAOd,yBAAyB;;UAE1B;WACC;WACA;WACA;WACA;WACA;;;;iBAIM,KAAK,UAAU,UAAU,OAAO,gBAAgB,cAAc,aAAa,SAAS,cAAc,QAAQ;;;iBAG1G,oBAAoB,UAAU,UAAU,SAAS,aAAa,kBAAkB,cAAc,kBAAkB;WACtH;WACA;WACA;GACR,UAAU,8BAA8B,cAAc,aAAa,yBAAyB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-CXbGUWGu-
|
|
1
|
+
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-CXbGUWGu-CstQHPh6.mjs";
|
|
2
2
|
//#region ../../../1-framework/3-tooling/migration/dist/invariants-CTHy88OP.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Hygiene check for `invariantId`. Rejects empty values plus any
|
|
@@ -54,4 +54,4 @@ function readInvariantId(op) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { validateInvariantId as n, deriveProvidedInvariants as t };
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=invariants-CTHy88OP-
|
|
57
|
+
//# sourceMappingURL=invariants-CTHy88OP-CYI2a8IO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariants-CTHy88OP-
|
|
1
|
+
{"version":3,"file":"invariants-CTHy88OP-CYI2a8IO.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-CTHy88OP.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-CXbGUWGu.mjs\";\n//#region src/invariants.ts\n/**\n* Hygiene check for `invariantId`. Rejects empty values plus any\n* whitespace or control character (including Unicode whitespace like\n* NBSP and em space, which are visually identical to ASCII space and\n* routinely sneak in via paste).\n*/\nfunction validateInvariantId(invariantId) {\n\tif (invariantId.length === 0) return false;\n\treturn !/[\\p{Cc}\\p{White_Space}]/u.test(invariantId);\n}\n/**\n* Walk a migration's operations and produce its `providedInvariants`\n* aggregate: the sorted, deduplicated list of `invariantId`s declared\n* by ops in the migration. Ops without an `invariantId` are skipped.\n*\n* Both `data`-class ops (data-transforms, e.g. backfills) and\n* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle\n* via `installEqlBundleOp`) may declare invariantIds: the\n* `operationClass` axis classifies *policy gating* (which kinds of ops\n* a `db init` / `db update` policy permits), while `invariantId`\n* classifies *marker bookkeeping* (which named bundles of work a\n* future regeneration knows to skip). The two concerns are\n* intentionally orthogonal — an extension can ship additive\n* non-IR-derivable DDL (the only way the planner can know the bundle\n* is already applied is via the invariantId on the marker) without\n* needing to mis-classify it as `data`-class.\n*\n* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and\n* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.\n*\n* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n* — extension migrations carry `invariantId`s on additive ops; e.g.\n* cipherstash's `installEqlBundle` and structural `create-*` ops are\n* additive-class but carry `cipherstash:*` invariantIds.\n*/\nfunction deriveProvidedInvariants(ops) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const op of ops) {\n\t\tconst invariantId = readInvariantId(op);\n\t\tif (invariantId === void 0) continue;\n\t\tif (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);\n\t\tif (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);\n\t\tseen.add(invariantId);\n\t}\n\treturn [...seen].sort();\n}\nfunction readInvariantId(op) {\n\tif (!Object.hasOwn(op, \"invariantId\")) return void 0;\n\tconst candidate = op.invariantId;\n\treturn typeof candidate === \"string\" ? candidate : void 0;\n}\n//#endregion\nexport { validateInvariantId as n, deriveProvidedInvariants as t };\n\n//# sourceMappingURL=invariants-CTHy88OP.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,aAAa;CACzC,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,OAAO,CAAC,2BAA2B,KAAK,WAAW;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB,KAAK;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,MAAM,KAAK;EACrB,MAAM,cAAc,gBAAgB,EAAE;EACtC,IAAI,gBAAgB,KAAK,GAAG;EAC5B,IAAI,CAAC,oBAAoB,WAAW,GAAG,MAAM,wBAAwB,WAAW;EAChF,IAAI,KAAK,IAAI,WAAW,GAAG,MAAM,8BAA8B,WAAW;EAC1E,KAAK,IAAI,WAAW;CACrB;CACA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;AACvB;AACA,SAAS,gBAAgB,IAAI;CAC5B,IAAI,CAAC,OAAO,OAAO,IAAI,aAAa,GAAG,OAAO,KAAK;CACnD,MAAM,YAAY,GAAG;CACrB,OAAO,OAAO,cAAc,WAAW,YAAY,KAAK;AACzD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, j as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-CXbGUWGu-
|
|
2
|
-
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-B0G1Fw_F-
|
|
1
|
+
import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, j as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-CXbGUWGu-CstQHPh6.mjs";
|
|
2
|
+
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs";
|
|
3
3
|
import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
4
|
-
import { t as deriveProvidedInvariants } from "./invariants-CTHy88OP-
|
|
4
|
+
import { t as deriveProvidedInvariants } from "./invariants-CTHy88OP-CYI2a8IO.mjs";
|
|
5
5
|
import { n as MigrationOpsSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
|
|
6
6
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
7
|
import { basename, dirname, join, resolve } from "pathe";
|
|
@@ -310,4 +310,4 @@ function formatMigrationDirName(timestamp, slug) {
|
|
|
310
310
|
//#endregion
|
|
311
311
|
export { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };
|
|
312
312
|
|
|
313
|
-
//# sourceMappingURL=io-635GlNx1-
|
|
313
|
+
//# sourceMappingURL=io-635GlNx1-D3zrw2qu.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io-635GlNx1-D94PxRc-.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-635GlNx1.mjs"],"sourcesContent":["import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, j as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from \"./errors-CXbGUWGu.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-B0G1Fw_F.mjs\";\nimport { n as verifyMigrationHash } from \"./hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-CTHy88OP.mjs\";\nimport { n as MigrationOpsSchema } from \"./op-schema-BSVHzEQN.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join, resolve } from \"pathe\";\nimport { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/io.ts\nconst MANIFEST_FILE = \"migration.json\";\nconst OPS_FILE = \"ops.json\";\nconst MAX_SLUG_LENGTH = 64;\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\nconst MigrationMetadataSchema = type({\n\t\"+\": \"reject\",\n\tfrom: \"string > 0 | null\",\n\tto: \"string\",\n\tmigrationHash: \"string\",\n\tprovidedInvariants: \"string[]\",\n\tcreatedAt: \"string\"\n});\nasync function writeMigrationPackage(dir, metadata, ops) {\n\tawait mkdir(dirname(dir), { recursive: true });\n\ttry {\n\t\tawait mkdir(dir);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"EEXIST\")) throw errorDirectoryExists(dir);\n\t\tthrow error;\n\t}\n\tawait writeFile(join(dir, MANIFEST_FILE), JSON.stringify(metadata, null, 2), { flag: \"wx\" });\n\tawait writeFile(join(dir, OPS_FILE), JSON.stringify(ops, null, 2), { flag: \"wx\" });\n}\n/**\n* Materialise an in-memory {@link MigrationPackage} to a per-space\n* directory on disk.\n*\n* Writes two files under `<targetDir>/<pkg.dirName>/`:\n*\n* - `migration.json` — the manifest (pretty-printed, matches\n* {@link writeMigrationPackage}'s output for byte-for-byte parity with\n* app-space migrations).\n* - `ops.json` — the operation list (pretty-printed).\n*\n* Distinct verb from the lower-level {@link writeMigrationPackage}\n* (which takes constituent `(metadata, ops)`): callers reading\n* `materialise…` know they are persisting a struct-typed package.\n*\n* Overwrite-idempotent: the per-package directory is cleared before\n* each emit, so re-running against the same `targetDir` produces\n* byte-identical contents and never leaves stale files behind. The\n* lower-level {@link writeMigrationPackage} stays strict because the\n* CLI authoring path (`migration plan` / `migration new`) deliberately\n* refuses to clobber an existing authored migration; this helper is\n* the re-emit path that is supposed to converge on a single canonical\n* on-disk shape.\n*\n* The per-space head contract resolves through\n* `<projectMigrationsDir>/snapshots/<hex>/` (written by\n* {@link import('./emit-contract-space-artifacts').emitContractSpaceArtifacts}),\n* not inside the per-package directory. The runner reads only\n* `migration.json` + `ops.json` from each package.\n*/\nasync function materialiseMigrationPackage(targetDir, pkg) {\n\tconst dir = join(targetDir, pkg.dirName);\n\tawait rm(dir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait writeMigrationPackage(dir, pkg.metadata, pkg.ops);\n}\n/**\n* Idempotent variant of {@link materialiseMigrationPackage}: writes the\n* package only if `<targetDir>/<pkg.dirName>/` does not already exist on\n* disk as a directory; returns `{ written: false }` when the package\n* directory is present (no rewrite, no comparison — by-existence skip).\n*\n* Concretely:\n* - existing directory → skip silently, return `{ written: false }`.\n* - missing path → write three files via {@link materialiseMigrationPackage},\n* return `{ written: true }`.\n* - path exists but is not a directory (file/symlink) → treated as\n* missing; {@link materialiseMigrationPackage} will attempt creation\n* and fail with an appropriate OS error.\n* - any other I/O error from `stat` → propagated unchanged.\n*\n* Used by the CLI's `runContractSpaceExtensionMigrationsPass` to\n* materialise extension migration packages into a project's\n* `migrations/<spaceId>/` directory, and by extension-package tests\n* that mirror the same idempotent-rematerialise property locally\n* without taking a CLI dependency.\n*/\nasync function materialiseExtensionMigrationPackageIfMissing(targetDir, pkg) {\n\tif (await directoryExists(join(targetDir, pkg.dirName))) return { written: false };\n\tawait materialiseMigrationPackage(targetDir, pkg);\n\treturn { written: true };\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\n/**\n* Copy a list of files into `destDir`, optionally renaming each one.\n*\n* The destination directory is created (with `recursive: true`) if it\n* does not already exist. Each source path is copied byte-for-byte into\n* `destDir/<destName>`; missing sources throw `ENOENT`. The helper is\n* intentionally generic: callers own the list of files and the naming\n* convention for the copies.\n*/\nasync function copyFilesWithRename(destDir, files) {\n\tawait mkdir(destDir, { recursive: true });\n\tfor (const file of files) {\n\t\tif (basename(file.destName) !== file.destName) throw errorInvalidDestName(file.destName);\n\t\tawait copyFile(file.sourcePath, join(destDir, file.destName));\n\t}\n}\nasync function writeMigrationMetadata(dir, metadata) {\n\tawait writeFile(join(dir, MANIFEST_FILE), `${JSON.stringify(metadata, null, 2)}\\n`);\n}\nasync function writeMigrationOps(dir, ops) {\n\tawait writeFile(join(dir, OPS_FILE), `${JSON.stringify(ops, null, 2)}\\n`);\n}\nasync function readMigrationPackage(dir, options) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(MANIFEST_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(OPS_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(manifestPath, e instanceof Error ? e.message : String(e));\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(opsPath, e instanceof Error ? e.message : String(e));\n\t}\n\tvalidateMetadata(metadata, manifestPath);\n\tvalidateOps(ops, opsPath);\n\tconst derivedInvariants = deriveProvidedInvariants(ops);\n\tif (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);\n\tconst endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to);\n\tconst pkg = {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops,\n\t\t...ifDefined(\"endContractJson\", endContractJson)\n\t};\n\tconst verification = verifyMigrationHash(pkg);\n\tif (!verification.ok) throw errorMigrationHashMismatch(absoluteDir, verification.storedHash, verification.computedHash);\n\treturn pkg;\n}\n/**\n* Reads a migration package's manifest and ops without running hash or\n* invariants verification. Returns `null` when the files cannot be read or\n* parsed (i.e. when the package is genuinely unloadable).\n*\n* Used by {@link readMigrationsDir} to retain a package whose hash or\n* invariants diverge from what is stored on disk — the raw content is still\n* useful for display / querying; only integrity is in question.\n*/\nasync function readMigrationPackageRaw(dir) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (MigrationMetadataSchema(metadata) instanceof type.errors) return null;\n\tif (MigrationOpsSchema(ops) instanceof type.errors) return null;\n\treturn {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops\n\t};\n}\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\nfunction validateMetadata(metadata, filePath) {\n\tconst result = MigrationMetadataSchema(metadata);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction validateOps(ops, filePath) {\n\tconst result = MigrationOpsSchema(ops);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction packageLoadProblemDetailFromError(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nasync function readMigrationsDir(migrationsRoot, options) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(migrationsRoot);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\tpackages: [],\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst packages = [];\n\tconst problems = [];\n\tfor (const entry of entries.sort()) {\n\t\tconst entryPath = join(migrationsRoot, entry);\n\t\tif (!(await stat(entryPath)).isDirectory()) continue;\n\t\tconst manifestPath = join(entryPath, MANIFEST_FILE);\n\t\ttry {\n\t\t\tawait stat(manifestPath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tlet pkg;\n\t\ttry {\n\t\t\tpkg = await readMigrationPackage(entryPath, options);\n\t\t} catch (error) {\n\t\t\tconst dirName = entry;\n\t\t\tif (MigrationToolsError.is(error)) {\n\t\t\t\tif (error.code === \"MIGRATION.HASH_MISMATCH\") {\n\t\t\t\t\tconst meta = error.meta;\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\t\t\tdirName,\n\t\t\t\t\t\tstored: typeof meta?.[\"storedHash\"] === \"string\" ? meta[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof meta?.[\"computedHash\"] === \"string\" ? meta[\"computedHash\"] : \"\"\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (error.code === \"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\") {\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\t\t\t\tdirName\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tproblems.push({\n\t\t\t\tkind: \"packageUnloadable\",\n\t\t\t\tdirName,\n\t\t\t\tdetail: packageLoadProblemDetailFromError(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpackages.push(pkg);\n\t}\n\treturn {\n\t\tpackages,\n\t\tproblems\n\t};\n}\nfunction formatMigrationDirName(timestamp, slug) {\n\tconst sanitized = slug.toLowerCase().replace(/[^a-z0-9]/g, \"_\").replace(/_+/g, \"_\").replace(/^_|_$/g, \"\");\n\tif (sanitized.length === 0) throw errorInvalidSlug(slug);\n\tconst truncated = sanitized.slice(0, MAX_SLUG_LENGTH);\n\treturn `${timestamp.getUTCFullYear()}${String(timestamp.getUTCMonth() + 1).padStart(2, \"0\")}${String(timestamp.getUTCDate()).padStart(2, \"0\")}T${String(timestamp.getUTCHours()).padStart(2, \"0\")}${String(timestamp.getUTCMinutes()).padStart(2, \"0\")}_${truncated}`;\n}\n//#endregion\nexport { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };\n\n//# sourceMappingURL=io-635GlNx1.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,MAAM,SAAS;AACjD;AACA,MAAM,0BAA0B,KAAK;CACpC,KAAK;CACL,MAAM;CACN,IAAI;CACJ,eAAe;CACf,oBAAoB;CACpB,WAAW;AACZ,CAAC;AACD,eAAe,sBAA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E,CAAC;KACD;IACD;IACA,IAAI,MAAM,SAAS,0CAA0C;KAC5D,MAAM,SAAS,MAAM,wBAAwB,SAAS;KACtD,IAAI,WAAW,MAAM,SAAS,KAAK,MAAM;KACzC,SAAS,KAAK;MACb,MAAM;MACN;KACD,CAAC;KACD;IACD;GACD;GACA,SAAS,KAAK;IACb,MAAM;IACN;IACA,QAAQ,kCAAkC,KAAK;GAChD,CAAC;GACD;EACD;EACA,SAAS,KAAK,GAAG;CAClB;CACA,OAAO;EACN;EACA;CACD;AACD;AACA,SAAS,uBAAuB,WAAW,MAAM;CAChD,MAAM,YAAY,KAAK,YAAY,CAAC,CAAC,QAAQ,cAAc,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,UAAU,EAAE;CACxG,IAAI,UAAU,WAAW,GAAG,MAAM,iBAAiB,IAAI;CACvD,MAAM,YAAY,UAAU,MAAM,GAAG,eAAe;CACpD,OAAO,GAAG,UAAU,eAAe,IAAI,OAAO,UAAU,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,YAAY,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG;AAC3P"}
|
|
1
|
+
{"version":3,"file":"io-635GlNx1-D3zrw2qu.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-635GlNx1.mjs"],"sourcesContent":["import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, j as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from \"./errors-CXbGUWGu.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-B0G1Fw_F.mjs\";\nimport { n as verifyMigrationHash } from \"./hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-CTHy88OP.mjs\";\nimport { n as MigrationOpsSchema } from \"./op-schema-BSVHzEQN.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join, resolve } from \"pathe\";\nimport { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/io.ts\nconst MANIFEST_FILE = \"migration.json\";\nconst OPS_FILE = \"ops.json\";\nconst MAX_SLUG_LENGTH = 64;\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\nconst MigrationMetadataSchema = type({\n\t\"+\": \"reject\",\n\tfrom: \"string > 0 | null\",\n\tto: \"string\",\n\tmigrationHash: \"string\",\n\tprovidedInvariants: \"string[]\",\n\tcreatedAt: \"string\"\n});\nasync function writeMigrationPackage(dir, metadata, ops) {\n\tawait mkdir(dirname(dir), { recursive: true });\n\ttry {\n\t\tawait mkdir(dir);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"EEXIST\")) throw errorDirectoryExists(dir);\n\t\tthrow error;\n\t}\n\tawait writeFile(join(dir, MANIFEST_FILE), JSON.stringify(metadata, null, 2), { flag: \"wx\" });\n\tawait writeFile(join(dir, OPS_FILE), JSON.stringify(ops, null, 2), { flag: \"wx\" });\n}\n/**\n* Materialise an in-memory {@link MigrationPackage} to a per-space\n* directory on disk.\n*\n* Writes two files under `<targetDir>/<pkg.dirName>/`:\n*\n* - `migration.json` — the manifest (pretty-printed, matches\n* {@link writeMigrationPackage}'s output for byte-for-byte parity with\n* app-space migrations).\n* - `ops.json` — the operation list (pretty-printed).\n*\n* Distinct verb from the lower-level {@link writeMigrationPackage}\n* (which takes constituent `(metadata, ops)`): callers reading\n* `materialise…` know they are persisting a struct-typed package.\n*\n* Overwrite-idempotent: the per-package directory is cleared before\n* each emit, so re-running against the same `targetDir` produces\n* byte-identical contents and never leaves stale files behind. The\n* lower-level {@link writeMigrationPackage} stays strict because the\n* CLI authoring path (`migration plan` / `migration new`) deliberately\n* refuses to clobber an existing authored migration; this helper is\n* the re-emit path that is supposed to converge on a single canonical\n* on-disk shape.\n*\n* The per-space head contract resolves through\n* `<projectMigrationsDir>/snapshots/<hex>/` (written by\n* {@link import('./emit-contract-space-artifacts').emitContractSpaceArtifacts}),\n* not inside the per-package directory. The runner reads only\n* `migration.json` + `ops.json` from each package.\n*/\nasync function materialiseMigrationPackage(targetDir, pkg) {\n\tconst dir = join(targetDir, pkg.dirName);\n\tawait rm(dir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait writeMigrationPackage(dir, pkg.metadata, pkg.ops);\n}\n/**\n* Idempotent variant of {@link materialiseMigrationPackage}: writes the\n* package only if `<targetDir>/<pkg.dirName>/` does not already exist on\n* disk as a directory; returns `{ written: false }` when the package\n* directory is present (no rewrite, no comparison — by-existence skip).\n*\n* Concretely:\n* - existing directory → skip silently, return `{ written: false }`.\n* - missing path → write three files via {@link materialiseMigrationPackage},\n* return `{ written: true }`.\n* - path exists but is not a directory (file/symlink) → treated as\n* missing; {@link materialiseMigrationPackage} will attempt creation\n* and fail with an appropriate OS error.\n* - any other I/O error from `stat` → propagated unchanged.\n*\n* Used by the CLI's `runContractSpaceExtensionMigrationsPass` to\n* materialise extension migration packages into a project's\n* `migrations/<spaceId>/` directory, and by extension-package tests\n* that mirror the same idempotent-rematerialise property locally\n* without taking a CLI dependency.\n*/\nasync function materialiseExtensionMigrationPackageIfMissing(targetDir, pkg) {\n\tif (await directoryExists(join(targetDir, pkg.dirName))) return { written: false };\n\tawait materialiseMigrationPackage(targetDir, pkg);\n\treturn { written: true };\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\n/**\n* Copy a list of files into `destDir`, optionally renaming each one.\n*\n* The destination directory is created (with `recursive: true`) if it\n* does not already exist. Each source path is copied byte-for-byte into\n* `destDir/<destName>`; missing sources throw `ENOENT`. The helper is\n* intentionally generic: callers own the list of files and the naming\n* convention for the copies.\n*/\nasync function copyFilesWithRename(destDir, files) {\n\tawait mkdir(destDir, { recursive: true });\n\tfor (const file of files) {\n\t\tif (basename(file.destName) !== file.destName) throw errorInvalidDestName(file.destName);\n\t\tawait copyFile(file.sourcePath, join(destDir, file.destName));\n\t}\n}\nasync function writeMigrationMetadata(dir, metadata) {\n\tawait writeFile(join(dir, MANIFEST_FILE), `${JSON.stringify(metadata, null, 2)}\\n`);\n}\nasync function writeMigrationOps(dir, ops) {\n\tawait writeFile(join(dir, OPS_FILE), `${JSON.stringify(ops, null, 2)}\\n`);\n}\nasync function readMigrationPackage(dir, options) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(MANIFEST_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(OPS_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(manifestPath, e instanceof Error ? e.message : String(e));\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(opsPath, e instanceof Error ? e.message : String(e));\n\t}\n\tvalidateMetadata(metadata, manifestPath);\n\tvalidateOps(ops, opsPath);\n\tconst derivedInvariants = deriveProvidedInvariants(ops);\n\tif (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);\n\tconst endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to);\n\tconst pkg = {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops,\n\t\t...ifDefined(\"endContractJson\", endContractJson)\n\t};\n\tconst verification = verifyMigrationHash(pkg);\n\tif (!verification.ok) throw errorMigrationHashMismatch(absoluteDir, verification.storedHash, verification.computedHash);\n\treturn pkg;\n}\n/**\n* Reads a migration package's manifest and ops without running hash or\n* invariants verification. Returns `null` when the files cannot be read or\n* parsed (i.e. when the package is genuinely unloadable).\n*\n* Used by {@link readMigrationsDir} to retain a package whose hash or\n* invariants diverge from what is stored on disk — the raw content is still\n* useful for display / querying; only integrity is in question.\n*/\nasync function readMigrationPackageRaw(dir) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (MigrationMetadataSchema(metadata) instanceof type.errors) return null;\n\tif (MigrationOpsSchema(ops) instanceof type.errors) return null;\n\treturn {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops\n\t};\n}\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\nfunction validateMetadata(metadata, filePath) {\n\tconst result = MigrationMetadataSchema(metadata);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction validateOps(ops, filePath) {\n\tconst result = MigrationOpsSchema(ops);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction packageLoadProblemDetailFromError(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nasync function readMigrationsDir(migrationsRoot, options) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(migrationsRoot);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\tpackages: [],\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst packages = [];\n\tconst problems = [];\n\tfor (const entry of entries.sort()) {\n\t\tconst entryPath = join(migrationsRoot, entry);\n\t\tif (!(await stat(entryPath)).isDirectory()) continue;\n\t\tconst manifestPath = join(entryPath, MANIFEST_FILE);\n\t\ttry {\n\t\t\tawait stat(manifestPath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tlet pkg;\n\t\ttry {\n\t\t\tpkg = await readMigrationPackage(entryPath, options);\n\t\t} catch (error) {\n\t\t\tconst dirName = entry;\n\t\t\tif (MigrationToolsError.is(error)) {\n\t\t\t\tif (error.code === \"MIGRATION.HASH_MISMATCH\") {\n\t\t\t\t\tconst meta = error.meta;\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\t\t\tdirName,\n\t\t\t\t\t\tstored: typeof meta?.[\"storedHash\"] === \"string\" ? meta[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof meta?.[\"computedHash\"] === \"string\" ? meta[\"computedHash\"] : \"\"\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (error.code === \"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\") {\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\t\t\t\tdirName\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tproblems.push({\n\t\t\t\tkind: \"packageUnloadable\",\n\t\t\t\tdirName,\n\t\t\t\tdetail: packageLoadProblemDetailFromError(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpackages.push(pkg);\n\t}\n\treturn {\n\t\tpackages,\n\t\tproblems\n\t};\n}\nfunction formatMigrationDirName(timestamp, slug) {\n\tconst sanitized = slug.toLowerCase().replace(/[^a-z0-9]/g, \"_\").replace(/_+/g, \"_\").replace(/^_|_$/g, \"\");\n\tif (sanitized.length === 0) throw errorInvalidSlug(slug);\n\tconst truncated = sanitized.slice(0, MAX_SLUG_LENGTH);\n\treturn `${timestamp.getUTCFullYear()}${String(timestamp.getUTCMonth() + 1).padStart(2, \"0\")}${String(timestamp.getUTCDate()).padStart(2, \"0\")}T${String(timestamp.getUTCHours()).padStart(2, \"0\")}${String(timestamp.getUTCMinutes()).padStart(2, \"0\")}_${truncated}`;\n}\n//#endregion\nexport { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };\n\n//# sourceMappingURL=io-635GlNx1.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,SAAS,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KACtD,IAAI,WAAW,MAAM,SAAS,KAAK,MAAM;KACzC,SAAS,KAAK;MACb,MAAM;MACN;MACA,QAAQ,OAAO,OAAO,kBAAkB,WAAW,KAAK,gBAAgB;MACxE,UAAU,OAAO,OAAO,oBAAoB,WAAW,KAAK,kBAAkB;KAC/E,CAAC;KACD;IACD;IACA,IAAI,MAAM,SAAS,0CAA0C;KAC5D,MAAM,SAAS,MAAM,wBAAwB,SAAS;KACtD,IAAI,WAAW,MAAM,SAAS,KAAK,MAAM;KACzC,SAAS,KAAK;MACb,MAAM;MACN;KACD,CAAC;KACD;IACD;GACD;GACA,SAAS,KAAK;IACb,MAAM;IACN;IACA,QAAQ,kCAAkC,KAAK;GAChD,CAAC;GACD;EACD;EACA,SAAS,KAAK,GAAG;CAClB;CACA,OAAO;EACN;EACA;CACD;AACD;AACA,SAAS,uBAAuB,WAAW,MAAM;CAChD,MAAM,YAAY,KAAK,YAAY,CAAC,CAAC,QAAQ,cAAc,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,UAAU,EAAE;CACxG,IAAI,UAAU,WAAW,GAAG,MAAM,iBAAiB,IAAI;CACvD,MAAM,YAAY,UAAU,MAAM,GAAG,eAAe;CACpD,OAAO,GAAG,UAAU,eAAe,IAAI,OAAO,UAAU,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,YAAY,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG;AAC3P"}
|
package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs → migration-graph-_SJImD5V-BURyY1KM.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from "./errors-CXbGUWGu-
|
|
1
|
+
import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from "./errors-CXbGUWGu-CstQHPh6.mjs";
|
|
2
2
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
3
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -497,4 +497,4 @@ function detectOrphans(graph) {
|
|
|
497
497
|
//#endregion
|
|
498
498
|
export { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };
|
|
499
499
|
|
|
500
|
-
//# sourceMappingURL=migration-graph-_SJImD5V-
|
|
500
|
+
//# sourceMappingURL=migration-graph-_SJImD5V-BURyY1KM.mjs.map
|
package/dist/{migration-graph-_SJImD5V-D5RCc651.mjs.map → migration-graph-_SJImD5V-BURyY1KM.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph-_SJImD5V-D5RCc651.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-_SJImD5V.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-CXbGUWGu.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-_SJImD5V.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,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EAAE;EACjG,KAAK,MAAM,QAAQ,MAAM,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,GAAG,WAAW,KAAK,IAAI;CAChF;CACA,KAAK,MAAM,QAAQ,IAAI,aAAa,MAAM,kBAAkB,OAAO,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,KAAK;CAChG,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,MAAM,eAAe,MAAM,cAAc,IAAI,CAAC,UAAU,IAAI,IAAI,GAAG,QAAQ,KAAK,GAAG,UAAU;CACzG,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"migration-graph-_SJImD5V-BURyY1KM.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-_SJImD5V.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-CXbGUWGu.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-_SJImD5V.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,GAAG;EACzB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzB;CACA,KAAK,MAAM;EACV,KAAK,MAAM,KAAK,IAAI;CACrB;;;;;CAKA,QAAQ;EACP,IAAI,KAAK,QAAQ,KAAK,MAAM,QAAQ,MAAM,IAAI,cAAc,mCAAmC;EAC/F,OAAO,KAAK,MAAM,KAAK;CACxB;CACA,IAAI,UAAU;EACb,OAAO,KAAK,QAAQ,KAAK,MAAM;CAChC;AACD;AAGA,UAAU,IAAI,QAAQ,YA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KAAK,GAAG,UAAU;CACzG,OAAO;AACR"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-CXbGUWGu-
|
|
1
|
+
import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-CXbGUWGu-CstQHPh6.mjs";
|
|
2
2
|
import { t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
3
|
-
import { t as deriveProvidedInvariants } from "./invariants-CTHy88OP-
|
|
3
|
+
import { t as deriveProvidedInvariants } from "./invariants-CTHy88OP-CYI2a8IO.mjs";
|
|
4
4
|
import { t as MigrationOpSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
|
|
5
|
-
import { realpathSync } from "node:fs";
|
|
6
5
|
import { type } from "arktype";
|
|
6
|
+
import { realpathSync } from "node:fs";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
//#region ../../../1-framework/3-tooling/migration/dist/exports/migration.mjs
|
|
9
9
|
const MigrationMetaSchema = type({
|
|
@@ -206,4 +206,4 @@ async function buildMigrationArtifacts(instance, existing) {
|
|
|
206
206
|
//#endregion
|
|
207
207
|
export { isDirectEntrypoint as i, MigrationContractViews as n, buildMigrationArtifacts as r, Migration as t };
|
|
208
208
|
|
|
209
|
-
//# sourceMappingURL=migration-
|
|
209
|
+
//# sourceMappingURL=migration-hspPIEeV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-gubSSeMk.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-CXbGUWGu.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-CTHy88OP.mjs\";\nimport { t as MigrationOpSchema } from \"../op-schema-BSVHzEQN.mjs\";\nimport { type } from \"arktype\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/migration-base.ts\nconst MigrationMetaSchema = type({\n\tfrom: \"string > 0 | null\",\n\tto: \"string\"\n});\n/**\n* Base class for migrations.\n*\n* A `Migration` subclass is itself a `MigrationPlan`: CLI commands and the\n* runner can consume it directly via `targetId`, `operations`, `origin`, and\n* `destination`.\n*\n* The from/to identities come from `describe()`. A migration provides them in\n* one of two ways:\n* - **Contract-derived (default):** assign the `contract.json` imports from\n* the snapshot store (`migrations/snapshots/<hex>/contract.json`) to\n* `startContractJson` / `endContractJson`; the concrete `describe()` below\n* derives `to`/`from` from their\n* `storage.storageHash`. The family bases additionally expose typed view\n* getters (`startContract` / `endContract`) over the same JSON.\n* - **Override (e.g. extension migrations that carry no contract):** override\n* `describe()` directly; the override wins and the JSON fields are unused.\n*\n* The `Start` / `End` generics carry each migration's precise contract types so\n* the family-base view getters resolve to fully-typed views.\n*/\nvar Migration = class {\n\t/**\n\t* The migration's end-state contract JSON (the `contract.json` import from\n\t* the snapshot store). When set, the derived `describe()` reads `to` from its\n\t* `storage.storageHash`. Family bases build the typed `endContract` view from\n\t* it. Optional so `describe()`-overriding migrations (no contract) compile.\n\t*\n\t* Typed with a plain `storageHash: string`, not the branded\n\t* `StorageHashBase`, so a raw `contract.json` import — whose `storageHash`\n\t* is an untyped string literal — is assignable without a cast. The full\n\t* `Start`/`End` contract typing is applied downstream in the family bases'\n\t* view getters (via `<Family>ContractView.fromJson<…>`).\n\t*/\n\tendContractJson;\n\t/**\n\t* The migration's start-state contract JSON (the `contract.json` import\n\t* from the snapshot store). Absent for a baseline migration (`from`\n\t* derives to `null`). Family bases build the typed `startContract` view from\n\t* it.\n\t*/\n\tstartContractJson;\n\t/**\n\t* Assembled `ControlStack` injected by the orchestrator (`runMigration`).\n\t*\n\t* Subclasses (e.g. `PostgresMigration`) read the stack to materialize their\n\t* adapter once per instance. Optional at the abstract level so unit tests can\n\t* construct `Migration` instances purely for `operations` / `describe`\n\t* assertions without needing a real stack; concrete subclasses that need the\n\t* stack at runtime should narrow the parameter to required.\n\t*/\n\tstack;\n\tconstructor(stack) {\n\t\tthis.stack = stack;\n\t}\n\t/**\n\t* Metadata inputs used to build `migration.json` and to derive the plan's\n\t* origin/destination identities.\n\t*\n\t* Default derivation: `to = endContractJson.storage.storageHash`,\n\t* `from = startContractJson?.storage.storageHash ?? null`. A migration that\n\t* carries no contract JSON (e.g. an extension migration) must override this;\n\t* otherwise it throws, since `migration.json` requires a `to` identity.\n\t*/\n\tdescribe() {\n\t\tconst end = this.endContractJson;\n\t\tif (end === void 0) throw errorDescribeMissingEndContract();\n\t\treturn {\n\t\t\tfrom: this.startContractJson?.storage.storageHash ?? null,\n\t\t\tto: end.storage.storageHash\n\t\t};\n\t}\n\tget origin() {\n\t\tconst from = this.describe().from;\n\t\treturn from === null ? null : { storageHash: from };\n\t}\n\tget destination() {\n\t\treturn { storageHash: this.describe().to };\n\t}\n};\n/**\n* Lazy-memoized `endContract` / `startContract` view accessors, one instance\n* held per migration. Each target base (`MongoMigration`, `SqliteMigration`,\n* `PostgresMigration`) creates one `MigrationContractViews` field from\n* `this` — passing its own `<Family>ContractView.fromJson<…>` as `fromJson`\n* and a name for error messages — and forwards its\n* `endContract`/`startContract` getters to it.\n*\n* `endContract` throws `MIGRATION.CONTRACT_VIEW_MISSING` when the migration\n* has no `endContractJson` (mirrors `describe()`'s own requirement).\n* `startContract` returns `null` for a baseline migration (no\n* `startContractJson`) instead of throwing.\n*/\nvar MigrationContractViews = class {\n\tmigration;\n\tclassName;\n\tfromJson;\n\t#endView;\n\t#startView;\n\tconstructor(migration, className, fromJson) {\n\t\tthis.migration = migration;\n\t\tthis.className = className;\n\t\tthis.fromJson = fromJson;\n\t}\n\tget endContract() {\n\t\tif (this.#endView === void 0) {\n\t\t\tconst json = this.migration.endContractJson;\n\t\t\tif (json === void 0) throw errorMigrationContractViewMissing(this.className, \"endContract\", \"endContractJson\");\n\t\t\tthis.#endView = this.fromJson(json);\n\t\t}\n\t\treturn this.#endView;\n\t}\n\tget startContract() {\n\t\tif (this.#startView === void 0) {\n\t\t\tconst json = this.migration.startContractJson;\n\t\t\tthis.#startView = json === void 0 ? null : this.fromJson(json);\n\t\t}\n\t\treturn this.#startView;\n\t}\n};\n/**\n* Returns true when `import.meta.url` resolves to the same file that was\n* invoked as the node entrypoint (`process.argv[1]`). Used by\n* `MigrationCLI.run` (in `@internal/cli/migration-cli`) to no-op when\n* the migration module is being imported (e.g. by another script) rather\n* than executed directly.\n*/\nfunction isDirectEntrypoint(importMetaUrl) {\n\tconst metaFilename = fileURLToPath(importMetaUrl);\n\tconst argv1 = process.argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(metaFilename) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Build the attested metadata from `describe()`-derived metadata, the\n* operations list, and the previously-scaffolded metadata (if any).\n*\n* When a `migration.json` already exists for this package (the common\n* case: it was scaffolded by `migration plan`), preserve `createdAt`\n* set there — that field is owned by the CLI scaffolder, not the authored\n* class. Only the `describe()`-derived fields (`from`, `to`) and the\n* operations change as the author iterates. When no metadata exists yet\n* (a bare `migration.ts` run from scratch), synthesize a minimal but\n* schema-conformant record so the resulting package can still be read,\n* verified, and applied.\n*\n* The `migrationHash` is recomputed against the current metadata + ops so\n* the on-disk artifacts are always fully attested.\n*/\nfunction buildAttestedMetadata(meta, ops, existing) {\n\tconst baseMetadata = {\n\t\tfrom: meta.from,\n\t\tto: meta.to,\n\t\tprovidedInvariants: deriveProvidedInvariants(ops),\n\t\tcreatedAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()\n\t};\n\tconst migrationHash = computeMigrationHash(baseMetadata, ops);\n\treturn {\n\t\t...baseMetadata,\n\t\tmigrationHash\n\t};\n}\n/**\n* Pure conversion from a `Migration` instance (plus the previously\n* scaffolded metadata, when one exists on disk) to the in-memory\n* artifacts that downstream tooling persists. Owns metadata validation,\n* metadata synthesis/preservation, and the content-addressed\n* `migrationHash` computation, but performs no file I/O — callers handle\n* reads (to source `existing`) and writes (to persist `opsJson` /\n* `metadataJson`).\n*/\nasync function buildMigrationArtifacts(instance, existing) {\n\tconst rawOps = instance.operations;\n\tif (!Array.isArray(rawOps)) throw errorOperationsNotArray();\n\tconst ops = await Promise.all(rawOps);\n\tfor (let index = 0; index < ops.length; index++) {\n\t\tconst result = MigrationOpSchema(ops[index]);\n\t\tif (result instanceof type.errors) throw errorInvalidOperationEntry(index, result.summary);\n\t}\n\tconst rawMeta = instance.describe();\n\tconst parsed = MigrationMetaSchema(rawMeta);\n\tif (parsed instanceof type.errors) throw errorDescribeInvalidMetadata(parsed.summary);\n\tconst metadata = buildAttestedMetadata(parsed, ops, existing);\n\treturn {\n\t\topsJson: JSON.stringify(ops, null, 2),\n\t\tmetadata,\n\t\tmetadataJson: JSON.stringify(metadata, null, 2)\n\t};\n}\n//#endregion\nexport { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,sBAAsB,KAAK;CAChC,MAAM;CACN,IAAI;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsBD,IAAI,YAAY,MAAM;;;;;;;;;;;;;CAarB;;;;;;;CAOA;;;;;;;;;;CAUA;CACA,YAAY,OAAO;EAClB,KAAK,QAAQ;CACd;;;;;;;;;;CAUA,WAAW;EACV,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,KAAK,GAAG,MAAM,gCAAgC;EAC1D,OAAO;GACN,MAAM,KAAK,mBAAmB,QAAQ,eAAe;GACrD,IAAI,IAAI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cAAc,GAAG;CAC5D,OAAO;EACN,GAAG;EACH;CACD;AACD;;;;;;;;;;AAUA,eAAe,wBAAwB,UAAU,UAAU;CAC1D,MAAM,SAAS,SAAS;CACxB,IAAI,CAAC,MAAM,QAAQ,MAAM,GAAG,MAAM,wBAAwB;CAC1D,MAAM,MAAM,MAAM,QAAQ,IAAI,MAAM;CACpC,KAAK,IAAI,QAAQ,GAAG,QAAQ,IAAI,QAAQ,SAAS;EAChD,MAAM,SAAS,kBAAkB,IAAI,MAAM;EAC3C,IAAI,kBAAkB,KAAK,QAAQ,MAAM,2BAA2B,OAAO,OAAO,OAAO;CAC1F;CACA,MAAM,UAAU,SAAS,SAAS;CAClC,MAAM,SAAS,oBAAoB,OAAO;CAC1C,IAAI,kBAAkB,KAAK,QAAQ,MAAM,6BAA6B,OAAO,OAAO;CACpF,MAAM,WAAW,sBAAsB,QAAQ,KAAK,QAAQ;CAC5D,OAAO;EACN,SAAS,KAAK,UAAU,KAAK,MAAM,CAAC;EACpC;EACA,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC;CAC/C;AACD"}
|
|
1
|
+
{"version":3,"file":"migration-hspPIEeV.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-CXbGUWGu.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-CTHy88OP.mjs\";\nimport { t as MigrationOpSchema } from \"../op-schema-BSVHzEQN.mjs\";\nimport { type } from \"arktype\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/migration-base.ts\nconst MigrationMetaSchema = type({\n\tfrom: \"string > 0 | null\",\n\tto: \"string\"\n});\n/**\n* Base class for migrations.\n*\n* A `Migration` subclass is itself a `MigrationPlan`: CLI commands and the\n* runner can consume it directly via `targetId`, `operations`, `origin`, and\n* `destination`.\n*\n* The from/to identities come from `describe()`. A migration provides them in\n* one of two ways:\n* - **Contract-derived (default):** assign the `contract.json` imports from\n* the snapshot store (`migrations/snapshots/<hex>/contract.json`) to\n* `startContractJson` / `endContractJson`; the concrete `describe()` below\n* derives `to`/`from` from their\n* `storage.storageHash`. The family bases additionally expose typed view\n* getters (`startContract` / `endContract`) over the same JSON.\n* - **Override (e.g. extension migrations that carry no contract):** override\n* `describe()` directly; the override wins and the JSON fields are unused.\n*\n* The `Start` / `End` generics carry each migration's precise contract types so\n* the family-base view getters resolve to fully-typed views.\n*/\nvar Migration = class {\n\t/**\n\t* The migration's end-state contract JSON (the `contract.json` import from\n\t* the snapshot store). When set, the derived `describe()` reads `to` from its\n\t* `storage.storageHash`. Family bases build the typed `endContract` view from\n\t* it. Optional so `describe()`-overriding migrations (no contract) compile.\n\t*\n\t* Typed with a plain `storageHash: string`, not the branded\n\t* `StorageHashBase`, so a raw `contract.json` import — whose `storageHash`\n\t* is an untyped string literal — is assignable without a cast. The full\n\t* `Start`/`End` contract typing is applied downstream in the family bases'\n\t* view getters (via `<Family>ContractView.fromJson<…>`).\n\t*/\n\tendContractJson;\n\t/**\n\t* The migration's start-state contract JSON (the `contract.json` import\n\t* from the snapshot store). Absent for a baseline migration (`from`\n\t* derives to `null`). Family bases build the typed `startContract` view from\n\t* it.\n\t*/\n\tstartContractJson;\n\t/**\n\t* Assembled `ControlStack` injected by the orchestrator (`runMigration`).\n\t*\n\t* Subclasses (e.g. `PostgresMigration`) read the stack to materialize their\n\t* adapter once per instance. Optional at the abstract level so unit tests can\n\t* construct `Migration` instances purely for `operations` / `describe`\n\t* assertions without needing a real stack; concrete subclasses that need the\n\t* stack at runtime should narrow the parameter to required.\n\t*/\n\tstack;\n\tconstructor(stack) {\n\t\tthis.stack = stack;\n\t}\n\t/**\n\t* Metadata inputs used to build `migration.json` and to derive the plan's\n\t* origin/destination identities.\n\t*\n\t* Default derivation: `to = endContractJson.storage.storageHash`,\n\t* `from = startContractJson?.storage.storageHash ?? null`. A migration that\n\t* carries no contract JSON (e.g. an extension migration) must override this;\n\t* otherwise it throws, since `migration.json` requires a `to` identity.\n\t*/\n\tdescribe() {\n\t\tconst end = this.endContractJson;\n\t\tif (end === void 0) throw errorDescribeMissingEndContract();\n\t\treturn {\n\t\t\tfrom: this.startContractJson?.storage.storageHash ?? null,\n\t\t\tto: end.storage.storageHash\n\t\t};\n\t}\n\tget origin() {\n\t\tconst from = this.describe().from;\n\t\treturn from === null ? null : { storageHash: from };\n\t}\n\tget destination() {\n\t\treturn { storageHash: this.describe().to };\n\t}\n};\n/**\n* Lazy-memoized `endContract` / `startContract` view accessors, one instance\n* held per migration. Each target base (`MongoMigration`, `SqliteMigration`,\n* `PostgresMigration`) creates one `MigrationContractViews` field from\n* `this` — passing its own `<Family>ContractView.fromJson<…>` as `fromJson`\n* and a name for error messages — and forwards its\n* `endContract`/`startContract` getters to it.\n*\n* `endContract` throws `MIGRATION.CONTRACT_VIEW_MISSING` when the migration\n* has no `endContractJson` (mirrors `describe()`'s own requirement).\n* `startContract` returns `null` for a baseline migration (no\n* `startContractJson`) instead of throwing.\n*/\nvar MigrationContractViews = class {\n\tmigration;\n\tclassName;\n\tfromJson;\n\t#endView;\n\t#startView;\n\tconstructor(migration, className, fromJson) {\n\t\tthis.migration = migration;\n\t\tthis.className = className;\n\t\tthis.fromJson = fromJson;\n\t}\n\tget endContract() {\n\t\tif (this.#endView === void 0) {\n\t\t\tconst json = this.migration.endContractJson;\n\t\t\tif (json === void 0) throw errorMigrationContractViewMissing(this.className, \"endContract\", \"endContractJson\");\n\t\t\tthis.#endView = this.fromJson(json);\n\t\t}\n\t\treturn this.#endView;\n\t}\n\tget startContract() {\n\t\tif (this.#startView === void 0) {\n\t\t\tconst json = this.migration.startContractJson;\n\t\t\tthis.#startView = json === void 0 ? null : this.fromJson(json);\n\t\t}\n\t\treturn this.#startView;\n\t}\n};\n/**\n* Returns true when `import.meta.url` resolves to the same file that was\n* invoked as the node entrypoint (`process.argv[1]`). Used by\n* `MigrationCLI.run` (in `@internal/cli/migration-cli`) to no-op when\n* the migration module is being imported (e.g. by another script) rather\n* than executed directly.\n*/\nfunction isDirectEntrypoint(importMetaUrl) {\n\tconst metaFilename = fileURLToPath(importMetaUrl);\n\tconst argv1 = process.argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(metaFilename) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Build the attested metadata from `describe()`-derived metadata, the\n* operations list, and the previously-scaffolded metadata (if any).\n*\n* When a `migration.json` already exists for this package (the common\n* case: it was scaffolded by `migration plan`), preserve `createdAt`\n* set there — that field is owned by the CLI scaffolder, not the authored\n* class. Only the `describe()`-derived fields (`from`, `to`) and the\n* operations change as the author iterates. When no metadata exists yet\n* (a bare `migration.ts` run from scratch), synthesize a minimal but\n* schema-conformant record so the resulting package can still be read,\n* verified, and applied.\n*\n* The `migrationHash` is recomputed against the current metadata + ops so\n* the on-disk artifacts are always fully attested.\n*/\nfunction buildAttestedMetadata(meta, ops, existing) {\n\tconst baseMetadata = {\n\t\tfrom: meta.from,\n\t\tto: meta.to,\n\t\tprovidedInvariants: deriveProvidedInvariants(ops),\n\t\tcreatedAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()\n\t};\n\tconst migrationHash = computeMigrationHash(baseMetadata, ops);\n\treturn {\n\t\t...baseMetadata,\n\t\tmigrationHash\n\t};\n}\n/**\n* Pure conversion from a `Migration` instance (plus the previously\n* scaffolded metadata, when one exists on disk) to the in-memory\n* artifacts that downstream tooling persists. Owns metadata validation,\n* metadata synthesis/preservation, and the content-addressed\n* `migrationHash` computation, but performs no file I/O — callers handle\n* reads (to source `existing`) and writes (to persist `opsJson` /\n* `metadataJson`).\n*/\nasync function buildMigrationArtifacts(instance, existing) {\n\tconst rawOps = instance.operations;\n\tif (!Array.isArray(rawOps)) throw errorOperationsNotArray();\n\tconst ops = await Promise.all(rawOps);\n\tfor (let index = 0; index < ops.length; index++) {\n\t\tconst result = MigrationOpSchema(ops[index]);\n\t\tif (result instanceof type.errors) throw errorInvalidOperationEntry(index, result.summary);\n\t}\n\tconst rawMeta = instance.describe();\n\tconst parsed = MigrationMetaSchema(rawMeta);\n\tif (parsed instanceof type.errors) throw errorDescribeInvalidMetadata(parsed.summary);\n\tconst metadata = buildAttestedMetadata(parsed, ops, existing);\n\treturn {\n\t\topsJson: JSON.stringify(ops, null, 2),\n\t\tmetadata,\n\t\tmetadataJson: JSON.stringify(metadata, null, 2)\n\t};\n}\n//#endregion\nexport { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,sBAAsB,KAAK;CAChC,MAAM;CACN,IAAI;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsBD,IAAI,YAAY,MAAM;;;;;;;;;;;;;CAarB;;;;;;;CAOA;;;;;;;;;;CAUA;CACA,YAAY,OAAO;EAClB,KAAK,QAAQ;CACd;;;;;;;;;;CAUA,WAAW;EACV,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,KAAK,GAAG,MAAM,gCAAgC;EAC1D,OAAO;GACN,MAAM,KAAK,mBAAmB,QAAQ,eAAe;GACrD,IAAI,IAAI,QAAQ;EACjB;CACD;CACA,IAAI,SAAS;EACZ,MAAM,OAAO,KAAK,SAAS,CAAC,CAAC;EAC7B,OAAO,SAAS,OAAO,OAAO,EAAE,aAAa,KAAK;CACnD;CACA,IAAI,cAAc;EACjB,OAAO,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC,GAAG;CAC1C;AACD;;;;;;;;;;;;;;AAcA,IAAI,yBAAyB,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA,YAAY,WAAW,WAAW,UAAU;EAC3C,KAAK,YAAY;EACjB,KAAK,YAAY;EACj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AAM,2BAA2B,OAAO,OAAO,OAAO;CAC1F;CACA,MAAM,UAAU,SAAS,SAAS;CAClC,MAAM,SAAS,oBAAoB,OAAO;CAC1C,IAAI,kBAAkB,KAAK,QAAQ,MAAM,6BAA6B,OAAO,OAAO;CACpF,MAAM,WAAW,sBAAsB,QAAQ,KAAK,QAAQ;CAC5D,OAAO;EACN,SAAS,KAAK,UAAU,KAAK,MAAM,CAAC;EACpC;EACA,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC;CAC/C;AACD"}
|
|
@@ -2,15 +2,15 @@ import { a as deleteRef, c as refsByContractHash, d as validateRefName, f as val
|
|
|
2
2
|
import { n as MigrationGraph, t as MigrationEdge } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
3
3
|
import { a as RefResolutionAmbiguous, c as RefResolutionInvalidFormat, d as findEdgeByDirName, f as parseContractRef, i as MigrationRefProvenance, l as RefResolutionNotFound, n as ContractRefProvenance, o as RefResolutionContext, p as parseMigrationRef, r as MigrationRef, s as RefResolutionError, t as ContractRef, u as RefResolutionWrongGrammar } from "./ref-resolution-COGOSL57.mjs";
|
|
4
4
|
import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
|
|
5
|
-
import { a as VerifyContractSpacesResult, i as VerifyContractSpacesInputs, n as SpaceMarkerRecord, o as listContractSpaceDirectories, r as SpaceVerifierViolation, s as verifyContractSpaces, t as ContractSpaceHeadRecord } from "./verify-contract-spaces-
|
|
5
|
+
import { a as VerifyContractSpacesResult, i as VerifyContractSpacesInputs, n as SpaceMarkerRecord, o as listContractSpaceDirectories, r as SpaceVerifierViolation, s as verifyContractSpaces, t as ContractSpaceHeadRecord } from "./verify-contract-spaces-C3PiFBk3-DfomYyOE.mjs";
|
|
6
6
|
import { a as materialiseExtensionMigrationPackageIfMissing, c as readMigrationsDir, d as writeMigrationPackage, i as formatMigrationDirName, l as writeMigrationMetadata, n as ReadMigrationsDirResult, o as materialiseMigrationPackage, r as copyFilesWithRename, s as readMigrationPackage, t as PackageLoadProblem, u as writeMigrationOps } from "./io-sr4CO9_t-C3eV_kn-.mjs";
|
|
7
7
|
import { a as findLeaf, c as findPathWithInvariants, i as findLatestMigration, l as findReachableLeaves, n as detectCycles, o as findPath, r as detectOrphans, s as findPathWithDecision, t as PathDecision, u as reconstructGraph } from "./migration-graph-tarTxJ99-BrGBANeE.mjs";
|
|
8
|
-
import { A as buildFabricatedMigrationEdge, B as verifyMigration, C as ResolveRecordedPathOutcome, D as VerifierOutput, E as VerifierInput, F as loadContractSpaceAggregate, I as loadProblemToViolation, L as planMigration, M as computeIntegrityViolations, N as createAggregateContractSpace, O as VerifierSuccess, P as createContractSpaceAggregate, R as requireHeadRef, S as ResolveRecordedPathInputs, T as VerifierError, _ as PerSpacePlan, a as ContractAtOptions, b as PlannerOutput, c as ContractSpaceAggregate, d as IntegrityQueryOptions, f as IntegritySpaceState, g as MarkerCheckSection, h as MarkerCheckResult, i as CallerPolicy, j as collectAggregateNamespaces, k as allStorageElementsExternal, l as DeclaredExtensionEntry, m as LoadAggregateInput, n as AggregateCurrentDBState, o as ContractAtResult, p as IntegrityViolation, r as AggregateMigrationEdgeRef, s as ContractMarkerRecordLike, t as AggregateContractSpace, u as IntegrityComputationInput, v as PlannerError, w as SchemaCheckSection, x as PlannerSuccess, y as PlannerInput, z as resolveRecordedPath } from "./aggregate-
|
|
8
|
+
import { A as buildFabricatedMigrationEdge, B as verifyMigration, C as ResolveRecordedPathOutcome, D as VerifierOutput, E as VerifierInput, F as loadContractSpaceAggregate, I as loadProblemToViolation, L as planMigration, M as computeIntegrityViolations, N as createAggregateContractSpace, O as VerifierSuccess, P as createContractSpaceAggregate, R as requireHeadRef, S as ResolveRecordedPathInputs, T as VerifierError, _ as PerSpacePlan, a as ContractAtOptions, b as PlannerOutput, c as ContractSpaceAggregate, d as IntegrityQueryOptions, f as IntegritySpaceState, g as MarkerCheckSection, h as MarkerCheckResult, i as CallerPolicy, j as collectAggregateNamespaces, k as allStorageElementsExternal, l as DeclaredExtensionEntry, m as LoadAggregateInput, n as AggregateCurrentDBState, o as ContractAtResult, p as IntegrityViolation, r as AggregateMigrationEdgeRef, s as ContractMarkerRecordLike, t as AggregateContractSpace, u as IntegrityComputationInput, v as PlannerError, w as SchemaCheckSection, x as PlannerSuccess, y as PlannerInput, z as resolveRecordedPath } from "./aggregate-DLUJLq5Y.mjs";
|
|
9
9
|
import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
|
|
10
10
|
import "./metadata-BtscDay2.mjs";
|
|
11
11
|
import { t as MigrationPackage } from "./package-N9PPdFV_.mjs";
|
|
12
12
|
import { a as buildMigrationArtifacts, i as MigrationMeta, n as MigrationArtifacts, o as isDirectEntrypoint, r as MigrationContractViews, t as Migration } from "./migration-B2ljMJim.mjs";
|
|
13
|
-
import { a as errorContractSnapshotMissing, c as errorInvalidRefName, i as errorContractSnapshotHashMismatch, l as errorNoInvariantPath, n as NoInvariantPathStructuralEdge, o as errorDescriptorHeadHashMismatch, r as errorContractDeserializationFailed, s as errorInvalidJson, t as MigrationToolsError, u as errorUnknownInvariant } from "./errors-
|
|
13
|
+
import { a as errorContractSnapshotMissing, c as errorInvalidRefName, i as errorContractSnapshotHashMismatch, l as errorNoInvariantPath, n as NoInvariantPathStructuralEdge, o as errorDescriptorHeadHashMismatch, r as errorContractDeserializationFailed, s as errorInvalidJson, t as MigrationToolsError, u as errorUnknownInvariant } from "./errors-D59OCpoI.mjs";
|
|
14
14
|
import "./io-DYfeLJxR.mjs";
|
|
15
15
|
import { a as readContractSnapshotJsonTolerant, i as readContractSnapshotJson, n as contractSnapshotDir, o as snapshotsImportPathFrom, r as readContractSnapshotDts, s as writeContractSnapshot, t as ContractSnapshotInput } from "./contract-snapshot-store-CbqynbtE.mjs";
|
|
16
16
|
import { n as computeMigrationHash, r as verifyMigrationHash, t as VerifyResult } from "./hash-XZYYKJ-i.mjs";
|
|
@@ -19,5 +19,5 @@ import { n as isGraphNode, t as assertHashIsGraphNode } from "./migration-graph-
|
|
|
19
19
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-Dkcn8Qu4.mjs";
|
|
20
20
|
import { t as ledgerOriginFromStored } from "./ledger-origin-BGRN77Oy.mjs";
|
|
21
21
|
import { a as writeMigrationTs, i as shebangLineFor, n as detectScaffoldRuntime, r as hasMigrationTs, t as ScaffoldRuntime } from "./migration-ts-CNaAtK8C.mjs";
|
|
22
|
-
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-
|
|
22
|
+
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-Dj65JrwZ.mjs";
|
|
23
23
|
export { APP_SPACE_ID, type AggregateContractSpace, type AggregateCurrentDBState, type AggregateMigrationEdgeRef, type CallerPolicy, type ComputeExtensionSpaceApplyPathInputs, type ContractAtOptions, type ContractAtResult, type ContractMarkerRecordLike, type ContractRef, type ContractRefProvenance, type ContractSnapshotInput, type ContractSpaceAggregate, type ContractSpaceArtifactInputs, type ContractSpaceHeadRecord, type ContractSpaceHeadRef, type DeclaredExtensionEntry, type DescriptorSelfConsistencyInputs, type DiskContractSpaceState, EMPTY_CONTRACT_HASH, type ExtensionSpaceApplyPathOutcome, HEAD_REF_NAME, type IntegrityComputationInput, type IntegrityQueryOptions, type IntegritySpaceState, type IntegrityViolation, type LoadAggregateInput, type MarkerCheckResult, type MarkerCheckSection, Migration, type MigrationArtifacts, MigrationContractViews, type MigrationEdge, type MigrationGraph, type MigrationMeta, type MigrationMetadata$1 as MigrationMetadata, type MigrationOps, type MigrationPackage, type MigrationRef, type MigrationRefProvenance, MigrationToolsError, type NoInvariantPathStructuralEdge, type OnDiskMigrationPackage, type PackageLoadProblem, type PathDecision, type PerSpacePlan, type PlannerError, type PlannerInput, type PlannerOutput, type PlannerSuccess, RESERVED_SPACE_SUBDIR_NAMES, type ReadMigrationsDirResult, type RefEntry, type RefResolutionAmbiguous, type RefResolutionContext, type RefResolutionError, type RefResolutionInvalidFormat, type RefResolutionNotFound, type RefResolutionWrongGrammar, type Refs, type ResolveRecordedPathInputs, type ResolveRecordedPathOutcome, SPACE_REFS_DIRNAME, type ScaffoldRuntime, type SchemaCheckSection, type SpaceApplyInput, type SpaceMarkerRecord, type SpacePlanInput, type SpacePlanOutput, type SpaceVerifierViolation, type ValidSpaceId, type VerifierError, type VerifierInput, type VerifierOutput, type VerifierSuccess, type VerifyContractSpacesInputs, type VerifyContractSpacesResult, type VerifyResult, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, formatMigrationDirName, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
|