prisma-next 0.12.0-dev.5 → 0.12.0-dev.51

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.
Files changed (127) hide show
  1. package/dist/cli.mjs +180 -163
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/{client-KgJorIvG.mjs → client-DC-UlBLy.mjs} +83 -58
  4. package/dist/client-DC-UlBLy.mjs.map +1 -0
  5. package/dist/{command-helpers-Bbw1GbwL.mjs → command-helpers-esJGBD4W.mjs} +317 -23
  6. package/dist/command-helpers-esJGBD4W.mjs.map +1 -0
  7. package/dist/commands/contract-emit.mjs +1 -1
  8. package/dist/commands/contract-infer.mjs +1 -1
  9. package/dist/commands/db-init.mjs +4 -5
  10. package/dist/commands/db-init.mjs.map +1 -1
  11. package/dist/commands/db-schema.mjs +3 -3
  12. package/dist/commands/db-sign.mjs +4 -4
  13. package/dist/commands/db-update.d.mts.map +1 -1
  14. package/dist/commands/db-update.mjs +10 -7
  15. package/dist/commands/db-update.mjs.map +1 -1
  16. package/dist/commands/db-verify.mjs +1 -1
  17. package/dist/commands/migrate.d.mts +2 -2
  18. package/dist/commands/migrate.d.mts.map +1 -1
  19. package/dist/commands/migrate.mjs +6 -8
  20. package/dist/commands/migrate.mjs.map +1 -1
  21. package/dist/commands/migration-check.d.mts +55 -13
  22. package/dist/commands/migration-check.d.mts.map +1 -1
  23. package/dist/commands/migration-check.mjs +3 -2
  24. package/dist/commands/migration-graph.d.mts +17 -8
  25. package/dist/commands/migration-graph.d.mts.map +1 -1
  26. package/dist/commands/migration-graph.mjs +183 -2
  27. package/dist/commands/migration-graph.mjs.map +1 -0
  28. package/dist/commands/migration-list.d.mts +25 -27
  29. package/dist/commands/migration-list.d.mts.map +1 -1
  30. package/dist/commands/migration-list.mjs +2 -190
  31. package/dist/commands/migration-log.d.mts +9 -19
  32. package/dist/commands/migration-log.d.mts.map +1 -1
  33. package/dist/commands/migration-log.mjs +1 -137
  34. package/dist/commands/migration-new.mjs +3 -3
  35. package/dist/commands/migration-plan.d.mts +1 -1
  36. package/dist/commands/migration-plan.mjs +1 -1
  37. package/dist/commands/migration-show.d.mts +17 -21
  38. package/dist/commands/migration-show.d.mts.map +1 -1
  39. package/dist/commands/migration-show.mjs +23 -35
  40. package/dist/commands/migration-show.mjs.map +1 -1
  41. package/dist/commands/migration-status.d.mts +42 -144
  42. package/dist/commands/migration-status.d.mts.map +1 -1
  43. package/dist/commands/migration-status.mjs +3 -759
  44. package/dist/commands/ref.d.mts +1 -1
  45. package/dist/commands/ref.mjs +3 -3
  46. package/dist/commands/telemetry/index.d.mts +7 -0
  47. package/dist/commands/telemetry/index.d.mts.map +1 -0
  48. package/dist/commands/telemetry/index.mjs +2 -0
  49. package/dist/{contract-at-errors-BxP-TOMl.mjs → contract-at-errors-COZAemUl.mjs} +2 -2
  50. package/dist/{contract-at-errors-BxP-TOMl.mjs.map → contract-at-errors-COZAemUl.mjs.map} +1 -1
  51. package/dist/{contract-emit-DxcGl4Uq.mjs → contract-emit-Bv46RAIO.mjs} +3 -3
  52. package/dist/{contract-emit-DxcGl4Uq.mjs.map → contract-emit-Bv46RAIO.mjs.map} +1 -1
  53. package/dist/{contract-emit-D-4jrNve.mjs → contract-emit-DIWImLqS.mjs} +5 -5
  54. package/dist/{contract-emit-D-4jrNve.mjs.map → contract-emit-DIWImLqS.mjs.map} +1 -1
  55. package/dist/{contract-infer-D8uEbJuu.mjs → contract-infer-DpGN9SAj.mjs} +3 -3
  56. package/dist/{contract-infer-D8uEbJuu.mjs.map → contract-infer-DpGN9SAj.mjs.map} +1 -1
  57. package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs → contract-space-aggregate-loader-CpNVrBqW.mjs} +63 -5
  58. package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs.map → contract-space-aggregate-loader-CpNVrBqW.mjs.map} +1 -1
  59. package/dist/{db-verify-v_vUKXTU.mjs → db-verify-Cq16Obsw.mjs} +4 -4
  60. package/dist/{db-verify-v_vUKXTU.mjs.map → db-verify-Cq16Obsw.mjs.map} +1 -1
  61. package/dist/exports/control-api.d.mts +2 -2
  62. package/dist/exports/control-api.d.mts.map +1 -1
  63. package/dist/exports/control-api.mjs +2 -2
  64. package/dist/exports/index.mjs +1 -1
  65. package/dist/exports/init-output.mjs +1 -1
  66. package/dist/{framework-components-fYXjz_in.mjs → framework-components-BO9VO43s.mjs} +2 -2
  67. package/dist/{framework-components-fYXjz_in.mjs.map → framework-components-BO9VO43s.mjs.map} +1 -1
  68. package/dist/{global-flags-DEHjV8_s.d.mts → global-flags-CV5LhrFg.d.mts} +1 -1
  69. package/dist/{global-flags-DEHjV8_s.d.mts.map → global-flags-CV5LhrFg.d.mts.map} +1 -1
  70. package/dist/{init-Cv9UzWL5.mjs → init-C0rjiQ9I.mjs} +5 -58
  71. package/dist/init-C0rjiQ9I.mjs.map +1 -0
  72. package/dist/{inspect-live-schema-C6ohV_oQ.mjs → inspect-live-schema-CRDKTNcf.mjs} +3 -3
  73. package/dist/{inspect-live-schema-C6ohV_oQ.mjs.map → inspect-live-schema-CRDKTNcf.mjs.map} +1 -1
  74. package/dist/migration-check-BxWlQBOs.mjs +573 -0
  75. package/dist/migration-check-BxWlQBOs.mjs.map +1 -0
  76. package/dist/{migration-command-scaffold-CjvwO6at.mjs → migration-command-scaffold-BDd9abqW.mjs} +3 -3
  77. package/dist/{migration-command-scaffold-CjvwO6at.mjs.map → migration-command-scaffold-BDd9abqW.mjs.map} +1 -1
  78. package/dist/migration-graph-space-render-CeNXh_Wy.mjs +1966 -0
  79. package/dist/migration-graph-space-render-CeNXh_Wy.mjs.map +1 -0
  80. package/dist/migration-list-vJWFuXca.mjs +228 -0
  81. package/dist/migration-list-vJWFuXca.mjs.map +1 -0
  82. package/dist/migration-log-6rcHQSI4.mjs +222 -0
  83. package/dist/migration-log-6rcHQSI4.mjs.map +1 -0
  84. package/dist/migration-path-target-UkxkgXnv.mjs +38 -0
  85. package/dist/migration-path-target-UkxkgXnv.mjs.map +1 -0
  86. package/dist/{migration-plan-9DJ7q7_z.mjs → migration-plan-CHu_erQ5.mjs} +5 -6
  87. package/dist/{migration-plan-9DJ7q7_z.mjs.map → migration-plan-CHu_erQ5.mjs.map} +1 -1
  88. package/dist/migration-status-Bjv91dE7.mjs +444 -0
  89. package/dist/migration-status-Bjv91dE7.mjs.map +1 -0
  90. package/dist/{output-B60Gw5fu.mjs → output-BD61elic.mjs} +1 -1
  91. package/dist/{output-B60Gw5fu.mjs.map → output-BD61elic.mjs.map} +1 -1
  92. package/dist/{ref-advancement-DUZqsue6.mjs → ref-advancement-CJY9zOv7.mjs} +1 -1
  93. package/dist/{ref-advancement-DUZqsue6.mjs.map → ref-advancement-CJY9zOv7.mjs.map} +1 -1
  94. package/dist/schemas-BL33A3i-.d.mts +193 -0
  95. package/dist/schemas-BL33A3i-.d.mts.map +1 -0
  96. package/dist/schemas-DJY2O09F.mjs +112 -0
  97. package/dist/schemas-DJY2O09F.mjs.map +1 -0
  98. package/dist/telemetry-CZkgkR_O.mjs +122 -0
  99. package/dist/telemetry-CZkgkR_O.mjs.map +1 -0
  100. package/dist/{terminal-ui-5Y6mrg93.d.mts → terminal-ui-BgLiAOYi.d.mts} +1 -1
  101. package/dist/{terminal-ui-5Y6mrg93.d.mts.map → terminal-ui-BgLiAOYi.d.mts.map} +1 -1
  102. package/dist/{types-Dt_SfqFm.d.mts → types-qV41eEXH.d.mts} +44 -31
  103. package/dist/types-qV41eEXH.d.mts.map +1 -0
  104. package/dist/{verify-DCA9Sldu.mjs → verify-IilvIk_E.mjs} +2 -2
  105. package/dist/{verify-DCA9Sldu.mjs.map → verify-IilvIk_E.mjs.map} +1 -1
  106. package/package.json +11 -12
  107. package/dist/client-KgJorIvG.mjs.map +0 -1
  108. package/dist/command-helpers-Bbw1GbwL.mjs.map +0 -1
  109. package/dist/commands/migration-list.mjs.map +0 -1
  110. package/dist/commands/migration-log.mjs.map +0 -1
  111. package/dist/commands/migration-status.mjs.map +0 -1
  112. package/dist/extension-pack-inputs-IDvjRCi3.mjs +0 -62
  113. package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +0 -1
  114. package/dist/graph-render-rFAqZujX.mjs +0 -1081
  115. package/dist/graph-render-rFAqZujX.mjs.map +0 -1
  116. package/dist/init-Cv9UzWL5.mjs.map +0 -1
  117. package/dist/migration-check-BiBJoYYW.mjs +0 -341
  118. package/dist/migration-check-BiBJoYYW.mjs.map +0 -1
  119. package/dist/migration-graph-D7DVUElV.mjs +0 -1232
  120. package/dist/migration-graph-D7DVUElV.mjs.map +0 -1
  121. package/dist/migration-list-styler-BRwF4-gy.mjs +0 -399
  122. package/dist/migration-list-styler-BRwF4-gy.mjs.map +0 -1
  123. package/dist/migration-types-D2FW63pr.d.mts +0 -15
  124. package/dist/migration-types-D2FW63pr.d.mts.map +0 -1
  125. package/dist/migrations-Cv2jxNNK.mjs +0 -228
  126. package/dist/migrations-Cv2jxNNK.mjs.map +0 -1
  127. package/dist/types-Dt_SfqFm.d.mts.map +0 -1
@@ -0,0 +1,228 @@
1
+ import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
2
+ import { A as formatStyledHeader, K as errorInvalidSpaceId, _ as createTerminalUI, at as errorSpaceNotFound, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, q as errorLegendHumanOnly, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-esJGBD4W.mjs";
3
+ import { n as buildReadAggregate } from "./contract-space-aggregate-loader-CpNVrBqW.mjs";
4
+ import { a as renderMigrationGraphLegend, c as renderMigrationListWithStyle, o as createAnsiMigrationListStyler } from "./migration-graph-space-render-CeNXh_Wy.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/utils/legend.ts
11
+ /**
12
+ * The legend is decoration printed alongside the command header on stderr, so
13
+ * it is suppressed for the machine-readable / silent paths (`--json`, `--dot`,
14
+ * `--quiet`) exactly as the header is.
15
+ */
16
+ function shouldShowLegend(options, flags) {
17
+ return options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true;
18
+ }
19
+ function validateLegendOptions(options, flags) {
20
+ if (options.legend !== true) return ok(void 0);
21
+ if (flags.json === true) return notOk(errorLegendHumanOnly("--json"));
22
+ if (flags.quiet === true) return notOk(errorLegendHumanOnly("--quiet"));
23
+ if (options.dot === true) return notOk(errorLegendHumanOnly("--dot"));
24
+ return ok(void 0);
25
+ }
26
+ //#endregion
27
+ //#region src/commands/migration-list.ts
28
+ function compareSpaceIds(a, b) {
29
+ if (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;
30
+ if (b === APP_SPACE_ID) return 1;
31
+ if (a < b) return -1;
32
+ if (a > b) return 1;
33
+ return 0;
34
+ }
35
+ function compareDirNamesDescending(a, b) {
36
+ if (a.name < b.name) return 1;
37
+ if (a.name > b.name) return -1;
38
+ return 0;
39
+ }
40
+ /**
41
+ * Ref names decorating a space's destination contract hashes. The
42
+ * tolerant `member.refs` deliberately omits the structural `head.json`;
43
+ * for extension spaces the old enumerator surfaced it as a `head`
44
+ * decoration on the tip migration, so fold `member.headRef` back in to
45
+ * keep that output. The app space synthesises its head, so it carries
46
+ * no on-disk `head` ref to restore.
47
+ */
48
+ function listRefsByContractHash(member) {
49
+ const byHash = new Map(refsByContractHash(member.refs));
50
+ if (member.spaceId !== APP_SPACE_ID && member.headRef !== null) {
51
+ const hash = member.headRef.hash;
52
+ const bucket = byHash.get(hash) ?? [];
53
+ if (!bucket.includes(HEAD_REF_NAME)) byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());
54
+ }
55
+ return byHash;
56
+ }
57
+ async function orderedOnDiskSpaceIds(projectMigrationsDir) {
58
+ return (await listContractSpaceDirectories(projectMigrationsDir)).filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).filter(isValidSpaceId).sort(compareSpaceIds);
59
+ }
60
+ /**
61
+ * Project the loaded {@link ContractSpaceAggregate} into the render-ready
62
+ * {@link MigrationSpaceListEntry} rows `migration list` displays.
63
+ *
64
+ * Space membership matches the on-disk contract-space directories (not the
65
+ * aggregate's always-present synthesized app member when `migrations/app/`
66
+ * is absent); package and ref data come from `aggregate.space(id)`.
67
+ */
68
+ async function migrationSpaceListEntriesFromAggregate(aggregate, projectMigrationsDir) {
69
+ const spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);
70
+ const spaces = [];
71
+ for (const spaceId of spaceIds) {
72
+ const member = aggregate.space(spaceId);
73
+ if (member === void 0) continue;
74
+ const refsByHash = listRefsByContractHash(member);
75
+ const migrations = member.packages.map((pkg) => ({
76
+ name: pkg.dirName,
77
+ hash: pkg.metadata.migrationHash,
78
+ fromContract: pkg.metadata.from,
79
+ toContract: pkg.metadata.to,
80
+ operationCount: pkg.ops.length,
81
+ createdAt: pkg.metadata.createdAt,
82
+ refs: [...refsByHash.get(pkg.metadata.to) ?? []],
83
+ providedInvariants: [...pkg.metadata.providedInvariants]
84
+ })).sort(compareDirNamesDescending);
85
+ spaces.push({
86
+ space: spaceId,
87
+ migrations
88
+ });
89
+ }
90
+ return spaces;
91
+ }
92
+ function renderMigrationListHumanOutput(result, options) {
93
+ return renderMigrationListWithStyle(result, createAnsiMigrationListStyler({ useColor: options.useColor }), options.glyphMode, {
94
+ colorize: options.useColor,
95
+ liveContractHash: options.liveContractHash,
96
+ graphForSpace: options.graphForSpace
97
+ });
98
+ }
99
+ function computeSummary(spaces) {
100
+ const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
101
+ if (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;
102
+ return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;
103
+ }
104
+ /**
105
+ * Policy core of `migration list`: validates `--space`, narrows the
106
+ * pre-enumerated spaces, and assembles a {@link MigrationListResult}.
107
+ *
108
+ * - `migrations/` missing or contains no valid space directories →
109
+ * caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.
110
+ * - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.
111
+ * - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.
112
+ */
113
+ function runMigrationList(inputs) {
114
+ const { spaces, spaceFilter } = inputs;
115
+ if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
116
+ if (spaceFilter !== void 0 && !spaces.some((s) => s.space === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));
117
+ const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.space === spaceFilter) : spaces;
118
+ const resultSpaces = scopedSpaces.length === 0 ? [{
119
+ space: APP_SPACE_ID,
120
+ migrations: []
121
+ }] : scopedSpaces;
122
+ return ok({
123
+ ok: true,
124
+ spaces: [...resultSpaces],
125
+ summary: computeSummary(resultSpaces)
126
+ });
127
+ }
128
+ /**
129
+ * CLI shell: loads config, resolves paths, prints the styled header on
130
+ * stderr (interactive mode only), and delegates to {@link runMigrationList}.
131
+ * Kept intentionally thin so the unit-testable surface lives in the core.
132
+ */
133
+ async function executeMigrationListCommand(options, flags, ui) {
134
+ const config = await loadConfig(options.config);
135
+ const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);
136
+ if (!flags.json && !flags.quiet) {
137
+ const header = formatStyledHeader({
138
+ command: "migration list",
139
+ description: "List on-disk migrations per contract space",
140
+ details: [
141
+ {
142
+ label: "config",
143
+ value: configPath
144
+ },
145
+ {
146
+ label: "migrations",
147
+ value: migrationsRelative
148
+ },
149
+ ...options.space !== void 0 ? [{
150
+ label: "space",
151
+ value: options.space
152
+ }] : []
153
+ ],
154
+ flags
155
+ });
156
+ ui.stderr(header);
157
+ if (shouldShowLegend(options, flags)) {
158
+ ui.stderr(renderMigrationGraphLegend({
159
+ colorize: flags.color !== false,
160
+ glyphMode: ui.resolveGlyphMode(options.ascii === true)
161
+ }));
162
+ ui.stderr("");
163
+ }
164
+ }
165
+ const loaded = await buildReadAggregate(config, { migrationsDir });
166
+ if (!loaded.ok) return notOk(loaded.failure);
167
+ const { aggregate, contractHash: liveContractHash } = loaded.value;
168
+ const listResult = runMigrationList({
169
+ spaces: await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir),
170
+ ...ifDefined("spaceFilter", options.space)
171
+ });
172
+ if (!listResult.ok) return listResult;
173
+ return ok({
174
+ list: listResult.value,
175
+ liveContractHash,
176
+ aggregate
177
+ });
178
+ }
179
+ function createMigrationListCommand() {
180
+ const command = new Command("list");
181
+ 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).");
182
+ setCommandExamples(command, [
183
+ "prisma-next migration list",
184
+ "prisma-next migration list --space app",
185
+ "prisma-next migration list --ascii",
186
+ "prisma-next migration list --legend",
187
+ "prisma-next migration list --json"
188
+ ]);
189
+ setCommandSeeAlso(command, [
190
+ {
191
+ verb: "migration status",
192
+ oneLiner: "Show migration path and pending status"
193
+ },
194
+ {
195
+ verb: "migration log",
196
+ oneLiner: "Show executed migration history"
197
+ },
198
+ {
199
+ verb: "migration graph",
200
+ oneLiner: "Show the migration graph topology"
201
+ },
202
+ {
203
+ verb: "migration show",
204
+ oneLiner: "Display migration package contents"
205
+ }
206
+ ]);
207
+ 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)").option("--legend", "Print a key for the tree glyphs and lane colors").action(async (options) => {
208
+ const flags = parseGlobalFlagsOrExit(options);
209
+ const ui = createTerminalUI(flags);
210
+ const legendValidation = validateLegendOptions(options, flags);
211
+ if (!legendValidation.ok) process.exit(handleResult(legendValidation, flags, ui));
212
+ const exitCode = handleResult(await executeMigrationListCommand(options, flags, ui), flags, ui, ({ list, liveContractHash, aggregate }) => {
213
+ if (flags.json) ui.output(JSON.stringify(list, null, 2));
214
+ else if (!flags.quiet) ui.output(renderMigrationListHumanOutput(list, {
215
+ glyphMode: ui.resolveGlyphMode(options.ascii === true),
216
+ useColor: ui.useColor,
217
+ liveContractHash,
218
+ graphForSpace: (spaceId) => aggregate.space(spaceId)?.graph()
219
+ }));
220
+ });
221
+ process.exit(exitCode);
222
+ });
223
+ return command;
224
+ }
225
+ //#endregion
226
+ export { renderMigrationListHumanOutput as a, validateLegendOptions as c, migrationSpaceListEntriesFromAggregate as i, executeMigrationListCommand as n, runMigrationList as o, listRefsByContractHash as r, shouldShowLegend as s, createMigrationListCommand as t };
227
+
228
+ //# sourceMappingURL=migration-list-vJWFuXca.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-list-vJWFuXca.mjs","names":[],"sources":["../src/utils/legend.ts","../src/commands/migration-list.ts"],"sourcesContent":["import { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { type CliStructuredError, errorLegendHumanOnly } from './cli-errors';\nimport type { GlobalFlags } from './global-flags';\n\nexport interface LegendCliOptions {\n readonly legend?: boolean;\n readonly dot?: 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 shouldShowLegend(options: LegendCliOptions, flags: GlobalFlags): boolean {\n return (\n options.legend === true && options.dot !== true && flags.json !== true && flags.quiet !== true\n );\n}\n\nexport function validateLegendOptions(\n options: LegendCliOptions,\n flags: GlobalFlags,\n): Result<void, CliStructuredError> {\n if (options.legend !== true) {\n return ok(undefined);\n }\n if (flags.json === true) {\n return notOk(errorLegendHumanOnly('--json'));\n }\n if (flags.quiet === true) {\n return notOk(errorLegendHumanOnly('--quiet'));\n }\n if (options.dot === true) {\n return notOk(errorLegendHumanOnly('--dot'));\n }\n return ok(undefined);\n}\n","import type {\n ContractSpaceAggregate,\n ContractSpaceMember,\n} from '@prisma-next/migration-tools/aggregate';\nimport type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { HEAD_REF_NAME, refsByContractHash } from '@prisma-next/migration-tools/refs';\nimport {\n APP_SPACE_ID,\n isValidSpaceId,\n listContractSpaceDirectories,\n RESERVED_SPACE_SUBDIR_NAMES,\n} from '@prisma-next/migration-tools/spaces';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport {\n type CliStructuredError,\n errorInvalidSpaceId,\n errorSpaceNotFound,\n} 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 { renderMigrationGraphLegend } from '../utils/formatters/migration-graph-tree-render';\nimport { renderMigrationListWithStyle } from '../utils/formatters/migration-list-render';\nimport { createAnsiMigrationListStyler } from '../utils/formatters/migration-list-styler';\nimport type {\n MigrationListEntry,\n MigrationListResult,\n MigrationSpaceListEntry,\n} from '../utils/formatters/migration-list-types';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport type { GlyphMode } from '../utils/glyph-mode';\nimport { shouldShowLegend, validateLegendOptions } from '../utils/legend';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\nfunction compareSpaceIds(a: string, b: string): number {\n if (a === APP_SPACE_ID) return b === APP_SPACE_ID ? 0 : -1;\n if (b === APP_SPACE_ID) return 1;\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n}\n\nfunction compareDirNamesDescending(a: MigrationListEntry, b: MigrationListEntry): number {\n if (a.name < b.name) return 1;\n if (a.name > b.name) return -1;\n return 0;\n}\n\n/**\n * Ref names decorating a space's destination contract hashes. The\n * tolerant `member.refs` deliberately omits the structural `head.json`;\n * for extension spaces the old enumerator surfaced it as a `head`\n * decoration on the tip migration, so fold `member.headRef` back in to\n * keep that output. The app space synthesises its head, so it carries\n * no on-disk `head` ref to restore.\n */\nexport function listRefsByContractHash(\n member: ContractSpaceMember,\n): ReadonlyMap<string, readonly string[]> {\n const byHash = new Map(refsByContractHash(member.refs));\n if (member.spaceId !== APP_SPACE_ID && member.headRef !== null) {\n const hash = member.headRef.hash;\n const bucket = byHash.get(hash) ?? [];\n if (!bucket.includes(HEAD_REF_NAME)) {\n byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());\n }\n }\n return byHash;\n}\n\nasync function orderedOnDiskSpaceIds(projectMigrationsDir: string): Promise<readonly string[]> {\n const candidateDirs = await listContractSpaceDirectories(projectMigrationsDir);\n return candidateDirs\n .filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name))\n .filter(isValidSpaceId)\n .sort(compareSpaceIds);\n}\n\n/**\n * Project the loaded {@link ContractSpaceAggregate} into the render-ready\n * {@link MigrationSpaceListEntry} rows `migration list` displays.\n *\n * Space membership matches the on-disk contract-space directories (not the\n * aggregate's always-present synthesized app member when `migrations/app/`\n * is absent); package and ref data come from `aggregate.space(id)`.\n */\nexport async function migrationSpaceListEntriesFromAggregate(\n aggregate: ContractSpaceAggregate,\n projectMigrationsDir: string,\n): Promise<readonly MigrationSpaceListEntry[]> {\n const spaceIds = await orderedOnDiskSpaceIds(projectMigrationsDir);\n const spaces: MigrationSpaceListEntry[] = [];\n\n for (const spaceId of spaceIds) {\n const member = aggregate.space(spaceId);\n if (member === undefined) {\n continue;\n }\n const refsByHash = listRefsByContractHash(member);\n const migrations: MigrationListEntry[] = member.packages\n .map((pkg) => ({\n name: pkg.dirName,\n hash: pkg.metadata.migrationHash,\n fromContract: pkg.metadata.from,\n toContract: pkg.metadata.to,\n operationCount: pkg.ops.length,\n createdAt: pkg.metadata.createdAt,\n refs: [...(refsByHash.get(pkg.metadata.to) ?? [])],\n providedInvariants: [...pkg.metadata.providedInvariants],\n }))\n .sort(compareDirNamesDescending);\n\n spaces.push({ space: spaceId, migrations });\n }\n\n return spaces;\n}\n\ninterface MigrationListOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly space?: string;\n readonly ascii?: boolean;\n readonly legend?: boolean;\n}\n\nexport interface MigrationListExecuteResult {\n readonly list: MigrationListResult;\n readonly liveContractHash: string;\n readonly aggregate: ContractSpaceAggregate;\n}\n\nexport interface MigrationListHumanRenderOptions {\n readonly glyphMode: GlyphMode;\n readonly useColor: boolean;\n readonly liveContractHash: string;\n readonly graphForSpace: (spaceId: string) => MigrationGraph | undefined;\n}\n\nexport function renderMigrationListHumanOutput(\n result: MigrationListResult,\n options: MigrationListHumanRenderOptions,\n): string {\n const styler = createAnsiMigrationListStyler({ useColor: options.useColor });\n return renderMigrationListWithStyle(result, styler, options.glyphMode, {\n colorize: options.useColor,\n liveContractHash: options.liveContractHash,\n graphForSpace: options.graphForSpace,\n });\n}\n\n/**\n * Inputs for {@link runMigrationList} — the policy core of `migration list`\n * that tests exercise directly.\n *\n * The core does not call `loadConfig`, parse CLI flags, render a styled\n * header, or write to any stream. Enumeration is supplied by the caller\n * (the CLI shell builds it from {@link migrationSpaceListEntriesFromAggregate}).\n */\nexport interface RunMigrationListInputs {\n readonly spaces: readonly MigrationSpaceListEntry[];\n readonly spaceFilter?: string;\n}\n\nfunction computeSummary(spaces: readonly MigrationSpaceListEntry[]): string {\n const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);\n if (spaces.length <= 1) {\n return `${totalMigrations} migration(s) on disk`;\n }\n return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;\n}\n\n/**\n * Policy core of `migration list`: validates `--space`, narrows the\n * pre-enumerated spaces, and assembles a {@link MigrationListResult}.\n *\n * - `migrations/` missing or contains no valid space directories →\n * caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.\n * - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.\n * - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.\n */\nexport function runMigrationList(\n inputs: RunMigrationListInputs,\n): Result<MigrationListResult, CliStructuredError> {\n const { spaces, spaceFilter } = inputs;\n\n if (spaceFilter !== undefined && !isValidSpaceId(spaceFilter)) {\n return notOk(errorInvalidSpaceId(spaceFilter));\n }\n\n if (spaceFilter !== undefined && !spaces.some((s) => s.space === spaceFilter)) {\n return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.space).sort()));\n }\n\n const scopedSpaces =\n spaceFilter !== undefined ? spaces.filter((s) => s.space === spaceFilter) : spaces;\n\n const resultSpaces: readonly MigrationSpaceListEntry[] =\n scopedSpaces.length === 0 ? [{ space: APP_SPACE_ID, migrations: [] }] : scopedSpaces;\n\n return ok({\n ok: true,\n spaces: [...resultSpaces],\n summary: computeSummary(resultSpaces),\n });\n}\n\n/**\n * CLI shell: loads config, resolves paths, prints the styled header on\n * stderr (interactive mode only), and delegates to {@link runMigrationList}.\n * Kept intentionally thin so the unit-testable surface lives in the core.\n */\nexport async function executeMigrationListCommand(\n options: MigrationListOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationListExecuteResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration list',\n description: 'List on-disk migrations per contract space',\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 notOk(loaded.failure);\n }\n\n const { aggregate, contractHash: liveContractHash } = loaded.value;\n\n const spaces = await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir);\n\n const listResult = runMigrationList({\n spaces,\n ...ifDefined('spaceFilter', options.space),\n });\n if (!listResult.ok) {\n return listResult;\n }\n return ok({ list: listResult.value, liveContractHash, aggregate });\n}\n\nexport function createMigrationListCommand(): Command {\n const command = new Command('list');\n setCommandDescriptions(\n command,\n 'List on-disk migrations per contract space',\n 'Enumerates every on-disk migration under migrations/<space>/ for every\\n' +\n 'contract space found on disk. Offline — does not consult the database.\\n' +\n 'Human output draws the shared migration graph tree with operation counts,\\n' +\n 'invariants on each migration row, and refs on destination contract nodes.\\n' +\n 'Pass --space <id> to narrow to one contract space. --ascii forces ASCII\\n' +\n 'tree glyphs (orthogonal to --no-color).',\n );\n setCommandExamples(command, [\n 'prisma-next migration list',\n 'prisma-next migration list --space app',\n 'prisma-next migration list --ascii',\n 'prisma-next migration list --legend',\n 'prisma-next migration list --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 graph', oneLiner: 'Show the migration graph topology' },\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('--ascii', 'Use ASCII kind glyphs (pipe-friendly)')\n .option('--legend', 'Print a key for the tree glyphs and lane colors')\n .action(async (options: MigrationListOptions) => {\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 executeMigrationListCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, ({ list, liveContractHash, aggregate }) => {\n if (flags.json) {\n ui.output(JSON.stringify(list, null, 2));\n } else if (!flags.quiet) {\n ui.output(\n renderMigrationListHumanOutput(list, {\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n useColor: ui.useColor,\n liveContractHash,\n graphForSpace: (spaceId) => aggregate.space(spaceId)?.graph(),\n }),\n );\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,iBAAiB,SAA2B,OAA6B;CACvF,OACE,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAAS,QAAQ,MAAM,UAAU;AAE9F;AAEA,SAAgB,sBACd,SACA,OACkC;CAClC,IAAI,QAAQ,WAAW,MACrB,OAAO,GAAG,KAAA,CAAS;CAErB,IAAI,MAAM,SAAS,MACjB,OAAO,MAAM,qBAAqB,QAAQ,CAAC;CAE7C,IAAI,MAAM,UAAU,MAClB,OAAO,MAAM,qBAAqB,SAAS,CAAC;CAE9C,IAAI,QAAQ,QAAQ,MAClB,OAAO,MAAM,qBAAqB,OAAO,CAAC;CAE5C,OAAO,GAAG,KAAA,CAAS;AACrB;;;ACQA,SAAS,gBAAgB,GAAW,GAAmB;CACrD,IAAI,MAAM,cAAc,OAAO,MAAM,eAAe,IAAI;CACxD,IAAI,MAAM,cAAc,OAAO;CAC/B,IAAI,IAAI,GAAG,OAAO;CAClB,IAAI,IAAI,GAAG,OAAO;CAClB,OAAO;AACT;AAEA,SAAS,0BAA0B,GAAuB,GAA+B;CACvF,IAAI,EAAE,OAAO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OAAO,WAAW,uCAAuC,EACzD,OAAO,YAAY,iDAAiD,EACpE,OAAO,OAAO,YAAkC;EAC/C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EACjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IACpB,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAGxD,MAAM,WAAW,aAAa,MADT,4BAA4B,SAAS,OAAO,EAAE,GAC7B,OAAO,KAAK,EAAE,MAAM,kBAAkB,gBAAgB;GAC1F,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,OAChB,GAAG,OACD,+BAA+B,MAAM;IACnC,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACrD,UAAU,GAAG;IACb;IACA,gBAAgB,YAAY,UAAU,MAAM,OAAO,GAAG,MAAM;GAC9D,CAAC,CACH;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
@@ -0,0 +1,222 @@
1
+ import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
2
+ import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-esJGBD4W.mjs";
3
+ import { t as createControlClient } from "./client-DC-UlBLy.mjs";
4
+ import { d as migrationListForwardArrow, l as abbreviateContractHash, o as createAnsiMigrationListStyler, s as IDENTITY_MIGRATION_LIST_STYLER, u as migrationListEmptySource } from "./migration-graph-space-render-CeNXh_Wy.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 stringWidth from "string-width";
9
+ import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
10
+ //#region src/utils/formatters/migration-log-table.ts
11
+ const HEADING_APPLIED_AT = "Applied at";
12
+ const HEADING_SPACE = "Space";
13
+ const HEADING_MIGRATION = "Migration";
14
+ const HEADING_CHANGE = "Change";
15
+ const HEADING_OPS = "Ops";
16
+ const COLUMN_SEPARATOR = " ";
17
+ const DIVIDER_CHAR = "─";
18
+ const ASCII_DIVIDER_CHAR = "-";
19
+ function sortLedgerEntries(entries) {
20
+ return [...entries].sort((left, right) => {
21
+ const timeDiff = left.appliedAt.getTime() - right.appliedAt.getTime();
22
+ if (timeDiff !== 0) return timeDiff;
23
+ const spaceDiff = left.space.localeCompare(right.space);
24
+ if (spaceDiff !== 0) return spaceDiff;
25
+ return left.migrationName.localeCompare(right.migrationName);
26
+ });
27
+ }
28
+ function pad2(value) {
29
+ return String(value).padStart(2, "0");
30
+ }
31
+ function formatLedgerAppliedAt(date, mode) {
32
+ if (mode === "iso") return date.toISOString();
33
+ if (mode === "utc") return `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}:${pad2(date.getUTCSeconds())}Z`;
34
+ const offsetMinutes = -date.getTimezoneOffset();
35
+ const sign = offsetMinutes >= 0 ? "+" : "-";
36
+ const absoluteOffset = Math.abs(offsetMinutes);
37
+ const offsetHours = pad2(Math.floor(absoluteOffset / 60));
38
+ const offsetMins = pad2(absoluteOffset % 60);
39
+ return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())} ${sign}${offsetHours}:${offsetMins}`;
40
+ }
41
+ function formatHashEndpoint(hash, glyphMode = "unicode") {
42
+ if (hash === null) return migrationListEmptySource(glyphMode);
43
+ return abbreviateContractHash(hash);
44
+ }
45
+ function formatHashTransition(from, to, glyphMode = "unicode") {
46
+ return `${formatHashEndpoint(from, glyphMode)} ${migrationListForwardArrow(glyphMode)} ${abbreviateContractHash(to)}`;
47
+ }
48
+ function styleHashTransition(from, to, styler, glyphMode = "unicode") {
49
+ return `${from === null ? styler.glyph(migrationListEmptySource(glyphMode)) : styler.sourceHash(abbreviateContractHash(from))} ${styler.glyph(migrationListForwardArrow(glyphMode))} ${styler.destHash(abbreviateContractHash(to))}`;
50
+ }
51
+ function padVisible(text, targetWidth) {
52
+ const padding = Math.max(0, targetWidth - stringWidth(text));
53
+ return text + " ".repeat(padding);
54
+ }
55
+ function columnWidth(values) {
56
+ return values.reduce((max, value) => Math.max(max, stringWidth(value)), 0);
57
+ }
58
+ function padDividerCell(valueWidth, dividerChar) {
59
+ return dividerChar.repeat(valueWidth + 2);
60
+ }
61
+ function padTextCell(value, valueWidth) {
62
+ return ` ${padVisible(value, valueWidth)} `;
63
+ }
64
+ function padOpsCell(value, valueWidth) {
65
+ const padding = Math.max(0, valueWidth - stringWidth(value));
66
+ return ` ${" ".repeat(padding)}${value} `;
67
+ }
68
+ function renderMigrationLogTable(entries, options = {}) {
69
+ const sorted = sortLedgerEntries(entries);
70
+ if (sorted.length === 0) return "";
71
+ const styler = options.styler ?? IDENTITY_MIGRATION_LIST_STYLER;
72
+ const glyphMode = options.glyphMode ?? "unicode";
73
+ const dividerChar = glyphMode === "ascii" ? ASCII_DIVIDER_CHAR : DIVIDER_CHAR;
74
+ const showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;
75
+ const timestampMode = options.utc ? "utc" : "local";
76
+ const rows = sorted.map((entry) => ({
77
+ appliedAt: formatLedgerAppliedAt(entry.appliedAt, timestampMode),
78
+ space: entry.space,
79
+ migrationName: entry.migrationName,
80
+ transition: formatHashTransition(entry.from, entry.to, glyphMode),
81
+ ops: `${entry.operationCount} ops`,
82
+ from: entry.from,
83
+ to: entry.to
84
+ }));
85
+ const appliedAtWidth = columnWidth([HEADING_APPLIED_AT, ...rows.map((row) => row.appliedAt)]);
86
+ const spaceWidth = showSpace ? columnWidth([HEADING_SPACE, ...rows.map((row) => row.space)]) : 0;
87
+ const nameWidth = columnWidth([HEADING_MIGRATION, ...rows.map((row) => row.migrationName)]);
88
+ const transitionWidth = columnWidth([HEADING_CHANGE, ...rows.map((row) => row.transition)]);
89
+ const opsWidth = columnWidth([HEADING_OPS, ...rows.map((row) => row.ops)]);
90
+ const headingParts = [padTextCell(HEADING_APPLIED_AT, appliedAtWidth)];
91
+ if (showSpace) headingParts.push(padTextCell(HEADING_SPACE, spaceWidth));
92
+ headingParts.push(padTextCell(HEADING_MIGRATION, nameWidth), padTextCell(HEADING_CHANGE, transitionWidth), padOpsCell(HEADING_OPS, opsWidth));
93
+ const heading = headingParts.join(COLUMN_SEPARATOR);
94
+ const dividerParts = [padDividerCell(appliedAtWidth, dividerChar)];
95
+ if (showSpace) dividerParts.push(padDividerCell(spaceWidth, dividerChar));
96
+ dividerParts.push(padDividerCell(nameWidth, dividerChar), padDividerCell(transitionWidth, dividerChar), padDividerCell(opsWidth, dividerChar));
97
+ return [
98
+ heading,
99
+ dividerParts.map((cell) => styler.summary(cell)).join(COLUMN_SEPARATOR),
100
+ ...rows.map((row) => {
101
+ const parts = [padTextCell(row.appliedAt, appliedAtWidth)];
102
+ if (showSpace) parts.push(padTextCell(row.space, spaceWidth));
103
+ parts.push(padTextCell(styler.dirName(row.migrationName), nameWidth), padTextCell(styleHashTransition(row.from, row.to, styler, glyphMode), transitionWidth), padOpsCell(row.ops, opsWidth));
104
+ return parts.join(COLUMN_SEPARATOR);
105
+ })
106
+ ].join("\n");
107
+ }
108
+ function serializeLedgerEntriesForJson(entries) {
109
+ return sortLedgerEntries(entries).map((entry) => ({
110
+ space: entry.space,
111
+ name: entry.migrationName,
112
+ hash: entry.migrationHash,
113
+ fromContract: entry.from,
114
+ toContract: entry.to,
115
+ appliedAt: formatLedgerAppliedAt(entry.appliedAt, "iso"),
116
+ operationCount: entry.operationCount
117
+ }));
118
+ }
119
+ const MIGRATION_LOG_EMPTY_MESSAGE = "No migrations have been applied to this database.";
120
+ //#endregion
121
+ //#region src/commands/migration-log.ts
122
+ async function executeMigrationLogCommand(options, flags, ui) {
123
+ const config = await loadConfig(options.config);
124
+ const { configPath } = resolveMigrationPaths(options.config, config);
125
+ const dbConnection = options.db ?? config.db?.connection;
126
+ const missingDb = requireLiveDatabase({
127
+ dbConnection,
128
+ hasDriver: !!config.driver,
129
+ why: `migration log needs a database connection and driver to read the ledger (set db.connection in ${configPath}, or pass --db <url>)`,
130
+ commandName: "migration log"
131
+ });
132
+ if (missingDb) return notOk(missingDb);
133
+ if (!targetSupportsMigrations(config.target)) return notOk(errorUnexpected("Target does not support migrations"));
134
+ if (!flags.json && !flags.quiet) {
135
+ const header = formatStyledHeader({
136
+ command: "migration log",
137
+ description: "Show executed migration history from the database ledger",
138
+ details: [{
139
+ label: "config",
140
+ value: configPath
141
+ }, ...typeof dbConnection === "string" ? [{
142
+ label: "database",
143
+ value: maskConnectionUrl(dbConnection)
144
+ }] : []],
145
+ flags
146
+ });
147
+ ui.stderr(header);
148
+ }
149
+ const client = createControlClient({
150
+ family: config.family,
151
+ target: config.target,
152
+ adapter: config.adapter,
153
+ ...ifDefined("driver", config.driver),
154
+ extensionPacks: config.extensionPacks ?? []
155
+ });
156
+ try {
157
+ await client.connect(dbConnection);
158
+ return ok(await client.readLedger());
159
+ } catch (error) {
160
+ if (CliStructuredError.is(error)) return notOk(error);
161
+ if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
162
+ return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` }));
163
+ } finally {
164
+ await client.close();
165
+ }
166
+ }
167
+ function createMigrationLogCommand() {
168
+ const command = new Command("log");
169
+ setCommandDescriptions(command, "Show executed migration history", "Reads the database ledger and displays every applied migration edge\nin chronological order, including rollbacks and re-applies, merged\nacross all contract spaces. Requires a database connection.");
170
+ setCommandExamples(command, [
171
+ "prisma-next migration log --db $DATABASE_URL",
172
+ "prisma-next migration log --utc --db $DATABASE_URL",
173
+ "prisma-next migration log --json --db $DATABASE_URL"
174
+ ]);
175
+ setCommandSeeAlso(command, [
176
+ {
177
+ verb: "migration status",
178
+ oneLiner: "Show migration path and pending status"
179
+ },
180
+ {
181
+ verb: "migration list",
182
+ oneLiner: "List on-disk migrations"
183
+ },
184
+ {
185
+ verb: "migration graph",
186
+ oneLiner: "Show the migration graph topology"
187
+ },
188
+ {
189
+ verb: "migration show",
190
+ oneLiner: "Display migration package contents"
191
+ }
192
+ ]);
193
+ addGlobalOptions(command).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--utc", "Render human timestamps in UTC instead of local time").option("--ascii", "Use ASCII glyphs (pipe-friendly)").action(async (options) => {
194
+ const flags = parseGlobalFlagsOrExit(options);
195
+ const ui = createTerminalUI(flags);
196
+ const exitCode = handleResult(await executeMigrationLogCommand(options, flags, ui), flags, ui, (entries) => {
197
+ if (flags.json) {
198
+ const records = serializeLedgerEntriesForJson(entries);
199
+ const result = {
200
+ ok: true,
201
+ records,
202
+ summary: `${records.length} migration(s) applied`
203
+ };
204
+ ui.output(JSON.stringify(result, null, 2));
205
+ } else if (!flags.quiet) if (entries.length === 0) ui.output(MIGRATION_LOG_EMPTY_MESSAGE);
206
+ else {
207
+ const styler = createAnsiMigrationListStyler({ useColor: ui.useColor });
208
+ ui.output(renderMigrationLogTable(entries, {
209
+ utc: options.utc === true,
210
+ styler,
211
+ glyphMode: ui.resolveGlyphMode(options.ascii === true)
212
+ }));
213
+ }
214
+ });
215
+ process.exit(exitCode);
216
+ });
217
+ return command;
218
+ }
219
+ //#endregion
220
+ export { executeMigrationLogCommand as n, createMigrationLogCommand as t };
221
+
222
+ //# sourceMappingURL=migration-log-6rcHQSI4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-log-6rcHQSI4.mjs","names":[],"sources":["../src/utils/formatters/migration-log-table.ts","../src/commands/migration-log.ts"],"sourcesContent":["import type { LedgerEntryRecord } from '@prisma-next/contract/types';\nimport stringWidth from 'string-width';\nimport type { GlyphMode } from '../glyph-mode';\nimport {\n abbreviateContractHash,\n migrationListEmptySource,\n migrationListForwardArrow,\n} from './migration-list-data-column';\nimport { IDENTITY_MIGRATION_LIST_STYLER, type MigrationListStyler } from './migration-list-render';\n\nexport type LedgerTimestampMode = 'local' | 'utc' | 'iso';\n\nexport interface RenderMigrationLogTableOptions {\n readonly utc?: boolean;\n readonly styler?: MigrationListStyler;\n readonly glyphMode?: GlyphMode;\n}\n\nexport interface SerializedLedgerEntryRecord {\n readonly space: string;\n readonly name: string;\n readonly hash: string;\n readonly fromContract: string | null;\n readonly toContract: string;\n readonly appliedAt: string;\n readonly operationCount: number;\n}\n\nconst HEADING_APPLIED_AT = 'Applied at';\nconst HEADING_SPACE = 'Space';\nconst HEADING_MIGRATION = 'Migration';\nconst HEADING_CHANGE = 'Change';\nconst HEADING_OPS = 'Ops';\nconst COLUMN_SEPARATOR = ' ';\nconst DIVIDER_CHAR = '─';\nconst ASCII_DIVIDER_CHAR = '-';\n\nexport function sortLedgerEntries(entries: readonly LedgerEntryRecord[]): LedgerEntryRecord[] {\n return [...entries].sort((left, right) => {\n const timeDiff = left.appliedAt.getTime() - right.appliedAt.getTime();\n if (timeDiff !== 0) {\n return timeDiff;\n }\n const spaceDiff = left.space.localeCompare(right.space);\n if (spaceDiff !== 0) {\n return spaceDiff;\n }\n return left.migrationName.localeCompare(right.migrationName);\n });\n}\n\nfunction pad2(value: number): string {\n return String(value).padStart(2, '0');\n}\n\nexport function formatLedgerAppliedAt(date: Date, mode: LedgerTimestampMode): string {\n if (mode === 'iso') {\n return date.toISOString();\n }\n if (mode === 'utc') {\n return `${date.getUTCFullYear()}-${pad2(date.getUTCMonth() + 1)}-${pad2(date.getUTCDate())} ${pad2(date.getUTCHours())}:${pad2(date.getUTCMinutes())}:${pad2(date.getUTCSeconds())}Z`;\n }\n const offsetMinutes = -date.getTimezoneOffset();\n const sign = offsetMinutes >= 0 ? '+' : '-';\n const absoluteOffset = Math.abs(offsetMinutes);\n const offsetHours = pad2(Math.floor(absoluteOffset / 60));\n const offsetMins = pad2(absoluteOffset % 60);\n return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())} ${sign}${offsetHours}:${offsetMins}`;\n}\n\nexport function formatHashEndpoint(hash: string | null, glyphMode: GlyphMode = 'unicode'): string {\n if (hash === null) {\n return migrationListEmptySource(glyphMode);\n }\n return abbreviateContractHash(hash);\n}\n\nexport function formatHashTransition(\n from: string | null,\n to: string,\n glyphMode: GlyphMode = 'unicode',\n): string {\n return `${formatHashEndpoint(from, glyphMode)} ${migrationListForwardArrow(glyphMode)} ${abbreviateContractHash(to)}`;\n}\n\nexport function styleHashTransition(\n from: string | null,\n to: string,\n styler: MigrationListStyler,\n glyphMode: GlyphMode = 'unicode',\n): string {\n const fromPart =\n from === null\n ? styler.glyph(migrationListEmptySource(glyphMode))\n : styler.sourceHash(abbreviateContractHash(from));\n const arrow = styler.glyph(migrationListForwardArrow(glyphMode));\n const dest = styler.destHash(abbreviateContractHash(to));\n return `${fromPart} ${arrow} ${dest}`;\n}\n\nfunction padVisible(text: string, targetWidth: number): string {\n const padding = Math.max(0, targetWidth - stringWidth(text));\n return text + ' '.repeat(padding);\n}\n\nfunction columnWidth(values: readonly string[]): number {\n return values.reduce((max, value) => Math.max(max, stringWidth(value)), 0);\n}\n\nfunction padDividerCell(valueWidth: number, dividerChar: string): string {\n return dividerChar.repeat(valueWidth + 2);\n}\n\nfunction padTextCell(value: string, valueWidth: number): string {\n return ` ${padVisible(value, valueWidth)} `;\n}\n\nfunction padOpsCell(value: string, valueWidth: number): string {\n const padding = Math.max(0, valueWidth - stringWidth(value));\n return ` ${' '.repeat(padding)}${value} `;\n}\n\nexport function renderMigrationLogTable(\n entries: readonly LedgerEntryRecord[],\n options: RenderMigrationLogTableOptions = {},\n): string {\n const sorted = sortLedgerEntries(entries);\n if (sorted.length === 0) {\n return '';\n }\n\n const styler = options.styler ?? IDENTITY_MIGRATION_LIST_STYLER;\n const glyphMode = options.glyphMode ?? 'unicode';\n const dividerChar = glyphMode === 'ascii' ? ASCII_DIVIDER_CHAR : DIVIDER_CHAR;\n const showSpace = new Set(sorted.map((entry) => entry.space)).size > 1;\n const timestampMode: LedgerTimestampMode = options.utc ? 'utc' : 'local';\n const rows = sorted.map((entry) => ({\n appliedAt: formatLedgerAppliedAt(entry.appliedAt, timestampMode),\n space: entry.space,\n migrationName: entry.migrationName,\n transition: formatHashTransition(entry.from, entry.to, glyphMode),\n ops: `${entry.operationCount} ops`,\n from: entry.from,\n to: entry.to,\n }));\n\n const appliedAtWidth = columnWidth([HEADING_APPLIED_AT, ...rows.map((row) => row.appliedAt)]);\n const spaceWidth = showSpace ? columnWidth([HEADING_SPACE, ...rows.map((row) => row.space)]) : 0;\n const nameWidth = columnWidth([HEADING_MIGRATION, ...rows.map((row) => row.migrationName)]);\n const transitionWidth = columnWidth([HEADING_CHANGE, ...rows.map((row) => row.transition)]);\n const opsWidth = columnWidth([HEADING_OPS, ...rows.map((row) => row.ops)]);\n\n const headingParts = [padTextCell(HEADING_APPLIED_AT, appliedAtWidth)];\n if (showSpace) {\n headingParts.push(padTextCell(HEADING_SPACE, spaceWidth));\n }\n headingParts.push(\n padTextCell(HEADING_MIGRATION, nameWidth),\n padTextCell(HEADING_CHANGE, transitionWidth),\n padOpsCell(HEADING_OPS, opsWidth),\n );\n const heading = headingParts.join(COLUMN_SEPARATOR);\n\n const dividerParts = [padDividerCell(appliedAtWidth, dividerChar)];\n if (showSpace) {\n dividerParts.push(padDividerCell(spaceWidth, dividerChar));\n }\n dividerParts.push(\n padDividerCell(nameWidth, dividerChar),\n padDividerCell(transitionWidth, dividerChar),\n padDividerCell(opsWidth, dividerChar),\n );\n const divider = dividerParts.map((cell) => styler.summary(cell)).join(COLUMN_SEPARATOR);\n\n const dataRows = rows.map((row) => {\n const parts = [padTextCell(row.appliedAt, appliedAtWidth)];\n if (showSpace) {\n parts.push(padTextCell(row.space, spaceWidth));\n }\n parts.push(\n padTextCell(styler.dirName(row.migrationName), nameWidth),\n padTextCell(styleHashTransition(row.from, row.to, styler, glyphMode), transitionWidth),\n padOpsCell(row.ops, opsWidth),\n );\n return parts.join(COLUMN_SEPARATOR);\n });\n\n return [heading, divider, ...dataRows].join('\\n');\n}\n\nexport function serializeLedgerEntriesForJson(\n entries: readonly LedgerEntryRecord[],\n): SerializedLedgerEntryRecord[] {\n return sortLedgerEntries(entries).map((entry) => ({\n space: entry.space,\n name: entry.migrationName,\n hash: entry.migrationHash,\n fromContract: entry.from,\n toContract: entry.to,\n appliedAt: formatLedgerAppliedAt(entry.appliedAt, 'iso'),\n operationCount: entry.operationCount,\n }));\n}\n\nexport const MIGRATION_LOG_EMPTY_MESSAGE = 'No migrations have been applied to this database.';\n","import type { LedgerEntryRecord } from '@prisma-next/contract/types';\nimport { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n CliStructuredError,\n errorUnexpected,\n mapMigrationToolsError,\n requireLiveDatabase,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n maskConnectionUrl,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n targetSupportsMigrations,\n} from '../utils/command-helpers';\nimport { createAnsiMigrationListStyler } from '../utils/formatters/migration-list-styler';\nimport {\n MIGRATION_LOG_EMPTY_MESSAGE,\n renderMigrationLogTable,\n serializeLedgerEntriesForJson,\n} from '../utils/formatters/migration-log-table';\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';\nimport type { MigrationLogResult } from './json/schemas';\n\nexport type { MigrationLogResult };\n\ninterface MigrationLogOptions extends CommonCommandOptions {\n readonly db?: string;\n readonly config?: string;\n readonly utc?: boolean;\n readonly ascii?: boolean;\n}\n\nexport async function executeMigrationLogCommand(\n options: MigrationLogOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<readonly LedgerEntryRecord[], CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath } = resolveMigrationPaths(options.config, config);\n\n const dbConnection = options.db ?? config.db?.connection;\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver: !!config.driver,\n why: `migration log needs a database connection and driver to read the ledger (set db.connection in ${configPath}, or pass --db <url>)`,\n commandName: 'migration log',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n if (!targetSupportsMigrations(config.target)) {\n return notOk(errorUnexpected('Target does not support migrations'));\n }\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration log',\n description: 'Show executed migration history from the database ledger',\n details: [\n { label: 'config', value: configPath },\n ...(typeof dbConnection === 'string'\n ? [{ label: 'database', value: maskConnectionUrl(dbConnection) }]\n : []),\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 try {\n await client.connect(dbConnection);\n const ledger = await client.readLedger();\n return ok(ledger);\n } catch (error) {\n if (CliStructuredError.is(error)) return notOk(error);\n if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createMigrationLogCommand(): Command {\n const command = new Command('log');\n setCommandDescriptions(\n command,\n 'Show executed migration history',\n 'Reads the database ledger and displays every applied migration edge\\n' +\n 'in chronological order, including rollbacks and re-applies, merged\\n' +\n 'across all contract spaces. Requires a database connection.',\n );\n setCommandExamples(command, [\n 'prisma-next migration log --db $DATABASE_URL',\n 'prisma-next migration log --utc --db $DATABASE_URL',\n 'prisma-next migration log --json --db $DATABASE_URL',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--utc', 'Render human timestamps in UTC instead of local time')\n .option('--ascii', 'Use ASCII glyphs (pipe-friendly)')\n .action(async (options: MigrationLogOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const result = await executeMigrationLogCommand(options, flags, ui);\n const exitCode = handleResult(result, flags, ui, (entries) => {\n if (flags.json) {\n const records = serializeLedgerEntriesForJson(entries);\n const result: MigrationLogResult = {\n ok: true,\n records,\n summary: `${records.length} migration(s) applied`,\n };\n ui.output(JSON.stringify(result, null, 2));\n } else if (!flags.quiet) {\n if (entries.length === 0) {\n ui.output(MIGRATION_LOG_EMPTY_MESSAGE);\n } else {\n const styler = createAnsiMigrationListStyler({ useColor: ui.useColor });\n ui.output(\n renderMigrationLogTable(entries, {\n utc: options.utc === true,\n styler,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n }\n }\n });\n process.exit(exitCode);\n });\n return command;\n}\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,oBAAoB;AAC1B,MAAM,iBAAi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rB,OAAO,cAAc,4BAA4B,EACjD,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,SAAS,sDAAsD,EACtE,OAAO,WAAW,kCAAkC,EACpD,OAAO,OAAO,YAAiC;EAC9C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EAEjC,MAAM,WAAW,aAAa,MADT,2BAA2B,SAAS,OAAO,EAAE,GAC5B,OAAO,KAAK,YAAY;GAC5D,IAAI,MAAM,MAAM;IACd,MAAM,UAAU,8BAA8B,OAAO;IACrD,MAAM,SAA6B;KACjC,IAAI;KACJ;KACA,SAAS,GAAG,QAAQ,OAAO;IAC7B;IACA,GAAG,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;GAC3C,OAAO,IAAI,CAAC,MAAM,OAChB,IAAI,QAAQ,WAAW,GACrB,GAAG,OAAO,2BAA2B;QAChC;IACL,MAAM,SAAS,8BAA8B,EAAE,UAAU,GAAG,SAAS,CAAC;IACtE,GAAG,OACD,wBAAwB,SAAS;KAC/B,KAAK,QAAQ,QAAQ;KACrB;KACA,WAAW,GAAG,iBAAiB,QAAQ,UAAU,IAAI;IACvD,CAAC,CACH;GACF;EAEJ,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CACH,OAAO;AACT"}
@@ -0,0 +1,38 @@
1
+ import { rt as errorRuntime } from "./command-helpers-esJGBD4W.mjs";
2
+ import { notOk, ok } from "@prisma-next/utils/result";
3
+ import { isAbsolute, relative, resolve } from "pathe";
4
+ //#region src/utils/migration-path-target.ts
5
+ function looksLikePath(target) {
6
+ return target.includes("/") || target.includes("\\");
7
+ }
8
+ function resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative) {
9
+ const targetPath = resolve(target);
10
+ const relativeToApp = relative(appMigrationsDir, targetPath);
11
+ if (relativeToApp === "" || relativeToApp === "." || relativeToApp.startsWith("..") || isAbsolute(relativeToApp)) return notOk(errorRuntime("Target must point to an app-space migration", {
12
+ why: `Expected a path under ${appMigrationsRelative}, got ${target}`,
13
+ fix: "Pass an app-space migration directory or use a hash prefix."
14
+ }));
15
+ return ok(targetPath);
16
+ }
17
+ /**
18
+ * Resolve a filesystem-path target to the migration dir that contains it,
19
+ * searching each in-scope space's `migrationsDir`. A path is explicit, so
20
+ * it can belong to at most one space — returns the first match, or `null`
21
+ * when the path falls outside every space dir.
22
+ */
23
+ function resolveTargetPathAcrossSpaces(target, spaces) {
24
+ const targetPath = resolve(target);
25
+ for (const space of spaces) {
26
+ const rel = relative(space.migrationsDir, targetPath);
27
+ if (!(rel === "" || rel === "." || rel.startsWith("..") || isAbsolute(rel))) return targetPath;
28
+ }
29
+ return null;
30
+ }
31
+ function findPackageByDirPath(packages, resolvedDirPath) {
32
+ const normalized = resolve(resolvedDirPath);
33
+ return packages.find((p) => resolve(p.dirPath) === normalized);
34
+ }
35
+ //#endregion
36
+ export { resolveTargetPathAcrossSpaces as i, looksLikePath as n, resolveAppTargetPath as r, findPackageByDirPath as t };
37
+
38
+ //# sourceMappingURL=migration-path-target-UkxkgXnv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-path-target-UkxkgXnv.mjs","names":[],"sources":["../src/utils/migration-path-target.ts"],"sourcesContent":["import type { OnDiskMigrationPackage } from '@prisma-next/migration-tools/package';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { isAbsolute, relative, resolve } from 'pathe';\nimport { type CliStructuredError, errorRuntime } from './cli-errors';\n\nexport function 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\n/**\n * Resolve a filesystem-path target to the migration dir that contains it,\n * searching each in-scope space's `migrationsDir`. A path is explicit, so\n * it can belong to at most one space — returns the first match, or `null`\n * when the path falls outside every space dir.\n */\nexport function resolveTargetPathAcrossSpaces(\n target: string,\n spaces: ReadonlyArray<{ readonly migrationsDir: string }>,\n): string | null {\n const targetPath = resolve(target);\n for (const space of spaces) {\n const rel = relative(space.migrationsDir, targetPath);\n const isOutside = rel === '' || rel === '.' || rel.startsWith('..') || isAbsolute(rel);\n if (!isOutside) {\n return targetPath;\n }\n }\n return null;\n}\n\nexport function 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"],"mappings":";;;;AAKA,SAAgB,cAAc,QAAyB;CACrD,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;;;;;;;AAQA,SAAgB,8BACd,QACA,QACe;CACf,MAAM,aAAa,QAAQ,MAAM;CACjC,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,MAAM,SAAS,MAAM,eAAe,UAAU;EAEpD,IAAI,EADc,QAAQ,MAAM,QAAQ,OAAO,IAAI,WAAW,IAAI,KAAK,WAAW,GAAG,IAEnF,OAAO;CAEX;CACA,OAAO;AACT;AAEA,SAAgB,qBACd,UACA,iBACoC;CACpC,MAAM,aAAa,QAAQ,eAAe;CAC1C,OAAO,SAAS,MAAM,MAAM,QAAQ,EAAE,OAAO,MAAM,UAAU;AAC/D"}
@@ -1,9 +1,8 @@
1
1
  import { t as loadConfig } from "./config-loader-B6sJjXTv.mjs";
2
- import { $ as errorTargetMigrationNotSupported, A as CliStructuredError, G as errorPlanForgotTheFlag, P as errorContractValidationFailed, R as errorFileNotFound, T as formatStyledHeader, U as errorMigrationPlanningFailed, Z as errorSnapshotMissing, _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, nt as mapMigrationToolsError, o as resolveContractPath, r as getTargetMigrations, rt as mapRefResolutionError, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "./command-helpers-Bbw1GbwL.mjs";
3
- import { t as assertFrameworkComponentsCompatible } from "./framework-components-fYXjz_in.mjs";
4
- import { n as toExtensionInputs } from "./extension-pack-inputs-IDvjRCi3.mjs";
5
- import { a as loadContractSpaceAggregateForCli, n as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-DvZwdkrr.mjs";
6
- import { t as mapContractAtError } from "./contract-at-errors-BxP-TOMl.mjs";
2
+ import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, Q as errorPlanForgotTheFlag, W as errorFileNotFound, X as errorMigrationPlanningFailed, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, it as errorSnapshotMissing, l as setCommandDescriptions, lt as mapMigrationToolsError, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "./command-helpers-esJGBD4W.mjs";
3
+ import { t as assertFrameworkComponentsCompatible } from "./framework-components-BO9VO43s.mjs";
4
+ import { c as toExtensionInputs, i as loadContractSpaceAggregateForCli, t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-CpNVrBqW.mjs";
5
+ import { t as mapContractAtError } from "./contract-at-errors-COZAemUl.mjs";
7
6
  import { Command } from "commander";
8
7
  import { getEmittedArtifactPaths } from "@prisma-next/emitter";
9
8
  import { notOk, ok } from "@prisma-next/utils/result";
@@ -765,4 +764,4 @@ function resolveBundleByPrefix(bundles, needle) {
765
764
  //#endregion
766
765
  export { formatMigrationPlanOutput as n, resolveBundleByPrefix as r, createMigrationPlanCommand as t };
767
766
 
768
- //# sourceMappingURL=migration-plan-9DJ7q7_z.mjs.map
767
+ //# sourceMappingURL=migration-plan-CHu_erQ5.mjs.map