prisma-next 0.12.0-dev.28 → 0.12.0-dev.29
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-nygCs15r.mjs → client-xeWpMlq1.mjs} +4 -4
- package/dist/client-xeWpMlq1.mjs.map +1 -0
- package/dist/{command-helpers-D7TK5Y9e.mjs → command-helpers-DK_5ItoJ.mjs} +16 -2
- package/dist/command-helpers-DK_5ItoJ.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 +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.mjs +4 -4
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +12 -15
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +84 -51
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.d.mts +13 -4
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -187
- package/dist/commands/migration-log.d.mts +2 -2
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.d.mts +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.mjs +2 -2
- package/dist/commands/migration-status.d.mts +20 -2
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +2 -3
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +2 -2
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-CK3qoqZf.mjs → contract-at-errors-DG3kjgoz.mjs} +2 -2
- package/dist/{contract-at-errors-CK3qoqZf.mjs.map → contract-at-errors-DG3kjgoz.mjs.map} +1 -1
- package/dist/{contract-emit-Dzf73HdD.mjs → contract-emit-BO0l6fnT.mjs} +3 -3
- package/dist/{contract-emit-Dzf73HdD.mjs.map → contract-emit-BO0l6fnT.mjs.map} +1 -1
- package/dist/{contract-emit-DwlIz5Zg.mjs → contract-emit-C0Bs0VRj.mjs} +3 -3
- package/dist/{contract-emit-DwlIz5Zg.mjs.map → contract-emit-C0Bs0VRj.mjs.map} +1 -1
- package/dist/{contract-infer-Bzh___GO.mjs → contract-infer-2wtPflGH.mjs} +3 -3
- package/dist/{contract-infer-Bzh___GO.mjs.map → contract-infer-2wtPflGH.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-5zmOENc4.mjs → contract-space-aggregate-loader-Dbr3-jHF.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-5zmOENc4.mjs.map → contract-space-aggregate-loader-Dbr3-jHF.mjs.map} +1 -1
- package/dist/{db-verify-CNz036sw.mjs → db-verify-CxHiSiTG.mjs} +4 -4
- package/dist/{db-verify-CNz036sw.mjs.map → db-verify-CxHiSiTG.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-CyM_xYCY.mjs → framework-components-CxOVKAAh.mjs} +2 -2
- package/dist/{framework-components-CyM_xYCY.mjs.map → framework-components-CxOVKAAh.mjs.map} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts → global-flags-DG4uY5tV.d.mts} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts.map → global-flags-DG4uY5tV.d.mts.map} +1 -1
- package/dist/{init-DJsQpr_6.mjs → init-R272pxux.mjs} +4 -4
- package/dist/{init-DJsQpr_6.mjs.map → init-R272pxux.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DE76Ou4D.mjs → inspect-live-schema-RekOwfi5.mjs} +3 -3
- package/dist/{inspect-live-schema-DE76Ou4D.mjs.map → inspect-live-schema-RekOwfi5.mjs.map} +1 -1
- package/dist/{migration-check-CL2MzDRX.mjs → migration-check-Dc0cOhKH.mjs} +2 -2
- package/dist/{migration-check-CL2MzDRX.mjs.map → migration-check-Dc0cOhKH.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-194pA8F5.mjs → migration-command-scaffold-ApB3NxWY.mjs} +3 -3
- package/dist/{migration-command-scaffold-194pA8F5.mjs.map → migration-command-scaffold-ApB3NxWY.mjs.map} +1 -1
- package/dist/{migration-graph-tree-render-CVmV9sWr.mjs → migration-graph-space-render-dmLLWift.mjs} +389 -210
- package/dist/migration-graph-space-render-dmLLWift.mjs.map +1 -0
- package/dist/migration-list-C5sXrl0U.mjs +228 -0
- package/dist/migration-list-C5sXrl0U.mjs.map +1 -0
- package/dist/{migration-log-CP6skD5b.mjs → migration-log-DD_vCbYW.mjs} +4 -4
- package/dist/{migration-log-CP6skD5b.mjs.map → migration-log-DD_vCbYW.mjs.map} +1 -1
- package/dist/{migration-plan-D61N1hID.mjs → migration-plan-CeTjQOIG.mjs} +5 -5
- package/dist/{migration-plan-D61N1hID.mjs.map → migration-plan-CeTjQOIG.mjs.map} +1 -1
- package/dist/{migration-status--ejfYqWS.mjs → migration-status-qV8ctwPy.mjs} +61 -45
- package/dist/migration-status-qV8ctwPy.mjs.map +1 -0
- package/dist/{output-B60Gw5fu.mjs → output-CF_hqzI-.mjs} +1 -1
- package/dist/{output-B60Gw5fu.mjs.map → output-CF_hqzI-.mjs.map} +1 -1
- package/dist/{telemetry-CnfdMrpv.mjs → telemetry-S-NGi9U6.mjs} +2 -2
- package/dist/{telemetry-CnfdMrpv.mjs.map → telemetry-S-NGi9U6.mjs.map} +1 -1
- package/dist/{types-BYwWOyYJ.d.mts → types-Mh7mdPHM.d.mts} +1 -1
- package/dist/{types-BYwWOyYJ.d.mts.map → types-Mh7mdPHM.d.mts.map} +1 -1
- package/dist/{verify-By66Zu3y.mjs → verify-BdI-BgYi.mjs} +2 -2
- package/dist/{verify-By66Zu3y.mjs.map → verify-BdI-BgYi.mjs.map} +1 -1
- package/package.json +11 -11
- package/dist/client-nygCs15r.mjs.map +0 -1
- package/dist/command-helpers-D7TK5Y9e.mjs.map +0 -1
- package/dist/commands/migration-list.mjs.map +0 -1
- package/dist/migration-graph-tree-render-CVmV9sWr.mjs.map +0 -1
- package/dist/migration-status--ejfYqWS.mjs.map +0 -1
- package/dist/migration-types-D2FW63pr.d.mts +0 -15
- package/dist/migration-types-D2FW63pr.d.mts.map +0 -1
|
@@ -1,36 +1,51 @@
|
|
|
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 {
|
|
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-DK_5ItoJ.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dbr3-jHF.mjs";
|
|
4
|
+
import { a as renderMigrationGraphLegend, i as renderMigrationGraphSpaceTree, n as computeGlobalMaxEdgeTreePrefixWidth, r as indentMigrationGraphTreeBlock, t as computeGlobalMaxDirNameWidth } from "../migration-graph-space-render-dmLLWift.mjs";
|
|
5
|
+
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-C5sXrl0U.mjs";
|
|
5
6
|
import { Command } from "commander";
|
|
7
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
6
8
|
import { ok } from "@prisma-next/utils/result";
|
|
7
9
|
//#region src/commands/migration-graph.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
function computeGraphSummary(graph) {
|
|
11
|
+
return `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`;
|
|
12
|
+
}
|
|
13
|
+
function formatMigrationGraphHumanOutput(result) {
|
|
14
|
+
const sections = [];
|
|
15
|
+
for (const section of result.treeSections) {
|
|
16
|
+
if (section.showHeading) sections.push(`${section.spaceId}:`);
|
|
17
|
+
if (section.tree.length > 0) sections.push(section.tree);
|
|
18
|
+
else sections.push("(no migrations)");
|
|
19
|
+
sections.push("");
|
|
20
|
+
}
|
|
21
|
+
sections.push(result.summary);
|
|
22
|
+
return sections.join("\n").trimEnd();
|
|
15
23
|
}
|
|
16
24
|
async function executeMigrationGraphCommand(options, flags, ui) {
|
|
17
25
|
const config = await loadConfig(options.config);
|
|
18
|
-
const { configPath,
|
|
26
|
+
const { configPath, migrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);
|
|
19
27
|
if (!flags.json && !flags.quiet) {
|
|
20
28
|
const header = formatStyledHeader({
|
|
21
29
|
command: "migration graph",
|
|
22
30
|
description: "Show the migration graph topology",
|
|
23
|
-
details: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
details: [
|
|
32
|
+
{
|
|
33
|
+
label: "config",
|
|
34
|
+
value: configPath
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "migrations",
|
|
38
|
+
value: migrationsRelative
|
|
39
|
+
},
|
|
40
|
+
...options.space !== void 0 ? [{
|
|
41
|
+
label: "space",
|
|
42
|
+
value: options.space
|
|
43
|
+
}] : []
|
|
44
|
+
],
|
|
30
45
|
flags
|
|
31
46
|
});
|
|
32
47
|
ui.stderr(header);
|
|
33
|
-
if (
|
|
48
|
+
if (shouldShowLegend(options, flags)) {
|
|
34
49
|
ui.stderr(renderMigrationGraphLegend({
|
|
35
50
|
colorize: flags.color !== false,
|
|
36
51
|
glyphMode: ui.resolveGlyphMode(options.ascii === true)
|
|
@@ -40,18 +55,50 @@ async function executeMigrationGraphCommand(options, flags, ui) {
|
|
|
40
55
|
}
|
|
41
56
|
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
42
57
|
if (!loaded.ok) return loaded;
|
|
43
|
-
const { aggregate, contractHash } = loaded.value;
|
|
44
|
-
const
|
|
58
|
+
const { aggregate, contractHash: liveContractHash } = loaded.value;
|
|
59
|
+
const appGraph = aggregate.app.graph();
|
|
60
|
+
const listResult = runMigrationList({
|
|
61
|
+
spaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),
|
|
62
|
+
...ifDefined("spaceFilter", options.space)
|
|
63
|
+
});
|
|
64
|
+
if (!listResult.ok) return listResult;
|
|
65
|
+
const scopedSpaces = listResult.value.spaces;
|
|
66
|
+
const showSpaceHeadings = scopedSpaces.length > 1;
|
|
67
|
+
const glyphMode = ui.resolveGlyphMode(options.ascii === true);
|
|
68
|
+
const colorize = flags.color !== false;
|
|
69
|
+
const globalLayoutInputs = showSpaceHeadings ? scopedSpaces.filter((spaceEntry) => spaceEntry.migrations.length > 0).map((spaceEntry) => ({
|
|
70
|
+
graph: aggregate.space(spaceEntry.spaceId).graph(),
|
|
71
|
+
liveContractHash
|
|
72
|
+
})) : [];
|
|
73
|
+
const globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;
|
|
74
|
+
const globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;
|
|
75
|
+
const treeSections = [];
|
|
76
|
+
for (const spaceEntry of scopedSpaces) {
|
|
77
|
+
const member = aggregate.space(spaceEntry.spaceId);
|
|
78
|
+
if (member === void 0) continue;
|
|
79
|
+
const graph = member.graph();
|
|
80
|
+
const tree = spaceEntry.migrations.length === 0 ? "" : renderMigrationGraphSpaceTree({
|
|
81
|
+
graph,
|
|
82
|
+
migrations: spaceEntry.migrations,
|
|
83
|
+
liveContractHash,
|
|
84
|
+
glyphMode,
|
|
85
|
+
colorize,
|
|
86
|
+
refsByHash: listRefsByContractHash(member),
|
|
87
|
+
...globalMaxEdgeTreePrefixWidth !== void 0 ? { globalMaxEdgeTreePrefixWidth } : {},
|
|
88
|
+
...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}
|
|
89
|
+
});
|
|
90
|
+
const displayTree = showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, " ") : tree;
|
|
91
|
+
treeSections.push({
|
|
92
|
+
spaceId: spaceEntry.spaceId,
|
|
93
|
+
tree: displayTree,
|
|
94
|
+
showHeading: showSpaceHeadings
|
|
95
|
+
});
|
|
96
|
+
}
|
|
45
97
|
return ok({
|
|
46
98
|
ok: true,
|
|
47
|
-
graph,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
name,
|
|
51
|
-
hash: entry.hash,
|
|
52
|
-
active: false
|
|
53
|
-
})),
|
|
54
|
-
summary: `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`
|
|
99
|
+
graph: appGraph,
|
|
100
|
+
treeSections,
|
|
101
|
+
summary: computeGraphSummary(appGraph)
|
|
55
102
|
});
|
|
56
103
|
}
|
|
57
104
|
function createMigrationGraphCommand() {
|
|
@@ -62,7 +109,8 @@ function createMigrationGraphCommand() {
|
|
|
62
109
|
"prisma-next migration graph --json",
|
|
63
110
|
"prisma-next migration graph --dot",
|
|
64
111
|
"prisma-next migration graph --ascii",
|
|
65
|
-
"prisma-next migration graph --legend"
|
|
112
|
+
"prisma-next migration graph --legend",
|
|
113
|
+
"prisma-next migration graph --space app"
|
|
66
114
|
]);
|
|
67
115
|
setCommandSeeAlso(command, [
|
|
68
116
|
{
|
|
@@ -82,9 +130,11 @@ function createMigrationGraphCommand() {
|
|
|
82
130
|
oneLiner: "Display migration package contents"
|
|
83
131
|
}
|
|
84
132
|
]);
|
|
85
|
-
addGlobalOptions(command).option("--config <path>", "Path to prisma-next.config.ts").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) => {
|
|
133
|
+
addGlobalOptions(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) => {
|
|
86
134
|
const flags = parseGlobalFlagsOrExit(options);
|
|
87
135
|
const ui = createTerminalUI(flags);
|
|
136
|
+
const legendValidation = validateLegendOptions(options, flags);
|
|
137
|
+
if (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));
|
|
88
138
|
const exitCode = handleResult(await executeMigrationGraphCommand(options, flags, ui), flags, ui, (graphResult) => {
|
|
89
139
|
if (options.dot) {
|
|
90
140
|
const lines = ["digraph migrations {"];
|
|
@@ -107,32 +157,15 @@ function createMigrationGraphCommand() {
|
|
|
107
157
|
ok: true,
|
|
108
158
|
nodes,
|
|
109
159
|
edges,
|
|
110
|
-
summary: graphResult.
|
|
160
|
+
summary: `${graphResult.graph.nodes.size} node(s), ${graphResult.graph.migrationByHash.size} edge(s)`
|
|
111
161
|
}, null, 2));
|
|
112
|
-
} else if (!flags.quiet)
|
|
113
|
-
const refsByHash = /* @__PURE__ */ new Map();
|
|
114
|
-
for (const ref of graphResult.refs) {
|
|
115
|
-
const existing = refsByHash.get(ref.hash);
|
|
116
|
-
refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);
|
|
117
|
-
}
|
|
118
|
-
const layout = buildMigrationGraphLayout(buildMigrationGraphRows(graphResult.graph, { ...graphResult.contractHash !== null ? { contractHash: graphResult.contractHash } : {} }));
|
|
119
|
-
const activeRef = graphResult.refs.find((ref) => ref.active);
|
|
120
|
-
const treeOutput = renderMigrationGraphTree(layout, {
|
|
121
|
-
refsByHash,
|
|
122
|
-
...graphResult.contractHash !== null ? { contractHash: graphResult.contractHash } : {},
|
|
123
|
-
...activeRef !== void 0 ? { activeRefName: activeRef.name } : {},
|
|
124
|
-
colorize: flags.color !== false,
|
|
125
|
-
glyphMode: ui.resolveGlyphMode(options.ascii === true)
|
|
126
|
-
});
|
|
127
|
-
ui.output(treeOutput);
|
|
128
|
-
ui.output(`\n${graphResult.summary}`);
|
|
129
|
-
}
|
|
162
|
+
} else if (!flags.quiet) ui.output(formatMigrationGraphHumanOutput(graphResult));
|
|
130
163
|
});
|
|
131
164
|
process.exit(exitCode);
|
|
132
165
|
});
|
|
133
166
|
return command;
|
|
134
167
|
}
|
|
135
168
|
//#endregion
|
|
136
|
-
export { createMigrationGraphCommand, executeMigrationGraphCommand,
|
|
169
|
+
export { createMigrationGraphCommand, executeMigrationGraphCommand, formatMigrationGraphHumanOutput };
|
|
137
170
|
|
|
138
171
|
//# sourceMappingURL=migration-graph.mjs.map
|
|
@@ -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 { 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 { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';\nimport { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';\nimport {\n renderMigrationGraphLegend,\n renderMigrationGraphTree,\n} 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 type { StatusRef } from '../utils/migration-types';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationGraphOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly dot?: boolean;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\n/**\n * The legend is decoration printed alongside the command header on stderr, so\n * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,\n * `--quiet`) exactly as the header is.\n */\nexport function migrationGraphShowsLegend(\n options: { readonly legend?: boolean; readonly dot?: boolean },\n flags: GlobalFlags,\n): boolean {\n return (\n options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true\n );\n}\n\nexport interface MigrationGraphResult {\n readonly ok: true;\n readonly graph: MigrationGraph;\n readonly contractHash: string | null;\n readonly refs: readonly StatusRef[];\n readonly summary: string;\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, appMigrationsRelative, 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: appMigrationsRelative },\n ],\n flags,\n });\n ui.stderr(header);\n if (migrationGraphShowsLegend(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 } = loaded.value;\n const graph = aggregate.app.graph();\n const refs: readonly StatusRef[] = Object.entries(aggregate.app.refs).map(([name, entry]) => ({\n name,\n hash: entry.hash,\n active: false,\n }));\n\n return ok({\n ok: true,\n graph,\n contractHash,\n refs,\n summary: `${graph.nodes.size} node(s), ${graph.migrationByHash.size} edge(s)`,\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 ]);\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('--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 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({ ok: true, nodes, edges, summary: graphResult.summary }, null, 2),\n );\n } else if (!flags.quiet) {\n const refsByHash = new Map<string, string[]>();\n for (const ref of graphResult.refs) {\n const existing = refsByHash.get(ref.hash);\n refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);\n }\n const rowModel = buildMigrationGraphRows(graphResult.graph, {\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n });\n const layout = buildMigrationGraphLayout(rowModel);\n const activeRef = graphResult.refs.find((ref) => ref.active);\n const treeOutput = renderMigrationGraphTree(layout, {\n refsByHash,\n ...(graphResult.contractHash !== null\n ? { contractHash: graphResult.contractHash }\n : {}),\n ...(activeRef !== undefined ? { activeRefName: activeRef.name } : {}),\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n });\n ui.output(treeOutput);\n ui.output(`\\n${graphResult.summary}`);\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,SAAgB,0BACd,SACA,OACS;CACT,OACE,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAE9F;AAUA,eAAsB,6BACpB,SACA,OACA,IAC2D;CAC3D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,uBAAuB,kBAAkB,sBAC3D,QAAQ,QACR,MACF;CAEA,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OAAO;EAC/B,MAAM,SAAS,mBAAmB;GAChC,SAAS;GACT,aAAa;GACb,SAAS,CACP;IAAE,OAAO;IAAU,OAAO;GAAW,GACrC;IAAE,OAAO;IAAc,OAAO;GAAsB,CACtD;GACA;EACF,CAAC;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,EAAE,cAAc,YAAY,aAAa,IACzC,CAAC;KACL,GAAI,cAAc,KAAA,IAAY,EAAE,eAAe,UAAU,KAAK,IAAI,CAAC;KACnE,UAAU,MAAM,UAAU;KAC1B,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACvD,CAAC;IACD,GAAG,OAAO,UAAU;IACpB,GAAG,OAAO,KAAK,YAAY,SAAS;GACtC;EACF,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\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;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;IAAW;IACrC;KAAE,OAAO;KAAc,OAAO;IAAmB;IACjD,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC;KAAE,OAAO;KAAS,OAAO,QAAQ;IAAM,CAAC,IAAI,CAAC;GAClF;GACA;EACF,CAAC;EACD,GAAG,OAAO,MAAM;EAChB,IAAI,iBAAiB,SAAS,KAAK,GAAG;GACpC,GAAG,OACD,2BAA2B;IACzB,UAAU,MAAM,UAAU;IAC1B,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;GAC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AG,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;IACrB,MAAM,QAAQ,CAAC,GAAG,YAAY,MAAM,KAAK;IACzC,MAAM,QAAQ,CAAC,GAAG,YAAY,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,10 +1,11 @@
|
|
|
1
|
-
import { N as CliStructuredError } from "../types-
|
|
2
|
-
import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-
|
|
1
|
+
import { N as CliStructuredError } from "../types-Mh7mdPHM.mjs";
|
|
2
|
+
import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
|
|
3
3
|
import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-5Y6mrg93.mjs";
|
|
4
4
|
import { n as MigrationListResult, r as MigrationSpaceListEntry } from "../migration-list-types-DS63IdFd.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { Result } from "@prisma-next/utils/result";
|
|
7
7
|
import { ContractSpaceAggregate, ContractSpaceMember } from "@prisma-next/migration-tools/aggregate";
|
|
8
|
+
import { MigrationGraph } from "@prisma-next/migration-tools/graph";
|
|
8
9
|
|
|
9
10
|
//#region src/commands/migration-list.d.ts
|
|
10
11
|
/**
|
|
@@ -29,10 +30,18 @@ interface MigrationListOptions extends CommonCommandOptions {
|
|
|
29
30
|
readonly config?: string;
|
|
30
31
|
readonly space?: string;
|
|
31
32
|
readonly ascii?: boolean;
|
|
33
|
+
readonly legend?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface MigrationListExecuteResult {
|
|
36
|
+
readonly list: MigrationListResult;
|
|
37
|
+
readonly liveContractHash: string;
|
|
38
|
+
readonly aggregate: ContractSpaceAggregate;
|
|
32
39
|
}
|
|
33
40
|
interface MigrationListHumanRenderOptions {
|
|
34
41
|
readonly glyphMode: GlyphMode;
|
|
35
42
|
readonly useColor: boolean;
|
|
43
|
+
readonly liveContractHash: string;
|
|
44
|
+
readonly graphForSpace: (spaceId: string) => MigrationGraph | undefined;
|
|
36
45
|
}
|
|
37
46
|
declare function renderMigrationListHumanOutput(result: MigrationListResult, options: MigrationListHumanRenderOptions): string;
|
|
38
47
|
/**
|
|
@@ -62,8 +71,8 @@ declare function runMigrationList(inputs: RunMigrationListInputs): Result<Migrat
|
|
|
62
71
|
* stderr (interactive mode only), and delegates to {@link runMigrationList}.
|
|
63
72
|
* Kept intentionally thin so the unit-testable surface lives in the core.
|
|
64
73
|
*/
|
|
65
|
-
declare function executeMigrationListCommand(options: MigrationListOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<
|
|
74
|
+
declare function executeMigrationListCommand(options: MigrationListOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<MigrationListExecuteResult, CliStructuredError>>;
|
|
66
75
|
declare function createMigrationListCommand(): Command;
|
|
67
76
|
//#endregion
|
|
68
|
-
export { MigrationListHumanRenderOptions, RunMigrationListInputs, createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
|
|
77
|
+
export { MigrationListExecuteResult, MigrationListHumanRenderOptions, RunMigrationListInputs, createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
|
|
69
78
|
//# sourceMappingURL=migration-list.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-list.d.mts","names":[],"sources":["../../src/commands/migration-list.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration-list.d.mts","names":[],"sources":["../../src/commands/migration-list.ts"],"mappings":";;;;;;;;;;AAmEA;;;;;;;;AAAA,iBAAgB,sBAAA,CACd,MAAA,EAAQ,mBAAA,GACP,WAAW;AA4Bd;;;;;;;;AAAA,iBAAsB,sCAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,uBAAA;AAAA,UA6BV,oBAAA,SAA6B,oBAAoB;EAAA,SAChD,MAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,0BAAA;EAAA,SACN,IAAA,EAAM,mBAAA;EAAA,SACN,gBAAA;EAAA,SACA,SAAA,EAAW,sBAAsB;AAAA;AAAA,UAG3B,+BAAA;EAAA,SACN,SAAA,EAAW,SAAA;EAAA,SACX,QAAA;EAAA,SACA,gBAAA;EAAA,SACA,aAAA,GAAgB,OAAA,aAAoB,cAAc;AAAA;AAAA,iBAG7C,8BAAA,CACd,MAAA,EAAQ,mBAAA,EACR,OAAA,EAAS,+BAA+B;;;;;;;;;UAkBzB,sBAAA;EAAA,SACN,MAAA,WAAiB,uBAAuB;EAAA,SACxC,WAAA;AAAA;;;;;;;;;;iBAoBK,gBAAA,CACd,MAAA,EAAQ,sBAAA,GACP,MAAA,CAAO,mBAAA,EAAqB,kBAAA;AA/C8B;AAG7D;;;;AAH6D,iBA4EvC,2BAAA,CACpB,OAAA,EAAS,oBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,0BAAA,EAA4B,kBAAA;AAAA,iBAiD9B,0BAAA,CAAA,GAA8B,OAAO"}
|
|
@@ -1,188 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { A as formatStyledHeader, G as errorInvalidSpaceId, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, rt as errorSpaceNotFound, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-D7TK5Y9e.mjs";
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-5zmOENc4.mjs";
|
|
4
|
-
import { a as renderMigrationListWithStyle, r as createAnsiMigrationListStyler } from "../migration-graph-tree-render-CVmV9sWr.mjs";
|
|
5
|
-
import { Command } from "commander";
|
|
6
|
-
import { ifDefined } from "@prisma-next/utils/defined";
|
|
7
|
-
import { notOk, ok } from "@prisma-next/utils/result";
|
|
8
|
-
import { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, isValidSpaceId, listContractSpaceDirectories } from "@prisma-next/migration-tools/spaces";
|
|
9
|
-
import { HEAD_REF_NAME, refsByContractHash } from "@prisma-next/migration-tools/refs";
|
|
10
|
-
//#region src/commands/migration-list.ts
|
|
11
|
-
function compareSpaceIds(a, b) {
|
|
12
|
-
if (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;
|
|
13
|
-
if (b === APP_SPACE_ID) return 1;
|
|
14
|
-
if (a < b) return -1;
|
|
15
|
-
if (a > b) return 1;
|
|
16
|
-
return 0;
|
|
17
|
-
}
|
|
18
|
-
function compareDirNamesDescending(a, b) {
|
|
19
|
-
if (a.dirName < b.dirName) return 1;
|
|
20
|
-
if (a.dirName > b.dirName) return -1;
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Ref names decorating a space's destination contract hashes. The
|
|
25
|
-
* tolerant `member.refs` deliberately omits the structural `head.json`;
|
|
26
|
-
* for extension spaces the old enumerator surfaced it as a `head`
|
|
27
|
-
* decoration on the tip migration, so fold `member.headRef` back in to
|
|
28
|
-
* keep that output. The app space synthesises its head, so it carries
|
|
29
|
-
* no on-disk `head` ref to restore.
|
|
30
|
-
*/
|
|
31
|
-
function listRefsByContractHash(member) {
|
|
32
|
-
const byHash = new Map(refsByContractHash(member.refs));
|
|
33
|
-
if (member.spaceId !== APP_SPACE_ID && member.headRef !== null) {
|
|
34
|
-
const hash = member.headRef.hash;
|
|
35
|
-
const bucket = byHash.get(hash) ?? [];
|
|
36
|
-
if (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());
|
|
37
|
-
}
|
|
38
|
-
return byHash;
|
|
39
|
-
}
|
|
40
|
-
async function orderedOnDiskSpaceIds(projectMigrationsDir) {
|
|
41
|
-
return (await listContractSpaceDirectories(projectMigrationsDir)).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).filter(isValidSpaceId).sort(compareSpaceIds);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Project the loaded {@link ContractSpaceAggregate} into the render-ready
|
|
45
|
-
* {@link MigrationSpaceListEntry} rows `migration list` displays.
|
|
46
|
-
*
|
|
47
|
-
* Space membership matches the on-disk contract-space directories (not the
|
|
48
|
-
* aggregate's always-present synthesized app member when `migrations/app/`
|
|
49
|
-
* is absent); package and ref data come from `aggregate.space(id)`.
|
|
50
|
-
*/
|
|
51
|
-
async function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {
|
|
52
|
-
const spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);
|
|
53
|
-
const spaces = [];
|
|
54
|
-
for (const spaceId of spaceIds) {
|
|
55
|
-
const member = aggregate.space(spaceId);
|
|
56
|
-
if (member === void 0) continue;
|
|
57
|
-
const refsByHash = listRefsByContractHash(member);
|
|
58
|
-
const migrations = member.packages.map((pkg) => ({
|
|
59
|
-
dirName: pkg.dirName,
|
|
60
|
-
from: pkg.metadata.from,
|
|
61
|
-
to: pkg.metadata.to,
|
|
62
|
-
migrationHash: pkg.metadata.migrationHash,
|
|
63
|
-
operationCount: pkg.ops.length,
|
|
64
|
-
createdAt: pkg.metadata.createdAt,
|
|
65
|
-
refs: refsByHash.get(pkg.metadata.to) ?? [],
|
|
66
|
-
providedInvariants: pkg.metadata.providedInvariants
|
|
67
|
-
})).sort(compareDirNamesDescending);
|
|
68
|
-
spaces.push({
|
|
69
|
-
spaceId,
|
|
70
|
-
migrations
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return spaces;
|
|
74
|
-
}
|
|
75
|
-
function renderMigrationListHumanOutput(result, options) {
|
|
76
|
-
return renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, { colorize: options.useColor });
|
|
77
|
-
}
|
|
78
|
-
function computeSummary(spaces) {
|
|
79
|
-
const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
|
|
80
|
-
if (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;
|
|
81
|
-
return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Policy core of `migration list`: validates `--space`, narrows the
|
|
85
|
-
* pre-enumerated spaces, and assembles a {@link MigrationListResult}.
|
|
86
|
-
*
|
|
87
|
-
* - `migrations/` missing or contains no valid space directories →
|
|
88
|
-
* caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.
|
|
89
|
-
* - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.
|
|
90
|
-
* - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.
|
|
91
|
-
*/
|
|
92
|
-
function runMigrationList(inputs) {
|
|
93
|
-
const { spaces, spaceFilter } = inputs;
|
|
94
|
-
if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
|
|
95
|
-
if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));
|
|
96
|
-
const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
|
|
97
|
-
const resultSpaces = scopedSpaces.length === 0 ? [{
|
|
98
|
-
spaceId: APP_SPACE_ID,
|
|
99
|
-
migrations: []
|
|
100
|
-
}] : scopedSpaces;
|
|
101
|
-
return ok({
|
|
102
|
-
ok: true,
|
|
103
|
-
spaces: resultSpaces,
|
|
104
|
-
summary: computeSummary(resultSpaces)
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* CLI shell: loads config, resolves paths, prints the styled header on
|
|
109
|
-
* stderr (interactive mode only), and delegates to {@link runMigrationList}.
|
|
110
|
-
* Kept intentionally thin so the unit-testable surface lives in the core.
|
|
111
|
-
*/
|
|
112
|
-
async function executeMigrationListCommand(options, flags, ui) {
|
|
113
|
-
const config = await loadConfig(options.config);
|
|
114
|
-
const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);
|
|
115
|
-
if (!flags.json && !flags.quiet) {
|
|
116
|
-
const header = formatStyledHeader({
|
|
117
|
-
command: "migration list",
|
|
118
|
-
description: "List on-disk migrations per contract space",
|
|
119
|
-
details: [
|
|
120
|
-
{
|
|
121
|
-
label: "config",
|
|
122
|
-
value: configPath
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: "migrations",
|
|
126
|
-
value: migrationsRelative
|
|
127
|
-
},
|
|
128
|
-
...options.space !== void 0 ? [{
|
|
129
|
-
label: "space",
|
|
130
|
-
value: options.space
|
|
131
|
-
}] : []
|
|
132
|
-
],
|
|
133
|
-
flags
|
|
134
|
-
});
|
|
135
|
-
ui.stderr(header);
|
|
136
|
-
}
|
|
137
|
-
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
138
|
-
if (!loaded.ok) return notOk(loaded.failure);
|
|
139
|
-
return runMigrationList({
|
|
140
|
-
spaces: await migrationSpaceListEntriesFromAggregate(loaded.value.aggregate, migrationsDir),
|
|
141
|
-
...ifDefined("spaceFilter", options.space)
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function createMigrationListCommand() {
|
|
145
|
-
const command = new Command("list");
|
|
146
|
-
setCommandDescriptions(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).");
|
|
147
|
-
setCommandExamples(command, [
|
|
148
|
-
"prisma-next migration list",
|
|
149
|
-
"prisma-next migration list --space app",
|
|
150
|
-
"prisma-next migration list --ascii",
|
|
151
|
-
"prisma-next migration list --json"
|
|
152
|
-
]);
|
|
153
|
-
setCommandSeeAlso(command, [
|
|
154
|
-
{
|
|
155
|
-
verb: "migration status",
|
|
156
|
-
oneLiner: "Show migration path and pending status"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
verb: "migration log",
|
|
160
|
-
oneLiner: "Show executed migration history"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
verb: "migration graph",
|
|
164
|
-
oneLiner: "Show the migration graph topology"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
verb: "migration show",
|
|
168
|
-
oneLiner: "Display migration package contents"
|
|
169
|
-
}
|
|
170
|
-
]);
|
|
171
|
-
addGlobalOptions(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)").action(async (options) => {
|
|
172
|
-
const flags = parseGlobalFlagsOrExit(options);
|
|
173
|
-
const ui = createTerminalUI(flags);
|
|
174
|
-
const exitCode = handleResult(await executeMigrationListCommand(options, flags, ui), flags, ui, (listResult) => {
|
|
175
|
-
if (flags.json) ui.output(JSON.stringify(listResult, null, 2));
|
|
176
|
-
else if (!flags.quiet) ui.output(renderMigrationListHumanOutput(listResult, {
|
|
177
|
-
glyphMode: ui.resolveGlyphMode(options.ascii === true),
|
|
178
|
-
useColor: ui.useColor
|
|
179
|
-
}));
|
|
180
|
-
});
|
|
181
|
-
process.exit(exitCode);
|
|
182
|
-
});
|
|
183
|
-
return command;
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
1
|
+
import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-C5sXrl0U.mjs";
|
|
186
2
|
export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
|
|
187
|
-
|
|
188
|
-
//# sourceMappingURL=migration-list.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as CliStructuredError } from "../types-
|
|
2
|
-
import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-
|
|
1
|
+
import { N as CliStructuredError } from "../types-Mh7mdPHM.mjs";
|
|
2
|
+
import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DG4uY5tV.mjs";
|
|
3
3
|
import { t as TerminalUI } from "../terminal-ui-5Y6mrg93.mjs";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { Result } from "@prisma-next/utils/result";
|
|
@@ -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-DD_vCbYW.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,
|
|
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-DK_5ItoJ.mjs";
|
|
3
|
+
import { t as assertFrameworkComponentsCompatible } from "../framework-components-CxOVKAAh.mjs";
|
|
4
|
+
import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-Dbr3-jHF.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,4 +1,4 @@
|
|
|
1
|
-
import { n as GlobalFlags } from "../global-flags-
|
|
1
|
+
import { n as GlobalFlags } from "../global-flags-DG4uY5tV.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { Result } from "@prisma-next/utils/result";
|
|
4
4
|
import { OperationPreview } from "@prisma-next/framework-components/control";
|
|
@@ -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-CeTjQOIG.mjs";
|
|
2
2
|
export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as CliStructuredError } from "../types-
|
|
1
|
+
import { N as CliStructuredError } from "../types-Mh7mdPHM.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { Result } from "@prisma-next/utils/result";
|
|
4
4
|
import { OperationPreview } from "@prisma-next/framework-components/control";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { A as formatStyledHeader, E as formatMigrationShowOutput, U as errorFileNotFound, _ as createTerminalUI,
|
|
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-DK_5ItoJ.mjs";
|
|
3
|
+
import { t as createControlClient } from "../client-xeWpMlq1.mjs";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import { n as StatusRef, t as StatusDiagnostic } from "../migration-types-D2FW63pr.mjs";
|
|
2
1
|
import { t as MigrationListEntry } from "../migration-list-types-DS63IdFd.mjs";
|
|
3
2
|
import { Command } from "commander";
|
|
4
3
|
|
|
4
|
+
//#region src/utils/migration-types.d.ts
|
|
5
|
+
interface StatusRef {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly hash: string;
|
|
8
|
+
readonly active: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface StatusDiagnostic {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly severity: 'warn' | 'info';
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly hints: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
5
17
|
//#region src/commands/migration-status.d.ts
|
|
6
18
|
interface MigrationStatusMigrationEntry extends MigrationListEntry {
|
|
7
19
|
readonly status: 'applied' | 'pending' | null;
|
|
@@ -25,6 +37,12 @@ interface MigrationStatusTreeSection {
|
|
|
25
37
|
readonly tree: string;
|
|
26
38
|
readonly showHeading: boolean;
|
|
27
39
|
}
|
|
40
|
+
declare function buildNoPathSummary(args: {
|
|
41
|
+
readonly markerHash: string | undefined;
|
|
42
|
+
readonly targetHash: string;
|
|
43
|
+
readonly explicitTarget: boolean;
|
|
44
|
+
readonly refName: string | undefined;
|
|
45
|
+
}): string;
|
|
28
46
|
declare function buildStatusHeadline(args: {
|
|
29
47
|
readonly pendingCount: number;
|
|
30
48
|
readonly targetHash: string;
|
|
@@ -35,5 +53,5 @@ declare function formatStatusSummary(result: MigrationStatusResult, colorize: bo
|
|
|
35
53
|
declare function formatStatusHumanOutput(result: MigrationStatusResult, colorize: boolean): string;
|
|
36
54
|
declare function createMigrationStatusCommand(): Command;
|
|
37
55
|
//#endregion
|
|
38
|
-
export { MigrationStatusMigrationEntry, MigrationStatusResult, MigrationStatusSpaceResult, MigrationStatusTreeSection, type StatusDiagnostic, type StatusRef, buildStatusHeadline, createMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary };
|
|
56
|
+
export { MigrationStatusMigrationEntry, MigrationStatusResult, MigrationStatusSpaceResult, MigrationStatusTreeSection, type StatusDiagnostic, type StatusRef, buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary };
|
|
39
57
|
//# sourceMappingURL=migration-status.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/commands/migration-status.ts"],"mappings":"
|
|
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;;;UCsEM,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,iBAoZvD,4BAAA,CAAA,GAAgC,OAAO"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
export { buildStatusHeadline, createMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary };
|
|
1
|
+
import { a as formatStatusSummary, i as formatStatusHumanOutput, n as buildStatusHeadline, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-qV8ctwPy.mjs";
|
|
2
|
+
export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary };
|
package/dist/commands/ref.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as CliStructuredError } from "../types-
|
|
1
|
+
import { N as CliStructuredError } from "../types-Mh7mdPHM.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { Result } from "@prisma-next/utils/result";
|
|
4
4
|
import { RefEntry } from "@prisma-next/migration-tools/refs";
|
package/dist/commands/ref.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
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-DK_5ItoJ.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-Dbr3-jHF.mjs";
|
|
4
4
|
import { i as readContractIR } from "../ref-advancement-V1o-9LVK.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createTelemetryCommand } from "../../telemetry-
|
|
1
|
+
import { t as createTelemetryCommand } from "../../telemetry-S-NGi9U6.mjs";
|
|
2
2
|
export { createTelemetryCommand };
|