@prisma/orm-toolchain 8.0.0-rc.1-dev.6 → 8.0.0-rc.1-dev.7
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/dist/{aggregate-i-rfetSO.mjs → aggregate-D53gnb7v.mjs} +8 -8
- package/dist/{aggregate-i-rfetSO.mjs.map → aggregate-D53gnb7v.mjs.map} +1 -1
- package/dist/bin__prisma-next.mjs +22 -22
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs +14 -0
- package/dist/caught-errors-D7Qznyrm-BzYooF6H.mjs.map +1 -0
- package/dist/{types-2n_H3DQ9-Bks8UPEO.d.mts → cli-errors-CDr3WcJP-NFry5GHb.d.mts} +2 -2
- package/dist/cli-errors-CDr3WcJP-NFry5GHb.d.mts.map +1 -0
- package/dist/cli.mjs +2 -2
- package/dist/cli__commands__contract-emit.mjs +1 -1
- package/dist/cli__commands__contract-infer.mjs +1 -1
- package/dist/cli__commands__db-init.mjs +1 -1
- package/dist/cli__commands__db-schema.mjs +1 -1
- package/dist/cli__commands__db-sign.mjs +1 -1
- package/dist/cli__commands__db-update.mjs +1 -1
- package/dist/cli__commands__db-verify.mjs +1 -1
- package/dist/cli__commands__migrate.d.mts +3 -12
- package/dist/cli__commands__migrate.d.mts.map +1 -1
- package/dist/cli__commands__migrate.mjs +1 -1
- package/dist/cli__commands__migration-check.d.mts +1 -57
- package/dist/cli__commands__migration-check.d.mts.map +1 -1
- package/dist/cli__commands__migration-check.mjs +2 -2
- package/dist/cli__commands__migration-graph.d.mts +1 -1
- package/dist/cli__commands__migration-graph.mjs +1 -1
- package/dist/cli__commands__migration-list.d.mts +4 -44
- package/dist/cli__commands__migration-list.d.mts.map +1 -1
- package/dist/cli__commands__migration-list.mjs +2 -2
- package/dist/cli__commands__migration-log.d.mts +1 -1
- package/dist/cli__commands__migration-log.mjs +1 -1
- package/dist/cli__commands__migration-new.mjs +1 -1
- package/dist/cli__commands__migration-plan.d.mts +2 -47
- package/dist/cli__commands__migration-plan.d.mts.map +1 -1
- package/dist/cli__commands__migration-plan.mjs +1 -1
- package/dist/cli__commands__migration-show.mjs +1 -1
- package/dist/cli__commands__migration-status.d.mts +1 -1
- package/dist/cli__commands__migration-status.mjs +1 -1
- package/dist/cli__commands__ref.d.mts +1 -28
- package/dist/cli__commands__ref.d.mts.map +1 -1
- package/dist/cli__commands__ref.mjs +2 -2
- package/dist/cli__commands__telemetry.mjs +1 -1
- package/dist/cli__control-api.d.mts +502 -2
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +18 -3
- package/dist/cli__migration-cli.mjs +2 -2
- package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs → client-Y6qbDk7X-BzKLmBZo.mjs} +8 -8
- package/dist/{client-7aUYC7ci-Bh9mLxkl.mjs.map → client-Y6qbDk7X-BzKLmBZo.mjs.map} +1 -1
- package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs → command-helpers-C4WpR-QE-DE494TSG.mjs} +2 -2
- package/dist/{command-helpers-C4WpR-QE-CK2gkj6l.mjs.map → command-helpers-C4WpR-QE-DE494TSG.mjs.map} +1 -1
- package/dist/config-loader.d.mts +2 -18
- package/dist/{contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs → contract-at-errors-Dv1mxKYO-C29YB4RC.mjs} +4 -4
- package/dist/contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map +1 -0
- package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs → contract-emit-CTm2zfuG-7PV9SBY6.mjs} +4 -4
- package/dist/{contract-emit-CTm2zfuG-8mtkxW8M.mjs.map → contract-emit-CTm2zfuG-7PV9SBY6.mjs.map} +1 -1
- package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs → contract-emit-D8IXP9Qp-Df6NwXn8.mjs} +3 -3
- package/dist/{contract-emit-D8IXP9Qp-CecAQio1.mjs.map → contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map} +1 -1
- package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs → contract-infer-BwT7ngoo-Dx6aAwIN.mjs} +4 -4
- package/dist/{contract-infer-C8-RqHeK-D_dm3onP.mjs.map → contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map} +1 -1
- package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs +82 -0
- package/dist/contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map +1 -0
- package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs} +3 -3
- package/dist/{contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map → contract-snapshot-store-C9-J6OBn-ByElY0EC.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs → contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs} +6 -6
- package/dist/contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map +1 -0
- package/dist/{db-init-CXMcvoIA.mjs → db-init-CBj_EWg3.mjs} +15 -26
- package/dist/db-init-CBj_EWg3.mjs.map +1 -0
- package/dist/{db-schema-j8DERh4t.mjs → db-schema-BWpeh0Q_.mjs} +4 -4
- package/dist/{db-schema-j8DERh4t.mjs.map → db-schema-BWpeh0Q_.mjs.map} +1 -1
- package/dist/{db-sign-xV_rpoIc.mjs → db-sign-DCb_DKtv.mjs} +13 -29
- package/dist/db-sign-DCb_DKtv.mjs.map +1 -0
- package/dist/{db-update-DXa2DIvu.mjs → db-update-WX0KitcX.mjs} +27 -50
- package/dist/db-update-WX0KitcX.mjs.map +1 -0
- package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs} +5 -5
- package/dist/{db-verify-YWHjuKC7-DidK1gx1.mjs.map → db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map} +1 -1
- package/dist/{errors-BwusfLIN-BXM7K-ww.mjs → errors-Co-8oaiB-CB-6Uqki.mjs} +5 -4
- package/dist/{errors-BwusfLIN-BXM7K-ww.mjs.map → errors-Co-8oaiB-CB-6Uqki.mjs.map} +1 -1
- package/dist/{errors-AkMBj-YP.d.mts → errors-NRmFpwR1.d.mts} +6 -2
- package/dist/errors-NRmFpwR1.d.mts.map +1 -0
- package/dist/{format-Bw3LVJ1v-D10inUT9.mjs → format-Bw3LVJ1v-BJ6lVFMA.mjs} +2 -2
- package/dist/{format-Bw3LVJ1v-D10inUT9.mjs.map → format-Bw3LVJ1v-BJ6lVFMA.mjs.map} +1 -1
- package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs → framework-components-3DdB31mk-BHyX-OlJ.mjs} +2 -2
- package/dist/{framework-components-3DdB31mk-BPGSuOyZ.mjs.map → framework-components-3DdB31mk-BHyX-OlJ.mjs.map} +1 -1
- package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs → graph-membership-BEmNEMtP-rz61CLM5.mjs} +3 -3
- package/dist/{graph-membership-h9ejuZla-ewjYM5wz.mjs.map → graph-membership-BEmNEMtP-rz61CLM5.mjs.map} +1 -1
- package/dist/index-Df9igRvP.d.mts +18 -0
- package/dist/index-Df9igRvP.d.mts.map +1 -0
- package/dist/{init-CPB89WK2-Di4kgP6B.mjs → init-CPB89WK2-DPZRZ9Ee.mjs} +3 -3
- package/dist/{init-CPB89WK2-Di4kgP6B.mjs.map → init-CPB89WK2-DPZRZ9Ee.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs} +4 -4
- package/dist/{inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map → inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map} +1 -1
- package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs +52 -0
- package/dist/invariants-BzYfO9IL-BXTvx0z9.mjs.map +1 -0
- package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs → invariants-C1WVUAH7-DlOBTTkM.mjs} +3 -3
- package/dist/{invariants-CMcQxRas-CXX9uhQW.mjs.map → invariants-C1WVUAH7-DlOBTTkM.mjs.map} +1 -1
- package/dist/{io-CL3hSv42-DGZtTs89.mjs → io-CHUUeHh0-CoCBe9eN.mjs} +5 -5
- package/dist/{io-CL3hSv42-DGZtTs89.mjs.map → io-CHUUeHh0-CoCBe9eN.mjs.map} +1 -1
- package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs +22 -0
- package/dist/legend-5iwwlLU2-CB8bdQKJ.mjs.map +1 -0
- package/dist/{migrate-COusRrm7.mjs → migrate-B-NAuO90.mjs} +87 -230
- package/dist/migrate-B-NAuO90.mjs.map +1 -0
- package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts +56 -0
- package/dist/migrate-show-60NNqVia-oGqMaVA9.d.mts.map +1 -0
- package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs +202 -0
- package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +1 -0
- package/dist/{migration-diUAhNaa.mjs → migration-DAJY-NmR.mjs} +3 -3
- package/dist/{migration-diUAhNaa.mjs.map → migration-DAJY-NmR.mjs.map} +1 -1
- package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs +254 -0
- package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +1 -0
- package/dist/{migration-check-CueEJelQ-J81XR_ns.mjs → migration-check-DONPyXff-CGTUpLv-.mjs} +12 -254
- package/dist/migration-check-DONPyXff-CGTUpLv-.mjs.map +1 -0
- package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs} +4 -4
- package/dist/{migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map → migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map} +1 -1
- package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs → migration-graph-DDaOHo10-yJFAbKCu.mjs} +3 -3
- package/dist/{migration-graph-D6bN-mX0-DwMWY8DA.mjs.map → migration-graph-DDaOHo10-yJFAbKCu.mjs.map} +1 -1
- package/dist/{migration-graph-BL6vfLcE.mjs → migration-graph-Dn469b0l.mjs} +10 -19
- package/dist/migration-graph-Dn469b0l.mjs.map +1 -0
- package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs +35 -0
- package/dist/migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map +1 -0
- package/dist/migration-list-C9OPCMt--C28yBgVr.mjs +102 -0
- package/dist/migration-list-C9OPCMt--C28yBgVr.mjs.map +1 -0
- package/dist/migration-list-jk4iCtmO.mjs +120 -0
- package/dist/migration-list-jk4iCtmO.mjs.map +1 -0
- package/dist/{migration-log-BXbz6-Lj-CKHbat5f.mjs → migration-log-DQzUBrm8-D3m9wcuf.mjs} +7 -5
- package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +1 -0
- package/dist/migration-new-BkSY6m0t.mjs +50 -0
- package/dist/migration-new-BkSY6m0t.mjs.map +1 -0
- package/dist/{migration-new-szZFsA3C.mjs → migration-new-g98oB3nC-BcrkxAAt.mjs} +12 -52
- package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +1 -0
- package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs → migration-path-target-BPYp3LNc-DsDdLU0J.mjs} +2 -2
- package/dist/{migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map → migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map} +1 -1
- package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts +159 -0
- package/dist/migration-plan-BsOYRogP-CC1UFAbu.d.mts.map +1 -0
- package/dist/migration-plan-CjIYMJZy.mjs +172 -0
- package/dist/migration-plan-CjIYMJZy.mjs.map +1 -0
- package/dist/{migration-plan-CxXAXYc8-Dnp-v8Nl.mjs → migration-plan-CwuZLXVE-DAJ-JUQT.mjs} +45 -183
- package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +1 -0
- package/dist/{migration-show-BKsIh7Uz.mjs → migration-show-CW6EKtfw.mjs} +13 -9
- package/dist/migration-show-CW6EKtfw.mjs.map +1 -0
- package/dist/{migration-status-CNnRInne--cvmx56T.mjs → migration-status-DSQcBhiN.mjs} +37 -68
- package/dist/migration-status-DSQcBhiN.mjs.map +1 -0
- package/dist/migration-tools.d.mts +4 -4
- package/dist/migration-tools.mjs +13 -13
- 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 +2 -2
- package/dist/migration-tools__errors.mjs +2 -2
- 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.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.mjs +2 -2
- package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs → project-import-root-C_bd0ooL-WkbJLnAA.mjs} +2 -2
- package/dist/{project-import-root-C_bd0ooL-CLXW-gp6.mjs.map → project-import-root-C_bd0ooL-WkbJLnAA.mjs.map} +1 -1
- package/dist/ref-DSAZime8.mjs +72 -0
- package/dist/ref-DSAZime8.mjs.map +1 -0
- package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs +96 -0
- package/dist/ref-advancement-DaZBzm7m-BZQtedYC.mjs.map +1 -0
- package/dist/ref-eJjxzYTh-CNiyDL4p.mjs +109 -0
- package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +1 -0
- package/dist/{ref-resolution-BsdziDFA.mjs → ref-resolution-Ct2GMcNB.mjs} +2 -2
- package/dist/{ref-resolution-BsdziDFA.mjs.map → ref-resolution-Ct2GMcNB.mjs.map} +1 -1
- package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs +16 -0
- package/dist/ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map +1 -0
- package/dist/{refs-DtoeUivZ-qay0UMSP.mjs → refs-B2BL8z3i-DGGFB7Mj.mjs} +3 -3
- package/dist/{refs-DtoeUivZ-qay0UMSP.mjs.map → refs-B2BL8z3i-DGGFB7Mj.mjs.map} +1 -1
- package/dist/refs-fQLFcMoq-UTlvnijY.mjs +47 -0
- package/dist/refs-fQLFcMoq-UTlvnijY.mjs.map +1 -0
- package/dist/{spaces-BNd2Tlk0.mjs → spaces-DxuvClN9.mjs} +6 -6
- package/dist/{spaces-BNd2Tlk0.mjs.map → spaces-DxuvClN9.mjs.map} +1 -1
- package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs → telemetry-DVBHDQd6-Ckn5oClN.mjs} +2 -2
- package/dist/{telemetry-DVBHDQd6-BEdoMii0.mjs.map → telemetry-DVBHDQd6-Ckn5oClN.mjs.map} +1 -1
- package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs → verify-C6L_hiJU-B4V3bqvG.mjs} +2 -2
- package/dist/{verify-C6L_hiJU-CN3eEe3Y.mjs.map → verify-C6L_hiJU-B4V3bqvG.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs} +4 -4
- package/dist/{verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map → verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +0 -1
- package/dist/db-init-CXMcvoIA.mjs.map +0 -1
- package/dist/db-sign-xV_rpoIc.mjs.map +0 -1
- package/dist/db-update-DXa2DIvu.mjs.map +0 -1
- package/dist/errors-AkMBj-YP.d.mts.map +0 -1
- package/dist/migrate-COusRrm7.mjs.map +0 -1
- package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +0 -1
- package/dist/migration-graph-BL6vfLcE.mjs.map +0 -1
- package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs +0 -228
- package/dist/migration-list-D2_JdzWC-MRHYYVQE.mjs.map +0 -1
- package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +0 -1
- package/dist/migration-new-szZFsA3C.mjs.map +0 -1
- package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +0 -1
- package/dist/migration-show-BKsIh7Uz.mjs.map +0 -1
- package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +0 -1
- package/dist/ref-DjZ5Y8ju.mjs +0 -171
- package/dist/ref-DjZ5Y8ju.mjs.map +0 -1
- package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs +0 -57
- package/dist/ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map +0 -1
- package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { t as MigrationToolsError } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
|
|
2
|
+
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
|
+
import { N as errorUnexpected, O as errorRuntime$1, S as errorPathUnreachable, Z as mapRefResolutionError, f as errorDatabaseConnectionRequired, it as resolveMigrationPaths, nt as requireLiveDatabase, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
|
|
4
|
+
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
5
|
+
import { i as readRefs } from "./refs-B2BL8z3i-DGGFB7Mj.mjs";
|
|
6
|
+
import { u as requireHeadRef } from "./aggregate-D53gnb7v.mjs";
|
|
7
|
+
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
|
|
8
|
+
import { a as planSpacePath, t as createControlClient } from "./client-Y6qbDk7X-BzKLmBZo.mjs";
|
|
9
|
+
import { n as parseContractRef } from "./ref-resolution-Ct2GMcNB.mjs";
|
|
10
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
11
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migrate-show-B2LkXkoB.mjs
|
|
12
|
+
/**
|
|
13
|
+
* Read-only preview core for `migrate --show`: computes the migration path through the same planSpacePath seam the real apply uses, stopping before any write boundary.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Computes the path through the SAME seam as `executeMigrate`:
|
|
17
|
+
* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving
|
|
18
|
+
* the full marker including `invariants` (not just `storageHash`).
|
|
19
|
+
* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,
|
|
20
|
+
* which feeds `resolveRecordedPath()` with the same target hash, target invariants,
|
|
21
|
+
* and current marker as the real apply path uses.
|
|
22
|
+
*
|
|
23
|
+
* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No
|
|
24
|
+
* DB state is mutated.
|
|
25
|
+
*/
|
|
26
|
+
async function executeMigrateShowPlan(options) {
|
|
27
|
+
const config = await loadConfig(options.config);
|
|
28
|
+
const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);
|
|
29
|
+
const dbConnection = options.db ?? config.db?.connection;
|
|
30
|
+
const hasDriver = !!config.driver;
|
|
31
|
+
const hasExplicitFrom = options.from !== void 0;
|
|
32
|
+
if (!hasExplicitFrom) {
|
|
33
|
+
const missingDb = requireLiveDatabase({
|
|
34
|
+
dbConnection,
|
|
35
|
+
hasDriver,
|
|
36
|
+
why: "migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)",
|
|
37
|
+
retryCommand: "prisma-next migrate --show --from <contract>"
|
|
38
|
+
});
|
|
39
|
+
if (missingDb) return notOk(missingDb);
|
|
40
|
+
}
|
|
41
|
+
let allRefs = {};
|
|
42
|
+
try {
|
|
43
|
+
allRefs = await readRefs(refsDir);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (MigrationToolsError.is(error)) return notOk(error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
49
|
+
if (!loaded.ok) return notOk(loaded.failure);
|
|
50
|
+
const { aggregate, contractHash } = loaded.value;
|
|
51
|
+
const appGraph = aggregate.app.graph();
|
|
52
|
+
let targetHash = contractHash;
|
|
53
|
+
let refInvariants;
|
|
54
|
+
if (options.to) {
|
|
55
|
+
const toResult = parseContractRef(options.to, {
|
|
56
|
+
graph: appGraph,
|
|
57
|
+
refs: allRefs,
|
|
58
|
+
contractHash
|
|
59
|
+
});
|
|
60
|
+
if (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));
|
|
61
|
+
if (toResult.value.provenance.kind === "reserved-db") return notOk(errorDatabaseConnectionRequired({
|
|
62
|
+
why: "@db is not valid as a --to target; it names the live database state, not a target contract.",
|
|
63
|
+
commandName: "migrate --show"
|
|
64
|
+
}));
|
|
65
|
+
targetHash = toResult.value.hash;
|
|
66
|
+
if (toResult.value.provenance.kind === "ref") {
|
|
67
|
+
const refEntry = allRefs[toResult.value.provenance.refName];
|
|
68
|
+
if (refEntry) refInvariants = refEntry.invariants;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
options.onPreflightComplete?.({
|
|
72
|
+
configPath,
|
|
73
|
+
migrationsRelative,
|
|
74
|
+
dbConnection,
|
|
75
|
+
hasExplicitFrom
|
|
76
|
+
});
|
|
77
|
+
const markerBySpace = /* @__PURE__ */ new Map();
|
|
78
|
+
const allSpaces = [aggregate.app, ...aggregate.extensions];
|
|
79
|
+
if (hasExplicitFrom) if (options.from === "@db") {
|
|
80
|
+
const missingDb = requireLiveDatabase({
|
|
81
|
+
dbConnection,
|
|
82
|
+
hasDriver,
|
|
83
|
+
why: "@db resolves to the live database marker and requires a --db connection",
|
|
84
|
+
retryCommand: "prisma-next migrate --show --from @db --db $DATABASE_URL"
|
|
85
|
+
});
|
|
86
|
+
if (missingDb) return notOk(missingDb);
|
|
87
|
+
} else {
|
|
88
|
+
const fromResult = parseContractRef(options.from, {
|
|
89
|
+
graph: appGraph,
|
|
90
|
+
refs: allRefs,
|
|
91
|
+
contractHash
|
|
92
|
+
});
|
|
93
|
+
if (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));
|
|
94
|
+
if (fromResult.value.provenance.kind === "reserved-db") {
|
|
95
|
+
const missingDb = requireLiveDatabase({
|
|
96
|
+
dbConnection,
|
|
97
|
+
hasDriver,
|
|
98
|
+
why: "@db resolves to the live database marker and requires a --db connection"
|
|
99
|
+
});
|
|
100
|
+
if (missingDb) return notOk(missingDb);
|
|
101
|
+
} else {
|
|
102
|
+
const fromHash = fromResult.value.hash;
|
|
103
|
+
const offlineMarker = fromHash === "empty" ? null : {
|
|
104
|
+
storageHash: fromHash,
|
|
105
|
+
invariants: []
|
|
106
|
+
};
|
|
107
|
+
markerBySpace.set(aggregate.app.spaceId, offlineMarker);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const needsLiveMarker = !hasExplicitFrom || options.from === "@db";
|
|
111
|
+
if (needsLiveMarker) {
|
|
112
|
+
if (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({
|
|
113
|
+
why: "A database connection is required to read the live marker for migrate --show",
|
|
114
|
+
commandName: "migrate --show"
|
|
115
|
+
}));
|
|
116
|
+
const client = createControlClient({
|
|
117
|
+
family: config.family,
|
|
118
|
+
target: config.target,
|
|
119
|
+
adapter: config.adapter,
|
|
120
|
+
driver: config.driver,
|
|
121
|
+
extensions: config.extensions ?? []
|
|
122
|
+
});
|
|
123
|
+
try {
|
|
124
|
+
await client.connect(dbConnection);
|
|
125
|
+
const allMarkers = await client.readAllMarkers();
|
|
126
|
+
for (const space of allSpaces) {
|
|
127
|
+
const marker = allMarkers.get(space.spaceId);
|
|
128
|
+
markerBySpace.set(space.spaceId, marker ?? null);
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
132
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));
|
|
133
|
+
} finally {
|
|
134
|
+
await client.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];
|
|
138
|
+
const orderedMigrations = [];
|
|
139
|
+
for (const space of canonicalOrderSpaces) {
|
|
140
|
+
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
141
|
+
const headRef = requireHeadRef(space);
|
|
142
|
+
const outcome = planSpacePath({
|
|
143
|
+
space,
|
|
144
|
+
aggregate,
|
|
145
|
+
targetHash: isAppSpace ? targetHash : headRef.hash,
|
|
146
|
+
refInvariants: isAppSpace ? refInvariants : void 0,
|
|
147
|
+
liveMarker: markerBySpace.get(space.spaceId) ?? null
|
|
148
|
+
});
|
|
149
|
+
if (outcome.kind === "at-head") continue;
|
|
150
|
+
if (outcome.kind === "never-planned") return notOk(errorPathUnreachable({
|
|
151
|
+
code: "MIGRATION_PATH_NOT_FOUND",
|
|
152
|
+
summary: `No on-disk migrations for contract space "${outcome.spaceId}"`,
|
|
153
|
+
why: `migrate is replay-only: space "${outcome.spaceId}" has no on-disk migrations but its head ref targets "${outcome.targetHash}".`,
|
|
154
|
+
meta: {
|
|
155
|
+
spaceId: outcome.spaceId,
|
|
156
|
+
target: outcome.targetHash,
|
|
157
|
+
kind: "neverPlanned"
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
if (outcome.kind === "unreachable") {
|
|
161
|
+
const fromHash = outcome.liveMarker?.storageHash ?? "empty";
|
|
162
|
+
return notOk(errorPathUnreachable({
|
|
163
|
+
code: "MIGRATION_PATH_NOT_FOUND",
|
|
164
|
+
summary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space "${outcome.spaceId}".`,
|
|
165
|
+
why: `The migration graph has no path from the from-state to the target in space "${outcome.spaceId}".`,
|
|
166
|
+
meta: {
|
|
167
|
+
spaceId: outcome.spaceId,
|
|
168
|
+
from: fromHash,
|
|
169
|
+
to: outcome.targetHash
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
if (outcome.kind === "unsatisfiable") return notOk(errorRuntime$1("MIGRATION.NO_INVARIANT_PATH", `Missing required invariants for space "${outcome.spaceId}"`, {
|
|
174
|
+
why: `The path requires invariants not available on disk: ${outcome.missing.join(", ")}`,
|
|
175
|
+
fix: "Add a migration on the path that runs `dataTransform({ invariantId: \"<id>\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.",
|
|
176
|
+
meta: {
|
|
177
|
+
spaceId: outcome.spaceId,
|
|
178
|
+
missing: [...outcome.missing]
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
for (const edge of outcome.plan.migrationEdges) orderedMigrations.push({
|
|
182
|
+
spaceId: space.spaceId,
|
|
183
|
+
dirName: edge.dirName,
|
|
184
|
+
migrationHash: edge.migrationHash,
|
|
185
|
+
from: edge.from,
|
|
186
|
+
to: edge.to
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const count = orderedMigrations.length;
|
|
190
|
+
return ok({
|
|
191
|
+
aggregate,
|
|
192
|
+
contractHash,
|
|
193
|
+
migrations: orderedMigrations,
|
|
194
|
+
summary: count === 0 ? "Already up to date — nothing to run" : `${count} migration${count === 1 ? "" : "s"} will run`,
|
|
195
|
+
renderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? "empty"])),
|
|
196
|
+
usedLiveMarker: needsLiveMarker
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
export { executeMigrateShowPlan as t };
|
|
201
|
+
|
|
202
|
+
//# sourceMappingURL=migrate-show-B2LkXkoB-D1ZNl84C.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-show-B2LkXkoB-D1ZNl84C.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/migrate-show-B2LkXkoB.mjs"],"sourcesContent":["import { F as CliStructuredError, V as errorDatabaseConnectionRequired, Z as errorPathUnreachable, ct as errorUnexpected, lt as mapRefResolutionError, rt as errorRuntime, s as resolveMigrationPaths, ut as requireLiveDatabase } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { n as planSpacePath, t as createControlClient } from \"./client-Y6qbDk7X.mjs\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { requireHeadRef } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/control-api/operations/migrate-show.ts\n/**\n* Read-only preview core for `migrate --show`: computes the migration path through the same planSpacePath seam the real apply uses, stopping before any write boundary.\n*/\n/**\n* Computes the path through the SAME seam as `executeMigrate`:\n* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n* the full marker including `invariants` (not just `storageHash`).\n* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,\n* which feeds `resolveRecordedPath()` with the same target hash, target invariants,\n* and current marker as the real apply path uses.\n*\n* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n* DB state is mutated.\n*/\nasync function executeMigrateShowPlan(options) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst hasExplicitFrom = options.from !== void 0;\n\tif (!hasExplicitFrom) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tlet targetHash = contractHash;\n\tlet refInvariants;\n\tif (options.to) {\n\t\tconst toResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));\n\t\tif (toResult.value.provenance.kind === \"reserved-db\") return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"@db is not valid as a --to target; it names the live database state, not a target contract.\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\ttargetHash = toResult.value.hash;\n\t\tif (toResult.value.provenance.kind === \"ref\") {\n\t\t\tconst refEntry = allRefs[toResult.value.provenance.refName];\n\t\t\tif (refEntry) refInvariants = refEntry.invariants;\n\t\t}\n\t}\n\toptions.onPreflightComplete?.({\n\t\tconfigPath,\n\t\tmigrationsRelative,\n\t\tdbConnection,\n\t\thasExplicitFrom\n\t});\n\tconst markerBySpace = /* @__PURE__ */ new Map();\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tif (hasExplicitFrom) if (options.from === \"@db\") {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from @db --db $DATABASE_URL\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t} else {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tif (fromResult.value.provenance.kind === \"reserved-db\") {\n\t\t\tconst missingDb = requireLiveDatabase({\n\t\t\t\tdbConnection,\n\t\t\t\thasDriver,\n\t\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\"\n\t\t\t});\n\t\t\tif (missingDb) return notOk(missingDb);\n\t\t} else {\n\t\t\tconst fromHash = fromResult.value.hash;\n\t\t\tconst offlineMarker = fromHash === EMPTY_CONTRACT_HASH ? null : {\n\t\t\t\tstorageHash: fromHash,\n\t\t\t\tinvariants: []\n\t\t\t};\n\t\t\tmarkerBySpace.set(aggregate.app.spaceId, offlineMarker);\n\t\t}\n\t}\n\tconst needsLiveMarker = !hasExplicitFrom || options.from === \"@db\";\n\tif (needsLiveMarker) {\n\t\tif (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"A database connection is required to read the live marker for migrate --show\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconst allMarkers = await client.readAllMarkers();\n\t\t\tfor (const space of allSpaces) {\n\t\t\t\tconst marker = allMarkers.get(space.spaceId);\n\t\t\t\tmarkerBySpace.set(space.spaceId, marker ?? null);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tconst canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];\n\tconst orderedMigrations = [];\n\tfor (const space of canonicalOrderSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: isAppSpace ? targetHash : headRef.hash,\n\t\t\trefInvariants: isAppSpace ? refInvariants : void 0,\n\t\t\tliveMarker: markerBySpace.get(space.spaceId) ?? null\n\t\t});\n\t\tif (outcome.kind === \"at-head\") continue;\n\t\tif (outcome.kind === \"never-planned\") return notOk(errorPathUnreachable({\n\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\tsummary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n\t\t\twhy: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\ttarget: outcome.targetHash,\n\t\t\t\tkind: \"neverPlanned\"\n\t\t\t}\n\t\t}));\n\t\tif (outcome.kind === \"unreachable\") {\n\t\t\tconst fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\treturn notOk(errorPathUnreachable({\n\t\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\t\tsummary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n\t\t\t\twhy: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n\t\t\t\tmeta: {\n\t\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: outcome.targetHash\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (outcome.kind === \"unsatisfiable\") return notOk(errorRuntime(\"MIGRATION.NO_INVARIANT_PATH\", `Missing required invariants for space \"${outcome.spaceId}\"`, {\n\t\t\twhy: `The path requires invariants not available on disk: ${outcome.missing.join(\", \")}`,\n\t\t\tfix: \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\tmissing: [...outcome.missing]\n\t\t\t}\n\t\t}));\n\t\tfor (const edge of outcome.plan.migrationEdges) orderedMigrations.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to\n\t\t});\n\t}\n\tconst count = orderedMigrations.length;\n\treturn ok({\n\t\taggregate,\n\t\tcontractHash,\n\t\tmigrations: orderedMigrations,\n\t\tsummary: count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`,\n\t\trenderMarkerHashBySpace: new Map(allSpaces.map((s) => [s.spaceId, markerBySpace.get(s.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH])),\n\t\tusedLiveMarker: needsLiveMarker\n\t});\n}\n//#endregion\nexport { executeMigrateShowPlan as t };\n\n//# sourceMappingURL=migrate-show-B2LkXkoB.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,eAAe,uBAAuB,SAAS;CAC9C,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBAAsB,QAAQ,QAAQ,MAAM;CAC/G,MAAM,eAAe,QAAQ,MAAM,OAAO,IAAI;CAC9C,MAAM,YAAY,CAAC,CAAC,OAAO;CAC3B,M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,KAAK,MAAM,QAAQ,QAAQ,KAAK,gBAAgB,kBAAkB,KAAK;GACtE,SAAS,MAAM;GACf,SAAS,KAAK;GACd,eAAe,KAAK;GACpB,MAAM,KAAK;GACX,IAAI,KAAK;EACV,CAAC;CACF;CACA,MAAM,QAAQ,kBAAkB;CAChC,OAAO,GAAG;EACT;EACA;EACA,YAAY;EACZ,SAAS,UAAU,IAAI,wCAAwC,GAAG,MAAM,YAAY,UAAU,IAAI,KAAK,IAAI;EAC3G,yBAAyB,IAAI,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,SAAS,cAAc,IAAI,EAAE,OAAO,CAAC,EAAE,eAAA,OAAkC,CAAC,CAAC;EACpI,gBAAgB;CACjB,CAAC;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-
|
|
1
|
+
import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-Co-8oaiB-CB-6Uqki.mjs";
|
|
2
2
|
import { t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
3
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
3
|
+
import { t as deriveProvidedInvariants } from "./invariants-C1WVUAH7-DlOBTTkM.mjs";
|
|
4
4
|
import { t as MigrationOpSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
|
|
5
5
|
import { type } from "arktype";
|
|
6
6
|
import { realpathSync } from "node:fs";
|
|
@@ -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-DAJY-NmR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-diUAhNaa.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-BwusfLIN.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-CMcQxRas.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,MA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Q;EACP,OAAO;CACR;AACD;;;;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB,MAAM,KAAK,UAAU;CACnD,MAAM,eAAe;EACpB,MAAM,KAAK;EACX,IAAI,KAAK;EACT,oBAAoB,yBAAyB,GAAG;EAChD,WAAW,UAAU,8BAA8B,IAAI,KAAK,EAAA,CAAG,YAAY;CAC5E;CACA,MAAM,gBAAgB,qBAAqB,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-DAJY-NmR.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-Co-8oaiB.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-C1WVUAH7.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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C1D,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"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { I as formatErrorJson, L as formatErrorOutput, W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DE494TSG.mjs";
|
|
2
|
+
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
3
|
+
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs";
|
|
4
|
+
import { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from "./migration-check-DONPyXff-CGTUpLv-.mjs";
|
|
5
|
+
import { join, relative } from "pathe";
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-check-BDjtAn7x.mjs
|
|
8
|
+
function migrationPathRelative(dirPath) {
|
|
9
|
+
return relative(process.cwd(), dirPath);
|
|
10
|
+
}
|
|
11
|
+
function migrationFileRelative(dirPath, fileName) {
|
|
12
|
+
return join(migrationPathRelative(dirPath), fileName);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Map one {@link IntegrityViolation} onto a `migration check` failure row.
|
|
16
|
+
* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.
|
|
17
|
+
*/
|
|
18
|
+
function integrityViolationToCheckFailure(violation, migrationsDir) {
|
|
19
|
+
const spaceRelative = (spaceId) => migrationPathRelative(join(migrationsDir, spaceId));
|
|
20
|
+
const packageRelative = (spaceId, dirName) => migrationPathRelative(join(migrationsDir, spaceId, dirName));
|
|
21
|
+
const refRelative = (spaceId, refName) => migrationPathRelative(join(migrationsDir, spaceId, "refs", `${refName}.json`));
|
|
22
|
+
switch (violation.kind) {
|
|
23
|
+
case "hashMismatch": return {
|
|
24
|
+
space: violation.spaceId,
|
|
25
|
+
code: "MIGRATION.CHECK_HASH_MISMATCH",
|
|
26
|
+
where: migrationFileRelative(join(migrationsDir, violation.spaceId, violation.dirName), "migration.json"),
|
|
27
|
+
why: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,
|
|
28
|
+
fix: "Re-emit the migration package or restore from version control."
|
|
29
|
+
};
|
|
30
|
+
case "providedInvariantsMismatch": return {
|
|
31
|
+
space: violation.spaceId,
|
|
32
|
+
code: "MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH",
|
|
33
|
+
where: packageRelative(violation.spaceId, violation.dirName),
|
|
34
|
+
why: `Migration "${violation.dirName}" providedInvariants in migration.json disagrees with ops.json.`,
|
|
35
|
+
fix: "Re-emit the migration package so migration.json and ops.json agree."
|
|
36
|
+
};
|
|
37
|
+
case "packageUnloadable": return {
|
|
38
|
+
space: violation.spaceId,
|
|
39
|
+
code: "MIGRATION.CHECK_PACKAGE_UNLOADABLE",
|
|
40
|
+
where: packageRelative(violation.spaceId, violation.dirName),
|
|
41
|
+
why: `Migration "${violation.dirName}" could not be loaded: ${violation.detail}`,
|
|
42
|
+
fix: "Re-emit the migration package or restore from version control."
|
|
43
|
+
};
|
|
44
|
+
case "sameSourceAndTarget": return {
|
|
45
|
+
space: violation.spaceId,
|
|
46
|
+
code: "MIGRATION.CHECK_NOOP_SELF_EDGE",
|
|
47
|
+
where: packageRelative(violation.spaceId, violation.dirName),
|
|
48
|
+
why: `Migration "${violation.dirName}" in space "${violation.spaceId}" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,
|
|
49
|
+
fix: "Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op."
|
|
50
|
+
};
|
|
51
|
+
case "orphanSpaceDir": return {
|
|
52
|
+
space: violation.spaceId,
|
|
53
|
+
code: "MIGRATION.CHECK_ORPHAN_SPACE_DIR",
|
|
54
|
+
where: spaceRelative(violation.spaceId),
|
|
55
|
+
why: `Contract-space directory "${violation.spaceId}" exists on disk but no extension declares it.`,
|
|
56
|
+
fix: "Remove the orphan directory, or declare the extension in `extensions`."
|
|
57
|
+
};
|
|
58
|
+
case "declaredButUnmigrated": return {
|
|
59
|
+
space: violation.spaceId,
|
|
60
|
+
code: "MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED",
|
|
61
|
+
where: spaceRelative(violation.spaceId),
|
|
62
|
+
why: `Extension "${violation.spaceId}" is declared in \`extensions\` but has no on-disk migrations directory.`,
|
|
63
|
+
fix: "Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused."
|
|
64
|
+
};
|
|
65
|
+
case "headRefMissing": return {
|
|
66
|
+
space: violation.spaceId,
|
|
67
|
+
code: "MIGRATION.CHECK_HEAD_REF_MISSING",
|
|
68
|
+
where: refRelative(violation.spaceId, "head"),
|
|
69
|
+
why: `Head ref \`refs/head.json\` is missing for contract space "${violation.spaceId}".`,
|
|
70
|
+
fix: "Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control."
|
|
71
|
+
};
|
|
72
|
+
case "headRefNotInGraph": return {
|
|
73
|
+
space: violation.spaceId,
|
|
74
|
+
code: "MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH",
|
|
75
|
+
where: refRelative(violation.spaceId, "head"),
|
|
76
|
+
why: `Head ref ${violation.hash} for contract space "${violation.spaceId}" is not present in its migration graph.`,
|
|
77
|
+
fix: "Re-emit the contract space migrations, or restore the missing migration package."
|
|
78
|
+
};
|
|
79
|
+
case "refUnreadable": return {
|
|
80
|
+
space: violation.spaceId,
|
|
81
|
+
code: "MIGRATION.CHECK_REF_UNREADABLE",
|
|
82
|
+
where: refRelative(violation.spaceId, violation.refName),
|
|
83
|
+
why: `Ref "${violation.refName}" for contract space "${violation.spaceId}" is unreadable: ${violation.detail}`,
|
|
84
|
+
fix: "Repair or remove the corrupt ref file."
|
|
85
|
+
};
|
|
86
|
+
case "targetMismatch": return {
|
|
87
|
+
space: violation.spaceId,
|
|
88
|
+
code: "MIGRATION.CHECK_TARGET_MISMATCH",
|
|
89
|
+
where: spaceRelative(violation.spaceId),
|
|
90
|
+
why: `Contract space "${violation.spaceId}" targets "${violation.actual}" but the project targets "${violation.expected}".`,
|
|
91
|
+
fix: "Update the extension to target the configured database, or change the project target."
|
|
92
|
+
};
|
|
93
|
+
case "disjointness": return {
|
|
94
|
+
space: "app",
|
|
95
|
+
code: "MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION",
|
|
96
|
+
where: migrationPathRelative(migrationsDir),
|
|
97
|
+
why: `Storage element "${violation.element}" is claimed by multiple contract spaces: ${violation.claimedBy.join(", ")}.`,
|
|
98
|
+
fix: "Update the contracts so each storage element is owned by exactly one contract space."
|
|
99
|
+
};
|
|
100
|
+
case "contractUnreadable": return {
|
|
101
|
+
space: violation.spaceId,
|
|
102
|
+
code: "MIGRATION.CHECK_CONTRACT_UNREADABLE",
|
|
103
|
+
where: migrationFileRelative(join(migrationsDir, violation.spaceId), "contract.json"),
|
|
104
|
+
why: `Contract for space "${violation.spaceId}" is unreadable: ${violation.detail}`,
|
|
105
|
+
fix: "Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract."
|
|
106
|
+
};
|
|
107
|
+
case "duplicateMigrationHash": return {
|
|
108
|
+
space: violation.spaceId,
|
|
109
|
+
code: "MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH",
|
|
110
|
+
where: spaceRelative(violation.spaceId),
|
|
111
|
+
why: `Multiple migrations in space "${violation.spaceId}" share migrationHash "${violation.migrationHash}" (${violation.dirNames.join(", ")}).`,
|
|
112
|
+
fix: "Re-emit one of the conflicting packages so each migrationHash is unique."
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function executeMigrationCheckCommand(target, options, flags, ui) {
|
|
117
|
+
const config = await loadConfig(options.config);
|
|
118
|
+
const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
119
|
+
if (!flags.json && !flags.quiet) {
|
|
120
|
+
const details = [{
|
|
121
|
+
label: "config",
|
|
122
|
+
value: configPath
|
|
123
|
+
}, {
|
|
124
|
+
label: "migrations",
|
|
125
|
+
value: appMigrationsRelative
|
|
126
|
+
}];
|
|
127
|
+
if (target) details.push({
|
|
128
|
+
label: "target",
|
|
129
|
+
value: target
|
|
130
|
+
});
|
|
131
|
+
const header = formatStyledHeader({
|
|
132
|
+
command: "migration check",
|
|
133
|
+
description: "Verify artifact and graph integrity",
|
|
134
|
+
details,
|
|
135
|
+
flags
|
|
136
|
+
});
|
|
137
|
+
ui.stderr(header);
|
|
138
|
+
}
|
|
139
|
+
const loadedAggregate = await buildReadAggregate(config, { migrationsDir });
|
|
140
|
+
if (!loadedAggregate.ok) return {
|
|
141
|
+
error: loadedAggregate.failure,
|
|
142
|
+
exitCode: 2
|
|
143
|
+
};
|
|
144
|
+
const spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);
|
|
145
|
+
if (target) return await checkSingleTarget(target, {
|
|
146
|
+
spaces,
|
|
147
|
+
...options.space !== void 0 ? { spaceFilter: options.space } : {},
|
|
148
|
+
appMigrationsDir,
|
|
149
|
+
appMigrationsRelative
|
|
150
|
+
});
|
|
151
|
+
const checkResult = await runMigrationCheck({
|
|
152
|
+
spaces,
|
|
153
|
+
...options.space !== void 0 ? { spaceFilter: options.space } : {}
|
|
154
|
+
});
|
|
155
|
+
if (!checkResult.ok) return {
|
|
156
|
+
error: checkResult.failure,
|
|
157
|
+
exitCode: 2
|
|
158
|
+
};
|
|
159
|
+
const failures = [...checkResult.value.failures];
|
|
160
|
+
const allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);
|
|
161
|
+
const scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== "disjointness" && v.spaceId === options.space);
|
|
162
|
+
for (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));
|
|
163
|
+
if (failures.length === 0) return {
|
|
164
|
+
result: {
|
|
165
|
+
ok: true,
|
|
166
|
+
failures: [],
|
|
167
|
+
summary: "All checks passed"
|
|
168
|
+
},
|
|
169
|
+
exitCode: 0
|
|
170
|
+
};
|
|
171
|
+
return {
|
|
172
|
+
result: {
|
|
173
|
+
ok: false,
|
|
174
|
+
failures,
|
|
175
|
+
summary: `${failures.length} integrity failure(s)`
|
|
176
|
+
},
|
|
177
|
+
exitCode: 4
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function createMigrationCheckCommand() {
|
|
181
|
+
const command = new Command("check");
|
|
182
|
+
setCommandDescriptions(command, "Verify artifact and graph integrity", "Validates that on-disk migration packages are internally consistent\n(hashes match, manifests are complete) and that the graph is well-formed\n(edges connect, refs point at valid nodes). The whole-graph check spans\nevery contract space by default; pass --space <id> to narrow to one. A\nmigration reference checks a single package, resolved across all contract\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\nOffline — does not consult the database.\nExit codes: 0 = all checks passed, 2 = precondition failed\n(unresolved target or unknown --space), 4 = integrity failure(s) found.");
|
|
183
|
+
setCommandExamples(command, [
|
|
184
|
+
"prisma-next migration check",
|
|
185
|
+
"prisma-next migration check --space app",
|
|
186
|
+
"prisma-next migration check 20260101-add-users",
|
|
187
|
+
"prisma-next migration check 20260101-add-users --space app",
|
|
188
|
+
"prisma-next migration check --json"
|
|
189
|
+
]);
|
|
190
|
+
setCommandSeeAlso(command, [
|
|
191
|
+
{
|
|
192
|
+
verb: "migration status",
|
|
193
|
+
oneLiner: "Show migration path and pending status"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
verb: "migration list",
|
|
197
|
+
oneLiner: "List on-disk migrations"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
verb: "migration graph",
|
|
201
|
+
oneLiner: "Show the migration graph topology"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
verb: "migration show",
|
|
205
|
+
oneLiner: "Display migration package contents"
|
|
206
|
+
}
|
|
207
|
+
]);
|
|
208
|
+
command.exitOverride();
|
|
209
|
+
addGlobalOptions(command).argument("[target]", "Migration reference: directory name, hash/prefix, ref, or path").option("--config <path>", "Path to prisma-next.config.ts").option("--space <id>", "Narrow output to a single contract space").action(async (target, options) => {
|
|
210
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
211
|
+
const ui = createTerminalUI(flags);
|
|
212
|
+
let outcome;
|
|
213
|
+
try {
|
|
214
|
+
outcome = await executeMigrationCheckCommand(target, options, flags, ui);
|
|
215
|
+
} catch (error) {
|
|
216
|
+
outcome = {
|
|
217
|
+
result: {
|
|
218
|
+
ok: false,
|
|
219
|
+
failures: [],
|
|
220
|
+
summary: error instanceof Error ? error.message : String(error)
|
|
221
|
+
},
|
|
222
|
+
exitCode: 2
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (outcome.error) {
|
|
226
|
+
const envelope = outcome.error.toEnvelope();
|
|
227
|
+
if (flags.json) ui.output(formatErrorJson(envelope));
|
|
228
|
+
else if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));
|
|
229
|
+
process.exit(outcome.exitCode);
|
|
230
|
+
}
|
|
231
|
+
const result = outcome.result ?? {
|
|
232
|
+
ok: false,
|
|
233
|
+
failures: [],
|
|
234
|
+
summary: "No check result produced"
|
|
235
|
+
};
|
|
236
|
+
if (flags.json) ui.output(JSON.stringify(result, null, 2));
|
|
237
|
+
else if (!flags.quiet) if (result.ok) {
|
|
238
|
+
const spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : "";
|
|
239
|
+
ui.log(`✔ ${result.summary}${spaceSuffix}`);
|
|
240
|
+
} else {
|
|
241
|
+
for (const f of result.failures) {
|
|
242
|
+
ui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);
|
|
243
|
+
ui.log(` fix: ${f.fix}`);
|
|
244
|
+
}
|
|
245
|
+
ui.log(`\n${result.summary}`);
|
|
246
|
+
}
|
|
247
|
+
process.exit(outcome.exitCode);
|
|
248
|
+
});
|
|
249
|
+
return command;
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
export { createMigrationCheckCommand as t };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=migration-check-BDjtAn7x-B0nEBR0k.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-check-BDjtAn7x-B0nEBR0k.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-BDjtAn7x.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, x as formatErrorOutput } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { i as runMigrationCheck, n as enumerateCheckSpaces, r as loadAggregateIntegrityViolations, t as checkSingleTarget } from \"./migration-check-DONPyXff.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { join, relative } from \"pathe\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\n/**\n* Map one {@link IntegrityViolation} onto a `migration check` failure row.\n* Sole catalogue mapping from integrity violations to `MIGRATION.CHECK_*` codes.\n*/\nfunction integrityViolationToCheckFailure(violation, migrationsDir) {\n\tconst spaceRelative = (spaceId) => migrationPathRelative(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative(join(migrationsDir, spaceId, \"refs\", `${refName}.json`));\n\tswitch (violation.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId, violation.dirName), \"migration.json\"),\n\t\t\twhy: `Stored hash ${violation.stored} does not match recomputed hash ${violation.computed}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PROVIDED_INVARIANTS_MISMATCH\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" providedInvariants in migration.json disagrees with ops.json.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json and ops.json agree.\"\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_PACKAGE_UNLOADABLE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" could not be loaded: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t\t};\n\t\tcase \"sameSourceAndTarget\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_NOOP_SELF_EDGE\",\n\t\t\twhere: packageRelative(violation.spaceId, violation.dirName),\n\t\t\twhy: `Migration \"${violation.dirName}\" in space \"${violation.spaceId}\" has source equal to target (${violation.hash}) with no data invariant — a true no-op self-edge.`,\n\t\t\tfix: \"Add a data operation if this self-edge was meant to carry a data invariant, or delete the migration if it is a true no-op.\"\n\t\t};\n\t\tcase \"orphanSpaceDir\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_ORPHAN_SPACE_DIR\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract-space directory \"${violation.spaceId}\" exists on disk but no extension declares it.`,\n\t\t\tfix: \"Remove the orphan directory, or declare the extension in `extensions`.\"\n\t\t};\n\t\tcase \"declaredButUnmigrated\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DECLARED_BUT_UNMIGRATED\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Extension \"${violation.spaceId}\" is declared in \\`extensions\\` but has no on-disk migrations directory.`,\n\t\t\tfix: \"Re-emit the extension contract-space artefacts with `prisma-next contract emit` and migration planning, or remove the extension from `extensions` if it is unused.\"\n\t\t};\n\t\tcase \"headRefMissing\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_MISSING\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref \\`refs/head.json\\` is missing for contract space \"${violation.spaceId}\".`,\n\t\t\tfix: \"Re-emit the contract-space migrations and head ref artefacts, or restore `refs/head.json` from version control.\"\n\t\t};\n\t\tcase \"headRefNotInGraph\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_HEAD_REF_NOT_IN_GRAPH\",\n\t\t\twhere: refRelative(violation.spaceId, \"head\"),\n\t\t\twhy: `Head ref ${violation.hash} for contract space \"${violation.spaceId}\" is not present in its migration graph.`,\n\t\t\tfix: \"Re-emit the contract space migrations, or restore the missing migration package.\"\n\t\t};\n\t\tcase \"refUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_REF_UNREADABLE\",\n\t\t\twhere: refRelative(violation.spaceId, violation.refName),\n\t\t\twhy: `Ref \"${violation.refName}\" for contract space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Repair or remove the corrupt ref file.\"\n\t\t};\n\t\tcase \"targetMismatch\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_TARGET_MISMATCH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Contract space \"${violation.spaceId}\" targets \"${violation.actual}\" but the project targets \"${violation.expected}\".`,\n\t\t\tfix: \"Update the extension to target the configured database, or change the project target.\"\n\t\t};\n\t\tcase \"disjointness\": return {\n\t\t\tspace: \"app\",\n\t\t\tcode: \"MIGRATION.CHECK_SPACE_DISJOINTNESS_VIOLATION\",\n\t\t\twhere: migrationPathRelative(migrationsDir),\n\t\t\twhy: `Storage element \"${violation.element}\" is claimed by multiple contract spaces: ${violation.claimedBy.join(\", \")}.`,\n\t\t\tfix: \"Update the contracts so each storage element is owned by exactly one contract space.\"\n\t\t};\n\t\tcase \"contractUnreadable\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_CONTRACT_UNREADABLE\",\n\t\t\twhere: migrationFileRelative(join(migrationsDir, violation.spaceId), \"contract.json\"),\n\t\t\twhy: `Contract for space \"${violation.spaceId}\" is unreadable: ${violation.detail}`,\n\t\t\tfix: \"Re-emit the extension contract artefacts, or fix the descriptor producing the invalid contract.\"\n\t\t};\n\t\tcase \"duplicateMigrationHash\": return {\n\t\t\tspace: violation.spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_DUPLICATE_MIGRATION_HASH\",\n\t\t\twhere: spaceRelative(violation.spaceId),\n\t\t\twhy: `Multiple migrations in space \"${violation.spaceId}\" share migrationHash \"${violation.migrationHash}\" (${violation.dirNames.join(\", \")}).`,\n\t\t\tfix: \"Re-emit one of the conflicting packages so each migrationHash is unique.\"\n\t\t};\n\t}\n}\n//#endregion\n//#region src/commands/migration-check.ts\nasync function executeMigrationCheckCommand(target, options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (target) details.push({\n\t\t\tlabel: \"target\",\n\t\t\tvalue: target\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration check\",\n\t\t\tdescription: \"Verify artifact and graph integrity\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst loadedAggregate = await buildReadAggregate(config, { migrationsDir });\n\tif (!loadedAggregate.ok) return {\n\t\terror: loadedAggregate.failure,\n\t\texitCode: 2\n\t};\n\tconst spaces = await enumerateCheckSpaces(loadedAggregate.value.aggregate, migrationsDir);\n\tif (target) return await checkSingleTarget(target, {\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {},\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative\n\t});\n\tconst checkResult = await runMigrationCheck({\n\t\tspaces,\n\t\t...options.space !== void 0 ? { spaceFilter: options.space } : {}\n\t});\n\tif (!checkResult.ok) return {\n\t\terror: checkResult.failure,\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkResult.value.failures];\n\tconst allViolations = await loadAggregateIntegrityViolations(config, migrationsDir);\n\tconst scopedViolations = options.space === void 0 ? allViolations : allViolations.filter((v) => v.kind !== \"disjointness\" && v.spaceId === options.space);\n\tfor (const violation of scopedViolations) failures.push(integrityViolationToCheckFailure(violation, migrationsDir));\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4\n\t};\n}\nfunction createMigrationCheckCommand() {\n\tconst command = new Command(\"check\");\n\tsetCommandDescriptions(command, \"Verify artifact and graph integrity\", \"Validates that on-disk migration packages are internally consistent\\n(hashes match, manifests are complete) and that the graph is well-formed\\n(edges connect, refs point at valid nodes). The whole-graph check spans\\nevery contract space by default; pass --space <id> to narrow to one. A\\nmigration reference checks a single package, resolved across all contract\\nspaces (narrow with --space; an ambiguous reference is a precondition failure).\\nOffline — does not consult the database.\\nExit codes: 0 = all checks passed, 2 = precondition failed\\n(unresolved target or unknown --space), 4 = integrity failure(s) found.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration check\",\n\t\t\"prisma-next migration check --space app\",\n\t\t\"prisma-next migration check 20260101-add-users\",\n\t\t\"prisma-next migration check 20260101-add-users --space app\",\n\t\t\"prisma-next migration check --json\"\n\t]);\n\tsetCommandSeeAlso(command, [\n\t\t{\n\t\t\tverb: \"migration status\",\n\t\t\toneLiner: \"Show migration path and pending status\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration list\",\n\t\t\toneLiner: \"List on-disk migrations\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration graph\",\n\t\t\toneLiner: \"Show the migration graph topology\"\n\t\t},\n\t\t{\n\t\t\tverb: \"migration show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\tcommand.exitOverride();\n\taddGlobalOptions(command).argument(\"[target]\", \"Migration reference: directory name, hash/prefix, ref, or path\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").action(async (target, options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await executeMigrationCheckCommand(target, options, flags, ui);\n\t\t} catch (error) {\n\t\t\toutcome = {\n\t\t\t\tresult: {\n\t\t\t\t\tok: false,\n\t\t\t\t\tfailures: [],\n\t\t\t\t\tsummary: error instanceof Error ? error.message : String(error)\n\t\t\t\t},\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t}\n\t\tif (outcome.error) {\n\t\t\tconst envelope = outcome.error.toEnvelope();\n\t\t\tif (flags.json) ui.output(formatErrorJson(envelope));\n\t\t\telse if (!flags.quiet) ui.error(formatErrorOutput(envelope, flags));\n\t\t\tprocess.exit(outcome.exitCode);\n\t\t}\n\t\tconst result = outcome.result ?? {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: \"No check result produced\"\n\t\t};\n\t\tif (flags.json) ui.output(JSON.stringify(result, null, 2));\n\t\telse if (!flags.quiet) if (result.ok) {\n\t\t\tconst spaceSuffix = outcome.resolvedSpaceId !== void 0 ? ` (space: ${outcome.resolvedSpaceId})` : \"\";\n\t\t\tui.log(`✔ ${result.summary}${spaceSuffix}`);\n\t\t} else {\n\t\t\tfor (const f of result.failures) {\n\t\t\t\tui.log(`✗ [${f.code}] ${f.where}: ${f.why}`);\n\t\t\t\tui.log(` fix: ${f.fix}`);\n\t\t\t}\n\t\t\tui.log(`\\n${result.summary}`);\n\t\t}\n\t\tprocess.exit(outcome.exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-BDjtAn7x.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,sBAAsB,SAAS;CACvC,OAAO,SAAS,QAAQ,IAAI,GAAG,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