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
@@ -1,190 +1,2 @@
1
- import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { B as errorInvalidSpaceId, Q as errorSpaceNotFound, T 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-Bbw1GbwL.mjs";
3
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-DvZwdkrr.mjs";
4
- import { i as renderMigrationListWithStyle, n as createAnsiMigrationListStyler, r as buildMigrationListTopologyBySpace } from "../migration-list-styler-BRwF4-gy.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
- const styler = createAnsiMigrationListStyler({ useColor: options.useColor });
77
- const topologyBySpaceId = buildMigrationListTopologyBySpace(result);
78
- return renderMigrationListWithStyle(result, styler, options.glyphMode, topologyBySpaceId);
79
- }
80
- function computeSummary(spaces) {
81
- const totalMigrations = spaces.reduce((count, space) => count + space.migrations.length, 0);
82
- if (spaces.length <= 1) return `${totalMigrations} migration(s) on disk`;
83
- return `${totalMigrations} migration(s) across ${spaces.length} contract space(s)`;
84
- }
85
- /**
86
- * Policy core of `migration list`: validates `--space`, narrows the
87
- * pre-enumerated spaces, and assembles a {@link MigrationListResult}.
88
- *
89
- * - `migrations/` missing or contains no valid space directories →
90
- * caller passes `spaces: []`; this synthesizes `[{ spaceId: APP_SPACE_ID, migrations: [] }]`.
91
- * - `--space <id>` on an existing-but-empty space → `{ spaceId, migrations: [] }` in the input.
92
- * - `--space <id>` on a non-existent (or reserved) space → `SPACE_NOT_FOUND`.
93
- */
94
- function runMigrationList(inputs) {
95
- const { spaces, spaceFilter } = inputs;
96
- if (spaceFilter !== void 0 && !isValidSpaceId(spaceFilter)) return notOk(errorInvalidSpaceId(spaceFilter));
97
- if (spaceFilter !== void 0 && !spaces.some((s) => s.spaceId === spaceFilter)) return notOk(errorSpaceNotFound(spaceFilter, spaces.map((s) => s.spaceId).sort()));
98
- const scopedSpaces = spaceFilter !== void 0 ? spaces.filter((s) => s.spaceId === spaceFilter) : spaces;
99
- const resultSpaces = scopedSpaces.length === 0 ? [{
100
- spaceId: APP_SPACE_ID,
101
- migrations: []
102
- }] : scopedSpaces;
103
- return ok({
104
- ok: true,
105
- spaces: resultSpaces,
106
- summary: computeSummary(resultSpaces)
107
- });
108
- }
109
- /**
110
- * CLI shell: loads config, resolves paths, prints the styled header on
111
- * stderr (interactive mode only), and delegates to {@link runMigrationList}.
112
- * Kept intentionally thin so the unit-testable surface lives in the core.
113
- */
114
- async function executeMigrationListCommand(options, flags, ui) {
115
- const config = await loadConfig(options.config);
116
- const { configPath, migrationsDir, migrationsRelative } = resolveMigrationPaths(options.config, config);
117
- if (!flags.json && !flags.quiet) {
118
- const header = formatStyledHeader({
119
- command: "migration list",
120
- description: "List on-disk migrations, latest first, per contract space",
121
- details: [
122
- {
123
- label: "config",
124
- value: configPath
125
- },
126
- {
127
- label: "migrations",
128
- value: migrationsRelative
129
- },
130
- ...options.space !== void 0 ? [{
131
- label: "space",
132
- value: options.space
133
- }] : []
134
- ],
135
- flags
136
- });
137
- ui.stderr(header);
138
- }
139
- const loaded = await buildReadAggregate(config, { migrationsDir });
140
- if (!loaded.ok) return notOk(loaded.failure);
141
- return runMigrationList({
142
- spaces: await migrationSpaceListEntriesFromAggregate(loaded.value.aggregate, migrationsDir),
143
- ...ifDefined("spaceFilter", options.space)
144
- });
145
- }
146
- function createMigrationListCommand() {
147
- const command = new Command("list");
148
- setCommandDescriptions(command, "List on-disk migrations, latest first, per contract space", "Enumerates every on-disk migration under migrations/<space>/ for every\ncontract space found on disk, latest first. Offline — does not consult\nthe database. Each row leads with a kind glyph (* forward, ↩ rollback,\n⟲ self), then dirName, then source → destination contract hashes\n(7-char git-style). Self-edges show a single hash. Invariants render as\n{...}; refs on the destination as (production, db). Pass --space <id>\nto narrow to one contract space. --ascii forces ASCII kind glyphs\n(orthogonal to --no-color).");
149
- setCommandExamples(command, [
150
- "prisma-next migration list",
151
- "prisma-next migration list --space app",
152
- "prisma-next migration list --ascii",
153
- "prisma-next migration list --json"
154
- ]);
155
- setCommandSeeAlso(command, [
156
- {
157
- verb: "migration status",
158
- oneLiner: "Show migration path and pending status"
159
- },
160
- {
161
- verb: "migration log",
162
- oneLiner: "Show executed migration history"
163
- },
164
- {
165
- verb: "migration graph",
166
- oneLiner: "Show the migration graph topology"
167
- },
168
- {
169
- verb: "migration show",
170
- oneLiner: "Display migration package contents"
171
- }
172
- ]);
173
- 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) => {
174
- const flags = parseGlobalFlagsOrExit(options);
175
- const ui = createTerminalUI(flags);
176
- const exitCode = handleResult(await executeMigrationListCommand(options, flags, ui), flags, ui, (listResult) => {
177
- if (flags.json) ui.output(JSON.stringify(listResult, null, 2));
178
- else if (!flags.quiet) ui.output(renderMigrationListHumanOutput(listResult, {
179
- glyphMode: ui.resolveGlyphMode(options.ascii === true),
180
- useColor: ui.useColor
181
- }));
182
- });
183
- process.exit(exitCode);
184
- });
185
- return command;
186
- }
187
- //#endregion
188
- export { createMigrationListCommand, executeMigrationListCommand, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
189
-
190
- //# sourceMappingURL=migration-list.mjs.map
1
+ import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-vJWFuXca.mjs";
2
+ export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
@@ -1,30 +1,20 @@
1
- import { N as CliStructuredError } from "../types-Dt_SfqFm.mjs";
2
- import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-DEHjV8_s.mjs";
3
- import { t as TerminalUI } from "../terminal-ui-5Y6mrg93.mjs";
1
+ import { N as CliStructuredError } from "../types-qV41eEXH.mjs";
2
+ import { i as MigrationLogResult } from "../schemas-BL33A3i-.mjs";
3
+ import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-CV5LhrFg.mjs";
4
+ import { t as TerminalUI } from "../terminal-ui-BgLiAOYi.mjs";
4
5
  import { Command } from "commander";
5
6
  import { Result } from "@prisma-next/utils/result";
7
+ import { LedgerEntryRecord } from "@prisma-next/contract/types";
6
8
 
7
9
  //#region src/commands/migration-log.d.ts
8
10
  interface MigrationLogOptions extends CommonCommandOptions {
9
11
  readonly db?: string;
10
12
  readonly config?: string;
13
+ readonly utc?: boolean;
14
+ readonly ascii?: boolean;
11
15
  }
12
- interface MigrationLogEntry {
13
- readonly dirName: string;
14
- readonly from: string;
15
- readonly to: string;
16
- readonly migrationHash: string;
17
- readonly operationCount: number;
18
- readonly createdAt: string;
19
- }
20
- interface MigrationLogResult {
21
- readonly ok: true;
22
- readonly markerHash: string | null;
23
- readonly applied: readonly MigrationLogEntry[];
24
- readonly summary: string;
25
- }
26
- declare function executeMigrationLogCommand(options: MigrationLogOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<MigrationLogResult, CliStructuredError>>;
16
+ declare function executeMigrationLogCommand(options: MigrationLogOptions, flags: GlobalFlags, ui: TerminalUI): Promise<Result<readonly LedgerEntryRecord[], CliStructuredError>>;
27
17
  declare function createMigrationLogCommand(): Command;
28
18
  //#endregion
29
- export { MigrationLogEntry, MigrationLogResult, createMigrationLogCommand, executeMigrationLogCommand };
19
+ export { type MigrationLogResult, createMigrationLogCommand, executeMigrationLogCommand };
30
20
  //# sourceMappingURL=migration-log.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/commands/migration-log.ts"],"mappings":";;;;;;;UAgCU,mBAAA,SAA4B,oBAAoB;EAAA,SAC/C,EAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,iBAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,aAAA;EAAA,SACA,cAAA;EAAA,SACA,SAAA;AAAA;AAAA,UAGM,kBAAA;EAAA,SACN,EAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA,WAAkB,iBAAiB;EAAA,SACnC,OAAA;AAAA;AAAA,iBAGW,0BAAA,CACpB,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,kBAAA,EAAoB,kBAAA;AAAA,iBA8GtB,yBAAA,CAAA,GAA6B,OAAO"}
1
+ {"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/commands/migration-log.ts"],"mappings":";;;;;;;;;UAqCU,mBAAA,SAA4B,oBAAoB;EAAA,SAC/C,EAAA;EAAA,SACA,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;AAAA;AAAA,iBAGW,0BAAA,CACpB,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,UAAgB,iBAAA,IAAqB,kBAAA;AAAA,iBA0DhC,yBAAA,CAAA,GAA6B,OAAO"}
@@ -1,138 +1,2 @@
1
- import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { A as CliStructuredError, F as errorDatabaseConnectionRequired, L as errorDriverRequired, T as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, nt as mapMigrationToolsError, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorUnexpected, u as setCommandExamples, y as handleResult } from "../command-helpers-Bbw1GbwL.mjs";
3
- import { t as createControlClient } from "../client-KgJorIvG.mjs";
4
- import { r as buildReadAggregate } from "../contract-space-aggregate-loader-DvZwdkrr.mjs";
5
- import { Command } from "commander";
6
- import { notOk, ok } from "@prisma-next/utils/result";
7
- import { cyan, dim } from "colorette";
8
- import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
9
- import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
10
- import { findPath } from "@prisma-next/migration-tools/migration-graph";
11
- //#region src/commands/migration-log.ts
12
- async function executeMigrationLogCommand(options, flags, ui) {
13
- const config = await loadConfig(options.config);
14
- const { configPath, appMigrationsRelative, migrationsDir } = resolveMigrationPaths(options.config, config);
15
- const dbConnection = options.db ?? config.db?.connection;
16
- if (!dbConnection) return notOk(errorDatabaseConnectionRequired({
17
- why: `Database connection is required for migration log (set db.connection in ${configPath}, or pass --db <url>)`,
18
- commandName: "migration log"
19
- }));
20
- if (!config.driver) return notOk(errorDriverRequired({ why: "Config.driver is required for migration log" }));
21
- if (!targetSupportsMigrations(config.target)) return notOk(errorUnexpected("Target does not support migrations"));
22
- if (!flags.json && !flags.quiet) {
23
- const header = formatStyledHeader({
24
- command: "migration log",
25
- description: "Show executed migration history",
26
- details: [
27
- {
28
- label: "config",
29
- value: configPath
30
- },
31
- {
32
- label: "migrations",
33
- value: appMigrationsRelative
34
- },
35
- ...typeof dbConnection === "string" ? [{
36
- label: "database",
37
- value: maskConnectionUrl(dbConnection)
38
- }] : []
39
- ],
40
- flags
41
- });
42
- ui.stderr(header);
43
- }
44
- const loaded = await buildReadAggregate(config, { migrationsDir });
45
- if (!loaded.ok) return loaded;
46
- const graph = loaded.value.aggregate.app.graph();
47
- const bundles = loaded.value.aggregate.app.packages;
48
- const client = createControlClient({
49
- family: config.family,
50
- target: config.target,
51
- adapter: config.adapter,
52
- driver: config.driver,
53
- extensionPacks: config.extensionPacks ?? []
54
- });
55
- try {
56
- await client.connect(dbConnection);
57
- const markerHash = (await client.readMarker())?.storageHash ?? null;
58
- if (!markerHash) return ok({
59
- ok: true,
60
- markerHash: null,
61
- applied: [],
62
- summary: "No migrations applied (database has no marker)"
63
- });
64
- const appliedPath = findPath(graph, EMPTY_CONTRACT_HASH, markerHash);
65
- if (appliedPath === null) return notOk(errorUnexpected("Database marker is not reachable from migration history", {
66
- why: `Marker hash ${markerHash} is not reachable from the root of the on-disk migration graph.`,
67
- fix: "The database may have been migrated outside this project. Use `migration status` to inspect the current state."
68
- }));
69
- const pkgByDirName = new Map(bundles.map((p) => [p.dirName, p]));
70
- const entries = appliedPath.map((edge) => {
71
- const ops = pkgByDirName.get(edge.dirName)?.ops ?? [];
72
- return {
73
- dirName: edge.dirName,
74
- from: edge.from,
75
- to: edge.to,
76
- migrationHash: edge.migrationHash,
77
- operationCount: ops.length,
78
- createdAt: edge.createdAt
79
- };
80
- });
81
- return ok({
82
- ok: true,
83
- markerHash,
84
- applied: entries,
85
- summary: `${entries.length} migration(s) applied`
86
- });
87
- } catch (error) {
88
- if (CliStructuredError.is(error)) return notOk(error);
89
- if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
90
- return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read migration log: ${error instanceof Error ? error.message : String(error)}` }));
91
- } finally {
92
- await client.close();
93
- }
94
- }
95
- function createMigrationLogCommand() {
96
- const command = new Command("log");
97
- setCommandDescriptions(command, "Show executed migration history", "Reads the database marker and displays the applied migration chain\nfrom the initial state to the current marker position.");
98
- setCommandExamples(command, ["prisma-next migration log --db $DATABASE_URL", "prisma-next migration log --json --db $DATABASE_URL"]);
99
- setCommandSeeAlso(command, [
100
- {
101
- verb: "migration status",
102
- oneLiner: "Show migration path and pending status"
103
- },
104
- {
105
- verb: "migration list",
106
- oneLiner: "List on-disk migrations"
107
- },
108
- {
109
- verb: "migration graph",
110
- oneLiner: "Show the migration graph topology"
111
- },
112
- {
113
- verb: "migration show",
114
- oneLiner: "Display migration package contents"
115
- }
116
- ]);
117
- addGlobalOptions(command).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").action(async (options) => {
118
- const flags = parseGlobalFlagsOrExit(options);
119
- const ui = createTerminalUI(flags);
120
- const exitCode = handleResult(await executeMigrationLogCommand(options, flags, ui), flags, ui, (logResult) => {
121
- if (flags.json) ui.output(JSON.stringify(logResult, null, 2));
122
- else if (!flags.quiet) {
123
- const c = (fn, s) => flags.color !== false ? fn(s) : s;
124
- if (logResult.applied.length === 0) ui.log(logResult.summary);
125
- else {
126
- for (const entry of logResult.applied) ui.log(`${c(cyan, "✓")} ${entry.dirName} ${c(dim, entry.migrationHash.slice(0, 16) + "…")} ${entry.operationCount} op(s)`);
127
- ui.log(`\n${logResult.summary}`);
128
- }
129
- }
130
- });
131
- process.exit(exitCode);
132
- });
133
- return command;
134
- }
135
- //#endregion
1
+ import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-6rcHQSI4.mjs";
136
2
  export { createMigrationLogCommand, executeMigrationLogCommand };
137
-
138
- //# sourceMappingURL=migration-log.mjs.map
@@ -1,7 +1,7 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { $ as errorTargetMigrationNotSupported, A as CliStructuredError, R as errorFileNotFound, T as formatStyledHeader, X as errorRuntime, _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, r as getTargetMigrations, 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 { s as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-DvZwdkrr.mjs";
2
+ import { A as formatStyledHeader, F as CliStructuredError, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, ot as errorTargetMigrationNotSupported, r as getTargetMigrations, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-esJGBD4W.mjs";
3
+ import { t as assertFrameworkComponentsCompatible } from "../framework-components-BO9VO43s.mjs";
4
+ import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-CpNVrBqW.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-DEHjV8_s.mjs";
1
+ import { n as GlobalFlags } from "../global-flags-CV5LhrFg.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-9DJ7q7_z.mjs";
1
+ import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-CHu_erQ5.mjs";
2
2
  export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
@@ -1,31 +1,27 @@
1
- import { N as CliStructuredError } from "../types-Dt_SfqFm.mjs";
1
+ import { a as MigrationShowResult } from "../schemas-BL33A3i-.mjs";
2
2
  import { Command } from "commander";
3
- import { Result } from "@prisma-next/utils/result";
4
- import { OperationPreview } from "@prisma-next/framework-components/control";
5
3
 
6
4
  //#region src/commands/migration-show.d.ts
7
5
  interface MigrationShowPresent {
8
- readonly spaceId: string;
9
- readonly dirName: string;
10
- readonly dirPath: string;
11
- readonly from: string | null;
12
- readonly to: string;
13
- readonly migrationHash: string;
6
+ readonly space: string;
7
+ readonly name: string;
8
+ readonly fromContract: string | null;
9
+ readonly toContract: string;
10
+ readonly hash: string;
14
11
  readonly createdAt: string;
15
- readonly operations: readonly {
16
- readonly id: string;
17
- readonly label: string;
18
- readonly operationClass: string;
12
+ readonly operations: {
13
+ id: string;
14
+ label: string;
15
+ operationClass: string;
19
16
  }[];
20
- readonly preview: OperationPreview;
21
- readonly summary: string;
17
+ readonly preview: {
18
+ statements: {
19
+ text: string;
20
+ language: string;
21
+ }[];
22
+ };
22
23
  }
23
- interface MigrationShowResult {
24
- readonly ok: true;
25
- readonly migration: MigrationShowPresent;
26
- }
27
- declare function resolveAppTargetPath(target: string, appMigrationsDir: string, appMigrationsRelative: string): Result<string, CliStructuredError>;
28
24
  declare function createMigrationShowCommand(): Command;
29
25
  //#endregion
30
- export { MigrationShowPresent, MigrationShowResult, createMigrationShowCommand, resolveAppTargetPath };
26
+ export { MigrationShowPresent, type MigrationShowResult, createMigrationShowCommand };
31
27
  //# sourceMappingURL=migration-show.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":";;;;;;UA6CiB,oBAAA;EAAA,SACN,OAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,aAAA;EAAA,SACA,SAAA;EAAA,SACA,UAAA;IAAA,SACE,EAAA;IAAA,SACA,KAAA;IAAA,SACA,cAAA;EAAA;EAAA,SAEF,OAAA,EAAS,gBAAgB;EAAA,SACzB,OAAA;AAAA;AAAA,UAGM,mBAAA;EAAA,SACN,EAAA;EAAA,SACA,SAAA,EAAW,oBAAoB;AAAA;AAAA,iBAO1B,oBAAA,CACd,MAAA,UACA,gBAAA,UACA,qBAAA,WACC,MAAM,SAAS,kBAAA;AAAA,iBAqLF,0BAAA,CAAA,GAA8B,OAAO"}
1
+ {"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":";;;;UAkDiB,oBAAA;EAAA,SACN,KAAA;EAAA,SACA,IAAA;EAAA,SACA,YAAA;EAAA,SACA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,SAAA;EAAA,SACA,UAAA;IAAc,EAAA;IAAY,KAAA;IAAe,cAAA;EAAA;EAAA,SACzC,OAAA;IACP,UAAA;MAAc,IAAA;MAAc,QAAA;IAAA;EAAA;AAAA;AAAA,iBAgKhB,0BAAA,CAAA,GAA8B,OAAO"}
@@ -1,53 +1,35 @@
1
1
  import { t as loadConfig } from "../config-loader-B6sJjXTv.mjs";
2
- import { P as errorContractValidationFailed, R as errorFileNotFound, T as formatStyledHeader, X as errorRuntime, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, 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 createControlClient } from "../client-KgJorIvG.mjs";
4
- import { a as formatMigrationShowOutput } from "../migrations-Cv2jxNNK.mjs";
2
+ import { A as formatStyledHeader, B as errorContractValidationFailed, E as formatMigrationShowOutput, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-esJGBD4W.mjs";
3
+ import { t as createControlClient } from "../client-DC-UlBLy.mjs";
4
+ import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-UkxkgXnv.mjs";
5
5
  import { Command } from "commander";
6
6
  import { ifDefined } from "@prisma-next/utils/defined";
7
7
  import { notOk, ok } from "@prisma-next/utils/result";
8
- import { isAbsolute, relative, resolve } from "pathe";
8
+ import { relative } from "pathe";
9
9
  import { readFile } from "node:fs/promises";
10
10
  import { APP_SPACE_ID, createControlStack } from "@prisma-next/framework-components/control";
11
- import { loadContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
12
11
  import { castAs } from "@prisma-next/utils/casts";
12
+ import { loadContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
13
13
  import { parseMigrationRef } from "@prisma-next/migration-tools/ref-resolution";
14
14
  //#region src/commands/migration-show.ts
15
- function looksLikePath(target) {
16
- return target.includes("/") || target.includes("\\");
17
- }
18
- function resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative) {
19
- const targetPath = resolve(target);
20
- const relativeToApp = relative(appMigrationsDir, targetPath);
21
- if (relativeToApp === "" || relativeToApp === "." || relativeToApp.startsWith("..") || isAbsolute(relativeToApp)) return notOk(errorRuntime("Target must point to an app-space migration", {
22
- why: `Expected a path under ${appMigrationsRelative}, got ${target}`,
23
- fix: "Pass an app-space migration directory or use a hash prefix."
24
- }));
25
- return ok(targetPath);
26
- }
27
15
  function pkgToPresent(spaceId, pkg, client) {
28
16
  const ops = castAs(pkg.ops);
29
- const preview = client.toOperationPreview(ops) ?? { statements: [] };
17
+ const rawPreview = client.toOperationPreview(ops) ?? { statements: [] };
30
18
  return {
31
- spaceId,
32
- dirName: pkg.dirName,
33
- dirPath: relative(process.cwd(), pkg.dirPath),
34
- from: pkg.metadata.from,
35
- to: pkg.metadata.to,
36
- migrationHash: pkg.metadata.migrationHash,
19
+ space: spaceId,
20
+ name: pkg.dirName,
21
+ fromContract: pkg.metadata.from,
22
+ toContract: pkg.metadata.to,
23
+ hash: pkg.metadata.migrationHash,
37
24
  createdAt: pkg.metadata.createdAt,
38
25
  operations: ops.map((op) => ({
39
26
  id: op.id,
40
27
  label: op.label,
41
28
  operationClass: op.operationClass
42
29
  })),
43
- preview,
44
- summary: `${ops.length} operation(s)`
30
+ preview: { statements: [...rawPreview.statements] }
45
31
  };
46
32
  }
47
- function findPackageByDirPath(packages, resolvedDirPath) {
48
- const normalized = resolve(resolvedDirPath);
49
- return packages.find((p) => resolve(p.dirPath) === normalized);
50
- }
51
33
  async function executeMigrationShowCommand(target, options, flags, ui) {
52
34
  const config = await loadConfig(options.config);
53
35
  const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } = resolveMigrationPaths(options.config, config);
@@ -139,15 +121,21 @@ async function executeMigrationShowCommand(target, options, flags, ui) {
139
121
  }));
140
122
  appPkg = matchedPkg;
141
123
  }
124
+ const migration = pkgToPresent(APP_SPACE_ID, appPkg, client);
142
125
  return ok({
143
126
  ok: true,
144
- migration: pkgToPresent(APP_SPACE_ID, appPkg, client)
127
+ summary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,
128
+ migration
145
129
  });
146
130
  }
147
131
  function createMigrationShowCommand() {
148
132
  const command = new Command("show");
149
- setCommandDescriptions(command, "Display migration package contents", "Shows the operations, statement preview, and metadata for one app-space migration.\nAccepts a directory path, directory name, or hash prefix.");
150
- setCommandExamples(command, ["prisma-next migration show 20260101_100000_add_user", "prisma-next migration show sha256:a1b2c3"]);
133
+ setCommandDescriptions(command, "Display migration package contents", "Shows the operations, statement preview, and metadata for one app-space migration.\nAccepts a directory path, directory name, or hash prefix.\nOffline — does not consult the database.");
134
+ setCommandExamples(command, [
135
+ "prisma-next migration show 20260101_100000_add_user",
136
+ "prisma-next migration show sha256:a1b2c3",
137
+ "prisma-next migration show 20260101_100000_add_user --json"
138
+ ]);
151
139
  setCommandSeeAlso(command, [
152
140
  {
153
141
  verb: "migration status",
@@ -166,7 +154,7 @@ function createMigrationShowCommand() {
166
154
  oneLiner: "Show the migration graph topology"
167
155
  }
168
156
  ]);
169
- addGlobalOptions(command).argument("<target>", "Migration reference: directory name, hash/prefix, or path").option("--config <path>", "Path to prisma-next.config.ts").action(async (target, options) => {
157
+ addGlobalOptions(command).argument("<target>", "Migration reference: directory name, hash/prefix, ref, or path").option("--config <path>", "Path to prisma-next.config.ts").action(async (target, options) => {
170
158
  const flags = parseGlobalFlagsOrExit(options);
171
159
  const ui = createTerminalUI(flags);
172
160
  const exitCode = handleResult(await executeMigrationShowCommand(target, options, flags, ui), flags, ui, (showResult) => {
@@ -178,6 +166,6 @@ function createMigrationShowCommand() {
178
166
  return command;
179
167
  }
180
168
  //#endregion
181
- export { createMigrationShowCommand, resolveAppTargetPath };
169
+ export { createMigrationShowCommand };
182
170
 
183
171
  //# sourceMappingURL=migration-show.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-show.mjs","names":[],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport {\n APP_SPACE_ID,\n createControlStack,\n type MigrationPlanOperation,\n type OperationPreview,\n} from '@prisma-next/framework-components/control';\nimport { loadContractSpaceAggregate } from '@prisma-next/migration-tools/aggregate';\nimport type { OnDiskMigrationPackage } from '@prisma-next/migration-tools/package';\nimport { parseMigrationRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { castAs } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { isAbsolute, relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n type CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorRuntime,\n errorUnexpected,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { formatMigrationShowOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface MigrationShowOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport interface MigrationShowPresent {\n readonly spaceId: string;\n readonly dirName: string;\n readonly dirPath: string;\n readonly from: string | null;\n readonly to: string;\n readonly migrationHash: string;\n readonly createdAt: string;\n readonly operations: readonly {\n readonly id: string;\n readonly label: string;\n readonly operationClass: string;\n }[];\n readonly preview: OperationPreview;\n readonly summary: string;\n}\n\nexport interface MigrationShowResult {\n readonly ok: true;\n readonly migration: MigrationShowPresent;\n}\n\nfunction looksLikePath(target: string): boolean {\n return target.includes('/') || target.includes('\\\\');\n}\n\nexport function resolveAppTargetPath(\n target: string,\n appMigrationsDir: string,\n appMigrationsRelative: string,\n): Result<string, CliStructuredError> {\n const targetPath = resolve(target);\n const relativeToApp = relative(appMigrationsDir, targetPath);\n const isOutsideAppDir =\n relativeToApp === '' ||\n relativeToApp === '.' ||\n relativeToApp.startsWith('..') ||\n isAbsolute(relativeToApp);\n if (isOutsideAppDir) {\n return notOk(\n errorRuntime('Target must point to an app-space migration', {\n why: `Expected a path under ${appMigrationsRelative}, got ${target}`,\n fix: 'Pass an app-space migration directory or use a hash prefix.',\n }),\n );\n }\n return ok(targetPath);\n}\n\nfunction pkgToPresent(\n spaceId: string,\n pkg: OnDiskMigrationPackage,\n client: ReturnType<typeof createControlClient>,\n): MigrationShowPresent {\n const ops = castAs<readonly MigrationPlanOperation[]>(pkg.ops);\n const preview: OperationPreview = client.toOperationPreview(ops) ?? { statements: [] };\n return {\n spaceId,\n dirName: pkg.dirName,\n dirPath: relative(process.cwd(), pkg.dirPath),\n from: pkg.metadata.from,\n to: pkg.metadata.to,\n migrationHash: pkg.metadata.migrationHash,\n createdAt: pkg.metadata.createdAt,\n operations: ops.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n preview,\n summary: `${ops.length} operation(s)`,\n };\n}\n\nfunction findPackageByDirPath(\n packages: readonly OnDiskMigrationPackage[],\n resolvedDirPath: string,\n): OnDiskMigrationPackage | undefined {\n const normalized = resolve(resolvedDirPath);\n return packages.find((p) => resolve(p.dirPath) === normalized);\n}\n\nasync function executeMigrationShowCommand(\n target: string,\n options: MigrationShowOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationShowResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } =\n resolveMigrationPaths(options.config, config);\n\n const contractPathAbsolute = resolveContractPath(config);\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration show',\n description: 'Display migration package contents',\n details: [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n { label: 'migrations', value: appMigrationsRelative },\n { label: 'target', value: target },\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n ...ifDefined('driver', config.driver),\n extensionPacks: config.extensionPacks ?? [],\n });\n\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as NodeJS.ErrnoException).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to read contract file',\n }),\n );\n }\n\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n let appContract: Contract;\n try {\n appContract = familyInstance.deserializeContract(\n castAs<unknown>(JSON.parse(contractJsonContent)),\n );\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n const aggregate = await loadContractSpaceAggregate({\n migrationsDir,\n appContract,\n deserializeContract: (json: unknown) => familyInstance.deserializeContract(json),\n });\n\n const packages = aggregate.app.packages;\n const graph = aggregate.app.graph();\n const refs = aggregate.app.refs;\n\n let appPkg: OnDiskMigrationPackage;\n if (looksLikePath(target)) {\n const resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n if (!resolved.ok) return resolved;\n const matched = findPackageByDirPath(packages, resolved.value);\n if (!matched) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n fix: 'Pass a directory name, hash prefix, or path to an on-disk app-space migration package.',\n }),\n );\n }\n appPkg = matched;\n } else {\n if (packages.length === 0) {\n return notOk(\n errorRuntime('No migrations found', {\n why: `No migration packages found in ${appMigrationsRelative}`,\n fix: 'Run `prisma-next migration plan` to create a migration first.',\n }),\n );\n }\n const migResult = parseMigrationRef(target, { graph, refs });\n if (!migResult.ok) {\n return notOk(mapRefResolutionError(migResult.failure));\n }\n const matchedPkg = packages.find(\n (p) => p.metadata.migrationHash === migResult.value.migrationHash,\n );\n if (!matchedPkg) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n appPkg = matchedPkg;\n }\n\n return ok({\n ok: true,\n migration: pkgToPresent(APP_SPACE_ID, appPkg, client),\n });\n}\n\nexport function createMigrationShowCommand(): Command {\n const command = new Command('show');\n setCommandDescriptions(\n command,\n 'Display migration package contents',\n 'Shows the operations, statement preview, and metadata for one app-space migration.\\n' +\n 'Accepts a directory path, directory name, or hash prefix.',\n );\n setCommandExamples(command, [\n 'prisma-next migration show 20260101_100000_add_user',\n 'prisma-next migration show sha256:a1b2c3',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n ]);\n addGlobalOptions(command)\n .argument('<target>', 'Migration reference: directory name, hash/prefix, or path')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (target: string, options: MigrationShowOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n\n const ui = createTerminalUI(flags);\n\n const result = await executeMigrationShowCommand(target, options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (showResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(showResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmEA,SAAS,cAAc,QAAyB;CAC9C,OAAO,OAAO,SAAS,GAAG,KAAK,OAAO,SAAS,IAAI;AACrD;AAEA,SAAgB,qBACd,QACA,kBACA,uBACoC;CACpC,MAAM,aAAa,QAAQ,MAAM;CACjC,MAAM,gBAAgB,SAAS,kBAAkB,UAAU;CAM3D,IAJE,kBAAkB,MAClB,kBAAkB,OAClB,cAAc,WAAW,IAAI,KAC7B,WAAW,aAAa,GAExB,OAAO,MACL,aAAa,+CAA+C;EAC1D,KAAK,yBAAyB,sBAAsB,QAAQ;EAC5D,KAAK;CACP,CAAC,CACH;CAEF,OAAO,GAAG,UAAU;AACtB;AAEA,SAAS,aACP,SACA,KACA,QACsB;CACtB,MAAM,MAAM,OAA0C,IAAI,GAAG;CAC7D,MAAM,UAA4B,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,CAAC,EAAE;CACrF,OAAO;EACL;EACA,SAAS,IAAI;EACb,SAAS,SAAS,QAAQ,IAAI,GAAG,IAAI,OAAO;EAC5C,MAAM,IAAI,SAAS;EACnB,IAAI,IAAI,SAAS;EACjB,eAAe,IAAI,SAAS;EAC5B,WAAW,IAAI,SAAS;EACxB,YAAY,IAAI,KAAK,QAAQ;GAC3B,IAAI,GAAG;GACP,OAAO,GAAG;GACV,gBAAgB,GAAG;EACrB,EAAE;EACF;EACA,SAAS,GAAG,IAAI,OAAO;CACzB;AACF;AAEA,SAAS,qBACP,UACA,iBACoC;CACpC,MAAM,aAAa,QAAQ,eAAe;CAC1C,OAAO,SAAS,MAAM,MAAM,QAAQ,EAAE,OAAO,MAAM,UAAU;AAC/D;AAEA,eAAe,4BACb,QACA,SACA,OACA,IAC0D;CAC1D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YA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B;GAAE,MAAM;GAAoB,UAAU;EAAyC;EAC/E;GAAE,MAAM;GAAiB,UAAU;EAAkC;EACrE;GAAE,MAAM;GAAkB,UAAU;EAA0B;EAC9D;GAAE,MAAM;GAAmB,UAAU;EAAoC;CAC3E,CAAC;CACD,iBAAiB,OAAO,EACrB,SAAS,YAAY,2DAA2D,EAChF,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,OAAO,QAAgB,YAAkC;EAC/D,MAAM,QAAQ,uBAAuB,OAAO;EAE5C,MAAM,KAAK,iBAAiB,KAAK;EAIjC,MAAM,WAAW,aAAa,MAFT,4BAA4B,QAAQ,SAAS,OAAO,EAAE,GAErC,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,OAChB,GAAG,IAAI,0BAA0B,YAAY,KAAK,CAAC;EAEvD,CAAC;EAED,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
1
+ {"version":3,"file":"migration-show.mjs","names":[],"sources":["../../src/commands/migration-show.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport {\n APP_SPACE_ID,\n createControlStack,\n type MigrationPlanOperation,\n} from '@prisma-next/framework-components/control';\nimport { loadContractSpaceAggregate } from '@prisma-next/migration-tools/aggregate';\nimport type { OnDiskMigrationPackage } from '@prisma-next/migration-tools/package';\nimport { parseMigrationRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { castAs } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { relative } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n type CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorRuntime,\n errorUnexpected,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n} from '../utils/command-helpers';\nimport { formatMigrationShowOutput } from '../utils/formatters/migrations';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport {\n findPackageByDirPath,\n looksLikePath,\n resolveAppTargetPath,\n} from '../utils/migration-path-target';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport type { MigrationShowResult } from './json/schemas';\n\ninterface MigrationShowOptions extends CommonCommandOptions {\n readonly config?: string;\n}\n\nexport interface MigrationShowPresent {\n readonly space: string;\n readonly name: string;\n readonly fromContract: string | null;\n readonly toContract: string;\n readonly hash: string;\n readonly createdAt: string;\n readonly operations: { id: string; label: string; operationClass: string }[];\n readonly preview: {\n statements: { text: string; language: string }[];\n };\n}\n\nexport type { MigrationShowResult };\n\nfunction pkgToPresent(\n spaceId: string,\n pkg: OnDiskMigrationPackage,\n client: ReturnType<typeof createControlClient>,\n): MigrationShowPresent {\n const ops = castAs<readonly MigrationPlanOperation[]>(pkg.ops);\n const rawPreview = client.toOperationPreview(ops) ?? { statements: [] };\n return {\n space: spaceId,\n name: pkg.dirName,\n fromContract: pkg.metadata.from,\n toContract: pkg.metadata.to,\n hash: pkg.metadata.migrationHash,\n createdAt: pkg.metadata.createdAt,\n operations: ops.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n preview: { statements: [...rawPreview.statements] },\n };\n}\n\nasync function executeMigrationShowCommand(\n target: string,\n options: MigrationShowOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationShowResult, CliStructuredError>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsDir, appMigrationsRelative } =\n resolveMigrationPaths(options.config, config);\n\n const contractPathAbsolute = resolveContractPath(config);\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n if (!flags.json && !flags.quiet) {\n const header = formatStyledHeader({\n command: 'migration show',\n description: 'Display migration package contents',\n details: [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n { label: 'migrations', value: appMigrationsRelative },\n { label: 'target', value: target },\n ],\n flags,\n });\n ui.stderr(header);\n }\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n ...ifDefined('driver', config.driver),\n extensionPacks: config.extensionPacks ?? [],\n });\n\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as NodeJS.ErrnoException).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to read contract file',\n }),\n );\n }\n\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n let appContract: Contract;\n try {\n appContract = familyInstance.deserializeContract(\n castAs<unknown>(JSON.parse(contractJsonContent)),\n );\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n const aggregate = await loadContractSpaceAggregate({\n migrationsDir,\n appContract,\n deserializeContract: (json: unknown) => familyInstance.deserializeContract(json),\n });\n\n const packages = aggregate.app.packages;\n const graph = aggregate.app.graph();\n const refs = aggregate.app.refs;\n\n let appPkg: OnDiskMigrationPackage;\n if (looksLikePath(target)) {\n const resolved = resolveAppTargetPath(target, appMigrationsDir, appMigrationsRelative);\n if (!resolved.ok) return resolved;\n const matched = findPackageByDirPath(packages, resolved.value);\n if (!matched) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `No loaded migration package at ${relative(process.cwd(), resolved.value)}`,\n fix: 'Pass a directory name, hash prefix, or path to an on-disk app-space migration package.',\n }),\n );\n }\n appPkg = matched;\n } else {\n if (packages.length === 0) {\n return notOk(\n errorRuntime('No migrations found', {\n why: `No migration packages found in ${appMigrationsRelative}`,\n fix: 'Run `prisma-next migration plan` to create a migration first.',\n }),\n );\n }\n const migResult = parseMigrationRef(target, { graph, refs });\n if (!migResult.ok) {\n return notOk(mapRefResolutionError(migResult.failure));\n }\n const matchedPkg = packages.find(\n (p) => p.metadata.migrationHash === migResult.value.migrationHash,\n );\n if (!matchedPkg) {\n return notOk(\n errorRuntime('Migration package not found', {\n why: `Resolved migration \"${migResult.value.dirName}\" but the package was not loaded`,\n fix: 'The migrations directory may be corrupted. Inspect the migration.json files.',\n }),\n );\n }\n appPkg = matchedPkg;\n }\n\n const migration = pkgToPresent(APP_SPACE_ID, appPkg, client);\n return ok({\n ok: true,\n summary: `Migration ${migration.name} in ${migration.space}: ${migration.operations.length} operation(s)`,\n migration,\n });\n}\n\nexport function createMigrationShowCommand(): Command {\n const command = new Command('show');\n setCommandDescriptions(\n command,\n 'Display migration package contents',\n 'Shows the operations, statement preview, and metadata for one app-space migration.\\n' +\n 'Accepts a directory path, directory name, or hash prefix.\\n' +\n 'Offline — does not consult the database.',\n );\n setCommandExamples(command, [\n 'prisma-next migration show 20260101_100000_add_user',\n 'prisma-next migration show sha256:a1b2c3',\n 'prisma-next migration show 20260101_100000_add_user --json',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration status', oneLiner: 'Show migration path and pending status' },\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n ]);\n addGlobalOptions(command)\n .argument('<target>', 'Migration reference: directory name, hash/prefix, ref, or path')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .action(async (target: string, options: MigrationShowOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n\n const ui = createTerminalUI(flags);\n\n const result = await executeMigrationShowCommand(target, options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (showResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(showResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;AAiEA,SAAS,aACP,SACA,KACA,QACsB;CACtB,MAAM,MAAM,OAA0C,IAAI,GAAG;CAC7D,MAAM,aAAa,OAAO,mBAAmB,GAAG,KAAK,EAAE,YAAY,CAAC,EAAE;CACtE,OAAO;EACL,OAAO;EACP,MAAM,IAAI;EACV,cAAc,IAAI,SAAS;EAC3B,YAAY,IAAI,SAAS;EACzB,MAAM,IAAI,SAAS;EACnB,WAAW,IAAI,SAAS;EACxB,YAAY,IAAI,KAAK,QAAQ;GAC3B,IAAI,GAAG;GACP,OAAO,GAAG;GACV,gBAAgB,GAAG;EACrB,EAAE;EACF,SAAS,EAAE,YAAY,CAAC,GAAG,WAAW,UAAU,EAAE;CACpD;AACF;AAEA,eAAe,4BACb,QACA,SACA,OACA,IAC0D;CAC1D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,kBAAkB,0BACnD,sBAAsB,QAAQ,QAAQ,MAAM;CAE9C,MAAM,uBAAuB,oBAAoB,MAAM;CACvD,MAAM,eAAe,SAAS,QAAQ,IAAI,GAAG,oBAAoB;CAEjE,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;KAAY,OAAO;IAAa;IACzC;KAAE,OAAO;KAAc,OAAO;IAAsB;IACpD;KAAE,OAAO;KAAU,OA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