prisma-next 0.12.0-dev.39 → 0.12.0-dev.40
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/cli.mjs +12 -12
- package/dist/{client-CcqChq9N.mjs → client-BNdG504y.mjs} +4 -4
- package/dist/{client-CcqChq9N.mjs.map → client-BNdG504y.mjs.map} +1 -1
- package/dist/{command-helpers-DK_5ItoJ.mjs → command-helpers-xvg9oq4T.mjs} +21 -3
- package/dist/command-helpers-xvg9oq4T.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +4 -4
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.mjs +5 -5
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.mjs +5 -6
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +55 -1
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +2 -2
- package/dist/commands/migration-graph.d.mts +13 -1
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +15 -16
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +18 -1
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -4
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +12 -23
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-DG3kjgoz.mjs → contract-at-errors-Wj3u4Xco.mjs} +2 -2
- package/dist/{contract-at-errors-DG3kjgoz.mjs.map → contract-at-errors-Wj3u4Xco.mjs.map} +1 -1
- package/dist/{contract-emit-C0Bs0VRj.mjs → contract-emit-COg18szA.mjs} +3 -3
- package/dist/{contract-emit-C0Bs0VRj.mjs.map → contract-emit-COg18szA.mjs.map} +1 -1
- package/dist/{contract-emit-BO0l6fnT.mjs → contract-emit-KyJNQK5-.mjs} +3 -3
- package/dist/{contract-emit-BO0l6fnT.mjs.map → contract-emit-KyJNQK5-.mjs.map} +1 -1
- package/dist/{contract-infer-DaHH7CGX.mjs → contract-infer-IEp0227u.mjs} +3 -3
- package/dist/{contract-infer-DaHH7CGX.mjs.map → contract-infer-IEp0227u.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-Dbr3-jHF.mjs → contract-space-aggregate-loader-BdRPfM3Q.mjs} +62 -4
- package/dist/{contract-space-aggregate-loader-Dbr3-jHF.mjs.map → contract-space-aggregate-loader-BdRPfM3Q.mjs.map} +1 -1
- package/dist/{db-verify-DppLAhYT.mjs → db-verify-C9k5KAyI.mjs} +4 -4
- package/dist/{db-verify-DppLAhYT.mjs.map → db-verify-C9k5KAyI.mjs.map} +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/{framework-components-CxOVKAAh.mjs → framework-components-Be4inY3I.mjs} +2 -2
- package/dist/{framework-components-CxOVKAAh.mjs.map → framework-components-Be4inY3I.mjs.map} +1 -1
- package/dist/{init-R272pxux.mjs → init-BIxw3l7t.mjs} +3 -3
- package/dist/{init-R272pxux.mjs.map → init-BIxw3l7t.mjs.map} +1 -1
- package/dist/{inspect-live-schema-CfOSPCmR.mjs → inspect-live-schema-DXUFGQDe.mjs} +3 -3
- package/dist/{inspect-live-schema-CfOSPCmR.mjs.map → inspect-live-schema-DXUFGQDe.mjs.map} +1 -1
- package/dist/{migration-check-Dc0cOhKH.mjs → migration-check-CUavU7U9.mjs} +236 -88
- package/dist/migration-check-CUavU7U9.mjs.map +1 -0
- package/dist/{migration-command-scaffold-CIxCqBXa.mjs → migration-command-scaffold-omgKpt3K.mjs} +3 -3
- package/dist/{migration-command-scaffold-CIxCqBXa.mjs.map → migration-command-scaffold-omgKpt3K.mjs.map} +1 -1
- package/dist/{migration-graph-space-render-dmLLWift.mjs → migration-graph-space-render-ByJ83gxp.mjs} +2 -2
- package/dist/{migration-graph-space-render-dmLLWift.mjs.map → migration-graph-space-render-ByJ83gxp.mjs.map} +1 -1
- package/dist/{migration-list-C5sXrl0U.mjs → migration-list-jK6QeczE.mjs} +4 -4
- package/dist/{migration-list-C5sXrl0U.mjs.map → migration-list-jK6QeczE.mjs.map} +1 -1
- package/dist/{migration-log-CwP41Cke.mjs → migration-log-CW0EjxSr.mjs} +39 -27
- package/dist/migration-log-CW0EjxSr.mjs.map +1 -0
- package/dist/migration-path-target-DqcrbOis.mjs +24 -0
- package/dist/migration-path-target-DqcrbOis.mjs.map +1 -0
- package/dist/{migration-plan-CeTjQOIG.mjs → migration-plan-NHdlUwPG.mjs} +5 -6
- package/dist/{migration-plan-CeTjQOIG.mjs.map → migration-plan-NHdlUwPG.mjs.map} +1 -1
- package/dist/{migration-status-GMRiiLFP.mjs → migration-status-GZ6XfbWs.mjs} +21 -14
- package/dist/migration-status-GZ6XfbWs.mjs.map +1 -0
- package/dist/{ref-advancement-V1o-9LVK.mjs → ref-advancement-CJY9zOv7.mjs} +1 -1
- package/dist/{ref-advancement-V1o-9LVK.mjs.map → ref-advancement-CJY9zOv7.mjs.map} +1 -1
- package/dist/{telemetry-S-NGi9U6.mjs → telemetry-DQP0BvKv.mjs} +2 -2
- package/dist/{telemetry-S-NGi9U6.mjs.map → telemetry-DQP0BvKv.mjs.map} +1 -1
- package/dist/{verify-BdI-BgYi.mjs → verify-tvHRBBVP.mjs} +2 -2
- package/dist/{verify-BdI-BgYi.mjs.map → verify-tvHRBBVP.mjs.map} +1 -1
- package/package.json +11 -11
- package/dist/command-helpers-DK_5ItoJ.mjs.map +0 -1
- package/dist/extension-pack-inputs-IDvjRCi3.mjs +0 -62
- package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +0 -1
- package/dist/migration-check-Dc0cOhKH.mjs.map +0 -1
- package/dist/migration-log-CwP41Cke.mjs.map +0 -1
- package/dist/migration-status-GMRiiLFP.mjs.map +0 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { N as CliStructuredError } from "../types-Cculk5KV.mjs";
|
|
1
2
|
import { Command } from "commander";
|
|
3
|
+
import { Result } from "@prisma-next/utils/result";
|
|
4
|
+
import { ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
|
|
5
|
+
import { Refs } from "@prisma-next/migration-tools/refs";
|
|
6
|
+
import { MigrationGraph } from "@prisma-next/migration-tools/graph";
|
|
7
|
+
import { OnDiskMigrationPackage } from "@prisma-next/migration-tools/package";
|
|
8
|
+
|
|
2
9
|
//#region src/utils/integrity-violation-to-check-failure.d.ts
|
|
3
10
|
interface CheckFailure {
|
|
4
11
|
readonly pnCode: string;
|
|
@@ -13,7 +20,54 @@ interface MigrationCheckResult {
|
|
|
13
20
|
readonly failures: readonly CheckFailure[];
|
|
14
21
|
readonly summary: string;
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* One contract space's on-disk state, resolved for the explicit graph
|
|
25
|
+
* checks `runMigrationCheck` runs per space: the space's migration
|
|
26
|
+
* packages, its user-authored refs, its induced graph, and the absolute
|
|
27
|
+
* `migrations/<space>/` + `migrations/<space>/refs/` directories the
|
|
28
|
+
* file-existence and dangling-ref `where` paths are derived from.
|
|
29
|
+
*/
|
|
30
|
+
interface CheckSpace {
|
|
31
|
+
readonly spaceId: string;
|
|
32
|
+
readonly packages: readonly OnDiskMigrationPackage[];
|
|
33
|
+
readonly refs: Refs;
|
|
34
|
+
readonly graph: MigrationGraph;
|
|
35
|
+
readonly migrationsDir: string;
|
|
36
|
+
readonly refsDir: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Project the loaded {@link ContractSpaceAggregate} into the
|
|
40
|
+
* {@link CheckSpace} rows the multi-space check iterates — one per on-disk
|
|
41
|
+
* contract-space directory, in the aggregate's `app`-first ordering. Mirrors
|
|
42
|
+
* `migration list`'s `migrationSpaceListEntriesFromAggregate`: space
|
|
43
|
+
* membership matches the on-disk directories, package / ref / graph data come
|
|
44
|
+
* from `aggregate.space(id)`.
|
|
45
|
+
*/
|
|
46
|
+
declare function enumerateCheckSpaces(aggregate: ContractSpaceAggregate, projectMigrationsDir: string): Promise<readonly CheckSpace[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Inputs for {@link runMigrationCheck} — the multi-space policy core of
|
|
49
|
+
* the holistic (no-arg) `migration check`. Enumeration is supplied by the
|
|
50
|
+
* caller (the CLI shell builds it from {@link enumerateCheckSpaces}); the
|
|
51
|
+
* core does not touch config, flags, or streams.
|
|
52
|
+
*/
|
|
53
|
+
interface RunMigrationCheckInputs {
|
|
54
|
+
readonly spaces: readonly CheckSpace[];
|
|
55
|
+
readonly spaceFilter?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Policy core of the holistic `migration check`: validates `--space`,
|
|
59
|
+
* narrows the pre-enumerated spaces, and runs the per-space explicit graph
|
|
60
|
+
* checks (file-existence, snapshot consistency, reachability, dangling
|
|
61
|
+
* refs), aggregating every failure into one {@link MigrationCheckResult}.
|
|
62
|
+
*
|
|
63
|
+
* `--space` validation mirrors `migration list`: an invalid id →
|
|
64
|
+
* {@link errorInvalidSpaceId}; an id with no on-disk space →
|
|
65
|
+
* {@link errorSpaceNotFound}. Both map to exit `PRECONDITION` at the shell.
|
|
66
|
+
* Aggregate-integrity violations (which already span every space) are folded
|
|
67
|
+
* in by the caller, not here.
|
|
68
|
+
*/
|
|
69
|
+
declare function runMigrationCheck(inputs: RunMigrationCheckInputs): Result<MigrationCheckResult, CliStructuredError>;
|
|
16
70
|
declare function createMigrationCheckCommand(): Command;
|
|
17
71
|
//#endregion
|
|
18
|
-
export { type CheckFailure, MigrationCheckResult, createMigrationCheckCommand };
|
|
72
|
+
export { type CheckFailure, CheckSpace, MigrationCheckResult, RunMigrationCheckInputs, createMigrationCheckCommand, enumerateCheckSpaces, runMigrationCheck };
|
|
19
73
|
//# sourceMappingURL=migration-check.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-check.d.mts","names":[],"sources":["../../src/utils/integrity-violation-to-check-failure.ts","../../src/commands/migration-check.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration-check.d.mts","names":[],"sources":["../../src/utils/integrity-violation-to-check-failure.ts","../../src/commands/migration-check.ts"],"mappings":";;;;;;;;;UAGiB,YAAA;EAAA,SACN,MAAA;EAAA,SACA,KAAA;EAAA,SACA,GAAA;EAAA,SACA,GAAA;AAAA;;;UC2DM,oBAAA;EAAA,SACN,EAAA;EAAA,SACA,QAAA,WAAmB,YAAY;EAAA,SAC/B,OAAA;AAAA;;;;;AD9DG;;;UCsHG,UAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA,WAAmB,sBAAA;EAAA,SACnB,IAAA,EAAM,IAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,SACP,aAAA;EAAA,SACA,OAAA;AAAA;;;AA9DO;AAwDlB;;;;;iBAiBsB,oBAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,UAAA;;;;;;;UAqGH,uBAAA;EAAA,SACN,MAAA,WAAiB,UAAU;EAAA,SAC3B,WAAA;AAAA;;;AArHO;AAWlB;;;;;;;;;iBAyHgB,iBAAA,CACd,MAAA,EAAQ,uBAAA,GACP,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBA8MhB,2BAAA,CAAA,GAA+B,OAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createMigrationCheckCommand } from "../migration-check-
|
|
2
|
-
export { createMigrationCheckCommand };
|
|
1
|
+
import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "../migration-check-CUavU7U9.mjs";
|
|
2
|
+
export { createMigrationCheckCommand, enumerateCheckSpaces, runMigrationCheck };
|
|
@@ -25,9 +25,21 @@ interface MigrationGraphResult {
|
|
|
25
25
|
readonly treeSections: readonly MigrationGraphTreeSection[];
|
|
26
26
|
readonly summary: string;
|
|
27
27
|
}
|
|
28
|
+
interface MigrationGraphJsonEdge {
|
|
29
|
+
readonly dirName: string;
|
|
30
|
+
readonly from: string;
|
|
31
|
+
readonly to: string;
|
|
32
|
+
readonly migrationHash: string;
|
|
33
|
+
}
|
|
34
|
+
interface MigrationGraphJsonResult {
|
|
35
|
+
readonly ok: true;
|
|
36
|
+
readonly nodes: readonly string[];
|
|
37
|
+
readonly edges: readonly MigrationGraphJsonEdge[];
|
|
38
|
+
readonly summary: string;
|
|
39
|
+
}
|
|
28
40
|
declare function formatMigrationGraphHumanOutput(result: MigrationGraphResult): string;
|
|
29
41
|
declare function executeMigrationGraphCommand(options: MigrationGraphOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<MigrationGraphResult, CliStructuredError>>;
|
|
30
42
|
declare function createMigrationGraphCommand(): Command;
|
|
31
43
|
//#endregion
|
|
32
|
-
export { MigrationGraphResult, MigrationGraphTreeSection, createMigrationGraphCommand, executeMigrationGraphCommand, formatMigrationGraphHumanOutput };
|
|
44
|
+
export { MigrationGraphJsonEdge, MigrationGraphJsonResult, MigrationGraphResult, MigrationGraphTreeSection, createMigrationGraphCommand, executeMigrationGraphCommand, formatMigrationGraphHumanOutput };
|
|
33
45
|
//# sourceMappingURL=migration-graph.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph.d.mts","names":[],"sources":["../../src/commands/migration-graph.ts"],"mappings":";;;;;;;;UAiCU,qBAAA,SAA8B,oBAAoB;EAAA,SACjD,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;EA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AI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBAwGxB,2BAAA,CAAA,GAA+B,OAAO"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
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-
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
4
|
-
import { a as renderMigrationGraphLegend, i as renderMigrationGraphSpaceTree, n as computeGlobalMaxEdgeTreePrefixWidth, r as indentMigrationGraphTreeBlock, t as computeGlobalMaxDirNameWidth } from "../migration-graph-space-render-
|
|
5
|
-
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-
|
|
2
|
+
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-xvg9oq4T.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-BdRPfM3Q.mjs";
|
|
4
|
+
import { a as renderMigrationGraphLegend, i as renderMigrationGraphSpaceTree, n as computeGlobalMaxEdgeTreePrefixWidth, r as indentMigrationGraphTreeBlock, t as computeGlobalMaxDirNameWidth } from "../migration-graph-space-render-ByJ83gxp.mjs";
|
|
5
|
+
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-jK6QeczE.mjs";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
8
8
|
import { ok } from "@prisma-next/utils/result";
|
|
@@ -103,7 +103,7 @@ async function executeMigrationGraphCommand(options, flags, ui) {
|
|
|
103
103
|
}
|
|
104
104
|
function createMigrationGraphCommand() {
|
|
105
105
|
const command = new Command("graph");
|
|
106
|
-
setCommandDescriptions(command, "Show the migration graph topology", "Renders the migration graph topology
|
|
106
|
+
setCommandDescriptions(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.");
|
|
107
107
|
setCommandExamples(command, [
|
|
108
108
|
"prisma-next migration graph",
|
|
109
109
|
"prisma-next migration graph --json",
|
|
@@ -146,19 +146,18 @@ function createMigrationGraphCommand() {
|
|
|
146
146
|
lines.push("}");
|
|
147
147
|
ui.output(lines.join("\n"));
|
|
148
148
|
} else if (flags.json) {
|
|
149
|
-
const
|
|
150
|
-
const edges = [...graphResult.graph.migrationByHash.values()].map((e) => ({
|
|
151
|
-
dirName: e.dirName,
|
|
152
|
-
from: e.from,
|
|
153
|
-
to: e.to,
|
|
154
|
-
migrationHash: e.migrationHash
|
|
155
|
-
}));
|
|
156
|
-
ui.output(JSON.stringify({
|
|
149
|
+
const jsonResult = {
|
|
157
150
|
ok: true,
|
|
158
|
-
nodes,
|
|
159
|
-
edges
|
|
151
|
+
nodes: [...graphResult.graph.nodes],
|
|
152
|
+
edges: [...graphResult.graph.migrationByHash.values()].map((e) => ({
|
|
153
|
+
dirName: e.dirName,
|
|
154
|
+
from: e.from,
|
|
155
|
+
to: e.to,
|
|
156
|
+
migrationHash: e.migrationHash
|
|
157
|
+
})),
|
|
160
158
|
summary: `${graphResult.graph.nodes.size} node(s), ${graphResult.graph.migrationByHash.size} edge(s)`
|
|
161
|
-
}
|
|
159
|
+
};
|
|
160
|
+
ui.output(JSON.stringify(jsonResult, null, 2));
|
|
162
161
|
} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));
|
|
163
162
|
});
|
|
164
163
|
process.exit(exitCode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph.mjs","names":[],"sources":["../../src/commands/migration-graph.ts"],"sourcesContent":["import type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport type { CliStructuredError } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport {\n computeGlobalMaxDirNameWidth,\n computeGlobalMaxEdgeTreePrefixWidth,\n indentMigrationGraphTreeBlock,\n renderMigrationGraphSpaceTree,\n} from '../utils/formatters/migration-graph-space-render';\nimport { renderMigrationGraphLegend } from '../utils/formatters/migration-graph-tree-render';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { shouldShowLegend, validateLegendOptions } from '../utils/legend';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport {\n listRefsByContractHash,\n migrationSpaceListEntriesFromAggregate,\n runMigrationList,\n} from './migration-list';\n\ninterface MigrationGraphOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly dot?: boolean;\n readonly space?: string;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\nexport interface MigrationGraphTreeSection {\n readonly spaceId: string;\n readonly tree: string;\n readonly showHeading: boolean;\n}\n\nexport interface MigrationGraphResult {\n readonly ok: true;\n /** App-space graph for `--json` / `--dot` (unchanged machine output). */\n readonly graph: MigrationGraph;\n readonly treeSections: readonly MigrationGraphTreeSection[];\n readonly summary: string;\n}\n\nfunction computeGraphSummary(graph: MigrationGraph): string {\n return `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`;\n}\n\nexport function formatMigrationGraphHumanOutput(result: MigrationGraphResult): string {\n const sections: string[] = [];\n for (const section of result.treeSections) {\n if (section.showHeading) {\n sections.push(`${section.spaceId}:`);\n }\n if (section.tree.length > 0) {\n sections.push(section.tree);\n } else {\n sections.push('(no migrations)');\n }\n sections.push('');\n }\n sections.push(result.summary);\n return sections.join('\\n').trimEnd();\n}\n\nexport async function executeMigrationGraphCommand(\n options: MigrationGraphOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationGraphResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration graph',\n description: 'Show the migration graph topology',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ...(options.space !== undefined ? [{ label: 'space', value: options.space }] : []),\n ],\n flags,\n });\n ui.stderr(header);\n if (shouldShowLegend(options, flags)) {\n ui.stderr(\n renderMigrationGraphLegend({\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n ui.stderr('');\n }\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return loaded;\n }\n\n const { aggregate, contractHash: liveContractHash } = loaded.value;\n const appGraph = aggregate.app.graph();\n\n const listSpaces = await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir);\n const listResult = runMigrationList({\n spaces: listSpaces,\n ...ifDefined('spaceFilter', options.space),\n });\n if (!listResult.ok) {\n return listResult;\n }\n\n const scopedSpaces = listResult.value.spaces;\n const showSpaceHeadings = scopedSpaces.length > 1;\n const glyphMode = ui.resolveGlyphMode(options.ascii === true);\n const colorize = flags.color !== false;\n\n const globalLayoutInputs = showSpaceHeadings\n ? scopedSpaces\n .filter((spaceEntry) => spaceEntry.migrations.length > 0)\n .map((spaceEntry) => ({\n graph: aggregate.space(spaceEntry.spaceId)!.graph(),\n liveContractHash,\n }))\n : [];\n const globalMaxEdgeTreePrefixWidth =\n globalLayoutInputs.length > 0\n ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs)\n : undefined;\n const globalMaxDirNameWidth =\n globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : undefined;\n\n const treeSections: MigrationGraphTreeSection[] = [];\n for (const spaceEntry of scopedSpaces) {\n const member = aggregate.space(spaceEntry.spaceId);\n if (member === undefined) {\n continue;\n }\n const graph = member.graph();\n const tree =\n spaceEntry.migrations.length === 0\n ? ''\n : renderMigrationGraphSpaceTree({\n graph,\n migrations: spaceEntry.migrations,\n liveContractHash,\n glyphMode,\n colorize,\n refsByHash: listRefsByContractHash(member),\n ...(globalMaxEdgeTreePrefixWidth !== undefined ? { globalMaxEdgeTreePrefixWidth } : {}),\n ...(globalMaxDirNameWidth !== undefined ? { globalMaxDirNameWidth } : {}),\n });\n const displayTree =\n showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, ' ') : tree;\n treeSections.push({\n spaceId: spaceEntry.spaceId,\n tree: displayTree,\n showHeading: showSpaceHeadings,\n });\n }\n\n return ok({\n ok: true,\n graph: appGraph,\n treeSections,\n summary: computeGraphSummary(appGraph),\n });\n}\n\nexport function createMigrationGraphCommand(): Command {\n const command = new Command('graph');\n setCommandDescriptions(\n command,\n 'Show the migration graph topology',\n 'Renders the migration graph topology. Offline — does not consult\\n' +\n 'the database. --ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\n' +\n 'Use --json for machine-readable output, or --dot for Graphviz DOT\\n' +\n 'format.',\n );\n setCommandExamples(command, [\n 'prisma-next migration graph',\n 'prisma-next migration graph --json',\n 'prisma-next migration graph --dot',\n 'prisma-next migration graph --ascii',\n 'prisma-next migration graph --legend',\n 'prisma-next migration graph --space app',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .option('--dot', 'Output in Graphviz DOT format')\n .option('--ascii', 'Use ASCII glyphs (pipe-friendly)')\n .option('--legend', 'Print a key for the tree glyphs and lane colors')\n .action(async (options: MigrationGraphOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const legendValidation = validateLegendOptions(options, flags);\n if (!legendValidation.ok) {\n process.exit(handleResult(legendValidation, flags, ui));\n }\n const result = await executeMigrationGraphCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (graphResult) => {\n if (options.dot) {\n const lines = ['digraph migrations {'];\n for (const edge of graphResult.graph.migrationByHash.values()) {\n const from = edge.from.slice(0, 12);\n const to = edge.to.slice(0, 12);\n lines.push(` \"${from}\" -> \"${to}\" [label=\"${edge.dirName}\"];`);\n }\n lines.push('}');\n ui.output(lines.join('\\n'));\n } else if (flags.json) {\n const nodes = [...graphResult.graph.nodes];\n const edges = [...graphResult.graph.migrationByHash.values()].map((e) => ({\n dirName: e.dirName,\n from: e.from,\n to: e.to,\n migrationHash: e.migrationHash,\n }));\n ui.output(\n JSON.stringify(\n {\n ok: true,\n nodes,\n edges,\n summary: `${graphResult.graph.nodes.size} node(s), ${graphResult.graph.migrationByHash.size} edge(s)`,\n },\n null,\n 2,\n ),\n );\n } else if (!flags.quiet) {\n ui.output(formatMigrationGraphHumanOutput(graphResult));\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;AAuDA,SAAS,oBAAoB,OAA+B;CAC1D,OAAO,GAAG,MAAM,MAAM,KAAK,YAAY,MAAM,gBAAgB,KAAK;AACpE;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,MAAM,gBAAgB,OAAO,CAAC,EAAE,KAAK,OAAO;KACxE,SAAS,EAAE;KACX,MAAM,EAAE;KACR,IAAI,EAAE;KACN,eAAe,EAAE;IACnB,EAAE;IACF,GAAG,OACD,KAAK,UACH;KACE,IAAI;KACJ;KACA;KACA,SAAS,GAAG,YAAY,MAAM,MAAM,KAAK,YAAY,YAAY,MAAM,gBAAgB,KAAK;IAC9F,GACA,MACA,CACF,CACF;GACF,OAAO,IAAI,CAAC,MAAM,OAChB,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAE1D,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"migration-graph.mjs","names":[],"sources":["../../src/commands/migration-graph.ts"],"sourcesContent":["import type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport type { CliStructuredError } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport {\n computeGlobalMaxDirNameWidth,\n computeGlobalMaxEdgeTreePrefixWidth,\n indentMigrationGraphTreeBlock,\n renderMigrationGraphSpaceTree,\n} from '../utils/formatters/migration-graph-space-render';\nimport { renderMigrationGraphLegend } from '../utils/formatters/migration-graph-tree-render';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { shouldShowLegend, validateLegendOptions } from '../utils/legend';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport {\n listRefsByContractHash,\n migrationSpaceListEntriesFromAggregate,\n runMigrationList,\n} from './migration-list';\n\ninterface MigrationGraphOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly dot?: boolean;\n readonly space?: string;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\nexport interface MigrationGraphTreeSection {\n readonly spaceId: string;\n readonly tree: string;\n readonly showHeading: boolean;\n}\n\nexport interface MigrationGraphResult {\n readonly ok: true;\n /** App-space graph for `--json` / `--dot` (unchanged machine output). */\n readonly graph: MigrationGraph;\n readonly treeSections: readonly MigrationGraphTreeSection[];\n readonly summary: string;\n}\n\nexport interface MigrationGraphJsonEdge {\n readonly dirName: string;\n readonly from: string;\n readonly to: string;\n readonly migrationHash: string;\n}\n\nexport interface MigrationGraphJsonResult {\n readonly ok: true;\n readonly nodes: readonly string[];\n readonly edges: readonly MigrationGraphJsonEdge[];\n readonly summary: string;\n}\n\nfunction computeGraphSummary(graph: MigrationGraph): string {\n return `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`;\n}\n\nexport function formatMigrationGraphHumanOutput(result: MigrationGraphResult): string {\n const sections: string[] = [];\n for (const section of result.treeSections) {\n if (section.showHeading) {\n sections.push(`${section.spaceId}:`);\n }\n if (section.tree.length > 0) {\n sections.push(section.tree);\n } else {\n sections.push('(no migrations)');\n }\n sections.push('');\n }\n sections.push(result.summary);\n return sections.join('\\n').trimEnd();\n}\n\nexport async function executeMigrationGraphCommand(\n options: MigrationGraphOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationGraphResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration graph',\n description: 'Show the migration graph topology',\n details: [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ...(options.space !== undefined ? [{ label: 'space', value: options.space }] : []),\n ],\n flags,\n });\n ui.stderr(header);\n if (shouldShowLegend(options, flags)) {\n ui.stderr(\n renderMigrationGraphLegend({\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n ui.stderr('');\n }\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return loaded;\n }\n\n const { aggregate, contractHash: liveContractHash } = loaded.value;\n const appGraph = aggregate.app.graph();\n\n const listSpaces = await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir);\n const listResult = runMigrationList({\n spaces: listSpaces,\n ...ifDefined('spaceFilter', options.space),\n });\n if (!listResult.ok) {\n return listResult;\n }\n\n const scopedSpaces = listResult.value.spaces;\n const showSpaceHeadings = scopedSpaces.length > 1;\n const glyphMode = ui.resolveGlyphMode(options.ascii === true);\n const colorize = flags.color !== false;\n\n const globalLayoutInputs = showSpaceHeadings\n ? scopedSpaces\n .filter((spaceEntry) => spaceEntry.migrations.length > 0)\n .map((spaceEntry) => ({\n graph: aggregate.space(spaceEntry.spaceId)!.graph(),\n liveContractHash,\n }))\n : [];\n const globalMaxEdgeTreePrefixWidth =\n globalLayoutInputs.length > 0\n ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs)\n : undefined;\n const globalMaxDirNameWidth =\n globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : undefined;\n\n const treeSections: MigrationGraphTreeSection[] = [];\n for (const spaceEntry of scopedSpaces) {\n const member = aggregate.space(spaceEntry.spaceId);\n if (member === undefined) {\n continue;\n }\n const graph = member.graph();\n const tree =\n spaceEntry.migrations.length === 0\n ? ''\n : renderMigrationGraphSpaceTree({\n graph,\n migrations: spaceEntry.migrations,\n liveContractHash,\n glyphMode,\n colorize,\n refsByHash: listRefsByContractHash(member),\n ...(globalMaxEdgeTreePrefixWidth !== undefined ? { globalMaxEdgeTreePrefixWidth } : {}),\n ...(globalMaxDirNameWidth !== undefined ? { globalMaxDirNameWidth } : {}),\n });\n const displayTree =\n showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, ' ') : tree;\n treeSections.push({\n spaceId: spaceEntry.spaceId,\n tree: displayTree,\n showHeading: showSpaceHeadings,\n });\n }\n\n return ok({\n ok: true,\n graph: appGraph,\n treeSections,\n summary: computeGraphSummary(appGraph),\n });\n}\n\nexport function createMigrationGraphCommand(): Command {\n const command = new Command('graph');\n setCommandDescriptions(\n command,\n 'Show the migration graph topology',\n 'Renders the migration graph topology.\\n' +\n 'Offline — does not consult the database.\\n' +\n '--ascii swaps box-drawing for pipe-friendly ASCII glyphs.\\n' +\n 'Use --json for machine-readable output, or --dot for Graphviz DOT\\n' +\n 'format.',\n );\n setCommandExamples(command, [\n 'prisma-next migration graph',\n 'prisma-next migration graph --json',\n 'prisma-next migration graph --dot',\n 'prisma-next migration graph --ascii',\n 'prisma-next migration graph --legend',\n 'prisma-next migration graph --space app',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .option('--dot', 'Output in Graphviz DOT format')\n .option('--ascii', 'Use ASCII glyphs (pipe-friendly)')\n .option('--legend', 'Print a key for the tree glyphs and lane colors')\n .action(async (options: MigrationGraphOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const legendValidation = validateLegendOptions(options, flags);\n if (!legendValidation.ok) {\n process.exit(handleResult(legendValidation, flags, ui));\n }\n const result = await executeMigrationGraphCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (graphResult) => {\n if (options.dot) {\n const lines = ['digraph migrations {'];\n for (const edge of graphResult.graph.migrationByHash.values()) {\n const from = edge.from.slice(0, 12);\n const to = edge.to.slice(0, 12);\n lines.push(` \"${from}\" -> \"${to}\" [label=\"${edge.dirName}\"];`);\n }\n lines.push('}');\n ui.output(lines.join('\\n'));\n } else if (flags.json) {\n const nodes = [...graphResult.graph.nodes];\n const edges = [...graphResult.graph.migrationByHash.values()].map(\n (e): MigrationGraphJsonEdge => ({\n dirName: e.dirName,\n from: e.from,\n to: e.to,\n migrationHash: e.migrationHash,\n }),\n );\n const jsonResult: MigrationGraphJsonResult = {\n ok: true,\n nodes,\n edges,\n summary: `${graphResult.graph.nodes.size} node(s), ${graphResult.graph.migrationByHash.size} edge(s)`,\n };\n ui.output(JSON.stringify(jsonResult, null, 2));\n } else if (!flags.quiet) {\n ui.output(formatMigrationGraphHumanOutput(graphResult));\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;AAqEA,SAAS,oBAAoB,OAA+B;CAC1D,OAAO,GAAG,MAAM,MAAM,KAAK,YAAY,MAAM,gBAAgB,KAAK;AACpE;AAEA,SAAgB,gCAAgC,QAAsC;CACpF,MAAM,WAAqB,CAAC;CAC5B,KAAK,MAAM,WAAW,OAAO,cAAc;EACzC,IAAI,QAAQ,aACV,SAAS,KAAK,GAAG,QAAQ,QAAQ,EAAE;EAErC,IAAI,QAAQ,KAAK,SAAS,GACxB,SAAS,KAAK,QAAQ,IAAI;OAE1B,SAAS,KAAK,iBAAiB;EAEjC,SAAS,KAAK,EAAE;CAClB;CACA,SAAS,KAAK,OAAO,OAAO;CAC5B,OAAO,SAAS,KAAK,IAAI,EAAE,QAAQ;AACrC;AAEA,eAAsB,6BACpB,SACA,OACA,IAC2D;CAC3D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,oBAAoB,kBAAkB,sBACxD,QAAQ,QACR,MACF;CAEA,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAC/B,MAAM,SAAS,mBAAmB;GAChC,SAAS;GACT,aAAa;GACb,SAAS;IACP;KAAE,OAAO;KAAU,OAAO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AAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAGxD,MAAM,WAAW,aAAa,MADT,6BAA6B,SAAS,OAAO,EAAE,GAC9B,OAAO,KAAK,gBAAgB;GAChE,IAAI,QAAQ,KAAK;IACf,MAAM,QAAQ,CAAC,sBAAsB;IACrC,KAAK,MAAM,QAAQ,YAAY,MAAM,gBAAgB,OAAO,GAAG;KAC7D,MAAM,OAAO,KAAK,KAAK,MAAM,GAAG,EAAE;KAClC,MAAM,KAAK,KAAK,GAAG,MAAM,GAAG,EAAE;KAC9B,MAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,YAAY,KAAK,QAAQ,IAAI;IAChE;IACA,MAAM,KAAK,GAAG;IACd,GAAG,OAAO,MAAM,KAAK,IAAI,CAAC;GAC5B,OAAO,IAAI,MAAM,MAAM;IAUrB,MAAM,aAAuC;KAC3C,IAAI;KACJ,OAAA,CAXa,GAAG,YAAY,MAAM,KAW9B;KACJ,OAXY,CAAC,GAAG,YAAY,MAAM,gBAAgB,OAAO,CAAC,EAAE,KAC3D,OAA+B;MAC9B,SAAS,EAAE;MACX,MAAM,EAAE;MACR,IAAI,EAAE;MACN,eAAe,EAAE;KACnB,EAKI;KACJ,SAAS,GAAG,YAAY,MAAM,MAAM,KAAK,YAAY,YAAY,MAAM,gBAAgB,KAAK;IAC9F;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC/C,OAAO,IAAI,CAAC,MAAM,OAChB,GAAG,OAAO,gCAAgC,WAAW,CAAC;EAE1D,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-
|
|
1
|
+
import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-jK6QeczE.mjs";
|
|
2
2
|
export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
|
|
@@ -4,15 +4,32 @@ import { t as TerminalUI } from "../terminal-ui-5Y6mrg93.mjs";
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { Result } from "@prisma-next/utils/result";
|
|
6
6
|
import { LedgerEntryRecord } from "@prisma-next/contract/types";
|
|
7
|
+
import { MigrationGraph } from "@prisma-next/migration-tools/graph";
|
|
7
8
|
|
|
9
|
+
//#region src/utils/formatters/migration-log-table.d.ts
|
|
10
|
+
interface SerializedLedgerEntryRecord {
|
|
11
|
+
readonly space: string;
|
|
12
|
+
readonly migrationName: string;
|
|
13
|
+
readonly migrationHash: string;
|
|
14
|
+
readonly from: string | null;
|
|
15
|
+
readonly to: string;
|
|
16
|
+
readonly appliedAt: string;
|
|
17
|
+
readonly operationCount: number;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
8
20
|
//#region src/commands/migration-log.d.ts
|
|
9
21
|
interface MigrationLogOptions extends CommonCommandOptions {
|
|
10
22
|
readonly db?: string;
|
|
11
23
|
readonly config?: string;
|
|
12
24
|
readonly utc?: boolean;
|
|
25
|
+
readonly ascii?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface MigrationLogResult {
|
|
28
|
+
readonly ok: true;
|
|
29
|
+
readonly entries: readonly SerializedLedgerEntryRecord[];
|
|
13
30
|
}
|
|
14
31
|
declare function executeMigrationLogCommand(options: MigrationLogOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<readonly LedgerEntryRecord[], CliStructuredError>>;
|
|
15
32
|
declare function createMigrationLogCommand(): Command;
|
|
16
33
|
//#endregion
|
|
17
|
-
export { createMigrationLogCommand, executeMigrationLogCommand };
|
|
34
|
+
export { MigrationLogResult, createMigrationLogCommand, executeMigrationLogCommand };
|
|
18
35
|
//# sourceMappingURL=migration-log.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/commands/migration-log.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/utils/formatters/migration-log-table.ts","../../src/commands/migration-log.ts"],"mappings":";;;;;;;;;UAkBiB,2BAAA;EAAA,SACN,KAAA;EAAA,SACA,aAAA;EAAA,SACA,aAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,SAAA;EAAA,SACA,cAAA;AAAA;;;UCUD,mBAAA,SAA4B,oBAAoB;EAAA,SAC/C,EAAA;EAAA,SACA,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;AAAA;AAAA,UAGM,kBAAA;EAAA,SACN,EAAA;EAAA,SACA,OAAA,WAAkB,2BAA2B;AAAA;AAAA,iBAGlC,0BAAA,CACpB,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,UAAgB,iBAAA,IAAqB,kBAAA;AAAA,iBA0DhC,yBAAA,CAAA,GAA6B,OAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-
|
|
1
|
+
import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-CW0EjxSr.mjs";
|
|
2
2
|
export { createMigrationLogCommand, executeMigrationLogCommand };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { A as formatStyledHeader, F as CliStructuredError, U as errorFileNotFound, _ as createTerminalUI, at as errorTargetMigrationNotSupported, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, nt as errorRuntime, o as resolveContractPath, r as getTargetMigrations, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-
|
|
3
|
-
import { t as assertFrameworkComponentsCompatible } from "../framework-components-
|
|
4
|
-
import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-
|
|
2
|
+
import { A as formatStyledHeader, F as CliStructuredError, U as errorFileNotFound, _ as createTerminalUI, at as errorTargetMigrationNotSupported, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, nt as errorRuntime, o as resolveContractPath, r as getTargetMigrations, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-xvg9oq4T.mjs";
|
|
3
|
+
import { t as assertFrameworkComponentsCompatible } from "../framework-components-Be4inY3I.mjs";
|
|
4
|
+
import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-BdRPfM3Q.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
7
7
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-
|
|
1
|
+
import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-NHdlUwPG.mjs";
|
|
2
2
|
export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { N as CliStructuredError } from "../types-Cculk5KV.mjs";
|
|
2
1
|
import { Command } from "commander";
|
|
3
|
-
import { Result } from "@prisma-next/utils/result";
|
|
4
2
|
import { OperationPreview } from "@prisma-next/framework-components/control";
|
|
5
3
|
|
|
6
4
|
//#region src/commands/migration-show.d.ts
|
|
@@ -24,8 +22,7 @@ interface MigrationShowResult {
|
|
|
24
22
|
readonly ok: true;
|
|
25
23
|
readonly migration: MigrationShowPresent;
|
|
26
24
|
}
|
|
27
|
-
declare function resolveAppTargetPath(target: string, appMigrationsDir: string, appMigrationsRelative: string): Result<string, CliStructuredError>;
|
|
28
25
|
declare function createMigrationShowCommand(): Command;
|
|
29
26
|
//#endregion
|
|
30
|
-
export { MigrationShowPresent, MigrationShowResult, createMigrationShowCommand
|
|
27
|
+
export { MigrationShowPresent, MigrationShowResult, createMigrationShowCommand };
|
|
31
28
|
//# sourceMappingURL=migration-show.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":";;;;UAkDiB,oBAAA;EAAA,SACN,OAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,aAAA;EAAA,SACA,SAAA;EAAA,SACA,UAAA;IAAA,SACE,EAAA;IAAA,SACA,KAAA;IAAA,SACA,cAAA;EAAA;EAAA,SAEF,OAAA,EAAS,gBAAgB;EAAA,SACzB,OAAA;AAAA;AAAA,UAGM,mBAAA;EAAA,SACN,EAAA;EAAA,SACA,SAAA,EAAW,oBAAoB;AAAA;AAAA,iBA6J1B,0BAAA,CAAA,GAA8B,OAAO"}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { A as formatStyledHeader, E as formatMigrationShowOutput, U as errorFileNotFound, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapRefResolutionError, nt as errorRuntime, o as resolveContractPath, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, u as setCommandExamples, y as handleResult, z as errorContractValidationFailed } from "../command-helpers-
|
|
3
|
-
import { t as createControlClient } from "../client-
|
|
2
|
+
import { A as formatStyledHeader, E as formatMigrationShowOutput, U as errorFileNotFound, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapRefResolutionError, nt as errorRuntime, o as resolveContractPath, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, u as setCommandExamples, y as handleResult, z as errorContractValidationFailed } from "../command-helpers-xvg9oq4T.mjs";
|
|
3
|
+
import { t as createControlClient } from "../client-BNdG504y.mjs";
|
|
4
|
+
import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-DqcrbOis.mjs";
|
|
4
5
|
import { Command } from "commander";
|
|
5
6
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
6
7
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
7
|
-
import {
|
|
8
|
+
import { relative } from "pathe";
|
|
8
9
|
import { readFile } from "node:fs/promises";
|
|
9
10
|
import { APP_SPACE_ID, createControlStack } from "@prisma-next/framework-components/control";
|
|
10
11
|
import { castAs } from "@prisma-next/utils/casts";
|
|
11
12
|
import { loadContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
|
|
12
13
|
import { parseMigrationRef } from "@prisma-next/migration-tools/ref-resolution";
|
|
13
14
|
//#region src/commands/migration-show.ts
|
|
14
|
-
function looksLikePath(target) {
|
|
15
|
-
return target.includes("/") || target.includes("\\");
|
|
16
|
-
}
|
|
17
|
-
function resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative) {
|
|
18
|
-
const targetPath = resolve(target);
|
|
19
|
-
const relativeToApp = relative(appMigrationsDir, targetPath);
|
|
20
|
-
if (relativeToApp === "" || relativeToApp === "." || relativeToApp.startsWith("..") || isAbsolute(relativeToApp)) return notOk(errorRuntime("Target must point to an app-space migration", {
|
|
21
|
-
why: `Expected a path under ${appMigrationsRelative}, got ${target}`,
|
|
22
|
-
fix: "Pass an app-space migration directory or use a hash prefix."
|
|
23
|
-
}));
|
|
24
|
-
return ok(targetPath);
|
|
25
|
-
}
|
|
26
15
|
function pkgToPresent(spaceId, pkg, client) {
|
|
27
16
|
const ops = castAs(pkg.ops);
|
|
28
17
|
const preview = client.toOperationPreview(ops) ?? { statements: [] };
|
|
@@ -43,10 +32,6 @@ function pkgToPresent(spaceId, pkg, client) {
|
|
|
43
32
|
summary: `${ops.length} operation(s)`
|
|
44
33
|
};
|
|
45
34
|
}
|
|
46
|
-
function findPackageByDirPath(packages, resolvedDirPath) {
|
|
47
|
-
const normalized = resolve(resolvedDirPath);
|
|
48
|
-
return packages.find((p) => resolve(p.dirPath) === normalized);
|
|
49
|
-
}
|
|
50
35
|
async function executeMigrationShowCommand(target, options, flags, ui) {
|
|
51
36
|
const config = await loadConfig(options.config);
|
|
52
37
|
const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
@@ -145,8 +130,12 @@ async function executeMigrationShowCommand(target, options, flags, ui) {
|
|
|
145
130
|
}
|
|
146
131
|
function createMigrationShowCommand() {
|
|
147
132
|
const command = new Command("show");
|
|
148
|
-
setCommandDescriptions(command, "Display migration package contents", "Shows the operations, statement preview, and metadata for one app-space migration.\nAccepts a directory path, directory name, or hash prefix.");
|
|
149
|
-
setCommandExamples(command, [
|
|
133
|
+
setCommandDescriptions(command, "Display migration package contents", "Shows the operations, statement preview, and metadata for one app-space migration.\nAccepts a directory path, directory name, or hash prefix.\nOffline — does not consult the database.");
|
|
134
|
+
setCommandExamples(command, [
|
|
135
|
+
"prisma-next migration show 20260101_100000_add_user",
|
|
136
|
+
"prisma-next migration show sha256:a1b2c3",
|
|
137
|
+
"prisma-next migration show 20260101_100000_add_user --json"
|
|
138
|
+
]);
|
|
150
139
|
setCommandSeeAlso(command, [
|
|
151
140
|
{
|
|
152
141
|
verb: "migration status",
|
|
@@ -165,7 +154,7 @@ function createMigrationShowCommand() {
|
|
|
165
154
|
oneLiner: "Show the migration graph topology"
|
|
166
155
|
}
|
|
167
156
|
]);
|
|
168
|
-
addGlobalOptions(command).argument("<target>", "Migration reference: directory name, hash/prefix, or path").option("--config <path>", "Path to prisma-next.config.ts").action(async (target, options) => {
|
|
157
|
+
addGlobalOptions(command).argument("<target>", "Migration reference: directory name, hash/prefix, ref, or path").option("--config <path>", "Path to prisma-next.config.ts").action(async (target, options) => {
|
|
169
158
|
const flags = parseGlobalFlagsOrExit(options);
|
|
170
159
|
const ui = createTerminalUI(flags);
|
|
171
160
|
const exitCode = handleResult(await executeMigrationShowCommand(target, options, flags, ui), flags, ui, (showResult) => {
|
|
@@ -177,6 +166,6 @@ function createMigrationShowCommand() {
|
|
|
177
166
|
return command;
|
|
178
167
|
}
|
|
179
168
|
//#endregion
|
|
180
|
-
export { createMigrationShowCommand
|
|
169
|
+
export { createMigrationShowCommand };
|
|
181
170
|
|
|
182
171
|
//# sourceMappingURL=migration-show.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-show.mjs","names":[],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport {\n APP_SPACE_ID,\n createControlStack,\n type MigrationPlanOperation,\n type OperationPreview,\n} from '@prisma-next/framework-components/control';\nimport { loadContractSpaceAggregate } from '@prisma-next/migration-tools/aggregate';\nimport type { OnDiskMigrationPackage } from '@prisma-next/migration-tools/package';\nimport { parseMigrationRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { castAs } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { isAbsolute, relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n type CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorRuntime,\n errorUnexpected,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { formatMigrationShowOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationShowOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport interface MigrationShowPresent {\n readonly spaceId: string;\n readonly dirName: string;\n readonly dirPath: string;\n readonly from: string | null;\n readonly to: string;\n readonly migrationHash: string;\n readonly createdAt: string;\n readonly operations: readonly {\n readonly id: string;\n readonly label: string;\n readonly operationClass: string;\n }[];\n readonly preview: OperationPreview;\n readonly summary: string;\n}\n\nexport interface MigrationShowResult {\n readonly ok: true;\n readonly migration: MigrationShowPresent;\n}\n\nfunction looksLikePath(target: string): boolean {\n return target.includes('/') || target.includes('\\\\');\n}\n\nexport function resolveAppTargetPath(\n target: string,\n appMigrationsDir: string,\n appMigrationsRelative: string,\n): Result<string, CliStructuredError> {\n const targetPath = resolve(target);\n const relativeToApp = relative(appMigrationsDir, targetPath);\n const isOutsideAppDir =\n relativeToApp === '' ||\n relativeToApp === '.' ||\n relativeToApp.startsWith('..') ||\n isAbsolute(relativeToApp);\n if (isOutsideAppDir) {\n return notOk(\n errorRuntime('Target must point to an app-space migration', {\n why: `Expected a path under ${appMigrationsRelative}, got ${target}`,\n fix: 'Pass an app-space migration directory or use a hash prefix.',\n }),\n );\n }\n return ok(targetPath);\n}\n\nfunction pkgToPresent(\n spaceId: string,\n pkg: OnDiskMigrationPackage,\n client: ReturnType<typeof createControlClient>,\n): MigrationShowPresent {\n const ops = castAs<readonly MigrationPlanOperation[]>(pkg.ops);\n const preview: OperationPreview = client.toOperationPreview(ops) ?? { statements: [] };\n return {\n spaceId,\n dirName: pkg.dirName,\n dirPath: relative(process.cwd(), pkg.dirPath),\n from: pkg.metadata.from,\n to: pkg.metadata.to,\n migrationHash: pkg.metadata.migrationHash,\n createdAt: pkg.metadata.createdAt,\n operations: ops.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n preview,\n summary: `${ops.length} operation(s)`,\n };\n}\n\nfunction findPackageByDirPath(\n packages: readonly OnDiskMigrationPackage[],\n resolvedDirPath: string,\n): OnDiskMigrationPackage | undefined {\n const normalized = resolve(resolvedDirPath);\n return packages.find((p) => resolve(p.dirPath) === normalized);\n}\n\nasync function executeMigrationShowCommand(\n target: string,\n options: MigrationShowOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationShowResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } =\n resolveMigrationPaths(options.config, config);\n\n const contractPathAbsolute = resolveContractPath(config);\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration show',\n description: 'Display migration package contents',\n details: [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n { label: 'migrations', value: appMigrationsRelative },\n { label: 'target', value: target },\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n ...ifDefined('driver', config.driver),\n extensionPacks: config.extensionPacks ?? [],\n });\n\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as NodeJS.ErrnoException).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to read contract file',\n }),\n );\n }\n\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n let appContract: Contract;\n try {\n appContract = familyInstance.deserializeContract(\n castAs<unknown>(JSON.parse(contractJsonContent)),\n );\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n const aggregate = await loadContractSpaceAggregate({\n migrationsDir,\n appContract,\n deserializeContract: (json: unknown) => familyInstance.deserializeContract(json),\n });\n\n const packages = aggregate.app.packages;\n const graph = aggregate.app.graph();\n const refs = aggregate.app.refs;\n\n let appPkg: OnDiskMigrationPackage;\n if (looksLikePath(target)) {\n const resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n if (!resolved.ok) return resolved;\n const matched = findPackageByDirPath(packages, resolved.value);\n if (!matched) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n fix: 'Pass a directory name, hash prefix, or path to an on-disk app-space migration package.',\n }),\n );\n }\n appPkg = matched;\n } else {\n if (packages.length === 0) {\n return notOk(\n errorRuntime('No migrations found', {\n why: `No migration packages found in ${appMigrationsRelative}`,\n fix: 'Run `prisma-next migration plan` to create a migration first.',\n }),\n );\n }\n const migResult = parseMigrationRef(target, { graph, refs });\n if (!migResult.ok) {\n return notOk(mapRefResolutionError(migResult.failure));\n }\n const matchedPkg = packages.find(\n (p) => p.metadata.migrationHash === migResult.value.migrationHash,\n );\n if (!matchedPkg) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n appPkg = matchedPkg;\n }\n\n return ok({\n ok: true,\n migration: pkgToPresent(APP_SPACE_ID, appPkg, client),\n });\n}\n\nexport function createMigrationShowCommand(): Command {\n const command = new Command('show');\n setCommandDescriptions(\n command,\n 'Display migration package contents',\n 'Shows the operations, statement preview, and metadata for one app-space migration.\\n' +\n 'Accepts a directory path, directory name, or hash prefix.',\n );\n setCommandExamples(command, [\n 'prisma-next migration show 20260101_100000_add_user',\n 'prisma-next migration show sha256:a1b2c3',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n ]);\n addGlobalOptions(command)\n .argument('<target>', 'Migration reference: directory name, hash/prefix, or path')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (target: string, options: MigrationShowOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n\n const ui = createTerminalUI(flags);\n\n const result = await executeMigrationShowCommand(target, options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (showResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(showResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;AAmEA,SAAS,cAAc,QAAyB;CAC9C,OAAO,OAAO,SAAS,GAAG,KAAK,OAAO,SAAS,IAAI;AACrD;AAEA,SAAgB,qBACd,QACA,kBACA,uBACoC;CACpC,MAAM,aAAa,QAAQ,MAAM;CACjC,MAAM,gBAAgB,SAAS,kBAAkB,UAAU;CAM3D,IAJE,kBAAkB,MAClB,kBAAkB,OAClB,cAAc,WAAW,IAAI,KAC7B,WAAW,aAAa,GAExB,OAAO,MACL,aAAa,+CAA+C;EAC1D,KAAK,yBAAyB,sBAAsB,QAAQ;EAC5D,KAAK;CACP,CAAC,CACH;CAEF,OAAO,GAAG,UAAU;AACtB;AAEA,SAAS,aACP,SACA,KACA,QACsB;CACtB,MAAM,MAAM,OAA0C,IAAI,GAAG;CAC7D,MAAM,UAA4B,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,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,"file":"migration-show.mjs","names":[],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport {\n APP_SPACE_ID,\n createControlStack,\n type MigrationPlanOperation,\n type OperationPreview,\n} from '@prisma-next/framework-components/control';\nimport { loadContractSpaceAggregate } from '@prisma-next/migration-tools/aggregate';\nimport type { OnDiskMigrationPackage } from '@prisma-next/migration-tools/package';\nimport { parseMigrationRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { castAs } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { relative } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n type CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorRuntime,\n errorUnexpected,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { formatMigrationShowOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport {\n findPackageByDirPath,\n looksLikePath,\n resolveAppTargetPath,\n} from '../utils/migration-path-target';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationShowOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport interface MigrationShowPresent {\n readonly spaceId: string;\n readonly dirName: string;\n readonly dirPath: string;\n readonly from: string | null;\n readonly to: string;\n readonly migrationHash: string;\n readonly createdAt: string;\n readonly operations: readonly {\n readonly id: string;\n readonly label: string;\n readonly operationClass: string;\n }[];\n readonly preview: OperationPreview;\n readonly summary: string;\n}\n\nexport interface MigrationShowResult {\n readonly ok: true;\n readonly migration: MigrationShowPresent;\n}\n\nfunction pkgToPresent(\n spaceId: string,\n pkg: OnDiskMigrationPackage,\n client: ReturnType<typeof createControlClient>,\n): MigrationShowPresent {\n const ops = castAs<readonly MigrationPlanOperation[]>(pkg.ops);\n const preview: OperationPreview = client.toOperationPreview(ops) ?? { statements: [] };\n return {\n spaceId,\n dirName: pkg.dirName,\n dirPath: relative(process.cwd(), pkg.dirPath),\n from: pkg.metadata.from,\n to: pkg.metadata.to,\n migrationHash: pkg.metadata.migrationHash,\n createdAt: pkg.metadata.createdAt,\n operations: ops.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n preview,\n summary: `${ops.length} operation(s)`,\n };\n}\n\nasync function executeMigrationShowCommand(\n target: string,\n options: MigrationShowOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationShowResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } =\n resolveMigrationPaths(options.config, config);\n\n const contractPathAbsolute = resolveContractPath(config);\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration show',\n description: 'Display migration package contents',\n details: [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n { label: 'migrations', value: appMigrationsRelative },\n { label: 'target', value: target },\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n ...ifDefined('driver', config.driver),\n extensionPacks: config.extensionPacks ?? [],\n });\n\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as NodeJS.ErrnoException).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to read contract file',\n }),\n );\n }\n\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n let appContract: Contract;\n try {\n appContract = familyInstance.deserializeContract(\n castAs<unknown>(JSON.parse(contractJsonContent)),\n );\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n const aggregate = await loadContractSpaceAggregate({\n migrationsDir,\n appContract,\n deserializeContract: (json: unknown) => familyInstance.deserializeContract(json),\n });\n\n const packages = aggregate.app.packages;\n const graph = aggregate.app.graph();\n const refs = aggregate.app.refs;\n\n let appPkg: OnDiskMigrationPackage;\n if (looksLikePath(target)) {\n const resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n if (!resolved.ok) return resolved;\n const matched = findPackageByDirPath(packages, resolved.value);\n if (!matched) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n fix: 'Pass a directory name, hash prefix, or path to an on-disk app-space migration package.',\n }),\n );\n }\n appPkg = matched;\n } else {\n if (packages.length === 0) {\n return notOk(\n errorRuntime('No migrations found', {\n why: `No migration packages found in ${appMigrationsRelative}`,\n fix: 'Run `prisma-next migration plan` to create a migration first.',\n }),\n );\n }\n const migResult = parseMigrationRef(target, { graph, refs });\n if (!migResult.ok) {\n return notOk(mapRefResolutionError(migResult.failure));\n }\n const matchedPkg = packages.find(\n (p) => p.metadata.migrationHash === migResult.value.migrationHash,\n );\n if (!matchedPkg) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n appPkg = matchedPkg;\n }\n\n return ok({\n ok: true,\n migration: pkgToPresent(APP_SPACE_ID, appPkg, client),\n });\n}\n\nexport function createMigrationShowCommand(): Command {\n const command = new Command('show');\n setCommandDescriptions(\n command,\n 'Display migration package contents',\n 'Shows the operations, statement preview, and metadata for one app-space migration.\\n' +\n 'Accepts a directory path, directory name, or hash prefix.\\n' +\n 'Offline — does not consult the database.',\n );\n setCommandExamples(command, [\n 'prisma-next migration show 20260101_100000_add_user',\n 'prisma-next migration show sha256:a1b2c3',\n 'prisma-next migration show 20260101_100000_add_user --json',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n ]);\n addGlobalOptions(command)\n .argument('<target>', 'Migration reference: directory name, hash/prefix, ref, or path')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (target: string, options: MigrationShowOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n\n const ui = createTerminalUI(flags);\n\n const result = await executeMigrationShowCommand(target, options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (showResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(showResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwEA,SAAS,aACP,SACA,KACA,QACsB;CACtB,MAAM,MAAM,OAA0C,IAAI,GAAG;CAC7D,MAAM,UAA4B,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,CAAC,EAAE;CACrF,OAAO;EACL;EACA,SAAS,IAAI;EACb,SAAS,SAAS,QAAQ,IAAI,GAAG,IAAI,OAAO;EAC5C,MAAM,IAAI,SAAS;EACnB,IAAI,IAAI,SAAS;EACjB,eAAe,IAAI,SAAS;EAC5B,WAAW,IA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H;EAEF,SAAS;CACX;CAEA,OAAO,GAAG;EACR,IAAI;EACJ,WAAW,aAAa,cAAc,QAAQ,MAAM;CACtD,CAAC;AACH;AAEA,SAAgB,6BAAsC;CACpD,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,uBACE,SACA,sCACA,yLAGF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;CACF,CAAC;CACD,kBAAkB,SAAS;EACzB;GAAE,MAAM;GAAoB,UAAU;EAAyC;EAC/E;GAAE,MAAM;GAAiB,UAAU;EAAkC;EACrE;GAAE,MAAM;GAAkB,UAAU;EAA0B;EAC9D;GAAE,MAAM;GAAmB,UAAU;EAAoC;CAC3E,CAAC;CACD,iBAAiB,OAAO,EACrB,SAAS,YAAY,gEAAgE,EACrF,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,OAAO,QAAgB,YAAkC;EAC/D,MAAM,QAAQ,uBAAuB,OAAO;EAE5C,MAAM,KAAK,iBAAiB,KAAK;EAIjC,MAAM,WAAW,aAAa,MAFT,4BAA4B,QAAQ,SAAS,OAAO,EAAE,GAErC,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,OAChB,GAAG,IAAI,0BAA0B,YAAY,KAAK,CAAC;EAEvD,CAAC;EAED,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/utils/migration-types.ts","../../src/commands/migration-status.ts"],"mappings":";;;;UAAiB,SAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/utils/migration-types.ts","../../src/commands/migration-status.ts"],"mappings":";;;;UAAiB,SAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;AAAA;;;UCuEM,6BAAA,SAAsC,kBAAkB;EAAA,SAC9D,MAAM;AAAA;AAAA,UAGA,0BAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA,WAAqB,6BAA6B;AAAA;AAAA,UAG5C,qBAAA;EAAA,SACN,EAAA;EAAA,SACA,MAAA,WAAiB,0BAAA;EAAA,SACjB,OAAA;EAAA,SACA,qBAAA;EAAA,SACA,WAAA,WAAsB,gBAAA;EAAA,SACtB,YAAA,WAAuB,0BAAA;AAAA;AAAA,UAGjB,0BAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAA;EAAA,SACA,WAAA;AAAA;AAAA,iBA8DK,kBAAA,CAAmB,IAAA;EAAA,SACxB,UAAA;EAAA,SACA,UAAA;EAAA,SACA,cAAA;EAAA,SACA,OAAA;AAAA;AAAA,iBAiBK,mBAAA,CAAoB,IAAA;EAAA,SACzB,YAAA;EAAA,SACA,UAAA;EAAA,SACA,cAAA;EAAA,SACA,UAAA;AAAA;AAAA,iBAWK,mBAAA,CAAoB,MAAA,EAAQ,qBAAqB,EAAE,QAAA;AAAA,iBAqBnD,uBAAA,CAAwB,MAAA,EAAQ,qBAAqB,EAAE,QAAA;AAAA,iBAuZvD,4BAAA,CAAA,GAAgC,OAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatStatusSummary, i as formatStatusHumanOutput, n as buildStatusHeadline, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-
|
|
1
|
+
import { a as formatStatusSummary, i as formatStatusHumanOutput, n as buildStatusHeadline, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-GZ6XfbWs.mjs";
|
|
2
2
|
export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary };
|
package/dist/commands/ref.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { $ as errorRefSetEmptySentinel, F as CliStructuredError, O as formatCommandHelp, Q as errorRefSetBundleNotFound, U as errorFileNotFound, _ as createTerminalUI, ct as mapMigrationToolsError, et as errorRefSetHashNotInGraph, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapRefResolutionError, nt as errorRuntime, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, y as handleResult } from "../command-helpers-
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
4
|
-
import { i as readContractIR } from "../ref-advancement-
|
|
2
|
+
import { $ as errorRefSetEmptySentinel, F as CliStructuredError, O as formatCommandHelp, Q as errorRefSetBundleNotFound, U as errorFileNotFound, _ as createTerminalUI, ct as mapMigrationToolsError, et as errorRefSetHashNotInGraph, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapRefResolutionError, nt as errorRuntime, s as resolveMigrationPaths, st as errorUnexpected, t as addGlobalOptions, y as handleResult } from "../command-helpers-xvg9oq4T.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-BdRPfM3Q.mjs";
|
|
4
|
+
import { i as readContractIR } from "../ref-advancement-CJY9zOv7.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
7
7
|
import { join } from "pathe";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createTelemetryCommand } from "../../telemetry-
|
|
1
|
+
import { t as createTelemetryCommand } from "../../telemetry-DQP0BvKv.mjs";
|
|
2
2
|
export { createTelemetryCommand };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as CliStructuredError, U as errorFileNotFound, ct as mapMigrationToolsError, rt as errorSnapshotMissing, st as errorUnexpected, z as errorContractValidationFailed } from "./command-helpers-
|
|
1
|
+
import { F as CliStructuredError, U as errorFileNotFound, ct as mapMigrationToolsError, rt as errorSnapshotMissing, st as errorUnexpected, z as errorContractValidationFailed } from "./command-helpers-xvg9oq4T.mjs";
|
|
2
2
|
import { notOk } from "@prisma-next/utils/result";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
|
|
@@ -39,4 +39,4 @@ function mapContractAtError(error, options) {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { mapContractAtError as t };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=contract-at-errors-
|
|
42
|
+
//# sourceMappingURL=contract-at-errors-Wj3u4Xco.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-at-errors-
|
|
1
|
+
{"version":3,"file":"contract-at-errors-Wj3u4Xco.mjs","names":[],"sources":["../src/utils/contract-at-errors.ts"],"sourcesContent":["import { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport { join } from 'pathe';\nimport {\n CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorSnapshotMissing,\n errorUnexpected,\n mapMigrationToolsError,\n} from './cli-errors';\n\nexport function mapContractAtError(\n error: unknown,\n options?: { readonly artifactRole?: 'from' | 'to' },\n): Result<never, CliStructuredError> {\n if (MigrationToolsError.is(error)) {\n switch (error.code) {\n case 'MIGRATION.SNAPSHOT_MISSING': {\n const refName =\n typeof error.details?.['refName'] === 'string'\n ? error.details['refName']\n : typeof error.details?.['identifier'] === 'string'\n ? error.details['identifier']\n : 'unknown';\n return notOk(errorSnapshotMissing(refName));\n }\n case 'MIGRATION.CONTRACT_DESERIALIZATION_FAILED': {\n const filePath =\n typeof error.details?.['filePath'] === 'string'\n ? error.details['filePath']\n : 'ref-snapshot';\n const message =\n typeof error.details?.['message'] === 'string' ? error.details['message'] : error.message;\n const isRefSnapshot = filePath.endsWith('.contract.json');\n return notOk(\n errorContractValidationFailed(\n isRefSnapshot\n ? `Ref snapshot contract failed to deserialize: ${message}`\n : `Predecessor contract at ${filePath} failed to deserialize: ${message}`,\n { where: { path: isRefSnapshot ? 'ref-snapshot' : filePath } },\n ),\n );\n }\n case 'MIGRATION.INVALID_JSON': {\n const filePath =\n typeof error.details?.['filePath'] === 'string' ? error.details['filePath'] : 'unknown';\n const message =\n typeof error.details?.['parseError'] === 'string'\n ? error.details['parseError']\n : error.message;\n const role = options?.artifactRole ?? 'from';\n return notOk(\n errorContractValidationFailed(\n role === 'to'\n ? `Target contract at ${filePath} failed to deserialize: ${message}`\n : `Predecessor contract at ${filePath} failed to deserialize: ${message}`,\n { where: { path: filePath } },\n ),\n );\n }\n case 'MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE':\n return notOk(\n errorUnexpected(error.message, {\n why: error.why,\n fix: error.fix,\n }),\n );\n case 'MIGRATION.FILE_MISSING': {\n const file =\n typeof error.details?.['file'] === 'string' ? error.details['file'] : 'end-contract.json';\n const dir = typeof error.details?.['dir'] === 'string' ? error.details['dir'] : '';\n const jsonPath = dir ? join(dir, 'end-contract.json') : file;\n const role = options?.artifactRole ?? 'from';\n return notOk(\n errorFileNotFound(jsonPath, {\n why:\n role === 'to'\n ? `Target migration is missing its destination contract snapshot at ${jsonPath}`\n : `Predecessor migration is missing its destination contract snapshot at ${jsonPath}`,\n fix:\n role === 'to'\n ? 'Re-emit the target migration so its sibling `end-contract.json` / `end-contract.d.ts` are restored, then re-run this command.'\n : 'Re-emit the predecessor migration (`prisma-next migration plan` from its source) so its sibling `end-contract.json` is restored, then re-run this command.',\n }),\n );\n }\n default:\n return notOk(mapMigrationToolsError(error));\n }\n }\n if (CliStructuredError.is(error)) {\n return not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,KAAK,mBAAmB,IAAI;GACxD,MAAM,OAAO,SAAS,gBAAgB;GACtC,OAAO,MACL,kBAAkB,UAAU;IAC1B,KACE,SAAS,OACL,oEAAoE,aACpE,yEAAyE;IAC/E,KACE,SAAS,OACL,kIACA;GACR,CAAC,CACH;EACF;EACA,SACE,OAAO,MAAM,uBAAuB,KAAK,CAAC;CAC9C;CAEF,IAAI,mBAAmB,GAAG,KAAK,GAC7B,OAAO,MAAM,KAAK;CAEpB,MAAM;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as executeContractEmit } from "./contract-emit-
|
|
1
|
+
import { n as executeContractEmit } from "./contract-emit-KyJNQK5-.mjs";
|
|
2
2
|
import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
|
|
3
|
-
import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, st as errorUnexpected$1, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-
|
|
3
|
+
import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, st as errorUnexpected$1, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-xvg9oq4T.mjs";
|
|
4
4
|
import { t as createProgressAdapter } from "./progress-adapter-C644QK8l.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
@@ -147,4 +147,4 @@ function createContractEmitCommand() {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
export { createContractEmitCommand as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=contract-emit-
|
|
150
|
+
//# sourceMappingURL=contract-emit-COg18szA.mjs.map
|