@prisma/orm-toolchain 8.0.0-rc.1-dev.4 → 8.0.0-rc.1-dev.6
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-B4mhR4Sk.mjs → aggregate-i-rfetSO.mjs} +8 -8
- package/dist/{aggregate-B4mhR4Sk.mjs.map → aggregate-i-rfetSO.mjs.map} +1 -1
- package/dist/bin__prisma-next.mjs +22 -22
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- 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 +1 -1
- package/dist/cli__commands__migrate.mjs +1 -1
- package/dist/cli__commands__migration-check.d.mts +1 -1
- package/dist/cli__commands__migration-check.mjs +1 -1
- 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 +1 -1
- package/dist/cli__commands__migration-list.mjs +1 -1
- 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.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 -1
- package/dist/cli__commands__ref.mjs +1 -1
- package/dist/cli__commands__telemetry.mjs +1 -1
- package/dist/cli__control-api.d.mts +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__migration-cli.mjs +3 -6
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{client-75qrAPqf-7l0C0H_b.mjs → client-7aUYC7ci-Bh9mLxkl.mjs} +16 -12
- package/dist/client-7aUYC7ci-Bh9mLxkl.mjs.map +1 -0
- package/dist/{command-helpers-CAoXqAY9-DWUBcTXM.mjs → command-helpers-C4WpR-QE-CK2gkj6l.mjs} +30 -74
- package/dist/command-helpers-C4WpR-QE-CK2gkj6l.mjs.map +1 -0
- package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs +44 -0
- package/dist/contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs.map +1 -0
- package/dist/{contract-emit-B6odMoem-C87PBvmo.mjs → contract-emit-CTm2zfuG-8mtkxW8M.mjs} +12 -11
- package/dist/contract-emit-CTm2zfuG-8mtkxW8M.mjs.map +1 -0
- package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs → contract-emit-D8IXP9Qp-CecAQio1.mjs} +4 -4
- package/dist/{contract-emit-0hSjbuxp-BJLC-VgC.mjs.map → contract-emit-D8IXP9Qp-CecAQio1.mjs.map} +1 -1
- package/dist/{contract-infer-BnkqpftN-DwBzasOu.mjs → contract-infer-C8-RqHeK-D_dm3onP.mjs} +5 -5
- package/dist/contract-infer-C8-RqHeK-D_dm3onP.mjs.map +1 -0
- package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs} +3 -3
- package/dist/{contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map → contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs → contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs} +6 -6
- package/dist/contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs.map +1 -0
- package/dist/{db-init-bd0_x2Q8.mjs → db-init-CXMcvoIA.mjs} +9 -12
- package/dist/db-init-CXMcvoIA.mjs.map +1 -0
- package/dist/{db-schema-CwgAWTqG.mjs → db-schema-j8DERh4t.mjs} +4 -4
- package/dist/{db-schema-CwgAWTqG.mjs.map → db-schema-j8DERh4t.mjs.map} +1 -1
- package/dist/{db-sign-vqiYfpjI.mjs → db-sign-xV_rpoIc.mjs} +10 -10
- package/dist/db-sign-xV_rpoIc.mjs.map +1 -0
- package/dist/{db-update-Br0diOCo.mjs → db-update-DXa2DIvu.mjs} +11 -11
- package/dist/db-update-DXa2DIvu.mjs.map +1 -0
- package/dist/{db-verify-CKPsRFrj-T7nSt7yT.mjs → db-verify-YWHjuKC7-DidK1gx1.mjs} +9 -6
- package/dist/db-verify-YWHjuKC7-DidK1gx1.mjs.map +1 -0
- package/dist/{errors--qsXZUtL.d.mts → errors-AkMBj-YP.d.mts} +8 -8
- package/dist/errors-AkMBj-YP.d.mts.map +1 -0
- package/dist/{errors-IpZm1Skp-BH495dRd.mjs → errors-BwusfLIN-BXM7K-ww.mjs} +42 -51
- package/dist/errors-BwusfLIN-BXM7K-ww.mjs.map +1 -0
- package/dist/{format-ByDm2goZ-BIRlFoo6.mjs → format-Bw3LVJ1v-D10inUT9.mjs} +12 -9
- package/dist/format-Bw3LVJ1v-D10inUT9.mjs.map +1 -0
- package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs → framework-components-3DdB31mk-BPGSuOyZ.mjs} +3 -3
- package/dist/{framework-components-CjshQKHA-Dlp6Leo5.mjs.map → framework-components-3DdB31mk-BPGSuOyZ.mjs.map} +1 -1
- package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs → graph-membership-h9ejuZla-ewjYM5wz.mjs} +3 -3
- package/dist/{graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map → graph-membership-h9ejuZla-ewjYM5wz.mjs.map} +1 -1
- package/dist/{init-BGm77aWc-jHVUn63W.mjs → init-CPB89WK2-Di4kgP6B.mjs} +4 -4
- package/dist/{init-BGm77aWc-jHVUn63W.mjs.map → init-CPB89WK2-Di4kgP6B.mjs.map} +1 -1
- package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs} +4 -4
- package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs.map → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map} +1 -1
- package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs → invariants-CMcQxRas-CXX9uhQW.mjs} +3 -3
- package/dist/{invariants-lXzy6txi-DAoP4nTE.mjs.map → invariants-CMcQxRas-CXX9uhQW.mjs.map} +1 -1
- package/dist/{io-C8TdyBKt-DloEBi70.mjs → io-CL3hSv42-DGZtTs89.mjs} +8 -8
- package/dist/{io-C8TdyBKt-DloEBi70.mjs.map → io-CL3hSv42-DGZtTs89.mjs.map} +1 -1
- package/dist/{migrate-BdVFDKF2.mjs → migrate-COusRrm7.mjs} +28 -22
- package/dist/migrate-COusRrm7.mjs.map +1 -0
- package/dist/{migration-check-CcG-fB8r-qpu6xdbA.mjs → migration-check-CueEJelQ-J81XR_ns.mjs} +10 -10
- package/dist/migration-check-CueEJelQ-J81XR_ns.mjs.map +1 -0
- package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs} +4 -4
- package/dist/{migration-command-scaffold-BCuoeAki-DMy_5ztW.mjs.map → migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map} +1 -1
- package/dist/{migration-BuUmO7It.mjs → migration-diUAhNaa.mjs} +3 -3
- package/dist/{migration-BuUmO7It.mjs.map → migration-diUAhNaa.mjs.map} +1 -1
- package/dist/{migration-graph-vmgkL3k4.mjs → migration-graph-BL6vfLcE.mjs} +4 -4
- package/dist/{migration-graph-vmgkL3k4.mjs.map → migration-graph-BL6vfLcE.mjs.map} +1 -1
- package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs → migration-graph-D6bN-mX0-DwMWY8DA.mjs} +3 -3
- package/dist/{migration-graph-CBf9ORe7-B4xAF8GN.mjs.map → migration-graph-D6bN-mX0-DwMWY8DA.mjs.map} +1 -1
- package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs → migration-list-D2_JdzWC-MRHYYVQE.mjs} +6 -6
- package/dist/{migration-list-BFBeo1_X-ckYMhETH.mjs.map → migration-list-D2_JdzWC-MRHYYVQE.mjs.map} +1 -1
- package/dist/{migration-log-CS5IWcNq-DI7FTHCA.mjs → migration-log-BXbz6-Lj-CKHbat5f.mjs} +4 -6
- package/dist/migration-log-BXbz6-Lj-CKHbat5f.mjs.map +1 -0
- package/dist/{migration-new-GmW2anVb.mjs → migration-new-szZFsA3C.mjs} +16 -15
- package/dist/migration-new-szZFsA3C.mjs.map +1 -0
- package/dist/{migration-path-target-D3Sj55PI-BICblCuk.mjs → migration-path-target-BPYp3LNc-qRQlG_Yn.mjs} +4 -4
- package/dist/migration-path-target-BPYp3LNc-qRQlG_Yn.mjs.map +1 -0
- package/dist/{migration-plan-q_L84PN1-ClkGgtVz.mjs → migration-plan-CxXAXYc8-Dnp-v8Nl.mjs} +17 -18
- package/dist/migration-plan-CxXAXYc8-Dnp-v8Nl.mjs.map +1 -0
- package/dist/{migration-show--pW4XhKs.mjs → migration-show-BKsIh7Uz.mjs} +9 -9
- package/dist/migration-show-BKsIh7Uz.mjs.map +1 -0
- package/dist/{migration-status-CFlzlRmu-QHUxHm_l.mjs → migration-status-CNnRInne--cvmx56T.mjs} +15 -15
- package/dist/migration-status-CNnRInne--cvmx56T.mjs.map +1 -0
- package/dist/migration-tools.d.mts +2 -2
- package/dist/migration-tools.mjs +12 -12
- 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.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 +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{project-import-root-CpwLCDLY-DkVwAnWj.mjs → project-import-root-C_bd0ooL-CLXW-gp6.mjs} +10 -8
- package/dist/project-import-root-C_bd0ooL-CLXW-gp6.mjs.map +1 -0
- package/dist/{ref-sHE8zOcm.mjs → ref-DjZ5Y8ju.mjs} +11 -11
- package/dist/ref-DjZ5Y8ju.mjs.map +1 -0
- package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs → ref-advancement-CSPMoQs3-CPkL3IFF.mjs} +4 -4
- package/dist/{ref-advancement-CSPMoQs3-fEipZrdu.mjs.map → ref-advancement-CSPMoQs3-CPkL3IFF.mjs.map} +1 -1
- package/dist/{ref-resolution-BjJBWPjX.mjs → ref-resolution-BsdziDFA.mjs} +2 -2
- package/dist/{ref-resolution-BjJBWPjX.mjs.map → ref-resolution-BsdziDFA.mjs.map} +1 -1
- package/dist/{refs-BDbB9BRB-D6Za3Q49.mjs → refs-DtoeUivZ-qay0UMSP.mjs} +6 -6
- package/dist/refs-DtoeUivZ-qay0UMSP.mjs.map +1 -0
- package/dist/{spaces-C27bA-xc.mjs → spaces-BNd2Tlk0.mjs} +7 -7
- package/dist/spaces-BNd2Tlk0.mjs.map +1 -0
- package/dist/{spaces-DxFj5y8l.d.mts → spaces-D5qtTlhj.d.mts} +2 -2
- package/dist/{spaces-DxFj5y8l.d.mts.map → spaces-D5qtTlhj.d.mts.map} +1 -1
- package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs → telemetry-DVBHDQd6-BEdoMii0.mjs} +3 -3
- package/dist/{telemetry-CmbCa3Ld-CmE5zcIG.mjs.map → telemetry-DVBHDQd6-BEdoMii0.mjs.map} +1 -1
- package/dist/{types-DZWEs4si-D8UlyJI0.d.mts → types-2n_H3DQ9-Bks8UPEO.d.mts} +8 -2
- package/dist/types-2n_H3DQ9-Bks8UPEO.d.mts.map +1 -0
- package/dist/{verify-DnVNjc5C-BGdsblBK.mjs → verify-C6L_hiJU-CN3eEe3Y.mjs} +3 -3
- package/dist/{verify-DnVNjc5C-BGdsblBK.mjs.map → verify-C6L_hiJU-CN3eEe3Y.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs} +4 -4
- package/dist/{verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map → verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/client-75qrAPqf-7l0C0H_b.mjs.map +0 -1
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +0 -1
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +0 -36
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +0 -1
- package/dist/contract-emit-B6odMoem-C87PBvmo.mjs.map +0 -1
- package/dist/contract-infer-BnkqpftN-DwBzasOu.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +0 -1
- package/dist/db-init-bd0_x2Q8.mjs.map +0 -1
- package/dist/db-sign-vqiYfpjI.mjs.map +0 -1
- package/dist/db-update-Br0diOCo.mjs.map +0 -1
- package/dist/db-verify-CKPsRFrj-T7nSt7yT.mjs.map +0 -1
- package/dist/errors--qsXZUtL.d.mts.map +0 -1
- package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +0 -1
- package/dist/format-ByDm2goZ-BIRlFoo6.mjs.map +0 -1
- package/dist/migrate-BdVFDKF2.mjs.map +0 -1
- package/dist/migration-check-CcG-fB8r-qpu6xdbA.mjs.map +0 -1
- package/dist/migration-log-CS5IWcNq-DI7FTHCA.mjs.map +0 -1
- package/dist/migration-new-GmW2anVb.mjs.map +0 -1
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +0 -1
- package/dist/migration-plan-q_L84PN1-ClkGgtVz.mjs.map +0 -1
- package/dist/migration-show--pW4XhKs.mjs.map +0 -1
- package/dist/migration-status-CFlzlRmu-QHUxHm_l.mjs.map +0 -1
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +0 -1
- package/dist/ref-sHE8zOcm.mjs.map +0 -1
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +0 -1
- package/dist/spaces-C27bA-xc.mjs.map +0 -1
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +0 -1
package/dist/{inspect-live-schema-CnwYTRZ0-P-6asJFl.mjs → inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, at as sanitizeErrorMessage, f as errorDatabaseConnectionRequired, m as errorDriverRequired, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
|
|
2
2
|
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
3
3
|
import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
|
|
4
|
-
import { t as createControlClient } from "./client-
|
|
4
|
+
import { t as createControlClient } from "./client-7aUYC7ci-Bh9mLxkl.mjs";
|
|
5
5
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
6
6
|
import { relative, resolve } from "pathe";
|
|
7
|
-
//#region ../../../1-framework/3-tooling/cli/dist/inspect-live-schema-
|
|
7
|
+
//#region ../../../1-framework/3-tooling/cli/dist/inspect-live-schema-DEYE4EHW.mjs
|
|
8
8
|
async function inspectLiveSchema(options, flags, ui, startTime, context) {
|
|
9
9
|
let config;
|
|
10
10
|
try {
|
|
@@ -88,4 +88,4 @@ async function inspectLiveSchema(options, flags, ui, startTime, context) {
|
|
|
88
88
|
//#endregion
|
|
89
89
|
export { inspectLiveSchema as t };
|
|
90
90
|
|
|
91
|
-
//# sourceMappingURL=inspect-live-schema-
|
|
91
|
+
//# sourceMappingURL=inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-live-schema-
|
|
1
|
+
{"version":3,"file":"inspect-live-schema-DEYE4EHW-DmSfKdpv.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/inspect-live-schema-DEYE4EHW.mjs"],"sourcesContent":["import { A as formatStyledHeader, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, c as sanitizeErrorMessage, ct as errorUnexpected, i as maskConnectionUrl } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-7aUYC7ci.mjs\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { relative, resolve } from \"pathe\";\n//#region src/commands/inspect-live-schema.ts\nasync function inspectLiveSchema(options, flags, ui, startTime, context) {\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(options.config);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: \"Failed to load config\" }));\n\t}\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\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\tif (options.db) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(options.db)\n\t\t});\n\t\telse if (config.db?.connection && typeof config.db.connection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(config.db.connection)\n\t\t});\n\t\tui.stderr(formatStyledHeader({\n\t\t\tcommand: context.commandName,\n\t\t\tdescription: context.description,\n\t\t\turl: context.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t}));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${context.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: context.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${context.commandName}` }));\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\tconst onProgress = createProgressAdapter({\n\t\tui,\n\t\tflags\n\t});\n\ttry {\n\t\tconst schema = await client.introspect({\n\t\t\tconnection: dbConnection,\n\t\t\tonProgress\n\t\t});\n\t\tconst schemaView = client.toSchemaView(schema);\n\t\tconst pslContractAst = client.inferPslContract(schema);\n\t\tconst pslBlockDescriptors = client.getPslBlockDescriptors();\n\t\tconst dbUrl = typeof dbConnection === \"string\" ? maskConnectionUrl(dbConnection) : void 0;\n\t\treturn ok({\n\t\t\tconfig,\n\t\t\tschema,\n\t\t\tschemaView,\n\t\t\tpslContractAst,\n\t\t\tpslBlockDescriptors,\n\t\t\ttarget: {\n\t\t\t\tfamilyId: config.family.familyId,\n\t\t\t\tid: config.target.targetId\n\t\t\t},\n\t\t\tmeta: {\n\t\t\t\tconfigPath,\n\t\t\t\t...dbUrl ? { dbUrl } : {}\n\t\t\t},\n\t\t\ttimings: { total: Date.now() - startTime }\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tconst safeMessage = sanitizeErrorMessage(error instanceof Error ? error.message : String(error), typeof dbConnection === \"string\" ? dbConnection : void 0);\n\t\treturn notOk(errorUnexpected(safeMessage, { why: `Unexpected error during ${context.command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AAc,CAAC,CAAC;CACrH,MAAM,SAAS,oBAAoB;EAClC,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,YAAY,OAAO,cAAc,CAAC;CACnC,CAAC;CACD,MAAM,aAAa,sBAAsB;EACxC;EACA;CACD,CAAC;CACD,IAAI;EACH,MAAM,SAAS,MAAM,OAAO,WAAW;GACtC,YAAY;GACZ;EACD,CAAC;EACD,MAAM,aAAa,OAAO,aAAa,MAAM;EAC7C,MAAM,iBAAiB,OAAO,iBAAiB,MAAM;EACrD,MAAM,sBAAsB,OAAO,uBAAuB;EAC1D,MAAM,QAAQ,OAAO,iBAAiB,WAAW,kBAAkB,YAAY,IAAI,KAAK;EACxF,OAAO,GAAG;GACT;GACA;GACA;GACA;GACA;GACA,QAAQ;IACP,UAAU,OAAO,OAAO;IACxB,IAAI,OAAO,OAAO;GACnB;GACA,MAAM;IACL;IACA,GAAG,QAAQ,EAAE,MAAM,IAAI,CAAC;GACzB;GACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;EAC1C,CAAC;CACF,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM,cAAc,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,OAAO,iBAAiB,WAAW,eAAe,KAAK,CAAC;EACzJ,OAAO,MAAM,gBAAgB,aAAa,EAAE,KAAK,2BAA2B,QAAQ,YAAY,IAAI,cAAc,CAAC,CAAC;CACrH,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-
|
|
2
|
-
//#region ../../../1-framework/3-tooling/migration/dist/invariants-
|
|
1
|
+
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-BwusfLIN-BXM7K-ww.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/invariants-CMcQxRas.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Hygiene check for `invariantId`. Rejects empty values plus any
|
|
5
5
|
* whitespace or control character (including Unicode whitespace like
|
|
@@ -54,4 +54,4 @@ function readInvariantId(op) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { validateInvariantId as n, deriveProvidedInvariants as t };
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=invariants-
|
|
57
|
+
//# sourceMappingURL=invariants-CMcQxRas-CXX9uhQW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariants-
|
|
1
|
+
{"version":3,"file":"invariants-CMcQxRas-CXX9uhQW.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-CMcQxRas.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-BwusfLIN.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-CMcQxRas.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,13 +1,13 @@
|
|
|
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-
|
|
2
|
-
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-
|
|
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-BwusfLIN-BXM7K-ww.mjs";
|
|
2
|
+
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
|
|
3
3
|
import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
4
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
4
|
+
import { t as deriveProvidedInvariants } from "./invariants-CMcQxRas-CXX9uhQW.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";
|
|
8
8
|
import { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
9
9
|
import { type } from "arktype";
|
|
10
|
-
//#region ../../../1-framework/3-tooling/migration/dist/io-
|
|
10
|
+
//#region ../../../1-framework/3-tooling/migration/dist/io-CL3hSv42.mjs
|
|
11
11
|
const MANIFEST_FILE = "migration.json";
|
|
12
12
|
const OPS_FILE = "ops.json";
|
|
13
13
|
const MAX_SLUG_LENGTH = 64;
|
|
@@ -266,14 +266,14 @@ async function readMigrationsDir(migrationsRoot, options) {
|
|
|
266
266
|
const dirName = entry;
|
|
267
267
|
if (MigrationToolsError.is(error)) {
|
|
268
268
|
if (error.code === "MIGRATION.HASH_MISMATCH") {
|
|
269
|
-
const
|
|
269
|
+
const meta = error.meta;
|
|
270
270
|
const rawPkg = await readMigrationPackageRaw(entryPath);
|
|
271
271
|
if (rawPkg !== null) packages.push(rawPkg);
|
|
272
272
|
problems.push({
|
|
273
273
|
kind: "hashMismatch",
|
|
274
274
|
dirName,
|
|
275
|
-
stored: typeof
|
|
276
|
-
computed: typeof
|
|
275
|
+
stored: typeof meta?.["storedHash"] === "string" ? meta["storedHash"] : "",
|
|
276
|
+
computed: typeof meta?.["computedHash"] === "string" ? meta["computedHash"] : ""
|
|
277
277
|
});
|
|
278
278
|
continue;
|
|
279
279
|
}
|
|
@@ -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-
|
|
313
|
+
//# sourceMappingURL=io-CL3hSv42-DGZtTs89.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io-C8TdyBKt-DloEBi70.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-C8TdyBKt.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-IpZm1Skp.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-sf5nP4mb.mjs\";\nimport { n as verifyMigrationHash } from \"./hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-lXzy6txi.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 details = error.details;\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 details?.[\"storedHash\"] === \"string\" ? details[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof details?.[\"computedHash\"] === \"string\" ? details[\"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-C8TdyBKt.mjs.map"],"mappings":";;;;;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ist/io-CL3hSv42.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-BwusfLIN.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-DNTOE6fB.mjs\";\nimport { n as verifyMigrationHash } from \"./hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-CMcQxRas.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-CL3hSv42.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,sBAAsB,KAAK,UAAU,KAAK;CACxD,MAAM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;CAC7C,IAAI;EACH,MAAM,MAAM,GAAG;CAChB,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,qBAAqB,GAAG;EACjE,MAAM;CACP;CACA,MAAM,UAAU,KAAK,KAAK,aAAa,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC3F,MAAM,UAAU,KAAK,KAAK,QAAQ,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAClF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAe,4BAA4B,WAAW,KAAK;CAC1D,MAAM,MAAM,KAAK,WAAW,IAAI,OAAO;CACvC,MAAM,GAAG,KAAK;EACb,WAAW;EACX,OAAO;CACR,CAAC;CACD,MAAM,sBAAsB,KAAK,IAAI,UAAU,IAAI,GAAG;AACvD;;;;;;;;;;;;;;;;;;;;;;AAsBA,eAAe,8CAA8C,WAAW,KAAK;CAC5E,IAAI,MAAM,gBAAgB,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,OAAO,EAA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C,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG;AAC3P"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { P as errorUnknownInvariant, t as MigrationToolsError } from "./errors-
|
|
1
|
+
import { P as errorUnknownInvariant, t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
|
|
2
2
|
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
|
-
import { r as findLatestMigration } from "./migration-graph-
|
|
4
|
-
import {
|
|
3
|
+
import { r as findLatestMigration } from "./migration-graph-D6bN-mX0-DwMWY8DA.mjs";
|
|
4
|
+
import { D as errorRunnerFailed, N as errorUnexpected, O as errorRuntime$1, Q as maskConnectionUrl, R as formatMigrationApplyCommandOutput, S as errorPathUnreachable, W as formatStyledHeader, Z as mapRefResolutionError, d as errorContractValidationFailed, et as parseGlobalFlagsOrExit, f as errorDatabaseConnectionRequired, h as errorFileNotFound, i as collectDeclaredInvariants, it as resolveMigrationPaths, j as errorTargetMigrationNotSupported, lt as targetSupportsMigrations, m as errorDriverRequired, nt as requireLiveDatabase, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, rt as resolveContractPath, st as setCommandExamples, t as CliStructuredError$1, y as errorMarkerMismatch } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
|
|
5
5
|
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
6
|
-
import { n as isGraphNode } from "./graph-membership-
|
|
7
|
-
import { i as readRefs } from "./refs-
|
|
8
|
-
import { u as requireHeadRef } from "./aggregate-
|
|
9
|
-
import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-
|
|
10
|
-
import { a as planSpacePath, t as createControlClient } from "./client-
|
|
11
|
-
import { i as readContractIR, r as executeRefAdvancement } from "./ref-advancement-CSPMoQs3-
|
|
12
|
-
import { n as parseContractRef } from "./ref-resolution-
|
|
13
|
-
import { t as mapContractAtError } from "./contract-at-errors-
|
|
6
|
+
import { n as isGraphNode } from "./graph-membership-h9ejuZla-ewjYM5wz.mjs";
|
|
7
|
+
import { i as readRefs } from "./refs-DtoeUivZ-qay0UMSP.mjs";
|
|
8
|
+
import { u as requireHeadRef } from "./aggregate-i-rfetSO.mjs";
|
|
9
|
+
import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs";
|
|
10
|
+
import { a as planSpacePath, t as createControlClient } from "./client-7aUYC7ci-Bh9mLxkl.mjs";
|
|
11
|
+
import { i as readContractIR, r as executeRefAdvancement } from "./ref-advancement-CSPMoQs3-CPkL3IFF.mjs";
|
|
12
|
+
import { n as parseContractRef } from "./ref-resolution-BsdziDFA.mjs";
|
|
13
|
+
import { t as mapContractAtError } from "./contract-at-errors-YdCQ5OOk-okxG7Eaj.mjs";
|
|
14
14
|
import { c as computeMaxDirNameWidth, d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as renderMigrationGraphCommand, i as buildMigrationGraphRows, r as buildGrid, s as computeLabelColumn, u as formatOnPathMigrationRow } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
15
|
-
import { r as listRefsByContractHash } from "./migration-list-
|
|
15
|
+
import { r as listRefsByContractHash } from "./migration-list-D2_JdzWC-MRHYYVQE.mjs";
|
|
16
16
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
17
17
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
18
18
|
import { readFile } from "node:fs/promises";
|
|
@@ -51,7 +51,7 @@ async function executeMigrateShowCommand(options, flags, ui) {
|
|
|
51
51
|
try {
|
|
52
52
|
allRefs = await readRefs(refsDir);
|
|
53
53
|
} catch (error) {
|
|
54
|
-
if (MigrationToolsError.is(error)) return notOk(
|
|
54
|
+
if (MigrationToolsError.is(error)) return notOk(error);
|
|
55
55
|
throw error;
|
|
56
56
|
}
|
|
57
57
|
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
@@ -160,7 +160,6 @@ async function executeMigrateShowCommand(options, flags, ui) {
|
|
|
160
160
|
}
|
|
161
161
|
} catch (error) {
|
|
162
162
|
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
163
|
-
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
164
163
|
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));
|
|
165
164
|
} finally {
|
|
166
165
|
await client.close();
|
|
@@ -202,7 +201,14 @@ async function executeMigrateShowCommand(options, flags, ui) {
|
|
|
202
201
|
}
|
|
203
202
|
}));
|
|
204
203
|
}
|
|
205
|
-
if (outcome.kind === "unsatisfiable") return notOk(errorRuntime$1(`Missing required invariants for space "${outcome.spaceId}"`, {
|
|
204
|
+
if (outcome.kind === "unsatisfiable") return notOk(errorRuntime$1("MIGRATION.NO_INVARIANT_PATH", `Missing required invariants for space "${outcome.spaceId}"`, {
|
|
205
|
+
why: `The path requires invariants not available on disk: ${outcome.missing.join(", ")}`,
|
|
206
|
+
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.",
|
|
207
|
+
meta: {
|
|
208
|
+
spaceId: outcome.spaceId,
|
|
209
|
+
missing: [...outcome.missing]
|
|
210
|
+
}
|
|
211
|
+
}));
|
|
206
212
|
for (const edge of outcome.plan.migrationEdges) orderedMigrations.push({
|
|
207
213
|
spaceId: space.spaceId,
|
|
208
214
|
dirName: edge.dirName,
|
|
@@ -293,10 +299,11 @@ function formatMigrateShowOutput(result, flags) {
|
|
|
293
299
|
}
|
|
294
300
|
function mapApplyFailure(failure) {
|
|
295
301
|
if (failure.code === "MIGRATION_PATH_NOT_FOUND") return errorPathUnreachable(failure);
|
|
296
|
-
return
|
|
302
|
+
return errorRunnerFailed(failure.summary, {
|
|
297
303
|
why: failure.why ?? "Migration runner failed",
|
|
298
304
|
fix: "Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.",
|
|
299
|
-
meta: failure.meta ?? {}
|
|
305
|
+
meta: failure.meta ?? {},
|
|
306
|
+
...ifDefined("cause", failure.cause)
|
|
300
307
|
});
|
|
301
308
|
}
|
|
302
309
|
async function executeMigrateCommand(options, flags, ui, startTime) {
|
|
@@ -403,11 +410,11 @@ async function executeMigrateCommand(options, flags, ui, startTime) {
|
|
|
403
410
|
const known = new Set(declared);
|
|
404
411
|
for (const id of appMarker?.invariants ?? []) known.add(id);
|
|
405
412
|
const unknown = refEntry.invariants.filter((id) => !known.has(id));
|
|
406
|
-
if (unknown.length > 0) return notOk(
|
|
413
|
+
if (unknown.length > 0) return notOk(errorUnknownInvariant({
|
|
407
414
|
...ifDefined("refName", toArg),
|
|
408
415
|
unknown,
|
|
409
416
|
declared: [...declared].sort()
|
|
410
|
-
}))
|
|
417
|
+
}));
|
|
411
418
|
}
|
|
412
419
|
if (!flags.quiet && !flags.json) ui.step("Loading contract spaces…");
|
|
413
420
|
let applyContract = contractRaw;
|
|
@@ -441,7 +448,7 @@ async function executeMigrateCommand(options, flags, ui, startTime) {
|
|
|
441
448
|
} : await readContractIR(snapshotContractJson, contractPathAbsolute);
|
|
442
449
|
advancedRef = await executeRefAdvancement(refsDir, migrationsDir, options.advanceRef, value.markerHash, contractIR);
|
|
443
450
|
} catch (error) {
|
|
444
|
-
if (MigrationToolsError.is(error)) return notOk(
|
|
451
|
+
if (MigrationToolsError.is(error)) return notOk(error);
|
|
445
452
|
throw error;
|
|
446
453
|
}
|
|
447
454
|
return ok({
|
|
@@ -458,7 +465,6 @@ async function executeMigrateCommand(options, flags, ui, startTime) {
|
|
|
458
465
|
});
|
|
459
466
|
} catch (error) {
|
|
460
467
|
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
461
|
-
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
462
468
|
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));
|
|
463
469
|
} finally {
|
|
464
470
|
await client.close();
|
|
@@ -497,4 +503,4 @@ function createMigrateCommand() {
|
|
|
497
503
|
//#endregion
|
|
498
504
|
export { createMigrateCommand as t };
|
|
499
505
|
|
|
500
|
-
//# sourceMappingURL=migrate-
|
|
506
|
+
//# sourceMappingURL=migrate-COusRrm7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-COusRrm7.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migrate.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, J as errorMarkerMismatch, S as formatMigrationApplyCommandOutput, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Z as errorPathUnreachable, _ as createTerminalUI, ct as errorUnexpected, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapRefResolutionError, n as collectDeclaredInvariants, nt as errorRunnerFailed, o as resolveContractPath, ot as errorTargetMigrationNotSupported, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as requireLiveDatabase, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"../contract-space-aggregate-loader-CziO_ZRW.mjs\";\nimport { n as planSpacePath, t as createControlClient } from \"../client-7aUYC7ci.mjs\";\nimport { i as readContractIR, r as executeRefAdvancement } from \"../ref-advancement-CSPMoQs3.mjs\";\nimport { t as mapContractAtError } from \"../contract-at-errors-YdCQ5OOk.mjs\";\nimport { d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as buildGrid, i as formatOnPathMigrationRow, m as buildMigrationGraphRows, n as computeMaxDirNameWidth, r as renderMigrationGraphCommand, t as computeLabelColumn } from \"../migration-graph-command-render-BKrg6BPv.mjs\";\nimport { r as listRefsByContractHash } from \"../migration-list-D2_JdzWC.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { requireHeadRef } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migrate.ts\n/**\n* Read-only preview of the migration path `migrate` will take.\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 executeMigrateShowCommand(options, flags, ui) {\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\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: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && !hasExplicitFrom) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.to) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: options.to\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate --show\",\n\t\t\tdescription: \"Preview the migration path migrate will take (read-only)\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\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\tconst summary = count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`;\n\tlet graphOutput;\n\tlet runListDirNameWidth;\n\tlet runListLeftPad;\n\tif (!flags.json) {\n\t\tconst onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));\n\t\tconst colorize = flags.color !== false;\n\t\tconst spaceLayouts = allSpaces.map((space) => {\n\t\t\tconst isApp = space.spaceId === aggregate.app.spaceId;\n\t\t\tconst spaceGraph = space.graph();\n\t\t\tconst rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});\n\t\t\tconst edgeAnnotations = /* @__PURE__ */ new Map();\n\t\t\tfor (const edge of spaceGraph.migrationByHash.values()) edgeAnnotations.set(edge.migrationHash, { pathHighlight: onPathHashes.has(edge.migrationHash) ? \"on-path\" : \"off-path\" });\n\t\t\treturn {\n\t\t\t\tspace,\n\t\t\t\tisApp,\n\t\t\t\tspaceGraph,\n\t\t\t\trowModel,\n\t\t\t\tgrid: buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations)),\n\t\t\t\tedgeAnnotations\n\t\t\t};\n\t\t});\n\t\tconst globalLabelColumn = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, \"unicode\"))) : void 0;\n\t\tconst globalMaxDirNameWidthFromLayouts = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel))) : void 0;\n\t\tconst runListMaxFromMigrations = orderedMigrations.length > 0 ? Math.max(...orderedMigrations.map((m) => m.dirName.length)) : 0;\n\t\tconst globalMaxDirNameWidth = globalMaxDirNameWidthFromLayouts !== void 0 ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations) : void 0;\n\t\trunListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;\n\t\trunListLeftPad = globalLabelColumn;\n\t\tconst showSpaceHeadings = allSpaces.length > 1;\n\t\tconst sections = [];\n\t\tfor (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {\n\t\t\tconst liveMarkerHash = (markerBySpace.get(space.spaceId) ?? null)?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\tconst tree = renderMigrationGraphCommand({\n\t\t\t\tgrid,\n\t\t\t\trowModel,\n\t\t\t\tcontractHash,\n\t\t\t\tisAppSpace: isApp,\n\t\t\t\t...needsLiveMarker ? { dbHash: liveMarkerHash } : {},\n\t\t\t\trefsByHash: listRefsByContractHash(space),\n\t\t\t\tedgeAnnotationsByHash: edgeAnnotations,\n\t\t\t\tcolorize,\n\t\t\t\tglyphMode: \"unicode\",\n\t\t\t\t...globalLabelColumn !== void 0 ? { globalLabelColumn } : {},\n\t\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t\t});\n\t\t\tif (tree.length === 0) continue;\n\t\t\tif (showSpaceHeadings) sections.push(`${space.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, \" \")}`);\n\t\t\telse sections.push(tree);\n\t\t}\n\t\tgraphOutput = sections.join(\"\\n\\n\");\n\t}\n\treturn ok({\n\t\tok: true,\n\t\tmigrations: orderedMigrations,\n\t\tsummary,\n\t\t...graphOutput !== void 0 ? { graphOutput } : {},\n\t\t...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},\n\t\t...runListLeftPad !== void 0 ? { runListLeftPad } : {}\n\t});\n}\nfunction formatMigrateShowOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst colorize = flags.color !== false;\n\tconst lines = [];\n\tif (result.graphOutput !== void 0 && result.graphOutput.length > 0) {\n\t\tlines.push(result.graphOutput);\n\t\tlines.push(\"\");\n\t}\n\tconst n = result.migrations.length;\n\tif (n > 0) {\n\t\tlines.push(`The following ${n} migration${n === 1 ? \"\" : \"s\"} will run:`);\n\t\tconst isMultiSpace = result.runListLeftPad !== void 0;\n\t\tconst gutter = result.runListLeftPad ?? 0;\n\t\tconst rawDirNameWidth = result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));\n\t\tconst listDirNameWidth = gutter + Math.max(rawDirNameWidth + 2, 25 - gutter) - (isMultiSpace ? 2 : 4);\n\t\tfor (const m of result.migrations) lines.push(` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, \"unicode\")}`);\n\t} else lines.push(result.summary);\n\treturn lines.join(\"\\n\");\n}\nfunction mapApplyFailure(failure) {\n\tif (failure.code === \"MIGRATION_PATH_NOT_FOUND\") return errorPathUnreachable(failure);\n\treturn errorRunnerFailed(failure.summary, {\n\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\tfix: \"Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.\",\n\t\tmeta: failure.meta ?? {},\n\t\t...ifDefined(\"cause\", failure.cause)\n\t});\n}\nasync function executeMigrateCommand(options, flags, ui, startTime) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migrate\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for migrate\" }));\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst toArg = options.to;\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractRaw;\n\tlet contractContent;\n\ttry {\n\t\tcontractContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate a valid contract.json, then retry.\"\n\t\t}));\n\t\treturn notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\ttry {\n\t\tcontractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst loadedAggregate = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: contractRaw,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loadedAggregate.ok) return notOk(loadedAggregate.failure);\n\tconst aggregate = loadedAggregate.value;\n\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),\n\t\tcheckContracts: true\n\t});\n\tif (integrityFailure) return notOk(integrityFailure);\n\tlet refEntry;\n\tlet refName;\n\tif (toArg) {\n\t\tconst refs = aggregate.app.refs;\n\t\tconst refResult = parseContractRef(toArg, {\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\trefName = refResult.value.provenance.refName;\n\t\t\tconst resolved = refs[refName];\n\t\t\tif (resolved) refEntry = resolved;\n\t\t} else refEntry = {\n\t\t\thash: refResult.value.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\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 (typeof dbConnection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t});\n\t\tif (toArg) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: toArg\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate\",\n\t\t\tdescription: \"Apply planned migrations to advance the database\",\n\t\t\turl: \"https://pris.ly/migrate\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\tif (appMarker !== null && !isGraphNode(appMarker.storageHash, appGraph)) return notOk(errorMarkerMismatch(appMarker.storageHash, [...appGraph.nodes].sort(), findLatestMigration(appGraph)?.to ?? null));\n\t\tif (refEntry && refEntry.invariants.length > 0) {\n\t\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\t\tconst known = new Set(declared);\n\t\t\tfor (const id of appMarker?.invariants ?? []) known.add(id);\n\t\t\tconst unknown = refEntry.invariants.filter((id) => !known.has(id));\n\t\t\tif (unknown.length > 0) return notOk(errorUnknownInvariant({\n\t\t\t\t...ifDefined(\"refName\", toArg),\n\t\t\t\tunknown,\n\t\t\t\tdeclared: [...declared].sort()\n\t\t\t}));\n\t\t}\n\t\tif (!flags.quiet && !flags.json) ui.step(\"Loading contract spaces…\");\n\t\tlet applyContract = contractRaw;\n\t\tlet snapshotContractJson = JSON.parse(contractContent);\n\t\tlet snapshotContractDts;\n\t\tif (toArg && refEntry) {\n\t\t\tconst targetHash = refEntry.hash;\n\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {\n\t\t\t\tconst at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);\n\t\t\t\tapplyContract = at.contract;\n\t\t\t\tsnapshotContractJson = at.contractJson;\n\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t} catch (error) {\n\t\t\t\treturn mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t}\n\t\t}\n\t\tconst applyResult = await client.migrate({\n\t\t\tcontract: applyContract,\n\t\t\tmigrationsDir,\n\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},\n\t\t\t...refEntry !== void 0 ? ifDefined(\"refName\", toArg) : {}\n\t\t});\n\t\tif (!applyResult.ok) return notOk(mapApplyFailure(applyResult.failure));\n\t\tconst { value } = applyResult;\n\t\tlet advancedRef = null;\n\t\tif (options.advanceRef !== void 0) try {\n\t\t\tconst contractIR = snapshotContractDts !== void 0 ? {\n\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t} : await readContractIR(snapshotContractJson, contractPathAbsolute);\n\t\t\tadvancedRef = await executeRefAdvancement(refsDir, migrationsDir, options.advanceRef, value.markerHash, contractIR);\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\tmigrationsTotal: value.perSpace.length,\n\t\t\tmarkerHash: value.markerHash,\n\t\t\tapplied: value.applied,\n\t\t\tsummary: value.summary,\n\t\t\tperSpace: value.perSpace,\n\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\ttimings: { total: Date.now() - startTime },\n\t\t\tadvancedRef\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrateCommand() {\n\tconst command = new Command(\"migrate\");\n\tsetCommandDescriptions(command, \"Apply planned migrations to advance the database\", \"Walks every contract space (app + extensions) and applies pending\\non-disk migrations in canonical order (extensions alphabetically,\\nthen app). Graph-walks the on-disk migration graph for every space.\\nUse --to to target a specific contract (hash, ref name, migration dir).\\nUse --show for a read-only preview of the path that would run.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migrate --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to abc123 --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --from @contract --to production\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--advance-ref <name>\", \"Advance the named ref to the post-apply marker after success\").option(\"--show\", \"Preview the migration path without applying (read-only)\").option(\"--from <contract>\", \"From-state for --show preview (@contract, @db, hash, ref name, or migration dir)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (options.show) {\n\t\t\tconst exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {\n\t\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\t\telse ui.output(formatMigrateShowOutput(showResult, flags));\n\t\t\t});\n\t\t\tprocess.exit(exitCode);\n\t\t\treturn;\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrateCommand };\n\n//# sourceMappingURL=migrate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,eAAe,0BAA0B,SAAS,OAAO,IAAI;CAC5D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBAAsB,QAAQ,QAAQ,MAAM;CAC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KAAK,CAAC;EACtF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
package/dist/{migration-check-CcG-fB8r-qpu6xdbA.mjs → migration-check-CueEJelQ-J81XR_ns.mjs}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as MigrationToolsError } from "./errors-
|
|
2
|
-
import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
1
|
+
import { t as MigrationToolsError } from "./errors-BwusfLIN-BXM7K-ww.mjs";
|
|
2
|
+
import { r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DNTOE6fB-BDpjbdCJ.mjs";
|
|
3
3
|
import { n as verifyMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
4
4
|
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
5
|
-
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories } from "./verify-contract-spaces-
|
|
6
|
-
import { A as errorSpaceNotFound, I as formatErrorJson, L as formatErrorOutput,
|
|
5
|
+
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories } from "./verify-contract-spaces-Ak73-zQK-y4qVyu-y.mjs";
|
|
6
|
+
import { A as errorSpaceNotFound, I as formatErrorJson, L as formatErrorOutput, W as formatStyledHeader, Z as mapRefResolutionError, _ as errorInvalidSpaceId, c as errorAmbiguousMigrationRef, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, r as addGlobalOptions, rt as resolveContractPath, st as setCommandExamples } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
|
|
7
7
|
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
8
|
-
import { s as loadContractSpaceAggregate } from "./aggregate-
|
|
9
|
-
import { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-
|
|
10
|
-
import { r as parseMigrationRef } from "./ref-resolution-
|
|
11
|
-
import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-
|
|
8
|
+
import { s as loadContractSpaceAggregate } from "./aggregate-i-rfetSO.mjs";
|
|
9
|
+
import { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-CziO_ZRW-DIoQOL0P.mjs";
|
|
10
|
+
import { r as parseMigrationRef } from "./ref-resolution-BsdziDFA.mjs";
|
|
11
|
+
import { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "./migration-path-target-BPYp3LNc-qRQlG_Yn.mjs";
|
|
12
12
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
13
13
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
14
14
|
import { join, relative } from "pathe";
|
|
@@ -16,7 +16,7 @@ import { readFile } from "node:fs/promises";
|
|
|
16
16
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
17
17
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
18
18
|
import { Command } from "commander";
|
|
19
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-check-
|
|
19
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-check-CueEJelQ.mjs
|
|
20
20
|
function migrationPathRelative$1(dirPath) {
|
|
21
21
|
return relative(process.cwd(), dirPath);
|
|
22
22
|
}
|
|
@@ -594,4 +594,4 @@ function createMigrationCheckCommand() {
|
|
|
594
594
|
//#endregion
|
|
595
595
|
export { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };
|
|
596
596
|
|
|
597
|
-
//# sourceMappingURL=migration-check-
|
|
597
|
+
//# sourceMappingURL=migration-check-CueEJelQ-J81XR_ns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-check-CueEJelQ-J81XR_ns.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-check-CueEJelQ.mjs"],"sourcesContent":["import { A as formatStyledHeader, K as errorInvalidSpaceId, L as errorAmbiguousMigrationRef, _ as createTerminalUI, at as errorSpaceNotFound, b as formatErrorJson, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapRefResolutionError, o as resolveContractPath, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, x as formatErrorOutput } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"./contract-space-aggregate-loader-CziO_ZRW.mjs\";\nimport { i as resolveTargetPathAcrossSpaces, n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from \"./migration-path-target-BPYp3LNc.mjs\";\nimport \"./schemas-KhXMzNA_.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { isValidSpaceId, listContractSpaceDirectories, spaceMigrationDirectory, spaceRefsDirectory } from \"@internal/migration-tools/spaces\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError } from \"@internal/migration-tools/errors\";\nimport { contractSnapshotDir, readContractSnapshotJson } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { parseMigrationRef } from \"@internal/migration-tools/ref-resolution\";\nimport { verifyMigrationHash } from \"@internal/migration-tools/hash\";\n//#region src/utils/integrity-violation-to-check-failure.ts\nfunction migrationPathRelative$1(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative$1(dirPath, fileName) {\n\treturn join(migrationPathRelative$1(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$1(join(migrationsDir, spaceId));\n\tconst packageRelative = (spaceId, dirName) => migrationPathRelative$1(join(migrationsDir, spaceId, dirName));\n\tconst refRelative = (spaceId, refName) => migrationPathRelative$1(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$1(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$1(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$1(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\nfunction migrationPathRelative(dirPath) {\n\treturn relative(process.cwd(), dirPath);\n}\nfunction migrationFileRelative(dirPath, fileName) {\n\treturn join(migrationPathRelative(dirPath), fileName);\n}\nfunction checkFileExists(spaceId, dirPath, dirName, fileName) {\n\tif (!existsSync(join(dirPath, fileName))) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_FILE_MISSING\",\n\t\twhere: migrationFileRelative(dirPath, fileName),\n\t\twhy: `${fileName} is missing from ${dirName}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t};\n\treturn null;\n}\n/**\n* Snapshot-store consistency check for one migration package (D6.5):\n* absent store entry is not an issue (runner independence, ADR 199 — a\n* package dir with only `migration.json` + `ops.json` is legitimate); a\n* present entry whose inner `storage.storageHash` disagrees with\n* `pkg.metadata.to` is `MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH`; an unparseable store\n* entry (or a malformed `to`) is `MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE`.\n*/\nasync function checkSnapshotConsistency(spaceId, pkg, migrationsDir) {\n\tlet snapshotDir;\n\ttry {\n\t\tsnapshotDir = contractSnapshotDir(migrationsDir, pkg.metadata.to);\n\t} catch {\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" declares to=\"${pkg.metadata.to}\", which is not a well-formed contract snapshot hash.`,\n\t\t\tfix: \"Re-emit the migration package so migration.json declares a valid 64-hex to-hash.\"\n\t\t};\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readContractSnapshotJson(migrationsDir, pkg.metadata.to);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_MISSING\") return null;\n\t\treturn {\n\t\t\tspace: spaceId,\n\t\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_UNPARSEABLE\",\n\t\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\t\twhy: `Migration \"${pkg.dirName}\" has an unparseable contract snapshot at ${snapshotDir}/contract.json.`,\n\t\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that produced this migration to regenerate its snapshot.\"\n\t\t};\n\t}\n\tconst snapshotHash = (raw !== null && typeof raw === \"object\" ? raw : {})[\"storage\"]?.[\"storageHash\"];\n\tif (typeof snapshotHash === \"string\" && snapshotHash !== pkg.metadata.to) return {\n\t\tspace: spaceId,\n\t\tcode: \"MIGRATION.CHECK_SNAPSHOT_HASH_MISMATCH\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" declares to=${pkg.metadata.to} but its contract snapshot has storageHash=${snapshotHash}`,\n\t\tfix: \"Re-emit the migration package so migration.json and its contract snapshot agree.\"\n\t};\n\treturn null;\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the\n* {@link CheckSpace} rows the multi-space check iterates — one per on-disk\n* contract-space directory, in the aggregate's `app`-first ordering. Mirrors\n* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space\n* membership matches the on-disk directories, package / ref / graph data come\n* from `aggregate.space(id)`.\n*/\nasync function enumerateCheckSpaces(aggregate, projectMigrationsDir) {\n\tconst candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n\tconst onDiskSpaceIds = new Set(candidateDirs.filter(isValidSpaceId));\n\tconst spaces = [];\n\tfor (const space of aggregate.spaces()) {\n\t\tconst spaceId = space.spaceId;\n\t\tif (!isValidSpaceId(spaceId)) continue;\n\t\tif (!onDiskSpaceIds.has(spaceId)) continue;\n\t\tconst migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);\n\t\tspaces.push({\n\t\t\tspaceId,\n\t\t\tpackages: space.packages,\n\t\t\trefs: space.refs,\n\t\t\tgraph: space.graph(),\n\t\t\tmigrationsDir,\n\t\t\trefsDir: spaceRefsDirectory(migrationsDir),\n\t\t\tprojectMigrationsDir\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction checkManifestFilesPresent(space) {\n\tif (!existsSync(space.migrationsDir)) return [];\n\tconst loadedDirNames = new Set(space.packages.map((p) => p.dirName));\n\tconst failures = [];\n\tlet entries;\n\ttry {\n\t\tentries = readdirSync(space.migrationsDir);\n\t} catch {\n\t\treturn failures;\n\t}\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(\".\") || entry.startsWith(\"_\") || entry === \"refs\") continue;\n\t\tconst entryPath = join(space.migrationsDir, entry);\n\t\ttry {\n\t\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!loadedDirNames.has(entry)) for (const f of [\"migration.json\", \"ops.json\"]) {\n\t\t\tconst fail = checkFileExists(space.spaceId, entryPath, entry, f);\n\t\t\tif (fail) failures.push(fail);\n\t\t}\n\t}\n\treturn failures;\n}\nfunction checkReachability(space) {\n\tconst allToHashes = new Set(space.packages.map((p) => p.metadata.to));\n\tconst failures = [];\n\tfor (const pkg of space.packages) if (!(pkg.metadata.from === null || allToHashes.has(pkg.metadata.from) || pkg.metadata.from === EMPTY_CONTRACT_HASH)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_UNREACHABLE_MIGRATION\",\n\t\twhere: migrationPathRelative(pkg.dirPath),\n\t\twhy: `Migration \"${pkg.dirName}\" starts from ${pkg.metadata.from} which no other migration produces`,\n\t\tfix: \"This migration is unreachable in the graph. Delete it or re-emit a connecting migration.\"\n\t});\n\treturn failures;\n}\nfunction checkDanglingRefs(space) {\n\tconst failures = [];\n\tfor (const [name, entry] of Object.entries(space.refs)) if (!space.graph.nodes.has(entry.hash)) failures.push({\n\t\tspace: space.spaceId,\n\t\tcode: \"MIGRATION.CHECK_DANGLING_REF\",\n\t\twhere: relative(process.cwd(), join(space.refsDir, `${name}.json`)),\n\t\twhy: `Ref \"${name}\" points at ${entry.hash} which does not exist in the migration graph`,\n\t\tfix: `Update the ref with \\`prisma-next ref set ${name} <valid-hash>\\` or delete it.`\n\t});\n\treturn failures;\n}\nasync function checkSpace(space) {\n\tconst snapshotFailures = await Promise.all(space.packages.map((pkg) => checkSnapshotConsistency(space.spaceId, pkg, space.projectMigrationsDir)));\n\treturn [\n\t\t...checkManifestFilesPresent(space),\n\t\t...snapshotFailures.filter((f) => f !== null),\n\t\t...checkReachability(space),\n\t\t...checkDanglingRefs(space)\n\t];\n}\n/**\n* Policy core of the holistic `migration check`: validates `--space`,\n* narrows the pre-enumerated spaces, and runs the per-space explicit graph\n* checks (file-existence, snapshot consistency, reachability, dangling\n* refs), aggregating every failure into one {@link MigrationCheckResult}.\n*\n* `--space` validation mirrors `migration list`: an invalid id →\n* {@link errorInvalidSpaceId}; an id with no on-disk space →\n* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.\n* Aggregate-integrity violations (which already span every space) are folded\n* in by the caller, not here.\n*/\nasync function runMigrationCheck(inputs) {\n\tconst { spaces, spaceFilter } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tconst failures = (await Promise.all(scopedSpaces.map(checkSpace))).flat();\n\tif (failures.length === 0) return ok({\n\t\tok: true,\n\t\tfailures: [],\n\t\tsummary: \"All checks passed\"\n\t});\n\treturn ok({\n\t\tok: false,\n\t\tfailures,\n\t\tsummary: `${failures.length} integrity failure(s)`\n\t});\n}\nasync function loadAggregateIntegrityViolations(config, migrationsDir) {\n\ttry {\n\t\tconst contractJsonContent = await readFile(resolveContractPath(config), \"utf-8\");\n\t\tconst familyInstance = config.family.create(createControlStack(config));\n\t\tconst declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);\n\t\tconst parsedAppContract = JSON.parse(contractJsonContent);\n\t\treturn (await loadContractSpaceAggregate({\n\t\t\tmigrationsDir,\n\t\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\t\tappContract: familyInstance.deserializeContract(parsedAppContract)\n\t\t})).checkIntegrity({\n\t\t\tdeclaredExtensions,\n\t\t\tcheckContracts: true\n\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\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}\n/**\n* Ranks ref-resolution failure kinds by how informative they are, so a\n* single-target check surfaces the most useful failure across spaces instead of\n* whichever space failed first. `not-found` (the input matched nothing here)\n* says the least; a malformed input, a wrong grammar, or an in-space ambiguity\n* all say more.\n*/\nfunction refFailureSpecificity(error) {\n\tswitch (error.kind) {\n\t\tcase \"wrong-grammar\": return 3;\n\t\tcase \"ambiguous\": return 2;\n\t\tcase \"invalid-format\": return 1;\n\t\tcase \"not-found\": return 0;\n\t}\n}\n/**\n* Single-target (`check <ref/path>`) mode — resolves a migration reference\n* across all contract spaces (or the one space narrowed by `--space <id>`).\n*\n* Resolution:\n* - filesystem path → find the owning space by checking which space's\n* `migrationsDir` contains the resolved path; falls back to app-relative\n* validation when the path is outside every space dir.\n* - ref → `parseMigrationRef` against each in-scope space; collect every\n* (space, package) hit; 0 hits = not-found, 1 = check it, >1 = ambiguity\n* error (qualify with `--space`).\n*\n* `--space <id>` is validated the same way the holistic path does it:\n* invalid id → `errorInvalidSpaceId`; no on-disk space → `errorSpaceNotFound`.\n*/\nasync function checkSingleTarget(target, inputs) {\n\tconst { spaces, spaceFilter, appMigrationsDir, appMigrationsRelative } = inputs;\n\tif (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return {\n\t\terror: errorInvalidSpaceId(spaceFilter),\n\t\texitCode: 2\n\t};\n\tif (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return {\n\t\terror: errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()),\n\t\texitCode: 2\n\t};\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;\n\tlet matchedSpace;\n\tlet matchedPkg;\n\tif (looksLikePath(target)) {\n\t\tconst resolvedPath = resolveTargetPathAcrossSpaces(target, scopedSpaces);\n\t\tif (resolvedPath !== null) for (const space of scopedSpaces) {\n\t\t\tconst found = findPackageByDirPath(space.packages, resolvedPath);\n\t\t\tif (found) {\n\t\t\t\tmatchedSpace = space;\n\t\t\t\tmatchedPkg = found;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n\t\t\tif (!resolved.ok) return {\n\t\t\t\terror: resolved.failure,\n\t\t\t\texitCode: 2\n\t\t\t};\n\t\t\tconst appSpace = scopedSpaces.find((s) => s.spaceId === \"app\");\n\t\t\tif (appSpace) {\n\t\t\t\tmatchedSpace = appSpace;\n\t\t\t\tmatchedPkg = findPackageByDirPath(appSpace.packages, resolved.value);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst hits = [];\n\t\tlet bestParseFailure;\n\t\tfor (const space of scopedSpaces) {\n\t\t\tconst migResult = parseMigrationRef(target, {\n\t\t\t\tgraph: space.graph,\n\t\t\t\trefs: space.refs\n\t\t\t});\n\t\t\tif (!migResult.ok) {\n\t\t\t\tif (bestParseFailure === void 0 || refFailureSpecificity(migResult.failure) > refFailureSpecificity(bestParseFailure)) bestParseFailure = migResult.failure;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pkg = space.packages.find((p) => p.metadata.migrationHash === migResult.value.migrationHash);\n\t\t\tif (pkg) hits.push({\n\t\t\t\tspace,\n\t\t\t\tpkg\n\t\t\t});\n\t\t}\n\t\tif (hits.length > 1) return {\n\t\t\terror: errorAmbiguousMigrationRef(target, hits.map((h) => h.space.spaceId)),\n\t\t\texitCode: 2\n\t\t};\n\t\tif (hits.length === 1) {\n\t\t\tmatchedSpace = hits[0].space;\n\t\t\tmatchedPkg = hits[0].pkg;\n\t\t} else if (bestParseFailure !== void 0) return {\n\t\t\terror: mapRefResolutionError(bestParseFailure),\n\t\t\texitCode: 2\n\t\t};\n\t}\n\tif (!matchedPkg || !matchedSpace) return {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures: [],\n\t\t\tsummary: `Migration package for \"${target}\" not found on disk`\n\t\t},\n\t\texitCode: 2\n\t};\n\tconst failures = [...checkManifestFilesPresent(matchedSpace)];\n\tfor (const f of [\"migration.json\", \"ops.json\"]) {\n\t\tconst fail = checkFileExists(matchedSpace.spaceId, matchedPkg.dirPath, matchedPkg.dirName, f);\n\t\tif (fail) failures.push(fail);\n\t}\n\tconst verification = verifyMigrationHash(matchedPkg);\n\tif (!verification.ok) failures.push({\n\t\tspace: matchedSpace.spaceId,\n\t\tcode: \"MIGRATION.CHECK_HASH_MISMATCH\",\n\t\twhere: migrationFileRelative(matchedPkg.dirPath, \"migration.json\"),\n\t\twhy: `Stored hash ${verification.storedHash} does not match recomputed hash ${verification.computedHash}`,\n\t\tfix: \"Re-emit the migration package or restore from version control.\"\n\t});\n\tconst snapshotFailure = await checkSnapshotConsistency(matchedSpace.spaceId, matchedPkg, matchedSpace.projectMigrationsDir);\n\tif (snapshotFailure) failures.push(snapshotFailure);\n\tconst resolvedSpaceId = matchedSpace.spaceId !== \"app\" ? matchedSpace.spaceId : void 0;\n\tif (failures.length === 0) return {\n\t\tresult: {\n\t\t\tok: true,\n\t\t\tfailures: [],\n\t\t\tsummary: \"All checks passed\"\n\t\t},\n\t\texitCode: 0,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n\treturn {\n\t\tresult: {\n\t\t\tok: false,\n\t\t\tfailures,\n\t\t\tsummary: `${failures.length} integrity failure(s)`\n\t\t},\n\t\texitCode: 4,\n\t\t...ifDefined(\"resolvedSpaceId\", resolvedSpaceId)\n\t};\n}\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 { enumerateCheckSpaces as n, runMigrationCheck as r, createMigrationCheckCommand as t };\n\n//# sourceMappingURL=migration-check-CueEJelQ.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,wBAAwB,SAAS;CACzC,OAAO,SAAS,QAAQ,IAAI,GAAG,OAAO;AACvC;AACA,SAAS,wBAAwB,SAAS,UAAU;CACnD,OAAO,KAAK,wBAAwB,OAAO,GA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D;IACA,UAAU;GACX;EACD;EACA,IAAI,QAAQ,OAAO;GAClB,MAAM,WAAW,QAAQ,MAAM,WAAW;GAC1C,IAAI,MAAM,MAAM,GAAG,OAAO,gBAAgB,QAAQ,CAAC;QAC9C,IAAI,CAAC,MAAM,OAAO,GAAG,MAAM,kBAAkB,UAAU,KAAK,CAAC;GAClE,QAAQ,KAAK,QAAQ,QAAQ;EAC9B;EACA,MAAM,SAAS,QAAQ,UAAU;GAChC,IAAI;GACJ,UAAU,CAAC;GACX,SAAS;EACV;EACA,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;OACpD,IAAI,CAAC,MAAM,OAAO,IAAI,OAAO,IAAI;GACrC,MAAM,cAAc,QAAQ,oBAAoB,KAAK,IAAI,aAAa,QAAQ,gBAAgB,KAAK;GACnG,GAAG,IAAI,KAAK,OAAO,UAAU,aAAa;EAC3C,OAAO;GACN,KAAK,MAAM,KAAK,OAAO,UAAU;IAChC,GAAG,IAAI,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,KAAK;IAC3C,GAAG,IAAI,UAAU,EAAE,KAAK;GACzB;GACA,GAAG,IAAI,KAAK,OAAO,SAAS;EAC7B;EACA,QAAQ,KAAK,QAAQ,QAAQ;CAC9B,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, d as errorContractValidationFailed, f as errorDatabaseConnectionRequired, h as errorFileNotFound, j as errorTargetMigrationNotSupported, m as errorDriverRequired, r as addGlobalOptions, rt as resolveContractPath } from "./command-helpers-C4WpR-QE-CK2gkj6l.mjs";
|
|
2
2
|
import { r as loadConfig } from "./exports-CDX9kZuw.mjs";
|
|
3
3
|
import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_-BXYSd1eY.mjs";
|
|
4
|
-
import { t as createControlClient } from "./client-
|
|
4
|
+
import { t as createControlClient } from "./client-7aUYC7ci-Bh9mLxkl.mjs";
|
|
5
5
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { hasMigrations } from "@prisma/orm-framework/components/control";
|
|
8
8
|
import { relative, resolve } from "node:path";
|
|
9
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-
|
|
9
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-DNRo4exb.mjs
|
|
10
10
|
/**
|
|
11
11
|
* Prepares the shared context for migration commands (db init, db update).
|
|
12
12
|
*
|
|
@@ -100,4 +100,4 @@ function addMigrationCommandOptions(command) {
|
|
|
100
100
|
//#endregion
|
|
101
101
|
export { prepareMigrationContext as n, addMigrationCommandOptions as t };
|
|
102
102
|
|
|
103
|
-
//# sourceMappingURL=migration-command-scaffold-
|
|
103
|
+
//# sourceMappingURL=migration-command-scaffold-DNRo4exb-9JCezdoT.mjs.map
|