@prisma-next/cli 0.12.0-dev.60 → 0.12.0-dev.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +12 -12
- package/dist/{client-DQvxtihf.mjs → client-ROablRVC.mjs} +8 -4
- package/dist/{client-DQvxtihf.mjs.map → client-ROablRVC.mjs.map} +1 -1
- package/dist/{command-helpers-CxHSiwEg.mjs → command-helpers-DGMvGBeX.mjs} +2 -2
- package/dist/{command-helpers-CxHSiwEg.mjs.map → command-helpers-DGMvGBeX.mjs.map} +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +4 -4
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.mjs +6 -5
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.mjs +3 -3
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +3 -3
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +3 -3
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.mjs +2 -2
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-gBvfOS8r.mjs → contract-at-errors-CFXsstzm.mjs} +2 -2
- package/dist/{contract-at-errors-gBvfOS8r.mjs.map → contract-at-errors-CFXsstzm.mjs.map} +1 -1
- package/dist/{contract-emit-By59Nmmn.mjs → contract-emit-B_qriF8B.mjs} +3 -3
- package/dist/{contract-emit-By59Nmmn.mjs.map → contract-emit-B_qriF8B.mjs.map} +1 -1
- package/dist/{contract-emit-OpMbysHj.mjs → contract-emit-C8HmtboH.mjs} +8 -3
- package/dist/contract-emit-C8HmtboH.mjs.map +1 -0
- package/dist/{contract-infer-BkyyYGDf.mjs → contract-infer-Bsp46T8u.mjs} +3 -3
- package/dist/{contract-infer-BkyyYGDf.mjs.map → contract-infer-Bsp46T8u.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-Bup14UkI.mjs → contract-space-aggregate-loader-ClI1KN6d.mjs} +4 -62
- package/dist/{contract-space-aggregate-loader-Bup14UkI.mjs.map → contract-space-aggregate-loader-ClI1KN6d.mjs.map} +1 -1
- package/dist/{db-verify-DbmfgeYc.mjs → db-verify-CMKyBJZH.mjs} +4 -4
- package/dist/{db-verify-DbmfgeYc.mjs.map → db-verify-CMKyBJZH.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/extension-pack-inputs-1ySHqxKG.mjs +62 -0
- package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +1 -0
- package/dist/{framework-components-CmBpbvzV.mjs → framework-components-YVQHhPH7.mjs} +2 -2
- package/dist/{framework-components-CmBpbvzV.mjs.map → framework-components-YVQHhPH7.mjs.map} +1 -1
- package/dist/{init-tidQpK21.mjs → init-0HwB-Vh8.mjs} +3 -3
- package/dist/{init-tidQpK21.mjs.map → init-0HwB-Vh8.mjs.map} +1 -1
- package/dist/{inspect-live-schema-CUvD_9uF.mjs → inspect-live-schema-CDXkYGh0.mjs} +3 -3
- package/dist/{inspect-live-schema-CUvD_9uF.mjs.map → inspect-live-schema-CDXkYGh0.mjs.map} +1 -1
- package/dist/{migration-check-BjNlXTGF.mjs → migration-check-VwM8xCZV.mjs} +6 -4
- package/dist/{migration-check-BjNlXTGF.mjs.map → migration-check-VwM8xCZV.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-DWlpBp98.mjs → migration-command-scaffold-BC3X6KBg.mjs} +3 -3
- package/dist/{migration-command-scaffold-DWlpBp98.mjs.map → migration-command-scaffold-BC3X6KBg.mjs.map} +1 -1
- package/dist/{migration-list-zP59uUBC.mjs → migration-list-CyLslAtv.mjs} +3 -3
- package/dist/{migration-list-zP59uUBC.mjs.map → migration-list-CyLslAtv.mjs.map} +1 -1
- package/dist/{migration-log-DoytJNuF.mjs → migration-log-DvC-Iq_k.mjs} +3 -3
- package/dist/{migration-log-DoytJNuF.mjs.map → migration-log-DvC-Iq_k.mjs.map} +1 -1
- package/dist/{migration-path-target-DjbhWi_5.mjs → migration-path-target-Ce6OZImp.mjs} +2 -2
- package/dist/{migration-path-target-DjbhWi_5.mjs.map → migration-path-target-Ce6OZImp.mjs.map} +1 -1
- package/dist/{migration-plan-CgCXpjYD.mjs → migration-plan-DUBRTJEl.mjs} +6 -5
- package/dist/{migration-plan-CgCXpjYD.mjs.map → migration-plan-DUBRTJEl.mjs.map} +1 -1
- package/dist/{migration-status-ByptVtRZ.mjs → migration-status-DnEW9YQn.mjs} +6 -5
- package/dist/{migration-status-ByptVtRZ.mjs.map → migration-status-DnEW9YQn.mjs.map} +1 -1
- package/dist/{telemetry-DVv3V0gj.mjs → telemetry-BIM4beEO.mjs} +2 -2
- package/dist/{telemetry-DVv3V0gj.mjs.map → telemetry-BIM4beEO.mjs.map} +1 -1
- package/dist/{verify-CJpG9m7-.mjs → verify-DcOYZ1tH.mjs} +2 -2
- package/dist/{verify-CJpG9m7-.mjs.map → verify-DcOYZ1tH.mjs.map} +1 -1
- package/package.json +18 -18
- package/src/control-api/client.ts +20 -0
- package/src/control-api/operations/contract-emit.ts +20 -0
- package/dist/contract-emit-OpMbysHj.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createContractEmitCommand } from "../contract-emit-
|
|
1
|
+
import { t as createContractEmitCommand } from "../contract-emit-B_qriF8B.mjs";
|
|
2
2
|
export { createContractEmitCommand };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createContractInferCommand } from "../contract-infer-
|
|
1
|
+
import { t as createContractInferCommand } from "../contract-infer-Bsp46T8u.mjs";
|
|
2
2
|
export { createContractInferCommand };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as errorContractValidationFailed, C as formatMigrationApplyOutput, F as CliStructuredError, T as formatMigrationPlanOutput, X as errorMigrationPlanningFailed, _ as createTerminalUI, c as sanitizeErrorMessage, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapMigrationToolsError, nt as errorRunnerFailed, rt as errorRuntime, s as resolveMigrationPaths, u as setCommandExamples, w as formatMigrationJson, y as handleResult } from "../command-helpers-
|
|
2
|
-
import { o as ContractValidationError } from "../client-
|
|
3
|
-
import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-
|
|
1
|
+
import { B as errorContractValidationFailed, C as formatMigrationApplyOutput, F as CliStructuredError, T as formatMigrationPlanOutput, X as errorMigrationPlanningFailed, _ as createTerminalUI, c as sanitizeErrorMessage, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapMigrationToolsError, nt as errorRunnerFailed, rt as errorRuntime, s as resolveMigrationPaths, u as setCommandExamples, w as formatMigrationJson, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
2
|
+
import { o as ContractValidationError } from "../client-ROablRVC.mjs";
|
|
3
|
+
import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-BC3X6KBg.mjs";
|
|
4
4
|
import { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from "../ref-advancement-BkXlikCA.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-
|
|
2
|
-
import { t as inspectLiveSchema } from "../inspect-live-schema-
|
|
3
|
-
import { n as formatIntrospectOutput, t as formatIntrospectJson } from "../verify-
|
|
1
|
+
import { _ as createTerminalUI, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
2
|
+
import { t as inspectLiveSchema } from "../inspect-live-schema-CDXkYGh0.mjs";
|
|
3
|
+
import { n as formatIntrospectOutput, t as formatIntrospectJson } from "../verify-DcOYZ1tH.mjs";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
//#region src/commands/db-schema.ts
|
|
6
6
|
function toIntrospectSchemaResult(result) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.mjs";
|
|
2
|
-
import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-
|
|
2
|
+
import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, o as resolveContractPath, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
3
3
|
import { t as createProgressAdapter } from "../progress-adapter-CjAeTxY_.mjs";
|
|
4
|
-
import { o as ContractValidationError, t as createControlClient } from "../client-
|
|
5
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
6
|
-
import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-
|
|
4
|
+
import { o as ContractValidationError, t as createControlClient } from "../client-ROablRVC.mjs";
|
|
5
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
6
|
+
import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-DcOYZ1tH.mjs";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
9
9
|
import { join, relative, resolve } from "pathe";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as errorContractValidationFailed, C as formatMigrationApplyOutput, F as CliStructuredError, H as errorDestructiveChanges, I as ERROR_CODE_DESTRUCTIVE_CHANGES, T as formatMigrationPlanOutput, X as errorMigrationPlanningFailed, _ as createTerminalUI, c as sanitizeErrorMessage, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapMigrationToolsError, nt as errorRunnerFailed, s as resolveMigrationPaths, u as setCommandExamples, ut as mapRefResolutionError, w as formatMigrationJson, y as handleResult } from "../command-helpers-
|
|
2
|
-
import { o as ContractValidationError } from "../client-
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
4
|
-
import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-
|
|
1
|
+
import { B as errorContractValidationFailed, C as formatMigrationApplyOutput, F as CliStructuredError, H as errorDestructiveChanges, I as ERROR_CODE_DESTRUCTIVE_CHANGES, T as formatMigrationPlanOutput, X as errorMigrationPlanningFailed, _ as createTerminalUI, c as sanitizeErrorMessage, ct as errorUnexpected, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, lt as mapMigrationToolsError, nt as errorRunnerFailed, s as resolveMigrationPaths, u as setCommandExamples, ut as mapRefResolutionError, w as formatMigrationJson, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
2
|
+
import { o as ContractValidationError } from "../client-ROablRVC.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
4
|
+
import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-BC3X6KBg.mjs";
|
|
5
5
|
import { i as readContractIR, n as computeRefAdvancementName, t as buildRefAdvancementFields } from "../ref-advancement-BkXlikCA.mjs";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createDbVerifyCommand } from "../db-verify-
|
|
1
|
+
import { t as createDbVerifyCommand } from "../db-verify-CMKyBJZH.mjs";
|
|
2
2
|
export { createDbVerifyCommand };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.mjs";
|
|
2
|
-
import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, J as errorMarkerMismatch, S as formatMigrationApplyCommandOutput, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Z as errorPathUnreachable, _ as createTerminalUI, ct as errorUnexpected, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, o as resolveContractPath, ot as errorTargetMigrationNotSupported, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, J as errorMarkerMismatch, S as formatMigrationApplyCommandOutput, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Z as errorPathUnreachable, _ as createTerminalUI, ct as errorUnexpected, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, o as resolveContractPath, ot as errorTargetMigrationNotSupported, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
3
|
+
import { t as toDeclaredExtensionsFromRaw } from "../extension-pack-inputs-1ySHqxKG.mjs";
|
|
4
|
+
import { n as planMemberPath, t as createControlClient } from "../client-ROablRVC.mjs";
|
|
5
|
+
import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
5
6
|
import { i as readContractIR, r as executeRefAdvancement } from "../ref-advancement-BkXlikCA.mjs";
|
|
6
|
-
import { t as mapContractAtError } from "../contract-at-errors-
|
|
7
|
+
import { t as mapContractAtError } from "../contract-at-errors-CFXsstzm.mjs";
|
|
7
8
|
import { _ as buildMigrationGraphLayout, a as computeMaxDirNameLengthForLayout, g as buildMigrationGraphRows, l as renderMigrationGraphTree, o as computeMaxEdgeTreePrefixWidthForLayout, r as indentMigrationGraphTreeBlock, s as formatOnPathMigrationRow } from "../migration-graph-space-render-Cpg0ql8v.mjs";
|
|
8
|
-
import { r as listRefsByContractHash } from "../migration-list-
|
|
9
|
+
import { r as listRefsByContractHash } from "../migration-list-CyLslAtv.mjs";
|
|
9
10
|
import { Command } from "commander";
|
|
10
11
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
11
12
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.mjs","names":[],"sources":["../../src/commands/migrate.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { createControlStack } from '@prisma-next/framework-components/control';\nimport { type ContractSpaceMember, requireHeadRef } from '@prisma-next/migration-tools/aggregate';\nimport { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';\nimport { errorUnknownInvariant, MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { findLatestMigration, isGraphNode } from '@prisma-next/migration-tools/migration-graph';\nimport { parseContractRef } from '@prisma-next/migration-tools/ref-resolution';\nimport type { RefEntry, Refs } from '@prisma-next/migration-tools/refs';\nimport { readRefs } from '@prisma-next/migration-tools/refs';\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 { planMemberPath } from '../control-api/operations/migrate';\nimport type {\n MigrateFailure,\n MigratePathDecision,\n PerSpaceExecutionEntry,\n} from '../control-api/types';\nimport {\n CliStructuredError,\n type CliStructuredError as CliStructuredErrorType,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFileNotFound,\n errorMarkerMismatch,\n errorPathUnreachable,\n errorRuntime,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n mapMigrationToolsError,\n mapRefResolutionError,\n requireLiveDatabase,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n collectDeclaredInvariants,\n maskConnectionUrl,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n targetSupportsMigrations,\n} from '../utils/command-helpers';\nimport { mapContractAtError } from '../utils/contract-at-errors';\nimport {\n buildReadAggregate,\n loadContractSpaceAggregateForCli,\n refuseContractSpaceIntegrity,\n} from '../utils/contract-space-aggregate-loader';\nimport { toDeclaredExtensionsFromRaw } from '../utils/extension-pack-inputs';\nimport { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';\nimport { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';\nimport { indentMigrationGraphTreeBlock } from '../utils/formatters/migration-graph-space-render';\nimport type { MigrationEdgeAnnotation } from '../utils/formatters/migration-graph-tree-render';\nimport {\n computeMaxDirNameLengthForLayout,\n computeMaxEdgeTreePrefixWidthForLayout,\n formatOnPathMigrationRow,\n renderMigrationGraphTree,\n} from '../utils/formatters/migration-graph-tree-render';\nimport { formatMigrationApplyCommandOutput } 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 { executeRefAdvancement, readContractIR } from '../utils/ref-advancement';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport { listRefsByContractHash } from './migration-list';\n\ninterface MigrateCommandOptions extends CommonCommandOptions {\n readonly db?: string;\n readonly config?: string;\n readonly to?: string;\n readonly advanceRef?: string;\n readonly show?: boolean;\n readonly from?: string;\n}\n\n/**\n * One migration that will run in a `migrate --show` preview, in execution order.\n */\nexport interface MigrateShowMigration {\n readonly spaceId: string;\n readonly dirName: string;\n readonly migrationHash: string;\n readonly from: string;\n readonly to: string;\n}\n\n/** Result returned by `migrate --show`. Read-only; no writes performed. */\nexport interface MigrateShowResult {\n readonly ok: true;\n readonly migrations: readonly MigrateShowMigration[];\n readonly summary: string;\n /**\n * Pre-rendered Tier-3 graph tree for human output. Off-path migrations render\n * dim; on-path migrations render in ordinary colours. Only present in human\n * (non-JSON) mode.\n */\n readonly graphOutput?: string;\n /**\n * Name column width for the \"Will run, in order:\" list — globally aligned with\n * every graph-tree section. Only present in human (non-JSON) mode.\n */\n readonly runListDirNameWidth?: number;\n /**\n * Left-pad offset (number of blank spaces) matching the graph's data-column\n * offset (`globalMaxEdgeTreePrefixWidth`). Used to align list rows with graph\n * rows so every `→` in the output (graph + list) lands at the same column.\n * Only present in human (non-JSON) mode when multiple spaces are rendered.\n */\n readonly runListLeftPad?: number;\n}\n\nexport interface MigrateResult {\n readonly ok: boolean;\n readonly migrationsApplied: number;\n readonly migrationsTotal: number;\n readonly markerHash: string;\n readonly applied: readonly {\n readonly spaceId: string;\n readonly dirName: string;\n readonly migrationHash: string;\n readonly from: string;\n readonly to: string;\n readonly operationsExecuted: number;\n }[];\n readonly summary: string;\n readonly perSpace: readonly PerSpaceExecutionEntry[];\n readonly pathDecision?: MigratePathDecision;\n readonly timings: {\n readonly total: number;\n };\n readonly advancedRef?: { readonly name: string; readonly hash: string } | null;\n}\n\n/**\n * Read-only preview of the migration path `migrate` will take.\n *\n * Computes the path through the SAME seam as `executeMigrate`:\n * - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n * the full marker including `invariants` (not just `storageHash`).\n * - `planMemberPath()` (shared with `executeMigrate`) for per-member path selection,\n * which feeds `graphWalkStrategy()` with the same target hash, target invariants,\n * and current marker as the real apply path uses.\n *\n * Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n * DB state is mutated.\n */\nasync function executeMigrateShowCommand(\n options: MigrateCommandOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrateShowResult, CliStructuredErrorType>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n const dbConnection = options.db ?? config.db?.connection;\n const hasDriver = !!config.driver;\n const hasExplicitFrom = options.from !== undefined;\n\n // When --from is omitted we read the live DB marker (same as migrate's default).\n // When --from is given, we're in offline hypothetical mode — no connection needed.\n if (!hasExplicitFrom) {\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: 'migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)',\n retryCommand: 'prisma-next migrate --show --from <contract>',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n }\n\n let allRefs: Refs = {};\n try {\n allRefs = await readRefs(refsDir);\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n const { aggregate, contractHash } = loaded.value;\n const appGraph = aggregate.app.graph();\n\n // Resolve the --to target (defaults to the on-disk contract, same as migrate).\n // Also capture the ref's invariants so planMemberPath feeds graphWalkStrategy the\n // same target invariants that real migrate would use (refInvariants ?? headRef.invariants).\n let targetHash: string = contractHash;\n let refInvariants: readonly string[] | undefined;\n if (options.to) {\n const toResult = parseContractRef(options.to, {\n graph: appGraph,\n refs: allRefs,\n contractHash,\n });\n if (!toResult.ok) {\n return notOk(mapRefResolutionError(toResult.failure));\n }\n if (toResult.value.provenance.kind === 'reserved-db') {\n return notOk(\n errorDatabaseConnectionRequired({\n why: '@db is not valid as a --to target; it names the live database state, not a target contract.',\n commandName: 'migrate --show',\n }),\n );\n }\n targetHash = toResult.value.hash;\n if (toResult.value.provenance.kind === 'ref') {\n const refEntry = allRefs[toResult.value.provenance.refName];\n if (refEntry) refInvariants = refEntry.invariants;\n }\n }\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ];\n if (dbConnection && !hasExplicitFrom) {\n details.push({ label: 'database', value: maskConnectionUrl(String(dbConnection)) });\n }\n if (options.from) {\n details.push({ label: 'from', value: options.from });\n }\n if (options.to) {\n details.push({ label: 'to', value: options.to });\n }\n const header = formatStyledHeader({\n command: 'migrate --show',\n description: 'Preview the migration path migrate will take (read-only)',\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n // Resolve the from-state.\n // - Explicit --from: parse it offline (no connection).\n // - Omitted: read the live DB marker via readAllMarkers() — the same source migrate uses.\n //\n // Full marker records (storageHash + invariants) are preserved so planMemberPath\n // can feed graphWalkStrategy the complete currentMarker — exactly as executeMigrate\n // does via familyInstance.readAllMarkers(). A stripped { storageHash, invariants: [] }\n // marker would produce a different `required` set and a different (incorrect) path.\n type LiveMarker = { readonly storageHash: string; readonly invariants: readonly string[] };\n const markerBySpace = new Map<string, LiveMarker | null>();\n const allMembers: ReadonlyArray<ContractSpaceMember> = [aggregate.app, ...aggregate.extensions];\n\n if (hasExplicitFrom) {\n // @db with explicit --from requires a connection\n if (options.from === '@db') {\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: '@db resolves to the live database marker and requires a --db connection',\n retryCommand: 'prisma-next migrate --show --from @db --db $DATABASE_URL',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n // Fall through to the connection path below\n } else {\n const fromResult = parseContractRef(options.from, {\n graph: appGraph,\n refs: allRefs,\n contractHash,\n });\n if (!fromResult.ok) {\n return notOk(mapRefResolutionError(fromResult.failure));\n }\n if (fromResult.value.provenance.kind === 'reserved-db') {\n // Unreachable given the @db branch above, but guard for safety\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: '@db resolves to the live database marker and requires a --db connection',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n } else {\n // Offline hypothetical: the --from ref only carries a hash (no live invariants).\n // Apply the from-hash marker to the APP space only. Extension spaces are left\n // absent from markerBySpace (treated as null / greenfield by planMemberPath),\n // so they plan from their own marker → own head — exactly as executeMigrate does.\n const fromHash = fromResult.value.hash;\n const offlineMarker: LiveMarker | null =\n fromHash === EMPTY_CONTRACT_HASH ? null : { storageHash: fromHash, invariants: [] };\n markerBySpace.set(aggregate.app.spaceId, offlineMarker);\n }\n }\n }\n\n // If we need the live DB marker (no --from, or --from @db), connect and read.\n const needsLiveMarker = !hasExplicitFrom || options.from === '@db';\n if (needsLiveMarker) {\n if (!dbConnection || !hasDriver) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: 'A database connection is required to read the live marker for migrate --show',\n commandName: 'migrate --show',\n }),\n );\n }\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver!,\n extensionPacks: config.extensionPacks ?? [],\n });\n try {\n await client.connect(dbConnection);\n const allMarkers = await client.readAllMarkers();\n // Store the full marker record (storageHash + invariants) per space.\n // This is the same data executeMigrate uses via familyInstance.readAllMarkers().\n for (const member of allMembers) {\n const marker = allMarkers.get(member.spaceId);\n markerBySpace.set(member.spaceId, marker ?? null);\n }\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n }\n\n // Walk the path via planMemberPath — the same helper executeMigrate uses.\n // planMemberPath feeds graphWalkStrategy identical inputs (targetHash, targetInvariants,\n // currentMarker with full invariants), so the preview path is always the path migrate runs.\n //\n // Canonical schedule order: extensions alphabetically first, then app — mirroring the\n // runner's `applyOrder` in operations/migrate.ts so the \"Will run, in order:\" list\n // reflects the actual execution sequence (extensions install first, app last).\n const canonicalOrderMembers: ReadonlyArray<ContractSpaceMember> = [\n ...aggregate.extensions,\n aggregate.app,\n ];\n const orderedMigrations: MigrateShowMigration[] = [];\n for (const member of canonicalOrderMembers) {\n const isAppMember = member.spaceId === aggregate.app.spaceId;\n const headRef = requireHeadRef(member);\n const memberTargetHash = isAppMember ? targetHash : headRef.hash;\n const memberRefInvariants = isAppMember ? refInvariants : undefined;\n const liveMarker = markerBySpace.get(member.spaceId) ?? null;\n\n const outcome = planMemberPath({\n member,\n aggregate,\n targetHash: memberTargetHash,\n refInvariants: memberRefInvariants,\n liveMarker,\n });\n\n if (outcome.kind === 'at-head') {\n // Empty-graph member already at target — nothing to run for this space.\n continue;\n }\n if (outcome.kind === 'never-planned') {\n return notOk(\n errorPathUnreachable({\n code: 'MIGRATION_PATH_NOT_FOUND',\n summary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n why: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n meta: { spaceId: outcome.spaceId, target: outcome.targetHash, kind: 'neverPlanned' },\n }),\n );\n }\n if (outcome.kind === 'unreachable') {\n const fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n return notOk(\n errorPathUnreachable({\n code: 'MIGRATION_PATH_NOT_FOUND',\n summary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n why: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n meta: { spaceId: outcome.spaceId, from: fromHash, to: outcome.targetHash },\n }),\n );\n }\n if (outcome.kind === 'unsatisfiable') {\n return notOk(\n errorRuntime(`Missing required invariants for space \"${outcome.spaceId}\"`, {\n why: `The path requires invariants not available on disk: ${outcome.missing.join(', ')}`,\n }),\n );\n }\n\n for (const edge of outcome.plan.migrationEdges) {\n orderedMigrations.push({\n spaceId: member.spaceId,\n dirName: edge.dirName,\n migrationHash: edge.migrationHash,\n from: edge.from,\n to: edge.to,\n });\n }\n }\n\n const count = orderedMigrations.length;\n const summary =\n count === 0\n ? 'Already up to date — nothing to run'\n : `${count} migration${count === 1 ? '' : 's'} will run`;\n\n // Build the Tier-3 graph visualization (human mode only; skipped for --json).\n // Reuses the existing annotation hook — no parallel renderer.\n let graphOutput: string | undefined;\n let runListDirNameWidth: number | undefined;\n let runListLeftPad: number | undefined;\n if (!flags.json) {\n const onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));\n const colorize = flags.color !== false;\n\n // Build layouts for all spaces first so we can compute global column widths\n // before rendering. This ensures the name column, hash column, and ops column\n // start at the same horizontal offset across every space section AND the\n // \"Will run, in order:\" list below.\n const memberLayouts = allMembers.map((member) => {\n const isApp = member.spaceId === aggregate.app.spaceId;\n const memberGraph = member.graph();\n const rowModel = buildMigrationGraphRows(memberGraph, isApp ? { contractHash } : {});\n const layout = buildMigrationGraphLayout(rowModel);\n return { member, isApp, memberGraph, layout };\n });\n\n // Global max across all space layouts.\n const globalMaxEdgeTreePrefixWidth =\n memberLayouts.length > 1\n ? Math.max(\n ...memberLayouts.map(({ layout }) => computeMaxEdgeTreePrefixWidthForLayout(layout)),\n )\n : undefined;\n const globalMaxDirNameWidthFromLayouts =\n memberLayouts.length > 1\n ? Math.max(...memberLayouts.map(({ layout }) => computeMaxDirNameLengthForLayout(layout)))\n : undefined;\n // The run-list name column width must be at least as wide as the global tree dirName\n // width so that tree sections and the list align at the hash column.\n const runListMaxFromMigrations =\n orderedMigrations.length > 0\n ? Math.max(...orderedMigrations.map((m) => m.dirName.length))\n : 0;\n const globalMaxDirNameWidth =\n globalMaxDirNameWidthFromLayouts !== undefined\n ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations)\n : undefined;\n runListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;\n runListLeftPad = globalMaxEdgeTreePrefixWidth;\n\n // Render each space section with globally computed widths.\n const showSpaceHeadings = allMembers.length > 1;\n const sections: string[] = [];\n for (const { member, isApp, memberGraph, layout } of memberLayouts) {\n const edgeAnnotations = new Map<string, MigrationEdgeAnnotation>();\n for (const edge of memberGraph.migrationByHash.values()) {\n edgeAnnotations.set(edge.migrationHash, {\n pathHighlight: onPathHashes.has(edge.migrationHash) ? 'on-path' : 'off-path',\n });\n }\n const liveMarker = markerBySpace.get(member.spaceId) ?? null;\n const liveMarkerHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n const tree = renderMigrationGraphTree(layout, {\n contractHash,\n isAppSpace: isApp,\n ...(needsLiveMarker ? { dbHash: liveMarkerHash } : {}),\n refsByHash: listRefsByContractHash(member),\n edgeAnnotationsByHash: edgeAnnotations,\n colorize,\n ...(globalMaxEdgeTreePrefixWidth !== undefined ? { globalMaxEdgeTreePrefixWidth } : {}),\n ...(globalMaxDirNameWidth !== undefined ? { globalMaxDirNameWidth } : {}),\n });\n if (tree.length === 0) continue;\n if (showSpaceHeadings) {\n sections.push(`${member.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, ' ')}`);\n } else {\n sections.push(tree);\n }\n }\n graphOutput = sections.join('\\n\\n');\n }\n\n return ok({\n ok: true,\n migrations: orderedMigrations,\n summary,\n ...(graphOutput !== undefined ? { graphOutput } : {}),\n ...(runListDirNameWidth !== undefined ? { runListDirNameWidth } : {}),\n ...(runListLeftPad !== undefined ? { runListLeftPad } : {}),\n });\n}\n\nfunction formatMigrateShowOutput(result: MigrateShowResult, flags: GlobalFlags): string {\n if (flags.quiet) return '';\n const colorize = flags.color !== false;\n const lines: string[] = [];\n // Graph tree first (shows the full topology with on-path highlighted).\n if (result.graphOutput !== undefined && result.graphOutput.length > 0) {\n lines.push(result.graphOutput);\n lines.push('');\n }\n const n = result.migrations.length;\n if (n > 0) {\n // Consolidated header: one line replaces the old separate summary + blank +\n // \"Will run, in order:\" header.\n lines.push(`The following ${n} migration${n === 1 ? '' : 's'} will run:`);\n // Ordered list rendered through the SAME on-path row renderer as the tree.\n // `formatOnPathMigrationRow` uses PATH_HIGHLIGHT_STYLES.onPath so the list and\n // graph-tree rows are styled identically — changing the on-path colour in future\n // is a one-line edit in PATH_HIGHLIGHT_STYLES.\n //\n // Alignment anchor: the `→` arrow (source-hash onward) must land at the SAME\n // absolute column as in graph edge rows, across every graph section and this list.\n //\n // Multi-space output layout (space headings + 2-space indented tree sections):\n // Graph edge row: [2 heading][G gutter][D dirName][7 source] [→] [dest]\n // List row: [2 spaces][L dirName][ ][7 source] [→] [dest]\n // Alignment: 2 + G + D + 9 = 2 + L + 2 + 9 => L = G + D - 2\n //\n // Single-space output layout (flat tree, no heading indent):\n // Graph edge row: [G gutter][D dirName][7 source] [→] [dest]\n // List row: [2 spaces][L dirName][ ][7 source] [→] [dest]\n // Alignment: G + D + 9 = 2 + L + 2 + 9 => L = G + D - 4\n //\n // D (edgeDirNameWidth) = max(rawDirNameWidth + LABEL_GAP, MIN_HASH_DATA_COLUMN - G)\n // where LABEL_GAP = 2 and MIN_HASH_DATA_COLUMN = 25 (same constants as the renderer).\n //\n // runListLeftPad is set only for multi-space; undefined means single-space.\n const isMultiSpace = result.runListLeftPad !== undefined;\n const gutter = result.runListLeftPad ?? 0;\n const rawDirNameWidth =\n result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));\n const edgeDirNameWidth = Math.max(rawDirNameWidth + 2, 25 - gutter);\n const listDirNameWidth = gutter + edgeDirNameWidth - (isMultiSpace ? 2 : 4);\n for (const m of result.migrations) {\n lines.push(\n ` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, 'unicode')}`,\n );\n }\n } else {\n lines.push(result.summary);\n }\n return lines.join('\\n');\n}\n\nfunction mapApplyFailure(failure: MigrateFailure): CliStructuredErrorType {\n if (failure.code === 'MIGRATION_PATH_NOT_FOUND') {\n return errorPathUnreachable(failure);\n }\n return errorRuntime(failure.summary, {\n why: failure.why ?? 'Migration runner failed',\n fix: 'Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.',\n meta: failure.meta ?? {},\n });\n}\n\nasync function executeMigrateCommand(\n options: MigrateCommandOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<MigrateResult, CliStructuredErrorType>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n const dbConnection = options.db ?? config.db?.connection;\n if (!dbConnection) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n commandName: 'migrate',\n }),\n );\n }\n\n if (!config.driver) {\n return notOk(\n errorDriverRequired({\n why: 'Config.driver is required for migrate',\n }),\n );\n }\n\n if (!targetSupportsMigrations(config.target)) {\n return notOk(\n errorTargetMigrationNotSupported({\n why: `Target \"${config.target.id}\" does not support migrations`,\n }),\n );\n }\n\n const toArg = options.to;\n\n // Construct the family instance up-front so the on-disk contract read\n // crosses the serializer seam (`familyInstance.deserializeContract`) at\n // the read site. The downstream `client.migrate({ contract })`\n // re-validates internally (no harm — validation is idempotent), but\n // closing the gap at the read site is what makes the cast-pattern\n // lint enforceable and matches the other CLI commands. See TML-2536.\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n const contractPathAbsolute = resolveContractPath(config);\n let contractRaw: Contract;\n let contractContent: string;\n try {\n contractContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as { code?: string }).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 a valid contract.json, then retry.',\n }),\n );\n }\n return notOk(\n errorContractValidationFailed(\n `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n try {\n contractRaw = familyInstance.deserializeContract(JSON.parse(contractContent) as unknown);\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 loadedAggregate = await loadContractSpaceAggregateForCli({\n targetId: config.target.targetId,\n migrationsDir,\n appContract: contractRaw,\n extensionPacks: config.extensionPacks ?? [],\n deserializeContract: (json) => familyInstance.deserializeContract(json),\n });\n if (!loadedAggregate.ok) {\n return notOk(loadedAggregate.failure);\n }\n const aggregate = loadedAggregate.value;\n const integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n declaredExtensions: toDeclaredExtensionsFromRaw(\n (config.extensionPacks ?? []) as ReadonlyArray<unknown>,\n ),\n checkContracts: true,\n });\n if (integrityFailure) {\n return notOk(integrityFailure);\n }\n\n let refEntry: RefEntry | undefined;\n let refName: string | undefined;\n if (toArg) {\n const refs = aggregate.app.refs;\n const refResult = parseContractRef(toArg, { graph: aggregate.app.graph(), refs });\n if (!refResult.ok) {\n return notOk(mapRefResolutionError(refResult.failure));\n }\n if (refResult.value.provenance.kind === 'ref') {\n refName = refResult.value.provenance.refName;\n const resolved = refs[refName];\n if (resolved) refEntry = resolved;\n } else {\n refEntry = { hash: refResult.value.hash, invariants: [] };\n }\n }\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'migrations', value: appMigrationsRelative },\n ];\n if (typeof dbConnection === 'string') {\n details.push({\n label: 'database',\n value: maskConnectionUrl(dbConnection),\n });\n }\n if (toArg) {\n details.push({ label: 'to', value: toArg });\n }\n const header = formatStyledHeader({\n command: 'migrate',\n description: 'Apply planned migrations to advance the database',\n url: 'https://pris.ly/migrate',\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n const appGraph = aggregate.app.graph();\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver,\n extensionPacks: config.extensionPacks ?? [],\n });\n\n try {\n await client.connect(dbConnection);\n\n const allMarkers = await client.readAllMarkers();\n const appMarker = allMarkers.get('app') ?? null;\n\n if (appMarker !== null && !isGraphNode(appMarker.storageHash, appGraph)) {\n return notOk(\n errorMarkerMismatch(\n appMarker.storageHash,\n [...appGraph.nodes].sort(),\n findLatestMigration(appGraph)?.to ?? null,\n ),\n );\n }\n\n if (refEntry && refEntry.invariants.length > 0) {\n const declared = collectDeclaredInvariants(appGraph);\n const known = new Set<string>(declared);\n for (const id of appMarker?.invariants ?? []) known.add(id);\n const unknown = refEntry.invariants.filter((id) => !known.has(id));\n if (unknown.length > 0) {\n return notOk(\n mapMigrationToolsError(\n errorUnknownInvariant({\n ...ifDefined('refName', toArg),\n unknown,\n declared: [...declared].sort(),\n }),\n ),\n );\n }\n }\n\n if (!flags.quiet && !flags.json) {\n ui.step('Loading contract spaces…');\n }\n\n // When `--to` resolves to an on-disk graph node with a matching bundle,\n // verify and apply against THAT bundle's destination contract via\n // `contractAt` — not the emitted `contract.json`. With `--to` omitted,\n // or a target with no matching bundle, the emitted contract stays the\n // apply contract (the only migrate-specific default). The same\n // `contractAt` artifacts feed the optional ref-advancement snapshot.\n let applyContract: Contract = contractRaw;\n let snapshotContractJson: Record<string, unknown> = JSON.parse(contractContent);\n let snapshotContractDts: string | undefined;\n if (toArg && refEntry) {\n const targetHash = refEntry.hash;\n const matchingBundle = aggregate.app.packages.find((p) => p.metadata.to === targetHash);\n if (matchingBundle) {\n try {\n const at = await aggregate.app.contractAt(\n targetHash,\n refName !== undefined ? { refName } : undefined,\n );\n applyContract = at.contract;\n snapshotContractJson = at.contractJson as Record<string, unknown>;\n snapshotContractDts = at.contractDts;\n } catch (error) {\n return mapContractAtError(error, { artifactRole: 'to' });\n }\n }\n }\n\n const applyResult = await client.migrate({\n contract: applyContract,\n migrationsDir,\n ...ifDefined('refHash', refEntry?.hash),\n ...(refEntry?.invariants ? { refInvariants: refEntry.invariants } : {}),\n ...(refEntry !== undefined ? ifDefined('refName', toArg) : {}),\n });\n\n if (!applyResult.ok) {\n return notOk(mapApplyFailure(applyResult.failure));\n }\n\n const { value } = applyResult;\n\n let advancedRef: { name: string; hash: string } | null = null;\n if (options.advanceRef !== undefined) {\n try {\n const contractIR =\n snapshotContractDts !== undefined\n ? { contract: snapshotContractJson, contractDts: snapshotContractDts }\n : await readContractIR(snapshotContractJson, contractPathAbsolute);\n advancedRef = await executeRefAdvancement(\n refsDir,\n options.advanceRef,\n value.markerHash,\n contractIR,\n );\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n }\n\n return ok({\n ok: true,\n migrationsApplied: value.migrationsApplied,\n migrationsTotal: value.perSpace.length,\n markerHash: value.markerHash,\n applied: value.applied,\n summary: value.summary,\n perSpace: value.perSpace,\n ...ifDefined('pathDecision', value.pathDecision),\n timings: { total: Date.now() - startTime },\n advancedRef,\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createMigrateCommand(): Command {\n const command = new Command('migrate');\n setCommandDescriptions(\n command,\n 'Apply planned migrations to advance the database',\n 'Walks every contract space (app + extensions) and applies pending\\n' +\n 'on-disk migrations in canonical order (extensions alphabetically,\\n' +\n 'then app). Graph-walks the on-disk migration graph for every space.\\n' +\n 'Use --to to target a specific contract (hash, ref name, migration dir).\\n' +\n 'Use --show for a read-only preview of the path that would run.',\n );\n setCommandExamples(command, [\n 'prisma-next migrate --db $DATABASE_URL',\n 'prisma-next migrate --to production --db $DATABASE_URL',\n 'prisma-next migrate --to sha256:abc123 --db $DATABASE_URL',\n 'prisma-next migrate --show --db $DATABASE_URL',\n 'prisma-next migrate --show --from @contract --to production',\n ]);\n addGlobalOptions(command)\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option(\n '--to <contract>',\n 'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',\n )\n .option('--advance-ref <name>', 'Advance the named ref to the post-apply marker after success')\n .option('--show', 'Preview the migration path without applying (read-only)')\n .option(\n '--from <contract>',\n 'From-state for --show preview (@contract, @db, hash, ref name, or migration dir)',\n )\n .action(async (options: MigrateCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const startTime = Date.now();\n\n const ui = createTerminalUI(flags);\n\n if (options.show) {\n // Read-only path: compute the migration plan and print the ordered list.\n // NEVER reaches runMigration() or any write boundary.\n const result = await executeMigrateShowCommand(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 {\n // Print directly to stdout — not via ui.log() which injects Clack's │ gutter.\n ui.output(formatMigrateShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n return;\n }\n\n const result = await executeMigrateCommand(options, flags, ui, startTime);\n\n const exitCode = handleResult(result, flags, ui, (migrateResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(migrateResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,eAAe,0BACb,SACA,OACA,IAC4D;CAC5D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBACjE,QAAQ,QACR,MACF;CAEA,MAAM,eAAe,QAAQ,MAAM,OAAO,IAAI;CAC9C,MAAM,YAAY,CAAC,CAAC,OAAO;CAC3B,MAAM,kBAAkB,QAAQ,SAAS,KAAA;CAIzC,IAAI,CAAC,iBAAiB;EACpB,MAAM,YAAY,oBAAoB;GACpC;GACA;GACA,KAAK;GACL,cAAc;EAChB,CAAC;EACD,IAAI,WACF,OAAO,MAAM,SAAS;CAE1B;CAEA,IAAI,UAAgB,CAAC;CACrB,IAAI;EACF,UAAU,MAAM,SAAS,OAAO;CAClC,SAAS,OAAO;EACd,IAAI,oBAAoB,GAAG,KAAK,GAC9B,OAAO,MAAM,uBAAuB,KAAK,CAAC;EAE5C,MAAM;CACR;CAEA,MAAM,SAAS,MAAM,mBAAmB,QAAQ,EAAE,cAAc,CAAC;CACjE,IAAI,CAAC,OAAO,IACV,OAAO,MAAM,OAAO,OAAO;CAE7B,MAAM,EAAE,WAAW,iBAAiB,OAAO;CAC3C,MAAM,WAAW,UAAU,IAAI,MAAM;CAKrC,IAAI,aAAqB;CACzB,IAAI;CACJ,IAAI,QAAQ,IAAI;EACd,MAAM,WAAW,iBAAiB,QAAQ,IAAI;GAC5C,OAAO;GACP,MAAM;GACN;EACF,CAAC;EACD,IAAI,CAAC,SAAS,IACZ,OAAO,MAAM,sBAAsB,SAAS,OAAO,CAAC;EAEtD,IAAI,SAAS,MAAM,WAAW,SAAS,eACrC,OAAO,MACL,gCAAgC;GAC9B,KAAK;GACL,aAAa;EACf,CAAC,CACH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G,OAAO,wBAAwB,YAAY,KAAK,CAAC;GAExD,CAAC;GAED,QAAQ,KAAK,QAAQ;GACrB;EACF;EAIA,MAAM,WAAW,aAAa,MAFT,sBAAsB,SAAS,OAAO,IAAI,SAAS,GAElC,OAAO,KAAK,kBAAkB;GAClE,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,OAChB,GAAG,IAAI,kCAAkC,eAAe,KAAK,CAAC;EAElE,CAAC;EAED,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"migrate.mjs","names":[],"sources":["../../src/commands/migrate.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { createControlStack } from '@prisma-next/framework-components/control';\nimport { type ContractSpaceMember, requireHeadRef } from '@prisma-next/migration-tools/aggregate';\nimport { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';\nimport { errorUnknownInvariant, MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { findLatestMigration, isGraphNode } from '@prisma-next/migration-tools/migration-graph';\nimport { parseContractRef } from '@prisma-next/migration-tools/ref-resolution';\nimport type { RefEntry, Refs } from '@prisma-next/migration-tools/refs';\nimport { readRefs } from '@prisma-next/migration-tools/refs';\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 { planMemberPath } from '../control-api/operations/migrate';\nimport type {\n MigrateFailure,\n MigratePathDecision,\n PerSpaceExecutionEntry,\n} from '../control-api/types';\nimport {\n CliStructuredError,\n type CliStructuredError as CliStructuredErrorType,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFileNotFound,\n errorMarkerMismatch,\n errorPathUnreachable,\n errorRuntime,\n errorTargetMigrationNotSupported,\n errorUnexpected,\n mapMigrationToolsError,\n mapRefResolutionError,\n requireLiveDatabase,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n collectDeclaredInvariants,\n maskConnectionUrl,\n resolveContractPath,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n targetSupportsMigrations,\n} from '../utils/command-helpers';\nimport { mapContractAtError } from '../utils/contract-at-errors';\nimport {\n buildReadAggregate,\n loadContractSpaceAggregateForCli,\n refuseContractSpaceIntegrity,\n} from '../utils/contract-space-aggregate-loader';\nimport { toDeclaredExtensionsFromRaw } from '../utils/extension-pack-inputs';\nimport { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';\nimport { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';\nimport { indentMigrationGraphTreeBlock } from '../utils/formatters/migration-graph-space-render';\nimport type { MigrationEdgeAnnotation } from '../utils/formatters/migration-graph-tree-render';\nimport {\n computeMaxDirNameLengthForLayout,\n computeMaxEdgeTreePrefixWidthForLayout,\n formatOnPathMigrationRow,\n renderMigrationGraphTree,\n} from '../utils/formatters/migration-graph-tree-render';\nimport { formatMigrationApplyCommandOutput } 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 { executeRefAdvancement, readContractIR } from '../utils/ref-advancement';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport { listRefsByContractHash } from './migration-list';\n\ninterface MigrateCommandOptions extends CommonCommandOptions {\n readonly db?: string;\n readonly config?: string;\n readonly to?: string;\n readonly advanceRef?: string;\n readonly show?: boolean;\n readonly from?: string;\n}\n\n/**\n * One migration that will run in a `migrate --show` preview, in execution order.\n */\nexport interface MigrateShowMigration {\n readonly spaceId: string;\n readonly dirName: string;\n readonly migrationHash: string;\n readonly from: string;\n readonly to: string;\n}\n\n/** Result returned by `migrate --show`. Read-only; no writes performed. */\nexport interface MigrateShowResult {\n readonly ok: true;\n readonly migrations: readonly MigrateShowMigration[];\n readonly summary: string;\n /**\n * Pre-rendered Tier-3 graph tree for human output. Off-path migrations render\n * dim; on-path migrations render in ordinary colours. Only present in human\n * (non-JSON) mode.\n */\n readonly graphOutput?: string;\n /**\n * Name column width for the \"Will run, in order:\" list — globally aligned with\n * every graph-tree section. Only present in human (non-JSON) mode.\n */\n readonly runListDirNameWidth?: number;\n /**\n * Left-pad offset (number of blank spaces) matching the graph's data-column\n * offset (`globalMaxEdgeTreePrefixWidth`). Used to align list rows with graph\n * rows so every `→` in the output (graph + list) lands at the same column.\n * Only present in human (non-JSON) mode when multiple spaces are rendered.\n */\n readonly runListLeftPad?: number;\n}\n\nexport interface MigrateResult {\n readonly ok: boolean;\n readonly migrationsApplied: number;\n readonly migrationsTotal: number;\n readonly markerHash: string;\n readonly applied: readonly {\n readonly spaceId: string;\n readonly dirName: string;\n readonly migrationHash: string;\n readonly from: string;\n readonly to: string;\n readonly operationsExecuted: number;\n }[];\n readonly summary: string;\n readonly perSpace: readonly PerSpaceExecutionEntry[];\n readonly pathDecision?: MigratePathDecision;\n readonly timings: {\n readonly total: number;\n };\n readonly advancedRef?: { readonly name: string; readonly hash: string } | null;\n}\n\n/**\n * Read-only preview of the migration path `migrate` will take.\n *\n * Computes the path through the SAME seam as `executeMigrate`:\n * - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n * the full marker including `invariants` (not just `storageHash`).\n * - `planMemberPath()` (shared with `executeMigrate`) for per-member path selection,\n * which feeds `graphWalkStrategy()` with the same target hash, target invariants,\n * and current marker as the real apply path uses.\n *\n * Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n * DB state is mutated.\n */\nasync function executeMigrateShowCommand(\n options: MigrateCommandOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrateShowResult, CliStructuredErrorType>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n const dbConnection = options.db ?? config.db?.connection;\n const hasDriver = !!config.driver;\n const hasExplicitFrom = options.from !== undefined;\n\n // When --from is omitted we read the live DB marker (same as migrate's default).\n // When --from is given, we're in offline hypothetical mode — no connection needed.\n if (!hasExplicitFrom) {\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: 'migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)',\n retryCommand: 'prisma-next migrate --show --from <contract>',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n }\n\n let allRefs: Refs = {};\n try {\n allRefs = await readRefs(refsDir);\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n const { aggregate, contractHash } = loaded.value;\n const appGraph = aggregate.app.graph();\n\n // Resolve the --to target (defaults to the on-disk contract, same as migrate).\n // Also capture the ref's invariants so planMemberPath feeds graphWalkStrategy the\n // same target invariants that real migrate would use (refInvariants ?? headRef.invariants).\n let targetHash: string = contractHash;\n let refInvariants: readonly string[] | undefined;\n if (options.to) {\n const toResult = parseContractRef(options.to, {\n graph: appGraph,\n refs: allRefs,\n contractHash,\n });\n if (!toResult.ok) {\n return notOk(mapRefResolutionError(toResult.failure));\n }\n if (toResult.value.provenance.kind === 'reserved-db') {\n return notOk(\n errorDatabaseConnectionRequired({\n why: '@db is not valid as a --to target; it names the live database state, not a target contract.',\n commandName: 'migrate --show',\n }),\n );\n }\n targetHash = toResult.value.hash;\n if (toResult.value.provenance.kind === 'ref') {\n const refEntry = allRefs[toResult.value.provenance.refName];\n if (refEntry) refInvariants = refEntry.invariants;\n }\n }\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'migrations', value: migrationsRelative },\n ];\n if (dbConnection && !hasExplicitFrom) {\n details.push({ label: 'database', value: maskConnectionUrl(String(dbConnection)) });\n }\n if (options.from) {\n details.push({ label: 'from', value: options.from });\n }\n if (options.to) {\n details.push({ label: 'to', value: options.to });\n }\n const header = formatStyledHeader({\n command: 'migrate --show',\n description: 'Preview the migration path migrate will take (read-only)',\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n // Resolve the from-state.\n // - Explicit --from: parse it offline (no connection).\n // - Omitted: read the live DB marker via readAllMarkers() — the same source migrate uses.\n //\n // Full marker records (storageHash + invariants) are preserved so planMemberPath\n // can feed graphWalkStrategy the complete currentMarker — exactly as executeMigrate\n // does via familyInstance.readAllMarkers(). A stripped { storageHash, invariants: [] }\n // marker would produce a different `required` set and a different (incorrect) path.\n type LiveMarker = { readonly storageHash: string; readonly invariants: readonly string[] };\n const markerBySpace = new Map<string, LiveMarker | null>();\n const allMembers: ReadonlyArray<ContractSpaceMember> = [aggregate.app, ...aggregate.extensions];\n\n if (hasExplicitFrom) {\n // @db with explicit --from requires a connection\n if (options.from === '@db') {\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: '@db resolves to the live database marker and requires a --db connection',\n retryCommand: 'prisma-next migrate --show --from @db --db $DATABASE_URL',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n // Fall through to the connection path below\n } else {\n const fromResult = parseContractRef(options.from, {\n graph: appGraph,\n refs: allRefs,\n contractHash,\n });\n if (!fromResult.ok) {\n return notOk(mapRefResolutionError(fromResult.failure));\n }\n if (fromResult.value.provenance.kind === 'reserved-db') {\n // Unreachable given the @db branch above, but guard for safety\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: '@db resolves to the live database marker and requires a --db connection',\n });\n if (missingDb) {\n return notOk(missingDb);\n }\n } else {\n // Offline hypothetical: the --from ref only carries a hash (no live invariants).\n // Apply the from-hash marker to the APP space only. Extension spaces are left\n // absent from markerBySpace (treated as null / greenfield by planMemberPath),\n // so they plan from their own marker → own head — exactly as executeMigrate does.\n const fromHash = fromResult.value.hash;\n const offlineMarker: LiveMarker | null =\n fromHash === EMPTY_CONTRACT_HASH ? null : { storageHash: fromHash, invariants: [] };\n markerBySpace.set(aggregate.app.spaceId, offlineMarker);\n }\n }\n }\n\n // If we need the live DB marker (no --from, or --from @db), connect and read.\n const needsLiveMarker = !hasExplicitFrom || options.from === '@db';\n if (needsLiveMarker) {\n if (!dbConnection || !hasDriver) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: 'A database connection is required to read the live marker for migrate --show',\n commandName: 'migrate --show',\n }),\n );\n }\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver!,\n extensionPacks: config.extensionPacks ?? [],\n });\n try {\n await client.connect(dbConnection);\n const allMarkers = await client.readAllMarkers();\n // Store the full marker record (storageHash + invariants) per space.\n // This is the same data executeMigrate uses via familyInstance.readAllMarkers().\n for (const member of allMembers) {\n const marker = allMarkers.get(member.spaceId);\n markerBySpace.set(member.spaceId, marker ?? null);\n }\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n }\n\n // Walk the path via planMemberPath — the same helper executeMigrate uses.\n // planMemberPath feeds graphWalkStrategy identical inputs (targetHash, targetInvariants,\n // currentMarker with full invariants), so the preview path is always the path migrate runs.\n //\n // Canonical schedule order: extensions alphabetically first, then app — mirroring the\n // runner's `applyOrder` in operations/migrate.ts so the \"Will run, in order:\" list\n // reflects the actual execution sequence (extensions install first, app last).\n const canonicalOrderMembers: ReadonlyArray<ContractSpaceMember> = [\n ...aggregate.extensions,\n aggregate.app,\n ];\n const orderedMigrations: MigrateShowMigration[] = [];\n for (const member of canonicalOrderMembers) {\n const isAppMember = member.spaceId === aggregate.app.spaceId;\n const headRef = requireHeadRef(member);\n const memberTargetHash = isAppMember ? targetHash : headRef.hash;\n const memberRefInvariants = isAppMember ? refInvariants : undefined;\n const liveMarker = markerBySpace.get(member.spaceId) ?? null;\n\n const outcome = planMemberPath({\n member,\n aggregate,\n targetHash: memberTargetHash,\n refInvariants: memberRefInvariants,\n liveMarker,\n });\n\n if (outcome.kind === 'at-head') {\n // Empty-graph member already at target — nothing to run for this space.\n continue;\n }\n if (outcome.kind === 'never-planned') {\n return notOk(\n errorPathUnreachable({\n code: 'MIGRATION_PATH_NOT_FOUND',\n summary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n why: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n meta: { spaceId: outcome.spaceId, target: outcome.targetHash, kind: 'neverPlanned' },\n }),\n );\n }\n if (outcome.kind === 'unreachable') {\n const fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n return notOk(\n errorPathUnreachable({\n code: 'MIGRATION_PATH_NOT_FOUND',\n summary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n why: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n meta: { spaceId: outcome.spaceId, from: fromHash, to: outcome.targetHash },\n }),\n );\n }\n if (outcome.kind === 'unsatisfiable') {\n return notOk(\n errorRuntime(`Missing required invariants for space \"${outcome.spaceId}\"`, {\n why: `The path requires invariants not available on disk: ${outcome.missing.join(', ')}`,\n }),\n );\n }\n\n for (const edge of outcome.plan.migrationEdges) {\n orderedMigrations.push({\n spaceId: member.spaceId,\n dirName: edge.dirName,\n migrationHash: edge.migrationHash,\n from: edge.from,\n to: edge.to,\n });\n }\n }\n\n const count = orderedMigrations.length;\n const summary =\n count === 0\n ? 'Already up to date — nothing to run'\n : `${count} migration${count === 1 ? '' : 's'} will run`;\n\n // Build the Tier-3 graph visualization (human mode only; skipped for --json).\n // Reuses the existing annotation hook — no parallel renderer.\n let graphOutput: string | undefined;\n let runListDirNameWidth: number | undefined;\n let runListLeftPad: number | undefined;\n if (!flags.json) {\n const onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));\n const colorize = flags.color !== false;\n\n // Build layouts for all spaces first so we can compute global column widths\n // before rendering. This ensures the name column, hash column, and ops column\n // start at the same horizontal offset across every space section AND the\n // \"Will run, in order:\" list below.\n const memberLayouts = allMembers.map((member) => {\n const isApp = member.spaceId === aggregate.app.spaceId;\n const memberGraph = member.graph();\n const rowModel = buildMigrationGraphRows(memberGraph, isApp ? { contractHash } : {});\n const layout = buildMigrationGraphLayout(rowModel);\n return { member, isApp, memberGraph, layout };\n });\n\n // Global max across all space layouts.\n const globalMaxEdgeTreePrefixWidth =\n memberLayouts.length > 1\n ? Math.max(\n ...memberLayouts.map(({ layout }) => computeMaxEdgeTreePrefixWidthForLayout(layout)),\n )\n : undefined;\n const globalMaxDirNameWidthFromLayouts =\n memberLayouts.length > 1\n ? Math.max(...memberLayouts.map(({ layout }) => computeMaxDirNameLengthForLayout(layout)))\n : undefined;\n // The run-list name column width must be at least as wide as the global tree dirName\n // width so that tree sections and the list align at the hash column.\n const runListMaxFromMigrations =\n orderedMigrations.length > 0\n ? Math.max(...orderedMigrations.map((m) => m.dirName.length))\n : 0;\n const globalMaxDirNameWidth =\n globalMaxDirNameWidthFromLayouts !== undefined\n ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations)\n : undefined;\n runListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;\n runListLeftPad = globalMaxEdgeTreePrefixWidth;\n\n // Render each space section with globally computed widths.\n const showSpaceHeadings = allMembers.length > 1;\n const sections: string[] = [];\n for (const { member, isApp, memberGraph, layout } of memberLayouts) {\n const edgeAnnotations = new Map<string, MigrationEdgeAnnotation>();\n for (const edge of memberGraph.migrationByHash.values()) {\n edgeAnnotations.set(edge.migrationHash, {\n pathHighlight: onPathHashes.has(edge.migrationHash) ? 'on-path' : 'off-path',\n });\n }\n const liveMarker = markerBySpace.get(member.spaceId) ?? null;\n const liveMarkerHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n const tree = renderMigrationGraphTree(layout, {\n contractHash,\n isAppSpace: isApp,\n ...(needsLiveMarker ? { dbHash: liveMarkerHash } : {}),\n refsByHash: listRefsByContractHash(member),\n edgeAnnotationsByHash: edgeAnnotations,\n colorize,\n ...(globalMaxEdgeTreePrefixWidth !== undefined ? { globalMaxEdgeTreePrefixWidth } : {}),\n ...(globalMaxDirNameWidth !== undefined ? { globalMaxDirNameWidth } : {}),\n });\n if (tree.length === 0) continue;\n if (showSpaceHeadings) {\n sections.push(`${member.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, ' ')}`);\n } else {\n sections.push(tree);\n }\n }\n graphOutput = sections.join('\\n\\n');\n }\n\n return ok({\n ok: true,\n migrations: orderedMigrations,\n summary,\n ...(graphOutput !== undefined ? { graphOutput } : {}),\n ...(runListDirNameWidth !== undefined ? { runListDirNameWidth } : {}),\n ...(runListLeftPad !== undefined ? { runListLeftPad } : {}),\n });\n}\n\nfunction formatMigrateShowOutput(result: MigrateShowResult, flags: GlobalFlags): string {\n if (flags.quiet) return '';\n const colorize = flags.color !== false;\n const lines: string[] = [];\n // Graph tree first (shows the full topology with on-path highlighted).\n if (result.graphOutput !== undefined && result.graphOutput.length > 0) {\n lines.push(result.graphOutput);\n lines.push('');\n }\n const n = result.migrations.length;\n if (n > 0) {\n // Consolidated header: one line replaces the old separate summary + blank +\n // \"Will run, in order:\" header.\n lines.push(`The following ${n} migration${n === 1 ? '' : 's'} will run:`);\n // Ordered list rendered through the SAME on-path row renderer as the tree.\n // `formatOnPathMigrationRow` uses PATH_HIGHLIGHT_STYLES.onPath so the list and\n // graph-tree rows are styled identically — changing the on-path colour in future\n // is a one-line edit in PATH_HIGHLIGHT_STYLES.\n //\n // Alignment anchor: the `→` arrow (source-hash onward) must land at the SAME\n // absolute column as in graph edge rows, across every graph section and this list.\n //\n // Multi-space output layout (space headings + 2-space indented tree sections):\n // Graph edge row: [2 heading][G gutter][D dirName][7 source] [→] [dest]\n // List row: [2 spaces][L dirName][ ][7 source] [→] [dest]\n // Alignment: 2 + G + D + 9 = 2 + L + 2 + 9 => L = G + D - 2\n //\n // Single-space output layout (flat tree, no heading indent):\n // Graph edge row: [G gutter][D dirName][7 source] [→] [dest]\n // List row: [2 spaces][L dirName][ ][7 source] [→] [dest]\n // Alignment: G + D + 9 = 2 + L + 2 + 9 => L = G + D - 4\n //\n // D (edgeDirNameWidth) = max(rawDirNameWidth + LABEL_GAP, MIN_HASH_DATA_COLUMN - G)\n // where LABEL_GAP = 2 and MIN_HASH_DATA_COLUMN = 25 (same constants as the renderer).\n //\n // runListLeftPad is set only for multi-space; undefined means single-space.\n const isMultiSpace = result.runListLeftPad !== undefined;\n const gutter = result.runListLeftPad ?? 0;\n const rawDirNameWidth =\n result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));\n const edgeDirNameWidth = Math.max(rawDirNameWidth + 2, 25 - gutter);\n const listDirNameWidth = gutter + edgeDirNameWidth - (isMultiSpace ? 2 : 4);\n for (const m of result.migrations) {\n lines.push(\n ` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, 'unicode')}`,\n );\n }\n } else {\n lines.push(result.summary);\n }\n return lines.join('\\n');\n}\n\nfunction mapApplyFailure(failure: MigrateFailure): CliStructuredErrorType {\n if (failure.code === 'MIGRATION_PATH_NOT_FOUND') {\n return errorPathUnreachable(failure);\n }\n return errorRuntime(failure.summary, {\n why: failure.why ?? 'Migration runner failed',\n fix: 'Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.',\n meta: failure.meta ?? {},\n });\n}\n\nasync function executeMigrateCommand(\n options: MigrateCommandOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<MigrateResult, CliStructuredErrorType>> {\n const config = await loadConfig(options.config);\n const { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(\n options.config,\n config,\n );\n\n const dbConnection = options.db ?? config.db?.connection;\n if (!dbConnection) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n commandName: 'migrate',\n }),\n );\n }\n\n if (!config.driver) {\n return notOk(\n errorDriverRequired({\n why: 'Config.driver is required for migrate',\n }),\n );\n }\n\n if (!targetSupportsMigrations(config.target)) {\n return notOk(\n errorTargetMigrationNotSupported({\n why: `Target \"${config.target.id}\" does not support migrations`,\n }),\n );\n }\n\n const toArg = options.to;\n\n // Construct the family instance up-front so the on-disk contract read\n // crosses the serializer seam (`familyInstance.deserializeContract`) at\n // the read site. The downstream `client.migrate({ contract })`\n // re-validates internally (no harm — validation is idempotent), but\n // closing the gap at the read site is what makes the cast-pattern\n // lint enforceable and matches the other CLI commands. See TML-2536.\n const stack = createControlStack(config);\n const familyInstance = config.family.create(stack);\n\n const contractPathAbsolute = resolveContractPath(config);\n let contractRaw: Contract;\n let contractContent: string;\n try {\n contractContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as { code?: string }).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 a valid contract.json, then retry.',\n }),\n );\n }\n return notOk(\n errorContractValidationFailed(\n `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n try {\n contractRaw = familyInstance.deserializeContract(JSON.parse(contractContent) as unknown);\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 loadedAggregate = await loadContractSpaceAggregateForCli({\n targetId: config.target.targetId,\n migrationsDir,\n appContract: contractRaw,\n extensionPacks: config.extensionPacks ?? [],\n deserializeContract: (json) => familyInstance.deserializeContract(json),\n });\n if (!loadedAggregate.ok) {\n return notOk(loadedAggregate.failure);\n }\n const aggregate = loadedAggregate.value;\n const integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n declaredExtensions: toDeclaredExtensionsFromRaw(\n (config.extensionPacks ?? []) as ReadonlyArray<unknown>,\n ),\n checkContracts: true,\n });\n if (integrityFailure) {\n return notOk(integrityFailure);\n }\n\n let refEntry: RefEntry | undefined;\n let refName: string | undefined;\n if (toArg) {\n const refs = aggregate.app.refs;\n const refResult = parseContractRef(toArg, { graph: aggregate.app.graph(), refs });\n if (!refResult.ok) {\n return notOk(mapRefResolutionError(refResult.failure));\n }\n if (refResult.value.provenance.kind === 'ref') {\n refName = refResult.value.provenance.refName;\n const resolved = refs[refName];\n if (resolved) refEntry = resolved;\n } else {\n refEntry = { hash: refResult.value.hash, invariants: [] };\n }\n }\n\n if (!flags.json && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'migrations', value: appMigrationsRelative },\n ];\n if (typeof dbConnection === 'string') {\n details.push({\n label: 'database',\n value: maskConnectionUrl(dbConnection),\n });\n }\n if (toArg) {\n details.push({ label: 'to', value: toArg });\n }\n const header = formatStyledHeader({\n command: 'migrate',\n description: 'Apply planned migrations to advance the database',\n url: 'https://pris.ly/migrate',\n details,\n flags,\n });\n ui.stderr(header);\n }\n\n const appGraph = aggregate.app.graph();\n\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver,\n extensionPacks: config.extensionPacks ?? [],\n });\n\n try {\n await client.connect(dbConnection);\n\n const allMarkers = await client.readAllMarkers();\n const appMarker = allMarkers.get('app') ?? null;\n\n if (appMarker !== null && !isGraphNode(appMarker.storageHash, appGraph)) {\n return notOk(\n errorMarkerMismatch(\n appMarker.storageHash,\n [...appGraph.nodes].sort(),\n findLatestMigration(appGraph)?.to ?? null,\n ),\n );\n }\n\n if (refEntry && refEntry.invariants.length > 0) {\n const declared = collectDeclaredInvariants(appGraph);\n const known = new Set<string>(declared);\n for (const id of appMarker?.invariants ?? []) known.add(id);\n const unknown = refEntry.invariants.filter((id) => !known.has(id));\n if (unknown.length > 0) {\n return notOk(\n mapMigrationToolsError(\n errorUnknownInvariant({\n ...ifDefined('refName', toArg),\n unknown,\n declared: [...declared].sort(),\n }),\n ),\n );\n }\n }\n\n if (!flags.quiet && !flags.json) {\n ui.step('Loading contract spaces…');\n }\n\n // When `--to` resolves to an on-disk graph node with a matching bundle,\n // verify and apply against THAT bundle's destination contract via\n // `contractAt` — not the emitted `contract.json`. With `--to` omitted,\n // or a target with no matching bundle, the emitted contract stays the\n // apply contract (the only migrate-specific default). The same\n // `contractAt` artifacts feed the optional ref-advancement snapshot.\n let applyContract: Contract = contractRaw;\n let snapshotContractJson: Record<string, unknown> = JSON.parse(contractContent);\n let snapshotContractDts: string | undefined;\n if (toArg && refEntry) {\n const targetHash = refEntry.hash;\n const matchingBundle = aggregate.app.packages.find((p) => p.metadata.to === targetHash);\n if (matchingBundle) {\n try {\n const at = await aggregate.app.contractAt(\n targetHash,\n refName !== undefined ? { refName } : undefined,\n );\n applyContract = at.contract;\n snapshotContractJson = at.contractJson as Record<string, unknown>;\n snapshotContractDts = at.contractDts;\n } catch (error) {\n return mapContractAtError(error, { artifactRole: 'to' });\n }\n }\n }\n\n const applyResult = await client.migrate({\n contract: applyContract,\n migrationsDir,\n ...ifDefined('refHash', refEntry?.hash),\n ...(refEntry?.invariants ? { refInvariants: refEntry.invariants } : {}),\n ...(refEntry !== undefined ? ifDefined('refName', toArg) : {}),\n });\n\n if (!applyResult.ok) {\n return notOk(mapApplyFailure(applyResult.failure));\n }\n\n const { value } = applyResult;\n\n let advancedRef: { name: string; hash: string } | null = null;\n if (options.advanceRef !== undefined) {\n try {\n const contractIR =\n snapshotContractDts !== undefined\n ? { contract: snapshotContractJson, contractDts: snapshotContractDts }\n : await readContractIR(snapshotContractJson, contractPathAbsolute);\n advancedRef = await executeRefAdvancement(\n refsDir,\n options.advanceRef,\n value.markerHash,\n contractIR,\n );\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n }\n\n return ok({\n ok: true,\n migrationsApplied: value.migrationsApplied,\n migrationsTotal: value.perSpace.length,\n markerHash: value.markerHash,\n applied: value.applied,\n summary: value.summary,\n perSpace: value.perSpace,\n ...ifDefined('pathDecision', value.pathDecision),\n timings: { total: Date.now() - startTime },\n advancedRef,\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createMigrateCommand(): Command {\n const command = new Command('migrate');\n setCommandDescriptions(\n command,\n 'Apply planned migrations to advance the database',\n 'Walks every contract space (app + extensions) and applies pending\\n' +\n 'on-disk migrations in canonical order (extensions alphabetically,\\n' +\n 'then app). Graph-walks the on-disk migration graph for every space.\\n' +\n 'Use --to to target a specific contract (hash, ref name, migration dir).\\n' +\n 'Use --show for a read-only preview of the path that would run.',\n );\n setCommandExamples(command, [\n 'prisma-next migrate --db $DATABASE_URL',\n 'prisma-next migrate --to production --db $DATABASE_URL',\n 'prisma-next migrate --to sha256:abc123 --db $DATABASE_URL',\n 'prisma-next migrate --show --db $DATABASE_URL',\n 'prisma-next migrate --show --from @contract --to production',\n ]);\n addGlobalOptions(command)\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option(\n '--to <contract>',\n 'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',\n )\n .option('--advance-ref <name>', 'Advance the named ref to the post-apply marker after success')\n .option('--show', 'Preview the migration path without applying (read-only)')\n .option(\n '--from <contract>',\n 'From-state for --show preview (@contract, @db, hash, ref name, or migration dir)',\n )\n .action(async (options: MigrateCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const startTime = Date.now();\n\n const ui = createTerminalUI(flags);\n\n if (options.show) {\n // Read-only path: compute the migration plan and print the ordered list.\n // NEVER reaches runMigration() or any write boundary.\n const result = await executeMigrateShowCommand(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 {\n // Print directly to stdout — not via ui.log() which injects Clack's │ gutter.\n ui.output(formatMigrateShowOutput(showResult, flags));\n }\n });\n\n process.exit(exitCode);\n return;\n }\n\n const result = await executeMigrateCommand(options, flags, ui, startTime);\n\n const exitCode = handleResult(result, flags, ui, (migrateResult) => {\n if (flags.json) {\n ui.output(JSON.stringify(migrateResult, null, 2));\n } else if (!flags.quiet) {\n ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,eAAe,0BACb,SACA,OACA,IAC4D;CAC5D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBACjE,QAAQ,QACR,MACF;CAEA,MAAM,eAAe,QAAQ,MAAM,OAAO,IAAI;CAC9C,MAAM,YAAY,CAAC,CAAC,OAAO;CAC3B,MAAM,kBAAkB,QAAQ,SAAS,KAAA;CAIzC,IAAI,CAAC,iBAAiB;EACpB,MAAM,YAAY,oBAAoB;GACpC;GACA;GACA,KAAK;GACL,cAAc;EAChB,CAAC;EACD,IAAI,WACF,OAAO,MAAM,SAAS;CAE1B;CAEA,IAAI,UAAgB,CAAC;CACrB,IAAI;EACF,UAAU,MAAM,SAAS,OA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ACA,oVAKF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,iBAAiB,OAAO,CAAC,CACtB,OAAO,cAAc,4BAA4B,CAAC,CAClD,OAAO,mBAAmB,+BAA+B,CAAC,CAC1D,OACC,mBACA,2FACF,CAAC,CACA,OAAO,wBAAwB,8DAA8D,CAAC,CAC9F,OAAO,UAAU,yDAAyD,CAAC,CAC3E,OACC,qBACA,kFACF,CAAC,CACA,OAAO,OAAO,YAAmC;EAChD,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,YAAY,KAAK,IAAI;EAE3B,MAAM,KAAK,iBAAiB,KAAK;EAEjC,IAAI,QAAQ,MAAM;GAKhB,MAAM,WAAW,aAAa,MAFT,0BAA0B,SAAS,OAAO,EAAE,GAE3B,OAAO,KAAK,eAAe;IAC/D,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;SAG7C,GAAG,OAAO,wBAAwB,YAAY,KAAK,CAAC;GAExD,CAAC;GAED,QAAQ,KAAK,QAAQ;GACrB;EACF;EAIA,MAAM,WAAW,aAAa,MAFT,sBAAsB,SAAS,OAAO,IAAI,SAAS,GAElC,OAAO,KAAK,kBAAkB;GAClE,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU,eAAe,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,OAChB,GAAG,IAAI,kCAAkC,eAAe,KAAK,CAAC;EAElE,CAAC;EAED,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "../migration-check-
|
|
1
|
+
import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "../migration-check-VwM8xCZV.mjs";
|
|
2
2
|
import { t as migrationCheckResultSchema } from "../schemas-KhXMzNA_.mjs";
|
|
3
3
|
export { createMigrationCheckCommand, enumerateCheckSpaces, migrationCheckResultSchema, runMigrationCheck };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.mjs";
|
|
2
|
-
import { A as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
2
|
+
import { A as formatStyledHeader, _ as createTerminalUI, d as setCommandSeeAlso, g as parseGlobalFlagsOrExit, l as setCommandDescriptions, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
4
4
|
import { c as renderMigrationGraphLegend, i as renderMigrationGraphSpaceTree, n as computeGlobalMaxEdgeTreePrefixWidth, r as indentMigrationGraphTreeBlock, t as computeGlobalMaxDirNameWidth } from "../migration-graph-space-render-Cpg0ql8v.mjs";
|
|
5
|
-
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-
|
|
5
|
+
import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-CyLslAtv.mjs";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
8
8
|
import { ok } from "@prisma-next/utils/result";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-
|
|
1
|
+
import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-CyLslAtv.mjs";
|
|
2
2
|
export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-
|
|
1
|
+
import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-DvC-Iq_k.mjs";
|
|
2
2
|
export { createMigrationLogCommand, executeMigrationLogCommand };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.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-
|
|
3
|
-
import { t as assertFrameworkComponentsCompatible } from "../framework-components-
|
|
4
|
-
import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-
|
|
2
|
+
import { A as formatStyledHeader, F as CliStructuredError, 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-DGMvGBeX.mjs";
|
|
3
|
+
import { t as assertFrameworkComponentsCompatible } from "../framework-components-YVQHhPH7.mjs";
|
|
4
|
+
import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
7
7
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-
|
|
1
|
+
import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-DUBRTJEl.mjs";
|
|
2
2
|
export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.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-
|
|
3
|
-
import { t as createControlClient } from "../client-
|
|
4
|
-
import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-
|
|
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-DGMvGBeX.mjs";
|
|
3
|
+
import { t as createControlClient } from "../client-ROablRVC.mjs";
|
|
4
|
+
import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-Ce6OZImp.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";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as migrationStatusJsonResultSchema } from "../schemas-KhXMzNA_.mjs";
|
|
2
|
-
import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-
|
|
2
|
+
import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-DnEW9YQn.mjs";
|
|
3
3
|
export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, executeMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary, migrationStatusJsonResultSchema };
|
package/dist/commands/ref.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as loadConfig } from "../config-loader-p9JMrekQ.mjs";
|
|
2
|
-
import { $ as errorRefSetBundleNotFound, F as CliStructuredError, O as formatCommandHelp, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, et as errorRefSetEmptySentinel, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapMigrationToolsError, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorRefSetHashNotInGraph, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-
|
|
3
|
-
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-
|
|
2
|
+
import { $ as errorRefSetBundleNotFound, F as CliStructuredError, O as formatCommandHelp, W as errorFileNotFound, _ as createTerminalUI, ct as errorUnexpected, et as errorRefSetEmptySentinel, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, lt as mapMigrationToolsError, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, tt as errorRefSetHashNotInGraph, ut as mapRefResolutionError, y as handleResult } from "../command-helpers-DGMvGBeX.mjs";
|
|
3
|
+
import { n as buildReadAggregate } from "../contract-space-aggregate-loader-ClI1KN6d.mjs";
|
|
4
4
|
import { i as readContractIR } from "../ref-advancement-BkXlikCA.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createTelemetryCommand } from "../../telemetry-
|
|
1
|
+
import { t as createTelemetryCommand } from "../../telemetry-BIM4beEO.mjs";
|
|
2
2
|
export { createTelemetryCommand };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as errorContractValidationFailed, F as CliStructuredError, W as errorFileNotFound, ct as errorUnexpected, it as errorSnapshotMissing, lt as mapMigrationToolsError } from "./command-helpers-
|
|
1
|
+
import { B as errorContractValidationFailed, F as CliStructuredError, W as errorFileNotFound, ct as errorUnexpected, it as errorSnapshotMissing, lt as mapMigrationToolsError } from "./command-helpers-DGMvGBeX.mjs";
|
|
2
2
|
import { notOk } from "@prisma-next/utils/result";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
|
|
@@ -39,4 +39,4 @@ function mapContractAtError(error, options) {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { mapContractAtError as t };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=contract-at-errors-
|
|
42
|
+
//# sourceMappingURL=contract-at-errors-CFXsstzm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-at-errors-
|
|
1
|
+
{"version":3,"file":"contract-at-errors-CFXsstzm.mjs","names":[],"sources":["../src/utils/contract-at-errors.ts"],"sourcesContent":["import { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport { join } from 'pathe';\nimport {\n CliStructuredError,\n errorContractValidationFailed,\n errorFileNotFound,\n errorSnapshotMissing,\n errorUnexpected,\n mapMigrationToolsError,\n} from './cli-errors';\n\nexport function mapContractAtError(\n error: unknown,\n options?: { readonly artifactRole?: 'from' | 'to' },\n): Result<never, CliStructuredError> {\n if (MigrationToolsError.is(error)) {\n switch (error.code) {\n case 'MIGRATION.SNAPSHOT_MISSING': {\n const refName =\n typeof error.details?.['refName'] === 'string'\n ? error.details['refName']\n : typeof error.details?.['identifier'] === 'string'\n ? error.details['identifier']\n : 'unknown';\n return notOk(errorSnapshotMissing(refName));\n }\n case 'MIGRATION.CONTRACT_DESERIALIZATION_FAILED': {\n const filePath =\n typeof error.details?.['filePath'] === 'string'\n ? error.details['filePath']\n : 'ref-snapshot';\n const message =\n typeof error.details?.['message'] === 'string' ? error.details['message'] : error.message;\n const isRefSnapshot = filePath.endsWith('.contract.json');\n return notOk(\n errorContractValidationFailed(\n isRefSnapshot\n ? `Ref snapshot contract failed to deserialize: ${message}`\n : `Predecessor contract at ${filePath} failed to deserialize: ${message}`,\n { where: { path: isRefSnapshot ? 'ref-snapshot' : filePath } },\n ),\n );\n }\n case 'MIGRATION.INVALID_JSON': {\n const filePath =\n typeof error.details?.['filePath'] === 'string' ? error.details['filePath'] : 'unknown';\n const message =\n typeof error.details?.['parseError'] === 'string'\n ? error.details['parseError']\n : error.message;\n const role = options?.artifactRole ?? 'from';\n return notOk(\n errorContractValidationFailed(\n role === 'to'\n ? `Target contract at ${filePath} failed to deserialize: ${message}`\n : `Predecessor contract at ${filePath} failed to deserialize: ${message}`,\n { where: { path: filePath } },\n ),\n );\n }\n case 'MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE':\n return notOk(\n errorUnexpected(error.message, {\n why: error.why,\n fix: error.fix,\n }),\n );\n case 'MIGRATION.FILE_MISSING': {\n const file =\n typeof error.details?.['file'] === 'string' ? error.details['file'] : 'end-contract.json';\n const dir = typeof error.details?.['dir'] === 'string' ? error.details['dir'] : '';\n const jsonPath = dir ? join(dir, 'end-contract.json') : file;\n const role = options?.artifactRole ?? 'from';\n return notOk(\n errorFileNotFound(jsonPath, {\n why:\n role === 'to'\n ? `Target migration is missing its destination contract snapshot at ${jsonPath}`\n : `Predecessor migration is missing its destination contract snapshot at ${jsonPath}`,\n fix:\n role === 'to'\n ? 'Re-emit the target migration so its sibling `end-contract.json` / `end-contract.d.ts` are restored, then re-run this command.'\n : 'Re-emit the predecessor migration (`prisma-next migration plan` from its source) so its sibling `end-contract.json` is restored, then re-run this command.',\n }),\n );\n }\n default:\n return notOk(mapMigrationToolsError(error));\n }\n }\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n throw error;\n}\n"],"mappings":";;;;;AAYA,SAAgB,mBACd,OACA,SACmC;CACnC,IAAI,oBAAoB,GAAG,KAAK,GAC9B,QAAQ,MAAM,MAAd;EACE,KAAK,8BAOH,OAAO,MAAM,qBALX,OAAO,MAAM,UAAU,eAAe,WAClC,MAAM,QAAQ,aACd,OAAO,MAAM,UAAU,kBAAkB,WACvC,MAAM,QAAQ,gBACd,SACiC,CAAC;EAE5C,KAAK,6CAA6C;GAChD,MAAM,WACJ,OAAO,MAAM,UAAU,gBAAgB,WACnC,MAAM,QAAQ,cACd;GACN,MAAM,UACJ,OAAO,MAAM,UAAU,eAAe,WAAW,MAAM,QAAQ,aAAa,MAAM;GACpF,MAAM,gBAAgB,SAAS,SAAS,gBAAgB;GACxD,OAAO,MACL,8BACE,gBACI,gDAAgD,YAChD,2BAA2B,SAAS,0BAA0B,WAClE,EAAE,OAAO,EAAE,MAAM,gBAAgB,iBAAiB,SAAS,EAAE,CAC/D,CACF;EACF;EACA,KAAK,0BAA0B;GAC7B,MAAM,WACJ,OAAO,MAAM,UAAU,gBAAgB,WAAW,MAAM,QAAQ,cAAc;GAChF,MAAM,UACJ,OAAO,MAAM,UAAU,kBAAkB,WACrC,MAAM,QAAQ,gBACd,MAAM;GAEZ,OAAO,MACL,+BAFW,SAAS,gBAAgB,YAGzB,OACL,sBAAsB,SAAS,0BAA0B,YACzD,2BAA2B,SAAS,0BAA0B,WAClE,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE,CAC9B,CACF;EACF;EACA,KAAK,6CACH,OAAO,MACL,gBAAgB,MAAM,SAAS;GAC7B,KAAK,MAAM;GACX,KAAK,MAAM;EACb,CAAC,CACH;EACF,KAAK,0BAA0B;GAC7B,MAAM,OACJ,OAAO,MAAM,UAAU,YAAY,WAAW,MAAM,QAAQ,UAAU;GACxE,MAAM,MAAM,OAAO,MAAM,UAAU,WAAW,WAAW,MAAM,QAAQ,SAAS;GAChF,MAAM,WAAW,MAAM,KAAK,KAAK,mBAAmB,IAAI;GACxD,MAAM,OAAO,SAAS,gBAAgB;GACtC,OAAO,MACL,kBAAkB,UAAU;IAC1B,KACE,SAAS,OACL,oEAAoE,aACpE,yEAAyE;IAC/E,KACE,SAAS,OACL,kIACA;GACR,CAAC,CACH;EACF;EACA,SACE,OAAO,MAAM,uBAAuB,KAAK,CAAC;CAC9C;CAEF,IAAI,mBAAmB,GAAG,KAAK,GAC7B,OAAO,MAAM,KAAK;CAEpB,MAAM;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as executeContractEmit } from "./contract-emit-
|
|
1
|
+
import { n as executeContractEmit } from "./contract-emit-C8HmtboH.mjs";
|
|
2
2
|
import { t as loadConfig } from "./config-loader-p9JMrekQ.mjs";
|
|
3
|
-
import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, ct as errorUnexpected$1, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-
|
|
3
|
+
import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, ct as errorUnexpected$1, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-DGMvGBeX.mjs";
|
|
4
4
|
import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_.mjs";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
@@ -147,4 +147,4 @@ function createContractEmitCommand() {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
export { createContractEmitCommand as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=contract-emit-
|
|
150
|
+
//# sourceMappingURL=contract-emit-B_qriF8B.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-emit-By59Nmmn.mjs","names":["CliStructuredError","errorUnexpected"],"sources":["../src/utils/formatters/emit.ts","../src/commands/contract-emit.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\nimport { relative } from 'pathe';\n\nimport type { GlobalFlags } from '../global-flags';\nimport { isVerbose } from './helpers';\n\n// EmitContractResult type for CLI output formatting (includes file paths)\nexport interface EmitContractResult {\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n readonly outDir: string;\n readonly files: {\n readonly json: string;\n readonly dts: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\n/**\n * Formats human-readable output for contract emit.\n */\nexport function formatEmitOutput(result: EmitContractResult, flags: GlobalFlags): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n // Convert absolute paths to relative paths from cwd\n const jsonPath = relative(process.cwd(), result.files.json);\n const dtsPath = relative(process.cwd(), result.files.dts);\n\n lines.push(`✔ Emitted contract.json → ${jsonPath}`);\n lines.push(`✔ Emitted contract.d.ts → ${dtsPath}`);\n lines.push(` storageHash: ${result.storageHash}`);\n if (result.executionHash) {\n lines.push(` executionHash: ${result.executionHash}`);\n }\n if (result.profileHash) {\n lines.push(` profileHash: ${result.profileHash}`);\n }\n if (isVerbose(flags, 1)) {\n lines.push(` Total time: ${result.timings.total}ms`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats JSON output for contract emit.\n */\nexport function formatEmitJson(result: EmitContractResult): string {\n const output = {\n ok: true,\n storageHash: result.storageHash,\n ...ifDefined('executionHash', result.executionHash),\n ...(result.profileHash ? { profileHash: result.profileHash } : {}),\n outDir: result.outDir,\n files: result.files,\n timings: result.timings,\n };\n\n return JSON.stringify(output, null, 2);\n}\n","import { getEmittedArtifactPaths } from '@prisma-next/emitter';\nimport { errorContractConfigMissing } from '@prisma-next/errors/control';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { dirname, join, relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { executeContractEmit } from '../control-api/operations/contract-emit';\nimport type { ContractEmitResult } from '../control-api/types';\nimport { CliStructuredError, errorUnexpected } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport {\n type EmitContractResult,\n formatEmitJson,\n formatEmitOutput,\n} from '../utils/formatters/emit';\nimport { formatStyledHeader, formatSuccessMessage } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { createProgressAdapter } from '../utils/progress-adapter';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface ContractEmitOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly outputPath?: string;\n}\n\ninterface HeaderPaths {\n readonly displayConfigPath: string;\n readonly outputJsonPath: string;\n readonly outputDtsPath: string;\n}\n\n/**\n * Pre-load the config just to compute display paths for the styled header. The\n * actual emit work goes through `executeContractEmit`, which loads the config\n * itself; the redundant load here is bounded and lets the header render before\n * the emit spans start.\n */\nasync function resolveHeaderPaths(\n configOption: string | undefined,\n outputPath: string | undefined,\n): Promise<Result<HeaderPaths, CliStructuredError>> {\n const displayConfigPath = configOption\n ? relative(process.cwd(), resolve(configOption))\n : 'prisma-next.config.ts';\n\n let config: Awaited<ReturnType<typeof loadConfig>>;\n try {\n config = await loadConfig(configOption);\n } catch (error) {\n if (error instanceof CliStructuredError) {\n return notOk(error);\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to load config',\n }),\n );\n }\n\n const effectiveJsonPath =\n outputPath !== undefined ? join(outputPath, 'contract.json') : config.contract?.output;\n\n if (!effectiveJsonPath) {\n return notOk(\n errorContractConfigMissing({\n why: 'Config.contract.output is required for emit. Define it in your config: contract: { source: ..., output: ... }',\n }),\n );\n }\n\n try {\n const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } =\n getEmittedArtifactPaths(effectiveJsonPath);\n return ok({ displayConfigPath, outputJsonPath, outputDtsPath });\n } catch (error) {\n return notOk(\n errorContractConfigMissing({\n why: error instanceof Error ? error.message : String(error),\n }),\n );\n }\n}\n\nasync function executeContractEmitCommand(\n options: ContractEmitOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<EmitContractResult, CliStructuredError>> {\n const outputPath = options.outputPath !== undefined ? resolve(options.outputPath) : undefined;\n\n const headerPathsResult = await resolveHeaderPaths(options.config, outputPath);\n if (!headerPathsResult.ok) {\n return headerPathsResult;\n }\n const { displayConfigPath, outputJsonPath, outputDtsPath } = headerPathsResult.value;\n\n if (!flags.json && !flags.quiet) {\n ui.stderr(\n formatStyledHeader({\n command: 'contract emit',\n description: 'Emit your contract artifacts',\n url: 'https://pris.ly/contract-emit',\n details: [\n { label: 'config', value: displayConfigPath },\n { label: 'contract', value: relative(process.cwd(), outputJsonPath) },\n { label: 'types', value: relative(process.cwd(), outputDtsPath) },\n ],\n flags,\n }),\n );\n }\n\n const onProgress = createProgressAdapter({ ui, flags });\n const configPath = options.config ? resolve(options.config) : 'prisma-next.config.ts';\n\n let result: ContractEmitResult;\n try {\n result = await executeContractEmit({\n configPath,\n onProgress,\n ...ifDefined('outputPath', outputPath),\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n return notOk(\n errorUnexpected('Unexpected error during contract emit', {\n why: error instanceof Error ? error.message : String(error),\n }),\n );\n }\n\n if (result.validationWarning) {\n ui.warn(result.validationWarning);\n }\n\n return ok({\n storageHash: result.storageHash,\n ...ifDefined('executionHash', result.executionHash),\n profileHash: result.profileHash,\n outDir: dirname(result.files.json),\n files: result.files,\n timings: { total: Date.now() - startTime },\n });\n}\n\nexport function createContractEmitCommand(): Command {\n const command = new Command('emit');\n setCommandDescriptions(\n command,\n 'Emit your contract artifacts',\n 'Reads your contract source (TypeScript or Prisma schema) and emits contract.json and\\n' +\n 'contract.d.ts. The contract.json contains the canonical contract structure, and\\n' +\n 'contract.d.ts provides TypeScript types for type-safe query building.',\n );\n setCommandExamples(command, [\n 'prisma-next contract emit',\n 'prisma-next contract emit --config ./custom-config.ts',\n 'prisma-next contract emit --output-path ./generated',\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--output-path <dir>', 'Directory to write contract.json and contract.d.ts into')\n .action(async (options: ContractEmitOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const startTime = Date.now();\n\n const result = await executeContractEmitCommand(options, flags, ui, startTime);\n\n const exitCode = handleResult(result, flags, ui, (emitResult) => {\n if (flags.json) {\n ui.output(formatEmitJson(emitResult));\n } else {\n const output = formatEmitOutput(emitResult, flags);\n if (output) {\n ui.log(output);\n }\n if (!flags.quiet) {\n ui.success(formatSuccessMessage(flags));\n }\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,SAAgB,iBAAiB,QAA4B,OAA4B;CACvF,IAAI,MAAM,OACR,OAAO;CAGT,MAAM,QAAkB,CAAC;CAGzB,MAAM,WAAW,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI;CAC1D,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG;CAExD,MAAM,KAAK,6BAA6B,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O,MAAM,IAAI;EACjC,OAAO,OAAO;EACd,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC3C,CAAC;AACH;AAEA,SAAgB,4BAAqC;CACnD,MAAM,UAAU,IAAI,QAAQ,MAAM;CAClC,uBACE,SACA,gCACA,8OAGF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;CACF,CAAC;CACD,iBAAiB,OAAO,CAAC,CACtB,OAAO,mBAAmB,+BAA+B,CAAC,CAC1D,OAAO,uBAAuB,yDAAyD,CAAC,CACxF,OAAO,OAAO,YAAiC;EAC9C,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EAKjC,MAAM,WAAW,aAAa,MAFT,2BAA2B,SAAS,OAAO,IAF9C,KAAK,IAEqD,CAAC,GAEvC,OAAO,KAAK,eAAe;GAC/D,IAAI,MAAM,MACR,GAAG,OAAO,eAAe,UAAU,CAAC;QAC/B;IACL,MAAM,SAAS,iBAAiB,YAAY,KAAK;IACjD,IAAI,QACF,GAAG,IAAI,MAAM;IAEf,IAAI,CAAC,MAAM,OACT,GAAG,QAAQ,qBAAqB,KAAK,CAAC;GAE1C;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"contract-emit-B_qriF8B.mjs","names":["CliStructuredError","errorUnexpected"],"sources":["../src/utils/formatters/emit.ts","../src/commands/contract-emit.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\nimport { relative } from 'pathe';\n\nimport type { GlobalFlags } from '../global-flags';\nimport { isVerbose } from './helpers';\n\n// EmitContractResult type for CLI output formatting (includes file paths)\nexport interface EmitContractResult {\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n readonly outDir: string;\n readonly files: {\n readonly json: string;\n readonly dts: string;\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\n/**\n * Formats human-readable output for contract emit.\n */\nexport function formatEmitOutput(result: EmitContractResult, flags: GlobalFlags): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n // Convert absolute paths to relative paths from cwd\n const jsonPath = relative(process.cwd(), result.files.json);\n const dtsPath = relative(process.cwd(), result.files.dts);\n\n lines.push(`✔ Emitted contract.json → ${jsonPath}`);\n lines.push(`✔ Emitted contract.d.ts → ${dtsPath}`);\n lines.push(` storageHash: ${result.storageHash}`);\n if (result.executionHash) {\n lines.push(` executionHash: ${result.executionHash}`);\n }\n if (result.profileHash) {\n lines.push(` profileHash: ${result.profileHash}`);\n }\n if (isVerbose(flags, 1)) {\n lines.push(` Total time: ${result.timings.total}ms`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats JSON output for contract emit.\n */\nexport function formatEmitJson(result: EmitContractResult): string {\n const output = {\n ok: true,\n storageHash: result.storageHash,\n ...ifDefined('executionHash', result.executionHash),\n ...(result.profileHash ? { profileHash: result.profileHash } : {}),\n outDir: result.outDir,\n files: result.files,\n timings: result.timings,\n };\n\n return JSON.stringify(output, null, 2);\n}\n","import { getEmittedArtifactPaths } from '@prisma-next/emitter';\nimport { errorContractConfigMissing } from '@prisma-next/errors/control';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { dirname, join, relative, resolve } from 'pathe';\nimport { loadConfig } from '../config-loader';\nimport { executeContractEmit } from '../control-api/operations/contract-emit';\nimport type { ContractEmitResult } from '../control-api/types';\nimport { CliStructuredError, errorUnexpected } from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport {\n type EmitContractResult,\n formatEmitJson,\n formatEmitOutput,\n} from '../utils/formatters/emit';\nimport { formatStyledHeader, formatSuccessMessage } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { createProgressAdapter } from '../utils/progress-adapter';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface ContractEmitOptions extends CommonCommandOptions {\n readonly config?: string;\n readonly outputPath?: string;\n}\n\ninterface HeaderPaths {\n readonly displayConfigPath: string;\n readonly outputJsonPath: string;\n readonly outputDtsPath: string;\n}\n\n/**\n * Pre-load the config just to compute display paths for the styled header. The\n * actual emit work goes through `executeContractEmit`, which loads the config\n * itself; the redundant load here is bounded and lets the header render before\n * the emit spans start.\n */\nasync function resolveHeaderPaths(\n configOption: string | undefined,\n outputPath: string | undefined,\n): Promise<Result<HeaderPaths, CliStructuredError>> {\n const displayConfigPath = configOption\n ? relative(process.cwd(), resolve(configOption))\n : 'prisma-next.config.ts';\n\n let config: Awaited<ReturnType<typeof loadConfig>>;\n try {\n config = await loadConfig(configOption);\n } catch (error) {\n if (error instanceof CliStructuredError) {\n return notOk(error);\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: 'Failed to load config',\n }),\n );\n }\n\n const effectiveJsonPath =\n outputPath !== undefined ? join(outputPath, 'contract.json') : config.contract?.output;\n\n if (!effectiveJsonPath) {\n return notOk(\n errorContractConfigMissing({\n why: 'Config.contract.output is required for emit. Define it in your config: contract: { source: ..., output: ... }',\n }),\n );\n }\n\n try {\n const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } =\n getEmittedArtifactPaths(effectiveJsonPath);\n return ok({ displayConfigPath, outputJsonPath, outputDtsPath });\n } catch (error) {\n return notOk(\n errorContractConfigMissing({\n why: error instanceof Error ? error.message : String(error),\n }),\n );\n }\n}\n\nasync function executeContractEmitCommand(\n options: ContractEmitOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<EmitContractResult, CliStructuredError>> {\n const outputPath = options.outputPath !== undefined ? resolve(options.outputPath) : undefined;\n\n const headerPathsResult = await resolveHeaderPaths(options.config, outputPath);\n if (!headerPathsResult.ok) {\n return headerPathsResult;\n }\n const { displayConfigPath, outputJsonPath, outputDtsPath } = headerPathsResult.value;\n\n if (!flags.json && !flags.quiet) {\n ui.stderr(\n formatStyledHeader({\n command: 'contract emit',\n description: 'Emit your contract artifacts',\n url: 'https://pris.ly/contract-emit',\n details: [\n { label: 'config', value: displayConfigPath },\n { label: 'contract', value: relative(process.cwd(), outputJsonPath) },\n { label: 'types', value: relative(process.cwd(), outputDtsPath) },\n ],\n flags,\n }),\n );\n }\n\n const onProgress = createProgressAdapter({ ui, flags });\n const configPath = options.config ? resolve(options.config) : 'prisma-next.config.ts';\n\n let result: ContractEmitResult;\n try {\n result = await executeContractEmit({\n configPath,\n onProgress,\n ...ifDefined('outputPath', outputPath),\n });\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n return notOk(\n errorUnexpected('Unexpected error during contract emit', {\n why: error instanceof Error ? error.message : String(error),\n }),\n );\n }\n\n if (result.validationWarning) {\n ui.warn(result.validationWarning);\n }\n\n return ok({\n storageHash: result.storageHash,\n ...ifDefined('executionHash', result.executionHash),\n profileHash: result.profileHash,\n outDir: dirname(result.files.json),\n files: result.files,\n timings: { total: Date.now() - startTime },\n });\n}\n\nexport function createContractEmitCommand(): Command {\n const command = new Command('emit');\n setCommandDescriptions(\n command,\n 'Emit your contract artifacts',\n 'Reads your contract source (TypeScript or Prisma schema) and emits contract.json and\\n' +\n 'contract.d.ts. The contract.json contains the canonical contract structure, and\\n' +\n 'contract.d.ts provides TypeScript types for type-safe query building.',\n );\n setCommandExamples(command, [\n 'prisma-next contract emit',\n 'prisma-next contract emit --config ./custom-config.ts',\n 'prisma-next contract emit --output-path ./generated',\n ]);\n addGlobalOptions(command)\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--output-path <dir>', 'Directory to write contract.json and contract.d.ts into')\n .action(async (options: ContractEmitOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const startTime = Date.now();\n\n const result = await executeContractEmitCommand(options, flags, ui, startTime);\n\n const exitCode = handleResult(result, flags, ui, (emitResult) => {\n if (flags.json) {\n ui.output(formatEmitJson(emitResult));\n } else {\n const output = formatEmitOutput(emitResult, flags);\n if (output) {\n ui.log(output);\n }\n if (!flags.quiet) {\n ui.success(formatSuccessMessage(flags));\n }\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,SAAgB,iBAAiB,QAA4B,OAA4B;CACvF,IAAI,MAAM,OACR,OAAO;CAGT,MAAM,QAAkB,CAAC;CAGzB,MAAM,WAAW,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI;CAC1D,MAAM,UAAU,SAAS,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG;CAExD,MAAM,KAAK,6BAA6B,UAAU;CAClD,MAAM,KAAK,6BAA6B,SAAS;CACjD,MAAM,KAAK,kBAAkB,OAAO,aAAa;CACjD,IAAI,OAAO,eACT,MAAM,KAAK,oBAAoB,OAAO,eAAe;CAEvD,IAAI,OAAO,aACT,MAAM,KAAK,kBAAkB,OAAO,aAAa;CAEnD,IAAI,UAAU,OAAO,CAAC,GACpB,MAAM,KAAK,iBAAiB,OAAO,QAAQ,MAAM,GAAG;CAGtD,OAAO,MAAM,KAAK,IAAI;AACxB;;;;AAKA,SAAgB,eAAe,QAAoC;CACjE,MAAM,SAAS;EACb,IAAI;EACJ,aAAa,OAAO;EACpB,GAAG,UAAU,iBAAiB,OAAO,aAAa;EAClD,GAAI,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;EAChE,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,SAAS,OAAO;CAClB;CAEA,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACvC;;;;;;;;;ACtBA,eAAe,mBACb,cACA,YACkD;CAClD,MAAM,oBAAoB,eACtB,SAAS,QAAQ,IAAI,GAAG,QAAQ,YAAY,CAAC,IAC7C;CAEJ,IA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C;GAE1C;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as loadConfig } from "./config-loader-p9JMrekQ.mjs";
|
|
2
|
-
import { rt as errorRuntime, z as errorContractConfigMissing } from "./command-helpers-
|
|
3
|
-
import {
|
|
2
|
+
import { rt as errorRuntime, z as errorContractConfigMissing } from "./command-helpers-DGMvGBeX.mjs";
|
|
3
|
+
import { n as toExtensionInputs } from "./extension-pack-inputs-1ySHqxKG.mjs";
|
|
4
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-YVQHhPH7.mjs";
|
|
4
5
|
import { t as enrichContract } from "./contract-enrichment-gn9sWbPw.mjs";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import { emit, getEmittedArtifactPaths } from "@prisma-next/emitter";
|
|
@@ -9,6 +10,7 @@ import { basename, dirname, join } from "pathe";
|
|
|
9
10
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
10
11
|
import { createControlStack } from "@prisma-next/framework-components/control";
|
|
11
12
|
import { abortable } from "@prisma-next/utils/abortable";
|
|
13
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
12
14
|
//#region \0rolldown/runtime.js
|
|
13
15
|
var __defProp = Object.defineProperty;
|
|
14
16
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -271,8 +273,11 @@ async function executeContractEmit(options) {
|
|
|
271
273
|
const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;
|
|
272
274
|
return queueEmitByOutput(outputJsonPath, async () => {
|
|
273
275
|
const stack = createControlStack(config);
|
|
276
|
+
const extensionInputs = toExtensionInputs(blindCast(stack.extensionPacks));
|
|
277
|
+
const composedExtensionContracts = new Map(extensionInputs.filter((p) => p.contractSpace !== void 0).map((p) => [p.id, blindCast(p.contractSpace.contractJson)]));
|
|
274
278
|
const sourceContext = {
|
|
275
279
|
composedExtensionPacks: stack.extensionPacks.map((p) => p.id),
|
|
280
|
+
composedExtensionContracts,
|
|
276
281
|
scalarTypeDescriptors: stack.scalarTypeDescriptors,
|
|
277
282
|
authoringContributions: stack.authoringContributions,
|
|
278
283
|
codecLookup: stack.codecLookup,
|
|
@@ -343,4 +348,4 @@ async function executeContractEmit(options) {
|
|
|
343
348
|
//#endregion
|
|
344
349
|
export { executeContractEmit as n, disposeEmitQueue as r, contract_emit_exports as t };
|
|
345
350
|
|
|
346
|
-
//# sourceMappingURL=contract-emit-
|
|
351
|
+
//# sourceMappingURL=contract-emit-C8HmtboH.mjs.map
|