@prisma/orm-toolchain 8.0.0-rc.1-dev.21 → 8.0.0-rc.1-dev.23
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/bin__prisma-next.mjs +23 -23
- package/dist/bin__prisma-next.mjs.map +1 -1
- package/dist/{caught-errors-D7Qznyrm-BzYooF6H.mjs → caught-errors-D7Qznyrm-DaZubR00.mjs} +2 -2
- package/dist/{caught-errors-D7Qznyrm-BzYooF6H.mjs.map → caught-errors-D7Qznyrm-DaZubR00.mjs.map} +1 -1
- package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts} +3 -3
- package/dist/{cli-errors-CDr3WcJP-NFry5GHb.d.mts.map → cli-errors-BKPhkBSf-Ca-ymb6S.d.mts.map} +1 -1
- package/dist/cli-telemetry.mjs +6 -5
- package/dist/cli-telemetry.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 +2 -2
- package/dist/cli__commands__migrate.mjs +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.d.mts +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.mjs +1 -1
- package/dist/cli__commands__telemetry.mjs +1 -1
- package/dist/cli__control-api.d.mts +5 -5
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +15 -15
- package/dist/cli__control-api__testing.d.mts +66 -0
- package/dist/cli__control-api__testing.d.mts.map +1 -0
- package/dist/cli__control-api__testing.mjs +255 -0
- package/dist/cli__control-api__testing.mjs.map +1 -0
- package/dist/cli__migration-cli.mjs +13 -4
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs → client-BNAEJZ76-ld7eOxpZ.mjs} +5 -5
- package/dist/{client-Y6qbDk7X-BzKLmBZo.mjs.map → client-BNAEJZ76-ld7eOxpZ.mjs.map} +1 -1
- package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs → command-helpers-C4WpR-QE-DNllqff1.mjs} +3 -3
- package/dist/{command-helpers-C4WpR-QE-DE494TSG.mjs.map → command-helpers-C4WpR-QE-DNllqff1.mjs.map} +1 -1
- package/dist/config-loader.d.mts +2 -2
- package/dist/config-loader.mjs +2 -2
- package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs} +2 -2
- package/dist/{contract-at-errors-Dv1mxKYO-C29YB4RC.mjs.map → contract-at-errors-Dv1mxKYO-D4xfRBW5.mjs.map} +1 -1
- package/dist/{contract-emit-D8IXP9Qp-Df6NwXn8.mjs → contract-emit-DFu7h-Zl-7DBgYNv7.mjs} +9 -13
- package/dist/contract-emit-DFu7h-Zl-7DBgYNv7.mjs.map +1 -0
- package/dist/{contract-emit-CTm2zfuG-7PV9SBY6.mjs → contract-emit-DT0JKUZT-BYE7WZPc.mjs} +17 -9
- package/dist/contract-emit-DT0JKUZT-BYE7WZPc.mjs.map +1 -0
- package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs → contract-infer-C_b7E71m-D2UO-X-k.mjs} +4 -4
- package/dist/{contract-infer-BwT7ngoo-Dx6aAwIN.mjs.map → contract-infer-C_b7E71m-D2UO-X-k.mjs.map} +1 -1
- package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs} +3 -3
- package/dist/{contract-snapshot-resolution-SATuw0JW-CsYq7g_n.mjs.map → contract-snapshot-resolution-SATuw0JW-DpTZJd1x.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-C5r12INu-Db_pa3rX.mjs.map → contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs.map} +1 -1
- package/dist/{db-init-CBj_EWg3.mjs → db-init-Cqjw5Flp.mjs} +3 -3
- package/dist/{db-init-CBj_EWg3.mjs.map → db-init-Cqjw5Flp.mjs.map} +1 -1
- package/dist/{db-schema-BWpeh0Q_.mjs → db-schema-CRGCFKlH.mjs} +4 -4
- package/dist/{db-schema-BWpeh0Q_.mjs.map → db-schema-CRGCFKlH.mjs.map} +1 -1
- package/dist/{db-sign-DCb_DKtv.mjs → db-sign-BPQduGHb.mjs} +18 -7
- package/dist/db-sign-BPQduGHb.mjs.map +1 -0
- package/dist/{db-update-WX0KitcX.mjs → db-update-DuEk-ra5.mjs} +4 -4
- package/dist/{db-update-WX0KitcX.mjs.map → db-update-DuEk-ra5.mjs.map} +1 -1
- package/dist/{db-verify-B8ax2Y_x-Bp4s5Ra6.mjs → db-verify-DPH4lonK-pteoYVnK.mjs} +26 -11
- package/dist/db-verify-DPH4lonK-pteoYVnK.mjs.map +1 -0
- package/dist/exports-BN0vFTxG.mjs.map +1 -1
- package/dist/{exports-BnihzVhw.mjs → exports-DAA3XD4a.mjs} +15 -3
- package/dist/exports-DAA3XD4a.mjs.map +1 -0
- package/dist/exports-DVoyX2LM.mjs +173 -0
- package/dist/exports-DVoyX2LM.mjs.map +1 -0
- package/dist/{format-Bw3LVJ1v-BJ6lVFMA.mjs → format-DyVeO1z5-D1lnTJaz.mjs} +7 -11
- package/dist/format-DyVeO1z5-D1lnTJaz.mjs.map +1 -0
- package/dist/{framework-components-3DdB31mk-BHyX-OlJ.mjs → framework-components-ioeTnj2Z-yyQtaVWk.mjs} +7 -5
- package/dist/framework-components-ioeTnj2Z-yyQtaVWk.mjs.map +1 -0
- package/dist/index-Deu3DQZI.d.mts +47 -0
- package/dist/index-Deu3DQZI.d.mts.map +1 -0
- package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs → init-BwYYd10C-CJq9i42m.mjs} +4 -4
- package/dist/{init-CPB89WK2-DPZRZ9Ee.mjs.map → init-BwYYd10C-CJq9i42m.mjs.map} +1 -1
- package/dist/{inspect-live-schema-Da76TWOs-CAFqkhGb.mjs → inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs} +15 -12
- package/dist/inspect-live-schema-CXH4ZGHT-BfUdyZme.mjs.map +1 -0
- package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs → invariants-BzYfO9IL-BPDPDIr0.mjs} +2 -2
- package/dist/{invariants-BzYfO9IL-BXTvx0z9.mjs.map → invariants-BzYfO9IL-BPDPDIr0.mjs.map} +1 -1
- package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs → legend-5iwwlLU2-Bit8enjF.mjs} +2 -2
- package/dist/{legend-5iwwlLU2-CB8bdQKJ.mjs.map → legend-5iwwlLU2-Bit8enjF.mjs.map} +1 -1
- package/dist/{migrate-B-NAuO90.mjs → migrate-Bfsw18KQ.mjs} +23 -12
- package/dist/migrate-Bfsw18KQ.mjs.map +1 -0
- package/dist/{migrate-show-B2LkXkoB-D1ZNl84C.mjs → migrate-show-CO5OiR3J-DE4NIjvW.mjs} +18 -7
- package/dist/migrate-show-CO5OiR3J-DE4NIjvW.mjs.map +1 -0
- package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts} +3 -3
- package/dist/{migrate-show-60NNqVia-oGqMaVA9.d.mts.map → migrate-show-Cu3k9mZm-B-nCgvK1.d.mts.map} +1 -1
- package/dist/{migration-check-BDjtAn7x-B0nEBR0k.mjs → migration-check-BfOnfgyY-DII6Ty5m.mjs} +19 -7
- package/dist/migration-check-BfOnfgyY-DII6Ty5m.mjs.map +1 -0
- package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs → migration-check-DONPyXff-KpD0q3Zh.mjs} +4 -4
- package/dist/{migration-check-DONPyXff-CGTUpLv-.mjs.map → migration-check-DONPyXff-KpD0q3Zh.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs → migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs} +24 -7
- package/dist/migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs.map +1 -0
- package/dist/{migration-graph-Dn469b0l.mjs → migration-graph-BHiSuhBR.mjs} +17 -8
- package/dist/migration-graph-BHiSuhBR.mjs.map +1 -0
- package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs → migration-graph-HKch1Xk4-DD-3zdSg.mjs} +2 -2
- package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map → migration-graph-HKch1Xk4-DD-3zdSg.mjs.map} +1 -1
- package/dist/{migration-list-jk4iCtmO.mjs → migration-list-BkTNEeOK.mjs} +16 -7
- package/dist/migration-list-BkTNEeOK.mjs.map +1 -0
- package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs → migration-list-C9OPCMt--BBm2c7tN.mjs} +2 -2
- package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs.map → migration-list-C9OPCMt--BBm2c7tN.mjs.map} +1 -1
- package/dist/{migration-log-DQzUBrm8-D3m9wcuf.mjs → migration-log-CqrwQXER-cqf2INDN.mjs} +17 -7
- package/dist/migration-log-CqrwQXER-cqf2INDN.mjs.map +1 -0
- package/dist/{migration-new-g98oB3nC-BcrkxAAt.mjs → migration-new-Cjhe_MIE-CIovsuXK.mjs} +17 -8
- package/dist/migration-new-Cjhe_MIE-CIovsuXK.mjs.map +1 -0
- package/dist/{migration-new-BkSY6m0t.mjs → migration-new-NuMfcbH8.mjs} +3 -3
- package/dist/{migration-new-BkSY6m0t.mjs.map → migration-new-NuMfcbH8.mjs.map} +1 -1
- package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs} +2 -2
- package/dist/{migration-path-target-BPYp3LNc-DsDdLU0J.mjs.map → migration-path-target-BPYp3LNc-DjdEIQsZ.mjs.map} +1 -1
- package/dist/{migration-plan-CjIYMJZy.mjs → migration-plan-D81XmVwy.mjs} +3 -3
- package/dist/{migration-plan-CjIYMJZy.mjs.map → migration-plan-D81XmVwy.mjs.map} +1 -1
- package/dist/{migration-plan-CwuZLXVE-DAJ-JUQT.mjs → migration-plan-DE7-vtqT-jgtSH4Lw.mjs} +18 -9
- package/dist/migration-plan-DE7-vtqT-jgtSH4Lw.mjs.map +1 -0
- package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts → migration-plan-DvBJhxXg-B5aHAOtu.d.mts} +3 -3
- package/dist/{migration-plan-BsOYRogP-CC1UFAbu.d.mts.map → migration-plan-DvBJhxXg-B5aHAOtu.d.mts.map} +1 -1
- package/dist/{migration-show-CW6EKtfw.mjs → migration-show-DEsLJ6-a.mjs} +18 -8
- package/dist/migration-show-DEsLJ6-a.mjs.map +1 -0
- package/dist/{migration-status-DSQcBhiN.mjs → migration-status-DfLM3VqL.mjs} +21 -10
- package/dist/migration-status-DfLM3VqL.mjs.map +1 -0
- package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs → project-import-root-C_bd0ooL-CusfluWF.mjs} +2 -2
- package/dist/{project-import-root-C_bd0ooL-WkbJLnAA.mjs.map → project-import-root-C_bd0ooL-CusfluWF.mjs.map} +1 -1
- package/dist/{ref-DSAZime8.mjs → ref-D6JzE8nq.mjs} +3 -3
- package/dist/{ref-DSAZime8.mjs.map → ref-D6JzE8nq.mjs.map} +1 -1
- package/dist/{ref-eJjxzYTh-CNiyDL4p.mjs → ref-DrAvdDhN-q1ccuI03.mjs} +21 -10
- package/dist/ref-DrAvdDhN-q1ccuI03.mjs.map +1 -0
- package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs → ref-resolution-_S4xTT2L-JfNjZU9d.mjs} +2 -2
- package/dist/{ref-resolution-_S4xTT2L-BE5zgO2W.mjs.map → ref-resolution-_S4xTT2L-JfNjZU9d.mjs.map} +1 -1
- package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs → telemetry-DVBHDQd6-CWNTFnMO.mjs} +2 -2
- package/dist/{telemetry-DVBHDQd6-Ckn5oClN.mjs.map → telemetry-DVBHDQd6-CWNTFnMO.mjs.map} +1 -1
- package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs → verify-C6L_hiJU-MX67LFfI.mjs} +2 -2
- package/dist/{verify-C6L_hiJU-B4V3bqvG.mjs.map → verify-C6L_hiJU-MX67LFfI.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +5 -3
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +13 -12
- package/dist/contract-emit-CTm2zfuG-7PV9SBY6.mjs.map +0 -1
- package/dist/contract-emit-D8IXP9Qp-Df6NwXn8.mjs.map +0 -1
- package/dist/db-sign-DCb_DKtv.mjs.map +0 -1
- package/dist/db-verify-B8ax2Y_x-Bp4s5Ra6.mjs.map +0 -1
- package/dist/exports-BnihzVhw.mjs.map +0 -1
- package/dist/exports-CDX9kZuw.mjs +0 -119
- package/dist/exports-CDX9kZuw.mjs.map +0 -1
- package/dist/format-Bw3LVJ1v-BJ6lVFMA.mjs.map +0 -1
- package/dist/framework-components-3DdB31mk-BHyX-OlJ.mjs.map +0 -1
- package/dist/index-Df9igRvP.d.mts +0 -18
- package/dist/index-Df9igRvP.d.mts.map +0 -1
- package/dist/inspect-live-schema-Da76TWOs-CAFqkhGb.mjs.map +0 -1
- package/dist/migrate-B-NAuO90.mjs.map +0 -1
- package/dist/migrate-show-B2LkXkoB-D1ZNl84C.mjs.map +0 -1
- package/dist/migration-check-BDjtAn7x-B0nEBR0k.mjs.map +0 -1
- package/dist/migration-command-scaffold-BPqXPCFV-Bls2Wwg7.mjs.map +0 -1
- package/dist/migration-graph-Dn469b0l.mjs.map +0 -1
- package/dist/migration-list-jk4iCtmO.mjs.map +0 -1
- package/dist/migration-log-DQzUBrm8-D3m9wcuf.mjs.map +0 -1
- package/dist/migration-new-g98oB3nC-BcrkxAAt.mjs.map +0 -1
- package/dist/migration-plan-CwuZLXVE-DAJ-JUQT.mjs.map +0 -1
- package/dist/migration-show-CW6EKtfw.mjs.map +0 -1
- package/dist/migration-status-DSQcBhiN.mjs.map +0 -1
- package/dist/ref-eJjxzYTh-CNiyDL4p.mjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
2
|
-
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, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { a as loadConfigForSections } from "./exports-DVoyX2LM.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-BNAEJZ76-ld7eOxpZ.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-CGcbYM2B.mjs
|
|
10
10
|
/**
|
|
11
11
|
* Prepares the shared context for migration commands (db init, db update).
|
|
12
12
|
*
|
|
@@ -16,9 +16,26 @@ import { relative, resolve } from "node:path";
|
|
|
16
16
|
* Returns a Result with either the resolved context or a structured error.
|
|
17
17
|
*/
|
|
18
18
|
async function prepareMigrationContext(options, flags, ui, descriptor) {
|
|
19
|
-
const
|
|
19
|
+
const configResult = await loadConfigForSections(options.config, [
|
|
20
|
+
"family",
|
|
21
|
+
"target",
|
|
22
|
+
"adapter",
|
|
23
|
+
"driver",
|
|
24
|
+
"extensions",
|
|
25
|
+
"db",
|
|
26
|
+
"migrations",
|
|
27
|
+
"contract"
|
|
28
|
+
]);
|
|
29
|
+
if (!configResult.ok) return configResult;
|
|
30
|
+
const config = configResult.value;
|
|
20
31
|
const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
|
|
21
|
-
|
|
32
|
+
let contractPathAbsolute;
|
|
33
|
+
try {
|
|
34
|
+
contractPathAbsolute = resolveContractPath(config);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
22
39
|
const contractPath = relative(process.cwd(), contractPathAbsolute);
|
|
23
40
|
if (!flags.json && !flags.quiet) {
|
|
24
41
|
const details = [{
|
|
@@ -100,4 +117,4 @@ function addMigrationCommandOptions(command) {
|
|
|
100
117
|
//#endregion
|
|
101
118
|
export { prepareMigrationContext as n, addMigrationCommandOptions as t };
|
|
102
119
|
|
|
103
|
-
//# sourceMappingURL=migration-command-scaffold-
|
|
120
|
+
//# sourceMappingURL=migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-command-scaffold-CGcbYM2B-C3B8S3c-.mjs","names":["CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-command-scaffold-CGcbYM2B.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, ct as errorUnexpected, i as maskConnectionUrl, o as resolveContractPath, ot as errorTargetMigrationNotSupported, t as addGlobalOptions } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as createProgressAdapter } from \"./progress-adapter-CjAeTxY_.mjs\";\nimport { t as createControlClient } from \"./client-BNAEJZ76.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { hasMigrations } from \"@internal/framework-components/control\";\nimport { relative, resolve } from \"node:path\";\n//#region src/utils/migration-command-scaffold.ts\n/**\n* Prepares the shared context for migration commands (db init, db update).\n*\n* Handles: config loading, contract file reading, JSON parsing, connection resolution,\n* driver/migration-support validation, client creation, and header output.\n*\n* Returns a Result with either the resolved context or a structured error.\n*/\nasync function prepareMigrationContext(options, flags, ui, descriptor) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst configPath = options.config ? relative(process.cwd(), resolve(options.config)) : \"prisma-next.config.ts\";\n\tlet contractPathAbsolute;\n\ttry {\n\t\tcontractPathAbsolute = resolveContractPath(config);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst contractPath = relative(process.cwd(), contractPathAbsolute);\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: \"contract\",\n\t\t\tvalue: contractPath\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\tif (options.dryRun) details.push({\n\t\t\tlabel: \"mode\",\n\t\t\tvalue: \"dry run\"\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: descriptor.commandName,\n\t\t\tdescription: descriptor.description,\n\t\t\turl: descriptor.url,\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = 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 ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`\n\t\t}));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n\tlet contractJson;\n\ttry {\n\t\tcontractJson = JSON.parse(contractJsonContent);\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for ${descriptor.commandName} (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: descriptor.commandName\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${descriptor.commandName}` }));\n\tif (!hasMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\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\treturn ok({\n\t\tclient,\n\t\tcontractJson,\n\t\tdbConnection,\n\t\tonProgress,\n\t\tconfigPath,\n\t\tcontractPath,\n\t\tcontractPathAbsolute,\n\t\tconfig\n\t});\n}\n/**\n* Registers the shared CLI options for migration commands (db init, db update).\n*/\nfunction addMigrationCommandOptions(command) {\n\taddGlobalOptions(command);\n\treturn command.option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--dry-run\", \"Preview planned operations without applying\", false);\n}\n//#endregion\nexport { prepareMigrationContext as n, addMigrationCommandOptions as t };\n\n//# sourceMappingURL=migration-command-scaffold-CGcbYM2B.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAe,wBAAwB,SAAS,OAAO,IAAI,YAAY;CACtE,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,aAAa,QAAQ,SAAS,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAAI;CACvF,IAAI;CACJ,IAAI;EACH,uBAAuB,oBAAoB,MAAM;CAClD,SAAS,OAAO;EACf,IAAIA,qBAAmB,GAAG,KAAK,GAAG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YAAY,yBAAyB,WAAW;EACvG,aAAa,WAAW;CACzB,CAAC,CAAC;CACF,IAAI,CAAC,OAAO,QAAQ,OAAO,MAAM,oBAAoB,EAAE,KAAK,iCAAiC,WAAW,cAAc,CAAC,CAAC;CACxH,IAAI,CAAC,cAAc,OAAO,MAAM,GAAG,OAAO,MAAM,iCAAiC,EAAE,KAAK,WAAW,OAAO,OAAO,GAAG,+BAA+B,CAAC,CAAC;CACrJ,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,OAAO,GAAG;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;AACF;;;;AAIA,SAAS,2BAA2B,SAAS;CAC5C,iBAAiB,OAAO;CACxB,OAAO,QAAQ,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,aAAa,+CAA+C,KAAK;AACtM"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-
|
|
2
|
-
import {
|
|
3
|
-
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-
|
|
4
|
-
import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList, t as listRefsByContractHash } from "./migration-list-C9OPCMt--
|
|
1
|
+
import { W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
|
|
3
|
+
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
|
|
4
|
+
import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList, t as listRefsByContractHash } from "./migration-list-C9OPCMt--BBm2c7tN.mjs";
|
|
5
5
|
import { _ as renderMigrationGraphSpaceTree, a as computeGlobalMaxDirNameWidth, f as indentMigrationGraphTreeBlock, g as renderMigrationGraphLegend, o as computeGlobalMaxEdgeTreePrefixWidth } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
6
|
-
import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-5iwwlLU2-
|
|
7
|
-
import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-HKch1Xk4-
|
|
6
|
+
import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-5iwwlLU2-Bit8enjF.mjs";
|
|
7
|
+
import { t as buildMigrationSpaceGraphEntries } from "./migration-graph-HKch1Xk4-DD-3zdSg.mjs";
|
|
8
8
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
9
9
|
import { ok } from "@prisma/orm-framework/utils/result";
|
|
10
10
|
import { Command } from "commander";
|
|
@@ -26,7 +26,16 @@ function formatMigrationGraphHumanOutput(result) {
|
|
|
26
26
|
return sections.join("\n").trimEnd();
|
|
27
27
|
}
|
|
28
28
|
async function executeMigrationGraphCommand(options, flags, ui) {
|
|
29
|
-
const
|
|
29
|
+
const configResult = await loadConfigForSections(options.config, [
|
|
30
|
+
"family",
|
|
31
|
+
"target",
|
|
32
|
+
"adapter",
|
|
33
|
+
"extensions",
|
|
34
|
+
"migrations",
|
|
35
|
+
"contract"
|
|
36
|
+
]);
|
|
37
|
+
if (!configResult.ok) return configResult;
|
|
38
|
+
const config = configResult.value;
|
|
30
39
|
const { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);
|
|
31
40
|
if (!flags.json && !flags.quiet) {
|
|
32
41
|
const header = formatStyledHeader({
|
|
@@ -173,4 +182,4 @@ function createMigrationGraphCommand() {
|
|
|
173
182
|
//#endregion
|
|
174
183
|
export { executeMigrationGraphCommand as n, formatMigrationGraphHumanOutput as r, createMigrationGraphCommand as t };
|
|
175
184
|
|
|
176
|
-
//# sourceMappingURL=migration-graph-
|
|
185
|
+
//# sourceMappingURL=migration-graph-BHiSuhBR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-graph-BHiSuhBR.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-graph.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"../contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList, t as listRefsByContractHash } from \"../migration-list-C9OPCMt-.mjs\";\nimport { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from \"../migration-graph-command-render-BKrg6BPv.mjs\";\nimport { t as buildMigrationSpaceGraphEntries } from \"../migration-graph-HKch1Xk4.mjs\";\nimport { n as validateLegendOptions, t as shouldShowLegend } from \"../legend-5iwwlLU2.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/commands/migration-graph.ts\nfunction computeGraphSummary(spaces) {\n\tconst contractCount = spaces.reduce((count, space) => count + space.contracts.length, 0);\n\tconst migrationCount = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\treturn `${spaces.length} space(s), ${contractCount} contract(s), ${migrationCount} migration(s)`;\n}\nfunction formatMigrationGraphHumanOutput(result) {\n\tconst sections = [];\n\tfor (const section of result.treeSections) {\n\t\tif (section.showHeading) sections.push(`${section.space}:`);\n\t\tif (section.tree.length > 0) sections.push(section.tree);\n\t\telse sections.push(\"(no migrations)\");\n\t\tsections.push(\"\");\n\t}\n\tsections.push(result.summary);\n\treturn sections.join(\"\\n\").trimEnd();\n}\nasync function executeMigrationGraphCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration graph\",\n\t\t\tdescription: \"Show the migration graph topology\",\n\t\t\tdetails: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t},\n\t\t\t\t...options.space !== void 0 ? [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: options.space\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return loaded;\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\tconst scopedSpaces = listResult.value.spaces;\n\tconst showSpaceHeadings = scopedSpaces.length > 1;\n\tconst glyphMode = ui.resolveGlyphMode(options.ascii === true);\n\tconst colorize = flags.color !== false;\n\tconst globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({\n\t\tgraph: aggregate.space(spaceEntry.space).graph(),\n\t\tliveContractHash\n\t})) : [];\n\tconst globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;\n\tconst globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;\n\tconst treeSections = [];\n\tfor (const spaceEntry of scopedSpaces) {\n\t\tconst space = aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tconst tree = spaceEntry.migrations.length === 0 ? \"\" : renderMigrationGraphSpaceTree({\n\t\t\tgraph,\n\t\t\tmigrations: spaceEntry.migrations,\n\t\t\tliveContractHash,\n\t\t\tglyphMode,\n\t\t\tcolorize,\n\t\t\tisAppSpace,\n\t\t\trefsByHash,\n\t\t\t...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},\n\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t});\n\t\tconst displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, \" \") : tree;\n\t\ttreeSections.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\ttree: displayTree,\n\t\t\tshowHeading: showSpaceHeadings\n\t\t});\n\t}\n\tconst spaces = [...buildMigrationSpaceGraphEntries({\n\t\taggregate,\n\t\tscopedSpaces\n\t})];\n\treturn ok({\n\t\tok: true,\n\t\tgraph: appGraph,\n\t\tspaces,\n\t\ttreeSections,\n\t\tsummary: computeGraphSummary(spaces)\n\t});\n}\nfunction createMigrationGraphCommand() {\n\tconst command = new Command(\"graph\");\n\tsetCommandDescriptions(command, \"Show the migration graph topology\", \"Renders the migration graph topology.\\nOffline — does not consult the database.\\n--ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\nUse --json for machine-readable output, or --dot for Graphviz DOT\\nformat.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration graph\",\n\t\t\"prisma-next migration graph --json\",\n\t\t\"prisma-next migration graph --dot\",\n\t\t\"prisma-next migration graph --ascii\",\n\t\t\"prisma-next migration graph --legend\",\n\t\t\"prisma-next migration graph --space app\"\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 log\",\n\t\t\toneLiner: \"Show executed migration history\"\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 show\",\n\t\t\toneLiner: \"Display migration package contents\"\n\t\t}\n\t]);\n\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--dot\", \"Output in Graphviz DOT format\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {\n\t\t\tif (options.dot) {\n\t\t\t\tconst lines = [\"digraph migrations {\"];\n\t\t\t\tfor (const edge of graphResult.graph.migrationByHash.values()) {\n\t\t\t\t\tconst from = edge.from.slice(0, 12);\n\t\t\t\t\tconst to = edge.to.slice(0, 12);\n\t\t\t\t\tlines.push(` \"${from}\" -> \"${to}\" [label=\"${edge.dirName}\"];`);\n\t\t\t\t}\n\t\t\t\tlines.push(\"}\");\n\t\t\t\tui.output(lines.join(\"\\n\"));\n\t\t\t} else if (flags.json) {\n\t\t\t\tconst jsonResult = {\n\t\t\t\t\tok: true,\n\t\t\t\t\tspaces: [...graphResult.spaces],\n\t\t\t\t\tsummary: graphResult.summary\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(jsonResult, null, 2));\n\t\t\t} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationGraphCommand, executeMigrationGraphCommand, formatMigrationGraphHumanOutput };\n\n//# sourceMappingURL=migration-graph.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,oBAAoB,QAAQ;CACpC,MAAM,gBAAgB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,UAAU,QAAQ,CAAC;CACvF,MAAM,iBAAiB,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,WAAW,QAAQ,CAAC;CACzF,OAAO,GAAG,OAAO,OAAO,aAAa,cAAc,gBAAgB,eAAe;AACnF;AACA,SAAS,gCAAgC,QAAQ;CAChD,MAAM,WAAW,CAAC;CAClB,KAAK,MAAM,WAAW,OAAO,cAAc;EAC1C,IAAI,QAAQ,aAAa,SAAS,KAAK,GAAG,QAAQ,MAAM,EAAE;EAC1D,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,KAAK,QAAQ,I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QAAQ,CAAC,GAAG,YAAY,MAAM;KAC9B,SAAS,YAAY;IACtB;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC9C,OAAO,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAChF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs → migration-graph-HKch1Xk4-DD-3zdSg.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
2
|
-
import { t as listRefsByContractHash } from "./migration-list-C9OPCMt--
|
|
2
|
+
import { t as listRefsByContractHash } from "./migration-list-C9OPCMt--BBm2c7tN.mjs";
|
|
3
3
|
//#region ../../../1-framework/3-tooling/cli/dist/migration-graph-HKch1Xk4.mjs
|
|
4
4
|
/**
|
|
5
5
|
* Project scoped list entries into the per-space contracts+migrations rows the migration
|
|
@@ -32,4 +32,4 @@ function buildMigrationSpaceGraphEntries(args) {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { buildMigrationSpaceGraphEntries as t };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=migration-graph-HKch1Xk4-
|
|
35
|
+
//# sourceMappingURL=migration-graph-HKch1Xk4-DD-3zdSg.mjs.map
|
package/dist/{migration-graph-HKch1Xk4-DyWhXtjZ.mjs.map → migration-graph-HKch1Xk4-DD-3zdSg.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph-HKch1Xk4-
|
|
1
|
+
{"version":3,"file":"migration-graph-HKch1Xk4-DD-3zdSg.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-graph-HKch1Xk4.mjs"],"sourcesContent":["import { t as listRefsByContractHash } from \"./migration-list-C9OPCMt-.mjs\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\n//#region src/control-api/operations/migration-graph.ts\n/**\n* Project scoped list entries into the per-space contracts+migrations rows the migration\n* graph --json output serializes (EMPTY_CONTRACT_HASH from-hash → null). Skips space ids\n* the aggregate no longer resolves, mirroring the command loop.\n*/\nfunction buildMigrationSpaceGraphEntries(args) {\n\tconst spaces = [];\n\tfor (const spaceEntry of args.scopedSpaces) {\n\t\tconst space = args.aggregate.space(spaceEntry.space);\n\t\tif (space === void 0) continue;\n\t\tconst graph = space.graph();\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tspaces.push({\n\t\t\tspace: spaceEntry.space,\n\t\t\tcontracts: [...graph.nodes].map((hash) => ({\n\t\t\t\thash,\n\t\t\t\trefs: [...refsByHash.get(hash) ?? []]\n\t\t\t})),\n\t\t\tmigrations: [...graph.migrationByHash.values()].map((edge) => ({\n\t\t\t\tname: edge.dirName,\n\t\t\t\thash: edge.migrationHash,\n\t\t\t\tfromContract: edge.from === EMPTY_CONTRACT_HASH ? null : edge.from,\n\t\t\t\ttoContract: edge.to\n\t\t\t}))\n\t\t});\n\t}\n\treturn spaces;\n}\n//#endregion\nexport { buildMigrationSpaceGraphEntries as t };\n\n//# sourceMappingURL=migration-graph-HKch1Xk4.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,gCAAgC,MAAM;CAC9C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,cAAc,KAAK,cAAc;EAC3C,MAAM,QAAQ,KAAK,UAAU,MAAM,WAAW,KAAK;EACnD,IAAI,UAAU,KAAK,GAAG;EACtB,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,aAAa,uBAAuB,KAAK;EAC/C,OAAO,KAAK;GACX,OAAO,WAAW;GAClB,WAAW,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,KAAK,UAAU;IAC1C;IACA,MAAM,CAAC,GAAG,WAAW,IAAI,IAAI,KAAK,CAAC,CAAC;GACrC,EAAE;GACF,YAAY,CAAC,GAAG,MAAM,gBAAgB,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU;IAC9D,MAAM,KAAK;IACX,MAAM,KAAK;IACX,cAAc,KAAK,SAAA,UAA+B,OAAO,KAAK;IAC9D,YAAY,KAAK;GAClB,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-
|
|
2
|
-
import {
|
|
3
|
-
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-
|
|
4
|
-
import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-C9OPCMt--
|
|
1
|
+
import { W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
|
|
3
|
+
import { r as buildReadAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
|
|
4
|
+
import { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from "./migration-list-C9OPCMt--BBm2c7tN.mjs";
|
|
5
5
|
import { g as renderMigrationGraphLegend, l as createAnsiMigrationListStyler, v as renderMigrationListWithStyle } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
6
|
-
import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-5iwwlLU2-
|
|
6
|
+
import { n as validateLegendOptions, t as shouldShowLegend } from "./legend-5iwwlLU2-Bit8enjF.mjs";
|
|
7
7
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
8
8
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
9
9
|
import { Command } from "commander";
|
|
@@ -22,7 +22,16 @@ function renderMigrationListHumanOutput(result, options) {
|
|
|
22
22
|
* Kept intentionally thin so the unit-testable surface lives in the core.
|
|
23
23
|
*/
|
|
24
24
|
async function executeMigrationListCommand(options, flags, ui) {
|
|
25
|
-
const
|
|
25
|
+
const configResult = await loadConfigForSections(options.config, [
|
|
26
|
+
"family",
|
|
27
|
+
"target",
|
|
28
|
+
"adapter",
|
|
29
|
+
"extensions",
|
|
30
|
+
"migrations",
|
|
31
|
+
"contract"
|
|
32
|
+
]);
|
|
33
|
+
if (!configResult.ok) return configResult;
|
|
34
|
+
const config = configResult.value;
|
|
26
35
|
const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
27
36
|
if (!flags.json && !flags.quiet) {
|
|
28
37
|
const header = formatStyledHeader({
|
|
@@ -117,4 +126,4 @@ function createMigrationListCommand() {
|
|
|
117
126
|
//#endregion
|
|
118
127
|
export { executeMigrationListCommand as n, renderMigrationListHumanOutput as r, createMigrationListCommand as t };
|
|
119
128
|
|
|
120
|
-
//# sourceMappingURL=migration-list-
|
|
129
|
+
//# sourceMappingURL=migration-list-BkTNEeOK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-list-BkTNEeOK.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-list.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { r as buildReadAggregate } from \"../contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { n as migrationSpaceListEntriesFromAggregate, r as runMigrationList } from \"../migration-list-C9OPCMt-.mjs\";\nimport { a as renderMigrationGraphLegend, c as renderMigrationListWithStyle, o as createAnsiMigrationListStyler } from \"../migration-graph-command-render-BKrg6BPv.mjs\";\nimport { n as validateLegendOptions, t as shouldShowLegend } from \"../legend-5iwwlLU2.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/commands/migration-list.ts\nfunction renderMigrationListHumanOutput(result, options) {\n\treturn renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, {\n\t\tcolorize: options.useColor,\n\t\tliveContractHash: options.liveContractHash,\n\t\tgraphForSpace: options.graphForSpace,\n\t\t...options.appSpaceId !== void 0 ? { appSpaceId: options.appSpaceId } : {}\n\t});\n}\n/**\n* CLI shell: loads config, resolves paths, prints the styled header on\n* stderr (interactive mode only), and delegates to {@link runMigrationList}.\n* Kept intentionally thin so the unit-testable surface lives in the core.\n*/\nasync function executeMigrationListCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration list\",\n\t\t\tdescription: \"List on-disk migrations per contract space\",\n\t\t\tdetails: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"config\",\n\t\t\t\t\tvalue: configPath\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"migrations\",\n\t\t\t\t\tvalue: migrationsRelative\n\t\t\t\t},\n\t\t\t\t...options.space !== void 0 ? [{\n\t\t\t\t\tlabel: \"space\",\n\t\t\t\t\tvalue: options.space\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t\tif (shouldShowLegend(options, flags)) {\n\t\t\tui.stderr(renderMigrationGraphLegend({\n\t\t\t\tcolorize: flags.color !== false,\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t}));\n\t\t\tui.stderr(\"\");\n\t\t}\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash: liveContractHash } = loaded.value;\n\tconst listResult = runMigrationList({\n\t\tspaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),\n\t\t...ifDefined(\"spaceFilter\", options.space)\n\t});\n\tif (!listResult.ok) return listResult;\n\treturn ok({\n\t\tlist: listResult.value,\n\t\tliveContractHash,\n\t\taggregate\n\t});\n}\nfunction createMigrationListCommand() {\n\tconst command = new Command(\"list\");\n\tsetCommandDescriptions(command, \"List on-disk migrations per contract space\", \"Enumerates every on-disk migration under migrations/<space>/ for every\\ncontract space found on disk. Offline — does not consult the database.\\nHuman output draws the shared migration graph tree with operation counts,\\ninvariants on each migration row, and refs on destination contract nodes.\\nPass --space <id> to narrow to one contract space. --ascii forces ASCII\\ntree glyphs (orthogonal to --no-color).\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration list\",\n\t\t\"prisma-next migration list --space app\",\n\t\t\"prisma-next migration list --ascii\",\n\t\t\"prisma-next migration list --legend\",\n\t\t\"prisma-next migration list --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 log\",\n\t\t\toneLiner: \"Show executed migration history\"\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\taddGlobalOptions(command).option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--space <id>\", \"Narrow output to a single contract space\").option(\"--ascii\", \"Use ASCII kind glyphs (pipe-friendly)\").option(\"--legend\", \"Print a key for the tree glyphs and lane colors\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst legendValidation = validateLegendOptions(options, flags);\n\t\tif (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));\n\t\tconst exitCode = handleResult(await executeMigrationListCommand(options, flags, ui), flags, ui, ({ list, liveContractHash, aggregate }) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(list, null, 2));\n\t\t\telse if (!flags.quiet) ui.output(renderMigrationListHumanOutput(list, {\n\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true),\n\t\t\t\tuseColor: ui.useColor,\n\t\t\t\tliveContractHash,\n\t\t\t\tgraphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n\t\t\t\tappSpaceId: aggregate.app.spaceId\n\t\t\t}));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationListCommand, executeMigrationListCommand, renderMigrationListHumanOutput };\n\n//# sourceMappingURL=migration-list.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,+BAA+B,QAAQ,SAAS;CACxD,OAAO,6BAA6B,QAAQ,8BAA8B,EAAE,UAAU,QAAQ,SAAS,CAAC,GAAG,QAAQ,WAAW;EAC7H,UAAU,QAAQ;EAClB,kBAAkB,QAAQ;EAC1B,eAAe,QAAQ;EACvB,GAAG,QAAQ,eAAe,KAAK,IAAI,EAAE,YAAY,QAAQ,WAAW,IAAI,CAAC;CAC1E,CAAC;AACF;;;;;;AAMA,eAAe,4BAA4B,SAAS,OAAO,IAAI;CAC9D,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,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N,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,gBAAgB,0CAA0C,CAAC,CAAC,OAAO,WAAW,uCAAuC,CAAC,CAAC,OAAO,YAAY,iDAAiD,CAAC,CAAC,OAAO,OAAO,YAAY;EAClT,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IAAI,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAChF,MAAM,WAAW,aAAa,MAAM,4BAA4B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,EAAE,MAAM,kBAAkB,gBAAgB;GAC1I,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,+BAA+B,MAAM;IACrE,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACrD,UAAU,GAAG;IACb;IACA,gBAAgB,YAAY,UAAU,MAAM,OAAO,CAAC,EAAE,MAAM;IAC5D,YAAY,UAAU,IAAI;GAC3B,CAAC,CAAC;EACH,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as isValidSpaceId, o as listContractSpaceDirectories, t as APP_SPACE_ID } from "./verify-contract-spaces-WvjSiWcB-zGhaCnfs.mjs";
|
|
2
|
-
import { A as errorSpaceNotFound, _ as errorInvalidSpaceId } from "./command-helpers-C4WpR-QE-
|
|
2
|
+
import { A as errorSpaceNotFound, _ as errorInvalidSpaceId } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
3
3
|
import { o as refsByContractHash, t as HEAD_REF_NAME } from "./refs-B2BL8z3i-DGGFB7Mj.mjs";
|
|
4
4
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/cli/dist/migration-list-C9OPCMt-.mjs
|
|
@@ -99,4 +99,4 @@ function runMigrationList(inputs) {
|
|
|
99
99
|
//#endregion
|
|
100
100
|
export { migrationSpaceListEntriesFromAggregate as n, runMigrationList as r, listRefsByContractHash as t };
|
|
101
101
|
|
|
102
|
-
//# sourceMappingURL=migration-list-C9OPCMt--
|
|
102
|
+
//# sourceMappingURL=migration-list-C9OPCMt--BBm2c7tN.mjs.map
|
package/dist/{migration-list-C9OPCMt--C28yBgVr.mjs.map → migration-list-C9OPCMt--BBm2c7tN.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-list-C9OPCMt--
|
|
1
|
+
{"version":3,"file":"migration-list-C9OPCMt--BBm2c7tN.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-list-C9OPCMt-.mjs"],"sourcesContent":["import { K as errorInvalidSpaceId, at as errorSpaceNotFound } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { APP_SPACE_ID, isValidSpaceId, listContractSpaceDirectories } from \"@internal/migration-tools/spaces\";\nimport { HEAD_REF_NAME, refsByContractHash } from \"@internal/migration-tools/refs\";\n//#region src/control-api/operations/migration-list.ts\nfunction compareSpaceIds(a, b) {\n\tif (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n\tif (b === APP_SPACE_ID) return 1;\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\nfunction compareDirNamesDescending(a, b) {\n\tif (a.name < b.name) return 1;\n\tif (a.name > b.name) return -1;\n\treturn 0;\n}\n/**\n* Ref names decorating a space's destination contract hashes. The\n* tolerant `space.refs` deliberately omits the structural `head.json`;\n* for extension spaces the old enumerator surfaced it as a `head`\n* decoration on the tip migration, so fold `space.headRef` back in to\n* keep that output. The app space synthesises its head, so it carries\n* no on-disk `head` ref to restore.\n*/\nfunction listRefsByContractHash(space) {\n\tconst byHash = new Map(refsByContractHash(space.refs));\n\tif (space.spaceId !== APP_SPACE_ID && space.headRef !== null) {\n\t\tconst hash = space.headRef.hash;\n\t\tconst bucket = byHash.get(hash) ?? [];\n\t\tif (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n\t}\n\treturn byHash;\n}\nasync function orderedOnDiskSpaceIds(projectMigrationsDir) {\n\treturn (await listContractSpaceDirectories(projectMigrationsDir)).filter(isValidSpaceId).sort(compareSpaceIds);\n}\n/**\n* Project the loaded {@link ContractSpaceAggregate} into the render-ready\n* {@link MigrationSpaceListEntry} rows `migration list` displays.\n*\n* Space membership matches the on-disk contract-space directories (not the\n* aggregate's always-present synthesized app space when `migrations/app/`\n* is absent); package and ref data come from `aggregate.space(id)`.\n*/\nasync function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {\n\tconst spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n\tconst spaces = [];\n\tfor (const spaceId of spaceIds) {\n\t\tconst space = aggregate.space(spaceId);\n\t\tif (space === void 0) continue;\n\t\tconst refsByHash = listRefsByContractHash(space);\n\t\tconst migrations = space.packages.map((pkg) => ({\n\t\t\tname: pkg.dirName,\n\t\t\thash: pkg.metadata.migrationHash,\n\t\t\tfromContract: pkg.metadata.from,\n\t\t\ttoContract: pkg.metadata.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\trefs: [...refsByHash.get(pkg.metadata.to) ?? []],\n\t\t\tprovidedInvariants: [...pkg.metadata.providedInvariants]\n\t\t})).sort(compareDirNamesDescending);\n\t\tspaces.push({\n\t\t\tspace: spaceId,\n\t\t\tmigrations\n\t\t});\n\t}\n\treturn spaces;\n}\nfunction computeSummary(spaces) {\n\tconst totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n\tif (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;\n\treturn `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n/**\n* Policy core of `migration list`: validates `--space`, narrows the\n* pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n*\n* - `migrations/` missing or contains no valid space directories →\n* caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n* - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n* - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n*/\nfunction runMigrationList(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.space === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));\n\tconst scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.space === spaceFilter) : spaces;\n\tconst resultSpaces = scopedSpaces.length === 0 ? [{\n\t\tspace: APP_SPACE_ID,\n\t\tmigrations: []\n\t}] : scopedSpaces;\n\treturn ok({\n\t\tok: true,\n\t\tspaces: [...resultSpaces],\n\t\tsummary: computeSummary(resultSpaces)\n\t});\n}\n//#endregion\nexport { migrationSpaceListEntriesFromAggregate as n, runMigrationList as r, listRefsByContractHash as t };\n\n//# sourceMappingURL=migration-list-C9OPCMt-.mjs.map"],"mappings":";;;;;AAKA,SAAS,gBAAgB,GAAG,GAAG;CAC9B,IAAI,MAAM,cAAc,OAAO,MAAM,eAAe,IAAI;CACxD,IAAI,MAAM,cAAc,OAAO;CAC/B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,IAAI,GAAG,OAAO;CAClB,OAAO;AACR;AACA,SAAS,0BAA0B,GAAG,GAAG;CACxC,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO;CAC5B,IAAI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,OAAO,UAAU,QAAQ,MAAM,WAAW,QAAQ,CAAC;CAC1F,IAAI,OAAO,UAAU,GAAG,OAAO,GAAG,gBAAgB;CAClD,OAAO,GAAG,gBAAgB,uBAAuB,OAAO,OAAO;AAChE;;;;;;;;;;AAUA,SAAS,iBAAiB,QAAQ;CACjC,MAAM,EAAE,QAAQ,gBAAgB;CAChC,IAAI,gBAAgB,KAAK,KAAK,CAAC,eAAe,WAAW,GAAG,OAAO,MAAM,oBAAoB,WAAW,CAAC;CACzG,IAAI,gBAAgB,KAAK,KAAK,CAAC,OAAO,MAAM,MAAM,EAAE,UAAU,WAAW,GAAG,OAAO,MAAM,mBAAmB,aAAa,OAAO,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;CAC3J,MAAM,eAAe,gBAAgB,KAAK,IAAI,OAAO,QAAQ,MAAM,EAAE,UAAU,WAAW,IAAI;CAC9F,MAAM,eAAe,aAAa,WAAW,IAAI,CAAC;EACjD,OAAO;EACP,YAAY,CAAC;CACd,CAAC,IAAI;CACL,OAAO,GAAG;EACT,IAAI;EACJ,QAAQ,CAAC,GAAG,YAAY;EACxB,SAAS,eAAe,YAAY;CACrC,CAAC;AACF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, lt as targetSupportsMigrations, nt as requireLiveDatabase, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-
|
|
2
|
-
import {
|
|
3
|
-
import { t as createControlClient } from "./client-
|
|
1
|
+
import { N as errorUnexpected, Q as maskConnectionUrl, W as formatStyledHeader, ct as setCommandSeeAlso, et as parseGlobalFlagsOrExit, it as resolveMigrationPaths, lt as targetSupportsMigrations, nt as requireLiveDatabase, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
|
|
3
|
+
import { t as createControlClient } from "./client-BNAEJZ76-ld7eOxpZ.mjs";
|
|
4
4
|
import { l as createAnsiMigrationListStyler, m as migrationListForwardArrow, n as abbreviateContractHash, p as migrationListEmptySource, t as IDENTITY_MIGRATION_LIST_STYLER } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
5
|
-
import { t as mapCaughtMigrationError } from "./caught-errors-D7Qznyrm-
|
|
5
|
+
import { t as mapCaughtMigrationError } from "./caught-errors-D7Qznyrm-DaZubR00.mjs";
|
|
6
6
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
7
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
8
8
|
import stringWidth from "string-width";
|
|
9
9
|
import { Command } from "commander";
|
|
10
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-log-
|
|
10
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-log-CqrwQXER.mjs
|
|
11
11
|
const HEADING_APPLIED_AT = "Applied at";
|
|
12
12
|
const HEADING_SPACE = "Space";
|
|
13
13
|
const HEADING_MIGRATION = "Migration";
|
|
@@ -118,7 +118,17 @@ function serializeLedgerEntriesForJson(entries) {
|
|
|
118
118
|
}
|
|
119
119
|
const MIGRATION_LOG_EMPTY_MESSAGE = "No migrations have been applied to this database.";
|
|
120
120
|
async function executeMigrationLogCommand(options, flags, ui) {
|
|
121
|
-
const
|
|
121
|
+
const configResult = await loadConfigForSections(options.config, [
|
|
122
|
+
"family",
|
|
123
|
+
"target",
|
|
124
|
+
"adapter",
|
|
125
|
+
"driver",
|
|
126
|
+
"extensions",
|
|
127
|
+
"db",
|
|
128
|
+
"migrations"
|
|
129
|
+
]);
|
|
130
|
+
if (!configResult.ok) return configResult;
|
|
131
|
+
const config = configResult.value;
|
|
122
132
|
const { configPath } = resolveMigrationPaths(options.config, config);
|
|
123
133
|
const dbConnection = options.db ?? config.db?.connection;
|
|
124
134
|
const missingDb = requireLiveDatabase({
|
|
@@ -217,4 +227,4 @@ function createMigrationLogCommand() {
|
|
|
217
227
|
//#endregion
|
|
218
228
|
export { executeMigrationLogCommand as n, createMigrationLogCommand as t };
|
|
219
229
|
|
|
220
|
-
//# sourceMappingURL=migration-log-
|
|
230
|
+
//# sourceMappingURL=migration-log-CqrwQXER-cqf2INDN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-log-CqrwQXER-cqf2INDN.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-log-CqrwQXER.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as requireLiveDatabase, y as handleResult } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as createControlClient } from \"./client-BNAEJZ76.mjs\";\nimport { t as mapCaughtMigrationError } from \"./caught-errors-D7Qznyrm.mjs\";\nimport { _ as migrationListEmptySource, g as abbreviateContractHash, o as createAnsiMigrationListStyler, s as IDENTITY_MIGRATION_LIST_STYLER, v as migrationListForwardArrow } from \"./migration-graph-command-render-BKrg6BPv.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport stringWidth from \"string-width\";\n//#region src/utils/formatters/migration-log-table.ts\nconst HEADING_APPLIED_AT = \"Applied at\";\nconst HEADING_SPACE = \"Space\";\nconst HEADING_MIGRATION = \"Migration\";\nconst HEADING_CHANGE = \"Change\";\nconst HEADING_OPS = \"Ops\";\nconst COLUMN_SEPARATOR = \" \";\nconst DIVIDER_CHAR = \"─\";\nconst ASCII_DIVIDER_CHAR = \"-\";\nfunction sortLedgerEntries(entries) {\n\treturn [...entries].sort((left, right) => {\n\t\tconst timeDiff = left.appliedAt.getTime() - right.appliedAt.getTime();\n\t\tif (timeDiff !== 0) return timeDiff;\n\t\tconst spaceDiff = left.space.localeCompare(right.space);\n\t\tif (spaceDiff !== 0) return spaceDiff;\n\t\treturn left.migrationName.localeCompare(right.migrationName);\n\t});\n}\nfunction pad2(value) {\n\treturn String(value).padStart(2, \"0\");\n}\nfunction formatLedgerAppliedAt(date, mode) {\n\tif (mode === \"iso\") return date.toISOString();\n\tif (mode === \"utc\") return `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}:${pad2(date.getUTCSeconds())}Z`;\n\tconst offsetMinutes = -date.getTimezoneOffset();\n\tconst sign = offsetMinutes >= 0 ? \"+\" : \"-\";\n\tconst absoluteOffset = Math.abs(offsetMinutes);\n\tconst offsetHours = pad2(Math.floor(absoluteOffset / 60));\n\tconst offsetMins = pad2(absoluteOffset % 60);\n\treturn `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())} ${sign}${offsetHours}:${offsetMins}`;\n}\nfunction formatHashEndpoint(hash, glyphMode = \"unicode\") {\n\tif (hash === null) return migrationListEmptySource(glyphMode);\n\treturn abbreviateContractHash(hash);\n}\nfunction formatHashTransition(from, to, glyphMode = \"unicode\") {\n\treturn `${formatHashEndpoint(from, glyphMode)} ${migrationListForwardArrow(glyphMode)} ${abbreviateContractHash(to)}`;\n}\nfunction styleHashTransition(from, to, styler, glyphMode = \"unicode\") {\n\treturn `${from === null ? styler.glyph(migrationListEmptySource(glyphMode)) : styler.sourceHash(abbreviateContractHash(from))} ${styler.glyph(migrationListForwardArrow(glyphMode))} ${styler.destHash(abbreviateContractHash(to))}`;\n}\nfunction padVisible(text, targetWidth) {\n\tconst padding = Math.max(0, targetWidth - stringWidth(text));\n\treturn text + \" \".repeat(padding);\n}\nfunction columnWidth(values) {\n\treturn values.reduce((max, value) => Math.max(max, stringWidth(value)), 0);\n}\nfunction padDividerCell(valueWidth, dividerChar) {\n\treturn dividerChar.repeat(valueWidth + 2);\n}\nfunction padTextCell(value, valueWidth) {\n\treturn ` ${padVisible(value, valueWidth)} `;\n}\nfunction padOpsCell(value, valueWidth) {\n\tconst padding = Math.max(0, valueWidth - stringWidth(value));\n\treturn ` ${\" \".repeat(padding)}${value} `;\n}\nfunction renderMigrationLogTable(entries, options = {}) {\n\tconst sorted = sortLedgerEntries(entries);\n\tif (sorted.length === 0) return \"\";\n\tconst styler = options.styler ?? IDENTITY_MIGRATION_LIST_STYLER;\n\tconst glyphMode = options.glyphMode ?? \"unicode\";\n\tconst dividerChar = glyphMode === \"ascii\" ? ASCII_DIVIDER_CHAR : DIVIDER_CHAR;\n\tconst showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n\tconst timestampMode = options.utc ? \"utc\" : \"local\";\n\tconst rows = sorted.map((entry) => ({\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, timestampMode),\n\t\tspace: entry.space,\n\t\tmigrationName: entry.migrationName,\n\t\ttransition: formatHashTransition(entry.from, entry.to, glyphMode),\n\t\tops: `${entry.operationCount} ops`,\n\t\tfrom: entry.from,\n\t\tto: entry.to\n\t}));\n\tconst appliedAtWidth = columnWidth([HEADING_APPLIED_AT, ...rows.map((row) => row.appliedAt)]);\n\tconst spaceWidth = showSpace ? columnWidth([HEADING_SPACE, ...rows.map((row) => row.space)]) : 0;\n\tconst nameWidth = columnWidth([HEADING_MIGRATION, ...rows.map((row) => row.migrationName)]);\n\tconst transitionWidth = columnWidth([HEADING_CHANGE, ...rows.map((row) => row.transition)]);\n\tconst opsWidth = columnWidth([HEADING_OPS, ...rows.map((row) => row.ops)]);\n\tconst headingParts = [padTextCell(HEADING_APPLIED_AT, appliedAtWidth)];\n\tif (showSpace) headingParts.push(padTextCell(HEADING_SPACE, spaceWidth));\n\theadingParts.push(padTextCell(HEADING_MIGRATION, nameWidth), padTextCell(HEADING_CHANGE, transitionWidth), padOpsCell(HEADING_OPS, opsWidth));\n\tconst heading = headingParts.join(COLUMN_SEPARATOR);\n\tconst dividerParts = [padDividerCell(appliedAtWidth, dividerChar)];\n\tif (showSpace) dividerParts.push(padDividerCell(spaceWidth, dividerChar));\n\tdividerParts.push(padDividerCell(nameWidth, dividerChar), padDividerCell(transitionWidth, dividerChar), padDividerCell(opsWidth, dividerChar));\n\treturn [\n\t\theading,\n\t\tdividerParts.map((cell) => styler.summary(cell)).join(COLUMN_SEPARATOR),\n\t\t...rows.map((row) => {\n\t\t\tconst parts = [padTextCell(row.appliedAt, appliedAtWidth)];\n\t\t\tif (showSpace) parts.push(padTextCell(row.space, spaceWidth));\n\t\t\tparts.push(padTextCell(styler.dirName(row.migrationName), nameWidth), padTextCell(styleHashTransition(row.from, row.to, styler, glyphMode), transitionWidth), padOpsCell(row.ops, opsWidth));\n\t\t\treturn parts.join(COLUMN_SEPARATOR);\n\t\t})\n\t].join(\"\\n\");\n}\nfunction serializeLedgerEntriesForJson(entries) {\n\treturn sortLedgerEntries(entries).map((entry) => ({\n\t\tspace: entry.space,\n\t\tname: entry.migrationName,\n\t\thash: entry.migrationHash,\n\t\tfromContract: entry.from,\n\t\ttoContract: entry.to,\n\t\tappliedAt: formatLedgerAppliedAt(entry.appliedAt, \"iso\"),\n\t\toperationCount: entry.operationCount\n\t}));\n}\nconst MIGRATION_LOG_EMPTY_MESSAGE = \"No migrations have been applied to this database.\";\n//#endregion\n//#region src/commands/migration-log.ts\nasync function executeMigrationLogCommand(options, flags, ui) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\",\n\t\t\"db\",\n\t\t\"migrations\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { configPath } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst missingDb = requireLiveDatabase({\n\t\tdbConnection,\n\t\thasDriver: !!config.driver,\n\t\twhy: `migration log needs a database connection and driver to read the ledger (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migration log\"\n\t});\n\tif (missingDb) return notOk(missingDb);\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorUnexpected(\"Target does not support migrations\"));\n\tif (!flags.json && !flags.quiet) {\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migration log\",\n\t\t\tdescription: \"Show executed migration history from the database ledger\",\n\t\t\tdetails: [{\n\t\t\t\tlabel: \"config\",\n\t\t\t\tvalue: configPath\n\t\t\t}, ...typeof dbConnection === \"string\" ? [{\n\t\t\t\tlabel: \"database\",\n\t\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t\t}] : []],\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\t...ifDefined(\"driver\", config.driver),\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\treturn ok(await client.readLedger());\n\t} catch (error) {\n\t\tconst mapped = mapCaughtMigrationError(error);\n\t\tif (mapped) return notOk(mapped);\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrationLogCommand() {\n\tconst command = new Command(\"log\");\n\tsetCommandDescriptions(command, \"Show executed migration history\", \"Reads the database ledger and displays every applied migration edge\\nin chronological order, including rollbacks and re-applies, merged\\nacross all contract spaces. Requires a database connection.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migration log --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --utc --db $DATABASE_URL\",\n\t\t\"prisma-next migration log --json --db $DATABASE_URL\"\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\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--utc\", \"Render human timestamps in UTC instead of local time\").option(\"--ascii\", \"Use ASCII glyphs (pipe-friendly)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tconst exitCode = handleResult(await executeMigrationLogCommand(options, flags, ui), flags, ui, (entries) => {\n\t\t\tif (flags.json) {\n\t\t\t\tconst records = serializeLedgerEntriesForJson(entries);\n\t\t\t\tconst result = {\n\t\t\t\t\tok: true,\n\t\t\t\t\trecords,\n\t\t\t\t\tsummary: `${records.length} migration(s) applied`\n\t\t\t\t};\n\t\t\t\tui.output(JSON.stringify(result, null, 2));\n\t\t\t} else if (!flags.quiet) if (entries.length === 0) ui.output(MIGRATION_LOG_EMPTY_MESSAGE);\n\t\t\telse {\n\t\t\t\tconst styler = createAnsiMigrationListStyler({ useColor: ui.useColor });\n\t\t\t\tui.output(renderMigrationLogTable(entries, {\n\t\t\t\t\tutc: options.utc === true,\n\t\t\t\t\tstyler,\n\t\t\t\t\tglyphMode: ui.resolveGlyphMode(options.ascii === true)\n\t\t\t\t}));\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { executeM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AS;EAC3B;EACA;EACA;CACD,CAAC;CACD,kBAAkB,SAAS;EAC1B;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;EACA;GACC,MAAM;GACN,UAAU;EACX;CACD,CAAC;CACD,iBAAiB,OAAO,CAAC,CAAC,OAAO,cAAc,4BAA4B,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,SAAS,sDAAsD,CAAC,CAAC,OAAO,WAAW,kCAAkC,CAAC,CAAC,OAAO,OAAO,YAAY;EAC/R,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,WAAW,aAAa,MAAM,2BAA2B,SAAS,OAAO,EAAE,GAAG,OAAO,KAAK,YAAY;GAC3G,IAAI,MAAM,MAAM;IACf,MAAM,UAAU,8BAA8B,OAAO;IACrD,MAAM,SAAS;KACd,IAAI;KACJ;KACA,SAAS,GAAG,QAAQ,OAAO;IAC5B;IACA,GAAG,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;GAC1C,OAAO,IAAI,CAAC,MAAM,OAAO,IAAI,QAAQ,WAAW,GAAG,GAAG,OAAO,2BAA2B;QACnF;IACJ,MAAM,SAAS,8BAA8B,EAAE,UAAU,GAAG,SAAS,CAAC;IACtE,GAAG,OAAO,wBAAwB,SAAS;KAC1C,KAAK,QAAQ,QAAQ;KACrB;KACA,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACtD,CAAC,CAAC;GACH;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -2,24 +2,33 @@ import { a as snapshotsImportPathFrom, o as writeContractSnapshot, t as contract
|
|
|
2
2
|
import { t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
3
3
|
import { r as formatMigrationDirName, u as writeMigrationPackage } from "./io-CHUUeHh0-CoCBe9eN.mjs";
|
|
4
4
|
import { r as findLatestMigration } from "./migration-graph-DDaOHo10-yJFAbKCu.mjs";
|
|
5
|
-
import { K as getTargetMigrations, N as errorUnexpected, O as errorRuntime$1, it as resolveMigrationPaths, j as errorTargetMigrationNotSupported, rt as resolveContractPath, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-
|
|
6
|
-
import { t as assertFrameworkComponentsCompatible } from "./framework-components-
|
|
7
|
-
import { t as createProjectSpecifierResolver } from "./project-import-root-C_bd0ooL-
|
|
5
|
+
import { K as getTargetMigrations, N as errorUnexpected, O as errorRuntime$1, it as resolveMigrationPaths, j as errorTargetMigrationNotSupported, rt as resolveContractPath, t as CliStructuredError$1 } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
6
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-ioeTnj2Z-yyQtaVWk.mjs";
|
|
7
|
+
import { t as createProjectSpecifierResolver } from "./project-import-root-C_bd0ooL-CusfluWF.mjs";
|
|
8
8
|
import { r as getEmittedArtifactPaths } from "./exports-BCLg4CiV-okAfZydo.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { a as loadConfigForSections } from "./exports-DVoyX2LM.mjs";
|
|
10
10
|
import { s as loadContractSpaceAggregate } from "./aggregate-D53gnb7v.mjs";
|
|
11
|
-
import { l as refusePackageCorruptionOnAggregate } from "./contract-space-aggregate-loader-C5r12INu-
|
|
11
|
+
import { l as refusePackageCorruptionOnAggregate } from "./contract-space-aggregate-loader-C5r12INu-DfE0nmtZ.mjs";
|
|
12
12
|
import { i as writeMigrationTs } from "./migration-ts-FyF55c4M.mjs";
|
|
13
13
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
14
14
|
import { join, relative } from "pathe";
|
|
15
15
|
import { readFile } from "node:fs/promises";
|
|
16
16
|
import { APP_SPACE_ID, createControlStack } from "@prisma/orm-framework/components/control";
|
|
17
|
-
//#region ../../../1-framework/3-tooling/cli/dist/migration-new-
|
|
17
|
+
//#region ../../../1-framework/3-tooling/cli/dist/migration-new-Cjhe_MIE.mjs
|
|
18
18
|
/**
|
|
19
19
|
* Policy core of `migration new`: scaffolds a migration package with a `migration.ts` stub for manual authoring.
|
|
20
20
|
*/
|
|
21
21
|
async function executeMigrationNewCommand(options) {
|
|
22
|
-
const
|
|
22
|
+
const configResult = await loadConfigForSections(options.config, [
|
|
23
|
+
"family",
|
|
24
|
+
"target",
|
|
25
|
+
"adapter",
|
|
26
|
+
"extensions",
|
|
27
|
+
"migrations",
|
|
28
|
+
"contract"
|
|
29
|
+
]);
|
|
30
|
+
if (!configResult.ok) return configResult;
|
|
31
|
+
const config = configResult.value;
|
|
23
32
|
const { migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
24
33
|
const stack = createControlStack(config);
|
|
25
34
|
const familyInstance = config.family.create(stack);
|
|
@@ -126,4 +135,4 @@ async function executeMigrationNewCommand(options) {
|
|
|
126
135
|
//#endregion
|
|
127
136
|
export { executeMigrationNewCommand as t };
|
|
128
137
|
|
|
129
|
-
//# sourceMappingURL=migration-new-
|
|
138
|
+
//# sourceMappingURL=migration-new-Cjhe_MIE-CIovsuXK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-new-Cjhe_MIE-CIovsuXK.mjs","names":["errorRuntime","CliStructuredError"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-new-Cjhe_MIE.mjs"],"sourcesContent":["import { F as CliStructuredError, ct as errorUnexpected, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, rt as errorRuntime, s as resolveMigrationPaths } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { t as assertFrameworkComponentsCompatible } from \"./framework-components-ioeTnj2Z.mjs\";\nimport { t as createProjectSpecifierResolver } from \"./project-import-root-C_bd0ooL.mjs\";\nimport { l as refusePackageCorruptionOnAggregate } from \"./contract-space-aggregate-loader-C5r12INu.mjs\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { join, relative } from \"pathe\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID, createControlStack } from \"@internal/framework-components/control\";\nimport { loadContractSpaceAggregate } from \"@internal/migration-tools/aggregate\";\nimport { findLatestMigration } from \"@internal/migration-tools/migration-graph\";\nimport { contractSnapshotDir, snapshotsImportPathFrom, writeContractSnapshot } from \"@internal/migration-tools/contract-snapshot-store\";\nimport { computeMigrationHash } from \"@internal/migration-tools/hash\";\nimport { formatMigrationDirName, writeMigrationPackage } from \"@internal/migration-tools/io\";\nimport { writeMigrationTs } from \"@internal/migration-tools/migration-ts\";\n//#region src/control-api/operations/migration-new.ts\n/**\n* Policy core of `migration new`: scaffolds a migration package with a `migration.ts` stub for manual authoring.\n*/\nasync function executeMigrationNewCommand(options) {\n\tconst configResult = await loadConfigForSections(options.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"extensions\",\n\t\t\"migrations\",\n\t\t\"contract\"\n\t]);\n\tif (!configResult.ok) return configResult;\n\tconst config = configResult.value;\n\tconst { migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst controlAdapter = config.adapter.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractJsonContent;\n\ttry {\n\t\tcontractJsonContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorRuntime(\"CLI.FILE_NOT_FOUND\", `Contract file not found at ${contractPathAbsolute}`, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` first to generate the contract\"\n\t\t}));\n\t\tthrow error;\n\t}\n\tlet toContract;\n\ttry {\n\t\tconst parsedContract = JSON.parse(contractJsonContent);\n\t\ttoContract = familyInstance.deserializeContract(parsedContract);\n\t} catch (error) {\n\t\treturn notOk(errorRuntime(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract JSON is invalid\", {\n\t\t\twhy: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\",\n\t\t\tcause: error\n\t\t}));\n\t}\n\tconst toStorageHash = toContract.storage?.storageHash;\n\tif (typeof toStorageHash !== \"string\") return notOk(errorRuntime(\"CONTRACT.VALIDATION_FAILED\", \"Contract is missing storageHash\", {\n\t\twhy: `Contract at ${contractPathAbsolute} has no storageHash`,\n\t\tfix: \"Run `prisma-next contract emit` to regenerate the contract\"\n\t}));\n\tconst aggregate = await loadContractSpaceAggregate({\n\t\tmigrationsDir,\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json),\n\t\tappContract: toContract\n\t});\n\tconst packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n\tif (packageCorruptionFailure) return notOk(packageCorruptionFailure);\n\tconst packages = aggregate.app.packages;\n\tconst graph = aggregate.app.graph();\n\tlet fromHash = null;\n\tif (packages.length > 0) if (options.from) {\n\t\tconst match = packages.find((p) => p.metadata.to.startsWith(options.from));\n\t\tif (!match) return notOk(errorRuntime(\"MIGRATION.HASH_NOT_IN_GRAPH\", \"Starting contract not found\", {\n\t\t\twhy: `No migration with to hash matching \"${options.from}\" exists in ${appMigrationsRelative}`,\n\t\t\tfix: \"Check that the --from hash matches a known migration target hash.\"\n\t\t}));\n\t\tfromHash = match.metadata.to;\n\t} else {\n\t\tconst latestMigration = findLatestMigration(graph);\n\t\tif (latestMigration) fromHash = latestMigration.to;\n\t}\n\tif (fromHash === toStorageHash && !options.from) return notOk(errorRuntime(\"MIGRATION.NO_CHANGES\", \"No changes detected\", {\n\t\twhy: \"The from and to contract hashes are identical — there is nothing to migrate.\",\n\t\tfix: \"Change the contract and run `prisma-next contract emit` before creating a new migration. To author a data-only migration on the current contract hash, pass `--from <hash>` explicitly.\"\n\t}));\n\tconst timestamp = /* @__PURE__ */ new Date();\n\tconst packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? \"migration\"));\n\tconst baseMetadata = {\n\t\tfrom: fromHash,\n\t\tto: toStorageHash,\n\t\tprovidedInvariants: [],\n\t\tcreatedAt: timestamp.toISOString()\n\t};\n\tconst metadata = {\n\t\t...baseMetadata,\n\t\tmigrationHash: computeMigrationHash(baseMetadata, [])\n\t};\n\tconst migrations = getTargetMigrations(config.target);\n\tif (!migrations) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.targetId}\" does not support migrations` }));\n\ttry {\n\t\tassertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [\n\t\t\tconfig.target,\n\t\t\tconfig.adapter,\n\t\t\t...config.extensions ?? []\n\t\t]);\n\t\tconst resolveSpecifier = createProjectSpecifierResolver(options.config);\n\t\tawait writeMigrationPackage(packageDir, metadata, []);\n\t\tconst destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);\n\t\tconst [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, \"utf-8\"), readFile(destinationArtifacts.dtsPath, \"utf-8\")]);\n\t\tawait writeContractSnapshot(migrationsDir, toStorageHash, {\n\t\t\tcontractJson: JSON.parse(contractJsonRaw),\n\t\t\tcontractDts\n\t\t});\n\t\tawait writeMigrationTs(packageDir, migrations.createPlanner(controlAdapter).emptyMigration({\n\t\t\tpackageDir,\n\t\t\tcontractJsonPath: join(contractSnapshotDir(migrationsDir, toStorageHash), \"contract.json\"),\n\t\t\tfromHash,\n\t\t\ttoHash: toStorageHash,\n\t\t\tsnapshotsImportPath: snapshotsImportPathFrom(packageDir, migrationsDir)\n\t\t}, APP_SPACE_ID).renderTypeScript(resolveSpecifier));\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tdir: relative(process.cwd(), packageDir),\n\t\t\tfrom: fromHash,\n\t\t\tto: toStorageHash,\n\t\t\tsummary: `Scaffolded migration at ${relative(process.cwd(), packageDir)}`\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: `Failed to scaffold migration: ${error instanceof Error ? error.message : String(error)}` }));\n\t}\n}\n//#endregion\nexport { executeMigrationNewCommand as t };\n\n//# sourceMappingURL=migration-new-Cjhe_MIE.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,eAAe,2BAA2B,SAAS;CAClD,MAAM,eAAe,MAAM,sBAAsB,QAAQ,QAAQ;EAChE;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,OAAO;CAC7B,MAAM,SAAS,aAAa;CAC5B,MAAM,EAAE,eAAe,kBAAkB,0BAA0B,sBAAsB,QAAQ,QAAQ,MAAM;CAC/G,MAAM,QAAQ,mBAAmB,MAAM;CACvC,MAAM,iBAAiB,OAAO,OAAO,OAAO,KAAK;CACjD,MAAM,iBAAiB,OAAO,QAAQ,OAAO,KAAK;CAClD,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,IAAI;CACJ,IAAI;EACH,sBAAsB,MAAM,SAAS,sBAAsB,OAAO;CACnE,SAAS,OAAO;EACf,IAAI,iBAAiB,SAAS,MAAM,SAAS,UAAU,OAAO,MAAMA,eAAa,sBAAsB,8BAA8B,wBAAwB;GAC5J,KAAK,8BAA8B;GACnC,KAAK;EACN,CAAC,CAAC;EACF,MAAM;CACP;CACA,IAAI;CACJ,IAAI;EACH,MAAM,iBAAiB,KAAK,MAAM,mBAAmB;EACrD,aAAa,eAAe,oBAAoB,cAAc;CAC/D,SAAS,OAAO;EACf,OAAO,MAAMA,eAAa,6CAA6C,4BAA4B;GAClG,KAAK,yBAAyB,qBAAqB,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,K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5 @@
|
|
|
1
|
-
import { W as formatStyledHeader, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-
|
|
2
|
-
import { t as executeMigrationNewCommand } from "./migration-new-
|
|
1
|
+
import { W as formatStyledHeader, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { t as executeMigrationNewCommand } from "./migration-new-Cjhe_MIE-CIovsuXK.mjs";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
//#region ../../../1-framework/3-tooling/cli/dist/commands/migration-new.mjs
|
|
5
5
|
/**
|
|
@@ -47,4 +47,4 @@ function createMigrationNewCommand() {
|
|
|
47
47
|
//#endregion
|
|
48
48
|
export { createMigrationNewCommand as t };
|
|
49
49
|
|
|
50
|
-
//# sourceMappingURL=migration-new-
|
|
50
|
+
//# sourceMappingURL=migration-new-NuMfcbH8.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-new-
|
|
1
|
+
{"version":3,"file":"migration-new-NuMfcbH8.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migration-new.mjs"],"sourcesContent":["import { A as formatStyledHeader, _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from \"../command-helpers-C4WpR-QE.mjs\";\nimport { t as executeMigrationNewCommand } from \"../migration-new-Cjhe_MIE.mjs\";\nimport { Command } from \"commander\";\n//#region src/commands/migration-new.ts\n/**\n* `migration new` — scaffolds a migration package with a `migration.ts` file\n* for manual authoring.\n*\n* The planner's `emptyMigration(context)` returns a\n* `MigrationPlanWithAuthoringSurface`, whose `renderTypeScript(resolver)`\n* produces the target-appropriate empty stub. The CLI writes the returned\n* source verbatim.\n*\n* The resolver is the one this project's own manifest implies, so the\n* scaffold names packages the project can resolve — the same resolver\n* `contract emit` hands to the emitter (ADR 242).\n*/\nfunction createMigrationNewCommand() {\n\tconst command = new Command(\"new\");\n\tsetCommandDescriptions(command, \"Scaffold a new migration for manual authoring\", \"Creates a migration package with a migration.ts file for manual authoring.\\nWrite the migration body in migration.ts, then run the file with Node\\n(`node migration.ts`) to self-emit ops.json and attest the package.\");\n\tsetCommandExamples(command, [\"prisma-next migration new --name split-name\", \"prisma-next migration new --name custom-fk --from abc123...\"]);\n\taddGlobalOptions(command).option(\"--name <slug>\", \"Migration name (used in directory name)\").option(\"--from <hash>\", \"Starting contract hash (default: latest migration target)\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (!flags.json && !flags.quiet) {\n\t\t\tconst header = formatStyledHeader({\n\t\t\t\tcommand: \"migration new\",\n\t\t\t\tdescription: \"Scaffold a new migration\",\n\t\t\t\tdetails: [],\n\t\t\t\tflags\n\t\t\t});\n\t\t\tui.stderr(header);\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrationNewCommand(options), flags, ui, (value) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(value, null, 2));\n\t\t\telse if (!flags.quiet) {\n\t\t\t\tui.output(`\\nScaffolded migration at ${value.dir}`);\n\t\t\t\tui.output(` from: ${value.from}`);\n\t\t\t\tui.output(` to: ${value.to}`);\n\t\t\t\tui.output(`\\nEdit migration.ts, then run it directly (\\`node \"${value.dir}/migration.ts\"\\`) to self-emit and attest.`);\n\t\t\t}\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrationNewCommand };\n\n//# sourceMappingURL=migration-new.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,4BAA4B;CACpC,MAAM,UAAU,IAAI,QAAQ,KAAK;CACjC,uBAAuB,SAAS,iDAAiD,wNAAwN;CACzS,mBAAmB,SAAS,CAAC,+CAA+C,6DAA6D,CAAC;CAC1I,iBAAiB,OAAO,CAAC,CAAC,OAAO,iBAAiB,yCAAyC,CAAC,CAAC,OAAO,iBAAiB,2DAA2D,CAAC,CAAC,OAAO,mBAAmB,+BAA+B,CAAC,CAAC,OAAO,OAAO,YAAY;EACtQ,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;GAChC,MAAM,SAAS,mBAAmB;IACjC,SAAS;IACT,aAAa;IACb,SAAS,CAAC;IACV;GACD,CAAC;GACD,GAAG,OAAO,MAAM;EACjB;EACA,MAAM,WAAW,aAAa,MAAM,2BAA2B,OAAO,GAAG,OAAO,KAAK,UAAU;GAC9F,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,OAAO;IACtB,GAAG,OAAO,6BAA6B,MAAM,KAAK;IAClD,GAAG,OAAO,WAAW,MAAM,MAAM;IACjC,GAAG,OAAO,WAAW,MAAM,IAAI;IAC/B,GAAG,OAAO,sDAAsD,MAAM,IAAI,2CAA2C;GACtH;EACD,CAAC;EACD,QAAQ,KAAK,QAAQ;CACtB,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as errorRuntime$1 } from "./command-helpers-C4WpR-QE-
|
|
1
|
+
import { O as errorRuntime$1 } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
2
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
3
3
|
import { isAbsolute, relative, resolve } from "pathe";
|
|
4
4
|
//#region ../../../1-framework/3-tooling/cli/dist/migration-path-target-BPYp3LNc.mjs
|
|
@@ -35,4 +35,4 @@ function findPackageByDirPath(packages, resolvedDirPath) {
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { resolveTargetPathAcrossSpaces as i, looksLikePath as n, resolveAppTargetPath as r, findPackageByDirPath as t };
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=migration-path-target-BPYp3LNc-
|
|
38
|
+
//# sourceMappingURL=migration-path-target-BPYp3LNc-DjdEIQsZ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-path-target-BPYp3LNc-
|
|
1
|
+
{"version":3,"file":"migration-path-target-BPYp3LNc-DjdEIQsZ.mjs","names":["errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-path-target-BPYp3LNc.mjs"],"sourcesContent":["import { rt as errorRuntime } from \"./command-helpers-C4WpR-QE.mjs\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isAbsolute, relative, resolve } from \"pathe\";\n//#region src/utils/migration-path-target.ts\nfunction looksLikePath(target) {\n\treturn target.includes(\"/\") || target.includes(\"\\\\\");\n}\nfunction resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative) {\n\tconst targetPath = resolve(target);\n\tconst relativeToApp = relative(appMigrationsDir, targetPath);\n\tif (relativeToApp === \"\" || relativeToApp === \".\" || relativeToApp.startsWith(\"..\") || isAbsolute(relativeToApp)) return notOk(errorRuntime(\"MIGRATION.TARGET_NOT_APP_SPACE\", \"Target must point to an app-space migration\", {\n\t\twhy: `Expected a path under ${appMigrationsRelative}, got ${target}`,\n\t\tfix: \"Pass an app-space migration directory or use a hash prefix.\"\n\t}));\n\treturn ok(targetPath);\n}\n/**\n* Resolve a filesystem-path target to the migration dir that contains it,\n* searching each in-scope space's `migrationsDir`. A path is explicit, so\n* it can belong to at most one space — returns the first match, or `null`\n* when the path falls outside every space dir.\n*/\nfunction resolveTargetPathAcrossSpaces(target, spaces) {\n\tconst targetPath = resolve(target);\n\tfor (const space of spaces) {\n\t\tconst rel = relative(space.migrationsDir, targetPath);\n\t\tif (!(rel === \"\" || rel === \".\" || rel.startsWith(\"..\") || isAbsolute(rel))) return targetPath;\n\t}\n\treturn null;\n}\nfunction findPackageByDirPath(packages, resolvedDirPath) {\n\tconst normalized = resolve(resolvedDirPath);\n\treturn packages.find((p) => resolve(p.dirPath) === normalized);\n}\n//#endregion\nexport { resolveTargetPathAcrossSpaces as i, looksLikePath as n, resolveAppTargetPath as r, findPackageByDirPath as t };\n\n//# sourceMappingURL=migration-path-target-BPYp3LNc.mjs.map"],"mappings":";;;;AAIA,SAAS,cAAc,QAAQ;CAC9B,OAAO,OAAO,SAAS,GAAG,KAAK,OAAO,SAAS,IAAI;AACpD;AACA,SAAS,qBAAqB,QAAQ,kBAAkB,uBAAuB;CAC9E,MAAM,aAAa,QAAQ,MAAM;CACjC,MAAM,gBAAgB,SAAS,kBAAkB,UAAU;CAC3D,IAAI,kBAAkB,MAAM,kBAAkB,OAAO,cAAc,WAAW,IAAI,KAAK,WAAW,aAAa,GAAG,OAAO,MAAMA,eAAa,kCAAkC,+CAA+C;EAC5N,KAAK,yBAAyB,sBAAsB,QAAQ;EAC5D,KAAK;CACN,CAAC,CAAC;CACF,OAAO,GAAG,UAAU;AACrB;;;;;;;AAOA,SAAS,8BAA8B,QAAQ,QAAQ;CACtD,MAAM,aAAa,QAAQ,MAAM;CACjC,KAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,MAAM,SAAS,MAAM,eAAe,UAAU;EACpD,IAAI,EAAE,QAAQ,MAAM,QAAQ,OAAO,IAAI,WAAW,IAAI,KAAK,WAAW,GAAG,IAAI,OAAO;CACrF;CACA,OAAO;AACR;AACA,SAAS,qBAAqB,UAAU,iBAAiB;CACxD,MAAM,aAAa,QAAQ,eAAe;CAC1C,OAAO,SAAS,MAAM,MAAM,QAAQ,EAAE,OAAO,MAAM,UAAU;AAC9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as formatStyledHeader, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-
|
|
2
|
-
import { t as executeMigrationPlanCommand } from "./migration-plan-
|
|
1
|
+
import { W as formatStyledHeader, et as parseGlobalFlagsOrExit, o as createTerminalUI, ot as setCommandDescriptions, q as handleResult, r as addGlobalOptions, st as setCommandExamples } from "./command-helpers-C4WpR-QE-DNllqff1.mjs";
|
|
2
|
+
import { t as executeMigrationPlanCommand } from "./migration-plan-DE7-vtqT-jgtSH4Lw.mjs";
|
|
3
3
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/cli/dist/commands/migration-plan.mjs
|
|
@@ -169,4 +169,4 @@ function resolveBundleByPrefix(bundles, needle) {
|
|
|
169
169
|
//#endregion
|
|
170
170
|
export { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };
|
|
171
171
|
|
|
172
|
-
//# sourceMappingURL=migration-plan-
|
|
172
|
+
//# sourceMappingURL=migration-plan-D81XmVwy.mjs.map
|