@prisma-next/cli 0.15.0 → 0.16.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/cli.d.mts +1 -1
  2. package/dist/cli.mjs +13 -13
  3. package/dist/{client-DigVI8zX.mjs → client-KuBQftxz.mjs} +67 -36
  4. package/dist/client-KuBQftxz.mjs.map +1 -0
  5. package/dist/{command-helpers-CUoKYTlG.mjs → command-helpers-Cpq44aVa.mjs} +21 -5
  6. package/dist/command-helpers-Cpq44aVa.mjs.map +1 -0
  7. package/dist/commands/contract-emit.d.mts +0 -1
  8. package/dist/commands/contract-emit.d.mts.map +1 -1
  9. package/dist/commands/contract-emit.mjs +1 -1
  10. package/dist/commands/contract-infer.d.mts +0 -1
  11. package/dist/commands/contract-infer.d.mts.map +1 -1
  12. package/dist/commands/contract-infer.mjs +1 -1
  13. package/dist/commands/db-init.d.mts +0 -1
  14. package/dist/commands/db-init.d.mts.map +1 -1
  15. package/dist/commands/db-init.mjs +6 -6
  16. package/dist/commands/db-init.mjs.map +1 -1
  17. package/dist/commands/db-schema.d.mts +0 -1
  18. package/dist/commands/db-schema.d.mts.map +1 -1
  19. package/dist/commands/db-schema.mjs +3 -3
  20. package/dist/commands/db-sign.d.mts +0 -1
  21. package/dist/commands/db-sign.d.mts.map +1 -1
  22. package/dist/commands/db-sign.mjs +4 -4
  23. package/dist/commands/db-update.d.mts +0 -1
  24. package/dist/commands/db-update.d.mts.map +1 -1
  25. package/dist/commands/db-update.mjs +5 -5
  26. package/dist/commands/db-update.mjs.map +1 -1
  27. package/dist/commands/db-verify.d.mts +0 -1
  28. package/dist/commands/db-verify.d.mts.map +1 -1
  29. package/dist/commands/db-verify.mjs +1 -1
  30. package/dist/commands/migrate.d.mts +1 -2
  31. package/dist/commands/migrate.d.mts.map +1 -1
  32. package/dist/commands/migrate.mjs +5 -5
  33. package/dist/commands/migration-check.d.mts +1 -2
  34. package/dist/commands/migration-check.d.mts.map +1 -1
  35. package/dist/commands/migration-check.mjs +1 -1
  36. package/dist/commands/migration-graph.d.mts +2 -3
  37. package/dist/commands/migration-graph.d.mts.map +1 -1
  38. package/dist/commands/migration-graph.mjs +3 -3
  39. package/dist/commands/migration-list.d.mts +2 -3
  40. package/dist/commands/migration-list.d.mts.map +1 -1
  41. package/dist/commands/migration-list.mjs +1 -1
  42. package/dist/commands/migration-log.d.mts +2 -3
  43. package/dist/commands/migration-log.d.mts.map +1 -1
  44. package/dist/commands/migration-log.mjs +1 -1
  45. package/dist/commands/migration-new.d.mts +0 -1
  46. package/dist/commands/migration-new.d.mts.map +1 -1
  47. package/dist/commands/migration-new.mjs +3 -3
  48. package/dist/commands/migration-plan.d.mts +0 -1
  49. package/dist/commands/migration-plan.d.mts.map +1 -1
  50. package/dist/commands/migration-plan.mjs +1 -1
  51. package/dist/commands/migration-show.d.mts +0 -1
  52. package/dist/commands/migration-show.d.mts.map +1 -1
  53. package/dist/commands/migration-show.mjs +3 -3
  54. package/dist/commands/migration-status.d.mts +2 -3
  55. package/dist/commands/migration-status.d.mts.map +1 -1
  56. package/dist/commands/migration-status.mjs +1 -1
  57. package/dist/commands/ref.d.mts +1 -2
  58. package/dist/commands/ref.d.mts.map +1 -1
  59. package/dist/commands/ref.mjs +2 -2
  60. package/dist/commands/telemetry/index.d.mts +0 -1
  61. package/dist/commands/telemetry/index.d.mts.map +1 -1
  62. package/dist/commands/telemetry/index.mjs +1 -1
  63. package/dist/{contract-at-errors-D8CNDD7g.mjs → contract-at-errors-D9gEjYtg.mjs} +2 -2
  64. package/dist/{contract-at-errors-D8CNDD7g.mjs.map → contract-at-errors-D9gEjYtg.mjs.map} +1 -1
  65. package/dist/{contract-emit-wgqrOXUI.mjs → contract-emit-CgnXSANN.mjs} +3 -3
  66. package/dist/{contract-emit-wgqrOXUI.mjs.map → contract-emit-CgnXSANN.mjs.map} +1 -1
  67. package/dist/{contract-emit-sYrqzsdN.mjs → contract-emit-cJQBlvGb.mjs} +3 -3
  68. package/dist/{contract-emit-sYrqzsdN.mjs.map → contract-emit-cJQBlvGb.mjs.map} +1 -1
  69. package/dist/{contract-infer-6SQnnVj7.mjs → contract-infer-Cg8evbeg.mjs} +3 -3
  70. package/dist/{contract-infer-6SQnnVj7.mjs.map → contract-infer-Cg8evbeg.mjs.map} +1 -1
  71. package/dist/{contract-space-aggregate-loader-DpB4x97a.mjs → contract-space-aggregate-loader-D_3VeHVb.mjs} +14 -15
  72. package/dist/contract-space-aggregate-loader-D_3VeHVb.mjs.map +1 -0
  73. package/dist/{db-verify-CEsG5Gek.mjs → db-verify-BEclUzki.mjs} +6 -7
  74. package/dist/db-verify-BEclUzki.mjs.map +1 -0
  75. package/dist/exports/control-api.d.mts +1 -2
  76. package/dist/exports/control-api.d.mts.map +1 -1
  77. package/dist/exports/control-api.mjs +2 -2
  78. package/dist/exports/index.d.mts +0 -1
  79. package/dist/exports/index.d.mts.map +1 -1
  80. package/dist/exports/index.mjs +2 -2
  81. package/dist/exports/init-output.d.mts +1 -0
  82. package/dist/exports/init-output.d.mts.map +1 -1
  83. package/dist/{format-CjongNb1.mjs → format-DAUAZqPt.mjs} +2 -2
  84. package/dist/{format-CjongNb1.mjs.map → format-DAUAZqPt.mjs.map} +1 -1
  85. package/dist/{framework-components-BbnM1RYm.mjs → framework-components-CnbUbiJw.mjs} +2 -2
  86. package/dist/{framework-components-BbnM1RYm.mjs.map → framework-components-CnbUbiJw.mjs.map} +1 -1
  87. package/dist/global-flags-BpoOYtNZ.d.mts.map +1 -1
  88. package/dist/{init-D8YFfaD6.mjs → init-C3JhkHg-.mjs} +33 -46
  89. package/dist/init-C3JhkHg-.mjs.map +1 -0
  90. package/dist/{inspect-live-schema-CEt_ztBJ.mjs → inspect-live-schema-CX7EA5C3.mjs} +3 -3
  91. package/dist/{inspect-live-schema-CEt_ztBJ.mjs.map → inspect-live-schema-CX7EA5C3.mjs.map} +1 -1
  92. package/dist/{migration-check-ByeQHOhK.mjs → migration-check-VqN-iTcx.mjs} +25 -24
  93. package/dist/migration-check-VqN-iTcx.mjs.map +1 -0
  94. package/dist/migration-cli.d.mts +0 -1
  95. package/dist/migration-cli.d.mts.map +1 -1
  96. package/dist/migration-cli.mjs +3 -3
  97. package/dist/migration-cli.mjs.map +1 -1
  98. package/dist/{migration-command-scaffold-CJO3tjiR.mjs → migration-command-scaffold-CRyYrHZ9.mjs} +3 -3
  99. package/dist/{migration-command-scaffold-CJO3tjiR.mjs.map → migration-command-scaffold-CRyYrHZ9.mjs.map} +1 -1
  100. package/dist/{migration-list-DTYM8xvm.mjs → migration-list-BAKujUjh.mjs} +3 -3
  101. package/dist/{migration-list-DTYM8xvm.mjs.map → migration-list-BAKujUjh.mjs.map} +1 -1
  102. package/dist/{migration-log-qZ8LpQIl.mjs → migration-log-C_xam2HZ.mjs} +3 -3
  103. package/dist/{migration-log-qZ8LpQIl.mjs.map → migration-log-C_xam2HZ.mjs.map} +1 -1
  104. package/dist/{migration-path-target-DmNwsDgs.mjs → migration-path-target-DpPTsRCg.mjs} +2 -2
  105. package/dist/{migration-path-target-DmNwsDgs.mjs.map → migration-path-target-DpPTsRCg.mjs.map} +1 -1
  106. package/dist/{migration-plan-CfPrB80t.mjs → migration-plan-CreSVtWZ.mjs} +6 -6
  107. package/dist/migration-plan-CreSVtWZ.mjs.map +1 -0
  108. package/dist/{migration-status-DRuS-rP5.mjs → migration-status-DYErXpyF.mjs} +6 -5
  109. package/dist/{migration-status-DRuS-rP5.mjs.map → migration-status-DYErXpyF.mjs.map} +1 -1
  110. package/dist/schemas-CeGMYFYX.d.mts.map +1 -1
  111. package/dist/{telemetry-DHBBq5wT.mjs → telemetry-DVr6RFnq.mjs} +2 -2
  112. package/dist/{telemetry-DHBBq5wT.mjs.map → telemetry-DVr6RFnq.mjs.map} +1 -1
  113. package/dist/{terminal-ui-DGRNFWna.d.mts → terminal-ui-BN4QOsm5.d.mts} +1 -2
  114. package/dist/terminal-ui-BN4QOsm5.d.mts.map +1 -0
  115. package/dist/{types-DFoqNIcQ.d.mts → types-D4r_HI9-.d.mts} +8 -4
  116. package/dist/types-D4r_HI9-.d.mts.map +1 -0
  117. package/dist/{verify-DDCb0R2r.mjs → verify-CgDVZjhc.mjs} +9 -8
  118. package/dist/verify-CgDVZjhc.mjs.map +1 -0
  119. package/package.json +25 -25
  120. package/src/commands/db-init.ts +3 -3
  121. package/src/commands/db-update.ts +1 -1
  122. package/src/commands/db-verify.ts +2 -3
  123. package/src/commands/init/errors.ts +62 -58
  124. package/src/commands/init/init.ts +29 -26
  125. package/src/commands/migration-check.ts +7 -7
  126. package/src/commands/migration-plan.ts +1 -1
  127. package/src/control-api/operations/db-run.ts +4 -4
  128. package/src/control-api/operations/db-verify.ts +12 -9
  129. package/src/control-api/operations/migrate.ts +70 -26
  130. package/src/control-api/types.ts +4 -1
  131. package/src/migration-cli.ts +5 -5
  132. package/src/utils/cli-errors.ts +15 -2
  133. package/src/utils/combine-verify-results.ts +1 -1
  134. package/src/utils/contract-space-aggregate-loader.ts +12 -13
  135. package/src/utils/formatters/errors.ts +24 -3
  136. package/src/utils/formatters/verify.ts +7 -6
  137. package/src/utils/integrity-violation-to-check-failure.ts +14 -14
  138. package/src/utils/result-handler.ts +4 -2
  139. package/dist/client-DigVI8zX.mjs.map +0 -1
  140. package/dist/command-helpers-CUoKYTlG.mjs.map +0 -1
  141. package/dist/contract-space-aggregate-loader-DpB4x97a.mjs.map +0 -1
  142. package/dist/db-verify-CEsG5Gek.mjs.map +0 -1
  143. package/dist/init-D8YFfaD6.mjs.map +0 -1
  144. package/dist/migration-check-ByeQHOhK.mjs.map +0 -1
  145. package/dist/migration-plan-CfPrB80t.mjs.map +0 -1
  146. package/dist/terminal-ui-DGRNFWna.d.mts.map +0 -1
  147. package/dist/types-DFoqNIcQ.d.mts.map +0 -1
  148. package/dist/verify-DDCb0R2r.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"db-sign.d.mts","names":[],"sources":["../../src/commands/db-sign.ts"],"mappings":";;;iBA4PgB,mBAAA,IAAuB,OAAO"}
1
+ {"version":3,"file":"db-sign.d.mts","names":[],"sources":["../../src/commands/db-sign.ts"],"mappings":";;iBA4PgB,uBAAuB"}
@@ -1,8 +1,8 @@
1
- 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-CUoKYTlG.mjs";
1
+ 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-Cpq44aVa.mjs";
2
2
  import { t as createProgressAdapter } from "../progress-adapter-CjAeTxY_.mjs";
3
- import { o as ContractValidationError, t as createControlClient } from "../client-DigVI8zX.mjs";
4
- import { n as buildReadAggregate } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
5
- import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-DDCb0R2r.mjs";
3
+ import { o as ContractValidationError, t as createControlClient } from "../client-KuBQftxz.mjs";
4
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
5
+ import { a as formatSignJson, i as formatSchemaVerifyOutput, o as formatSignOutput, r as formatSchemaVerifyJson } from "../verify-CgDVZjhc.mjs";
6
6
  import { Command } from "commander";
7
7
  import { loadConfig } from "@prisma-next/config-loader";
8
8
  import { notOk, ok } from "@prisma-next/utils/result";
@@ -1,5 +1,4 @@
1
1
  import { Command } from "commander";
2
-
3
2
  //#region src/commands/db-update.d.ts
4
3
  declare function createDbUpdateCommand(): Command;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"db-update.d.mts","names":[],"sources":["../../src/commands/db-update.ts"],"mappings":";;;iBAuRgB,qBAAA,IAAyB,OAAO"}
1
+ {"version":3,"file":"db-update.d.mts","names":[],"sources":["../../src/commands/db-update.ts"],"mappings":";;iBAuRgB,yBAAyB"}
@@ -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-CUoKYTlG.mjs";
2
- import { o as ContractValidationError } from "../client-DigVI8zX.mjs";
3
- import { n as buildReadAggregate } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
4
- import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-CJO3tjiR.mjs";
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-Cpq44aVa.mjs";
2
+ import { o as ContractValidationError } from "../client-KuBQftxz.mjs";
3
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
4
+ import { n as prepareMigrationContext, t as addMigrationCommandOptions } from "../migration-command-scaffold-CRyYrHZ9.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";
@@ -17,7 +17,7 @@ import { parseContractRef } from "@prisma-next/migration-tools/ref-resolution";
17
17
  function mapDbUpdateFailure(failure) {
18
18
  if (failure.code === "PLANNING_FAILED") return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });
19
19
  if (failure.code === "RUNNER_FAILED") {
20
- const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema." : "Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`";
20
+ const fix = (typeof failure.meta?.["runnerErrorCode"] === "string" ? failure.meta["runnerErrorCode"] : void 0) === "MIGRATION.LEGACY_MARKER_SHAPE" ? "Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema." : "Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`";
21
21
  return errorRunnerFailed(failure.summary, {
22
22
  why: failure.why ?? "Migration runner failed",
23
23
  fix,
@@ -1 +1 @@
1
- {"version":3,"file":"db-update.mjs","names":[],"sources":["../../src/commands/db-update.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { parseContractRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { join } from 'pathe';\nimport { ContractValidationError } from '../control-api/errors';\nimport type { DbUpdateFailure } from '../control-api/types';\nimport {\n CliStructuredError,\n ERROR_CODE_DESTRUCTIVE_CHANGES,\n errorContractValidationFailed,\n errorDestructiveChanges,\n errorMigrationPlanningFailed,\n errorRunnerFailed,\n errorUnexpected,\n mapMigrationToolsError,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport type { MigrationCommandOptions } from '../utils/command-helpers';\nimport {\n resolveMigrationPaths,\n sanitizeErrorMessage,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport {\n formatMigrationApplyOutput,\n formatMigrationJson,\n formatMigrationPlanOutput,\n type MigrationCommandResult,\n} from '../utils/formatters/migrations';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport {\n addMigrationCommandOptions,\n prepareMigrationContext,\n} from '../utils/migration-command-scaffold';\nimport {\n buildRefAdvancementFields,\n computeRefAdvancementName,\n type RefAdvancementFields,\n readContractIR,\n} from '../utils/ref-advancement';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface DbUpdateOptions extends MigrationCommandOptions {\n readonly to?: string;\n readonly advanceRef?: string;\n}\n\n/**\n * Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.\n */\nfunction mapDbUpdateFailure(failure: DbUpdateFailure): CliStructuredError {\n if (failure.code === 'PLANNING_FAILED') {\n return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });\n }\n\n if (failure.code === 'RUNNER_FAILED') {\n const runnerCode =\n typeof failure.meta?.['runnerErrorCode'] === 'string'\n ? failure.meta['runnerErrorCode']\n : undefined;\n const fix =\n runnerCode === 'LEGACY_MARKER_SHAPE'\n ? 'Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema.'\n : 'Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`';\n return errorRunnerFailed(failure.summary, {\n why: failure.why ?? 'Migration runner failed',\n fix,\n meta: {\n ...failure.meta,\n ...(failure.warnings && failure.warnings.length > 0\n ? { plannerWarnings: failure.warnings }\n : {}),\n },\n });\n }\n\n if (failure.code === 'DESTRUCTIVE_CHANGES') {\n return errorDestructiveChanges(failure.summary, {\n ...ifDefined('why', failure.why),\n fix: 'Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first',\n ...ifDefined('meta', failure.meta),\n });\n }\n\n const exhaustive: never = failure.code;\n throw new Error(`Unhandled DbUpdateFailure code: ${exhaustive}`);\n}\n\n/**\n * Executes the db update command and returns a structured Result.\n */\nasync function executeDbUpdateCommand(\n options: DbUpdateOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<MigrationCommandResult, CliStructuredError>> {\n // Prepare shared migration context (config, contract, connection, client)\n const ctxResult = await prepareMigrationContext(options, flags, ui, {\n commandName: 'db update',\n description: 'Update your database schema to match your contract',\n url: 'https://pris.ly/db-update',\n });\n if (!ctxResult.ok) {\n return ctxResult;\n }\n const { client, config, dbConnection, onProgress, contractPathAbsolute } = ctxResult.value;\n let { contractJson } = ctxResult.value;\n let contractJsonPathForSnapshot = contractPathAbsolute;\n const { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\n if (options.to) {\n try {\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n const graph = loaded.value.aggregate.app.graph();\n const bundles = loaded.value.aggregate.app.packages;\n const refs = loaded.value.aggregate.app.refs;\n const refResult = parseContractRef(options.to, { graph, refs });\n if (!refResult.ok) {\n return notOk(mapRefResolutionError(refResult.failure));\n }\n const targetHash = refResult.value.hash;\n const matchingBundle = bundles.find((p) => p.metadata.to === targetHash);\n if (!matchingBundle) {\n return notOk(\n errorUnexpected(\n `No migration bundle found for --to \"${options.to}\" (resolved hash: ${targetHash})`,\n {\n why: `The ref resolved successfully but no on-disk migration package has an end-contract hash matching ${targetHash}.`,\n fix: 'Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.',\n },\n ),\n );\n }\n const endContractPath = join(matchingBundle.dirPath, 'end-contract.json');\n const raw = await readFile(endContractPath, 'utf-8');\n contractJson = JSON.parse(raw) as Record<string, unknown>;\n contractJsonPathForSnapshot = endContractPath;\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n throw error;\n }\n }\n\n try {\n await client.connect(dbConnection);\n\n const result = await client.dbUpdate({\n contract: contractJson,\n mode: options.dryRun ? 'plan' : 'apply',\n migrationsDir,\n ...(flags.yes ? { acceptDataLoss: true } : {}),\n onProgress,\n });\n\n // Handle failures by mapping to CLI structured error\n if (!result.ok) {\n return notOk(mapDbUpdateFailure(result.failure));\n }\n\n const advancementHash =\n result.value.mode === 'apply'\n ? (result.value.marker?.storageHash ?? result.value.destination.storageHash)\n : result.value.destination.storageHash;\n\n let refAdvancementFields: RefAdvancementFields = {\n advancedRef: null,\n plannedAdvanceRef: null,\n };\n if (\n computeRefAdvancementName({\n ...ifDefined('advanceRef', options.advanceRef),\n ...ifDefined('db', options.db),\n }) !== null\n ) {\n try {\n const contractIR = await readContractIR(contractJson, contractJsonPathForSnapshot);\n refAdvancementFields = await buildRefAdvancementFields({\n ...ifDefined('advanceRef', options.advanceRef),\n ...ifDefined('db', options.db),\n refsDir,\n contractIR,\n mode: result.value.mode,\n hash: advancementHash,\n });\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n }\n\n // Convert success result to CLI output format\n const dbUpdateResult: MigrationCommandResult = {\n ok: true,\n mode: result.value.mode,\n plan: {\n targetId: ctxResult.value.config.target.targetId,\n destination: {\n storageHash: result.value.destination.storageHash,\n ...ifDefined('profileHash', result.value.destination.profileHash),\n },\n operations: result.value.plan.operations.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n ...ifDefined('preview', result.value.plan.preview),\n },\n ...ifDefined(\n 'execution',\n result.value.execution\n ? {\n operationsPlanned: result.value.execution.operationsPlanned,\n operationsExecuted: result.value.execution.operationsExecuted,\n }\n : undefined,\n ),\n ...ifDefined(\n 'marker',\n result.value.marker\n ? {\n storageHash: result.value.marker.storageHash,\n ...ifDefined('profileHash', result.value.marker.profileHash),\n }\n : undefined,\n ),\n ...ifDefined('perSpace', result.value.perSpace),\n ...ifDefined('warnings', result.value.warnings),\n advancedRef: refAdvancementFields.advancedRef,\n plannedAdvanceRef: refAdvancementFields.plannedAdvanceRef,\n summary: result.value.summary,\n timings: { total: Date.now() - startTime },\n };\n\n return ok(dbUpdateResult);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n\n if (error instanceof ContractValidationError) {\n return notOk(\n errorContractValidationFailed(`Contract validation failed: ${error.message}`, {\n where: { path: contractPathAbsolute },\n }),\n );\n }\n\n const rawMessage = error instanceof Error ? error.message : String(error);\n const safeMessage = sanitizeErrorMessage(\n rawMessage,\n typeof dbConnection === 'string' ? dbConnection : undefined,\n );\n return notOk(\n errorUnexpected(safeMessage, {\n why: `Unexpected error during db update: ${safeMessage}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createDbUpdateCommand(): Command {\n const command = new Command('update');\n setCommandDescriptions(\n command,\n 'Update your database schema to match your contract',\n 'Compares your database schema to the emitted contract and applies the necessary\\n' +\n 'changes. Works on any database, whether or not it has been initialized with `db init`.\\n' +\n 'Destructive operations prompt for confirmation in interactive mode. Use -y to\\n' +\n 'auto-accept or --dry-run to preview first.',\n );\n setCommandExamples(command, [\n 'prisma-next db update --db $DATABASE_URL',\n 'prisma-next db update --db $DATABASE_URL --dry-run',\n ]);\n addMigrationCommandOptions(command);\n command.option(\n '--to <contract>',\n 'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',\n );\n command.option('--advance-ref <name>', 'Ref to advance to the post-command contract hash');\n command.action(async (options: DbUpdateOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const startTime = Date.now();\n\n const ui = createTerminalUI(flags);\n\n let result = await executeDbUpdateCommand(options, flags, ui, startTime);\n\n // Interactive confirmation for destructive operations:\n // When the control API rejects destructive changes, prompt the user instead of failing.\n // In non-interactive mode (CI, piped, --no-interactive, --json), the error is returned as-is.\n if (\n !result.ok &&\n result.failure.code === ERROR_CODE_DESTRUCTIVE_CHANGES &&\n flags.interactive &&\n !flags.json &&\n !flags.yes\n ) {\n const meta = result.failure.meta as\n | { destructiveOperations?: readonly { id: string; label: string }[] }\n | undefined;\n const destructiveOps = meta?.destructiveOperations ?? [];\n\n if (destructiveOps.length > 0) {\n ui.warn(\n `${destructiveOps.length} destructive operation(s) that may cause data loss:\\n${destructiveOps.map((op) => ` ${ui.yellow('▸')} ${op.label}`).join('\\n')}`,\n );\n }\n\n const confirmed = await ui.confirm('Apply destructive changes? This cannot be undone.');\n\n if (confirmed) {\n result = await executeDbUpdateCommand(options, { ...flags, yes: true }, ui, Date.now());\n }\n }\n\n const exitCode = handleResult(result, flags, ui, (dbUpdateResult) => {\n if (flags.json) {\n ui.output(formatMigrationJson(dbUpdateResult));\n } else {\n const output =\n dbUpdateResult.mode === 'plan'\n ? formatMigrationPlanOutput(dbUpdateResult, flags)\n : formatMigrationApplyOutput(dbUpdateResult, flags);\n if (output) {\n ui.log(output);\n }\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,SAAS,mBAAmB,SAA8C;CACxE,IAAI,QAAQ,SAAS,mBACnB,OAAO,6BAA6B,EAAE,WAAW,QAAQ,aAAa,CAAC,EAAE,CAAC;CAG5E,IAAI,Q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,OAAO,oBAAoB,cAAc,CAAC;QACxC;IACL,MAAM,SACJ,eAAe,SAAS,SACpB,0BAA0B,gBAAgB,KAAK,IAC/C,2BAA2B,gBAAgB,KAAK;IACtD,IAAI,QACF,GAAG,IAAI,MAAM;GAEjB;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"db-update.mjs","names":[],"sources":["../../src/commands/db-update.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { MigrationToolsError } from '@prisma-next/migration-tools/errors';\nimport { parseContractRef } from '@prisma-next/migration-tools/ref-resolution';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { join } from 'pathe';\nimport { ContractValidationError } from '../control-api/errors';\nimport type { DbUpdateFailure } from '../control-api/types';\nimport {\n CliStructuredError,\n ERROR_CODE_DESTRUCTIVE_CHANGES,\n errorContractValidationFailed,\n errorDestructiveChanges,\n errorMigrationPlanningFailed,\n errorRunnerFailed,\n errorUnexpected,\n mapMigrationToolsError,\n mapRefResolutionError,\n} from '../utils/cli-errors';\nimport type { MigrationCommandOptions } from '../utils/command-helpers';\nimport {\n resolveMigrationPaths,\n sanitizeErrorMessage,\n setCommandDescriptions,\n setCommandExamples,\n} from '../utils/command-helpers';\nimport { buildReadAggregate } from '../utils/contract-space-aggregate-loader';\nimport {\n formatMigrationApplyOutput,\n formatMigrationJson,\n formatMigrationPlanOutput,\n type MigrationCommandResult,\n} from '../utils/formatters/migrations';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport {\n addMigrationCommandOptions,\n prepareMigrationContext,\n} from '../utils/migration-command-scaffold';\nimport {\n buildRefAdvancementFields,\n computeRefAdvancementName,\n type RefAdvancementFields,\n readContractIR,\n} from '../utils/ref-advancement';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\n\ninterface DbUpdateOptions extends MigrationCommandOptions {\n readonly to?: string;\n readonly advanceRef?: string;\n}\n\n/**\n * Maps a DbUpdateFailure to a CliStructuredError for consistent error handling.\n */\nfunction mapDbUpdateFailure(failure: DbUpdateFailure): CliStructuredError {\n if (failure.code === 'PLANNING_FAILED') {\n return errorMigrationPlanningFailed({ conflicts: failure.conflicts ?? [] });\n }\n\n if (failure.code === 'RUNNER_FAILED') {\n const runnerCode =\n typeof failure.meta?.['runnerErrorCode'] === 'string'\n ? failure.meta['runnerErrorCode']\n : undefined;\n const fix =\n runnerCode === 'MIGRATION.LEGACY_MARKER_SHAPE'\n ? 'Legacy marker-table shape detected. Drop `prisma_contract.marker` (Postgres) or `_prisma_marker` (SQLite) and re-run `prisma-next db init` to recreate it with the current per-space schema.'\n : 'Inspect the reported conflict, reconcile schema drift if needed, then re-run `prisma-next db update`';\n return errorRunnerFailed(failure.summary, {\n why: failure.why ?? 'Migration runner failed',\n fix,\n meta: {\n ...failure.meta,\n ...(failure.warnings && failure.warnings.length > 0\n ? { plannerWarnings: failure.warnings }\n : {}),\n },\n });\n }\n\n if (failure.code === 'DESTRUCTIVE_CHANGES') {\n return errorDestructiveChanges(failure.summary, {\n ...ifDefined('why', failure.why),\n fix: 'Re-run with `-y` to apply destructive changes, or use `--dry-run` to preview first',\n ...ifDefined('meta', failure.meta),\n });\n }\n\n const exhaustive: never = failure.code;\n throw new Error(`Unhandled DbUpdateFailure code: ${exhaustive}`);\n}\n\n/**\n * Executes the db update command and returns a structured Result.\n */\nasync function executeDbUpdateCommand(\n options: DbUpdateOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n startTime: number,\n): Promise<Result<MigrationCommandResult, CliStructuredError>> {\n // Prepare shared migration context (config, contract, connection, client)\n const ctxResult = await prepareMigrationContext(options, flags, ui, {\n commandName: 'db update',\n description: 'Update your database schema to match your contract',\n url: 'https://pris.ly/db-update',\n });\n if (!ctxResult.ok) {\n return ctxResult;\n }\n const { client, config, dbConnection, onProgress, contractPathAbsolute } = ctxResult.value;\n let { contractJson } = ctxResult.value;\n let contractJsonPathForSnapshot = contractPathAbsolute;\n const { migrationsDir, refsDir } = resolveMigrationPaths(options.config, config);\n\n if (options.to) {\n try {\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n const graph = loaded.value.aggregate.app.graph();\n const bundles = loaded.value.aggregate.app.packages;\n const refs = loaded.value.aggregate.app.refs;\n const refResult = parseContractRef(options.to, { graph, refs });\n if (!refResult.ok) {\n return notOk(mapRefResolutionError(refResult.failure));\n }\n const targetHash = refResult.value.hash;\n const matchingBundle = bundles.find((p) => p.metadata.to === targetHash);\n if (!matchingBundle) {\n return notOk(\n errorUnexpected(\n `No migration bundle found for --to \"${options.to}\" (resolved hash: ${targetHash})`,\n {\n why: `The ref resolved successfully but no on-disk migration package has an end-contract hash matching ${targetHash}.`,\n fix: 'Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.',\n },\n ),\n );\n }\n const endContractPath = join(matchingBundle.dirPath, 'end-contract.json');\n const raw = await readFile(endContractPath, 'utf-8');\n contractJson = JSON.parse(raw) as Record<string, unknown>;\n contractJsonPathForSnapshot = endContractPath;\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n throw error;\n }\n }\n\n try {\n await client.connect(dbConnection);\n\n const result = await client.dbUpdate({\n contract: contractJson,\n mode: options.dryRun ? 'plan' : 'apply',\n migrationsDir,\n ...(flags.yes ? { acceptDataLoss: true } : {}),\n onProgress,\n });\n\n // Handle failures by mapping to CLI structured error\n if (!result.ok) {\n return notOk(mapDbUpdateFailure(result.failure));\n }\n\n const advancementHash =\n result.value.mode === 'apply'\n ? (result.value.marker?.storageHash ?? result.value.destination.storageHash)\n : result.value.destination.storageHash;\n\n let refAdvancementFields: RefAdvancementFields = {\n advancedRef: null,\n plannedAdvanceRef: null,\n };\n if (\n computeRefAdvancementName({\n ...ifDefined('advanceRef', options.advanceRef),\n ...ifDefined('db', options.db),\n }) !== null\n ) {\n try {\n const contractIR = await readContractIR(contractJson, contractJsonPathForSnapshot);\n refAdvancementFields = await buildRefAdvancementFields({\n ...ifDefined('advanceRef', options.advanceRef),\n ...ifDefined('db', options.db),\n refsDir,\n contractIR,\n mode: result.value.mode,\n hash: advancementHash,\n });\n } catch (error) {\n if (MigrationToolsError.is(error)) {\n return notOk(mapMigrationToolsError(error));\n }\n throw error;\n }\n }\n\n // Convert success result to CLI output format\n const dbUpdateResult: MigrationCommandResult = {\n ok: true,\n mode: result.value.mode,\n plan: {\n targetId: ctxResult.value.config.target.targetId,\n destination: {\n storageHash: result.value.destination.storageHash,\n ...ifDefined('profileHash', result.value.destination.profileHash),\n },\n operations: result.value.plan.operations.map((op) => ({\n id: op.id,\n label: op.label,\n operationClass: op.operationClass,\n })),\n ...ifDefined('preview', result.value.plan.preview),\n },\n ...ifDefined(\n 'execution',\n result.value.execution\n ? {\n operationsPlanned: result.value.execution.operationsPlanned,\n operationsExecuted: result.value.execution.operationsExecuted,\n }\n : undefined,\n ),\n ...ifDefined(\n 'marker',\n result.value.marker\n ? {\n storageHash: result.value.marker.storageHash,\n ...ifDefined('profileHash', result.value.marker.profileHash),\n }\n : undefined,\n ),\n ...ifDefined('perSpace', result.value.perSpace),\n ...ifDefined('warnings', result.value.warnings),\n advancedRef: refAdvancementFields.advancedRef,\n plannedAdvanceRef: refAdvancementFields.plannedAdvanceRef,\n summary: result.value.summary,\n timings: { total: Date.now() - startTime },\n };\n\n return ok(dbUpdateResult);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n\n if (error instanceof ContractValidationError) {\n return notOk(\n errorContractValidationFailed(`Contract validation failed: ${error.message}`, {\n where: { path: contractPathAbsolute },\n }),\n );\n }\n\n const rawMessage = error instanceof Error ? error.message : String(error);\n const safeMessage = sanitizeErrorMessage(\n rawMessage,\n typeof dbConnection === 'string' ? dbConnection : undefined,\n );\n return notOk(\n errorUnexpected(safeMessage, {\n why: `Unexpected error during db update: ${safeMessage}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createDbUpdateCommand(): Command {\n const command = new Command('update');\n setCommandDescriptions(\n command,\n 'Update your database schema to match your contract',\n 'Compares your database schema to the emitted contract and applies the necessary\\n' +\n 'changes. Works on any database, whether or not it has been initialized with `db init`.\\n' +\n 'Destructive operations prompt for confirmation in interactive mode. Use -y to\\n' +\n 'auto-accept or --dry-run to preview first.',\n );\n setCommandExamples(command, [\n 'prisma-next db update --db $DATABASE_URL',\n 'prisma-next db update --db $DATABASE_URL --dry-run',\n ]);\n addMigrationCommandOptions(command);\n command.option(\n '--to <contract>',\n 'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',\n );\n command.option('--advance-ref <name>', 'Ref to advance to the post-command contract hash');\n command.action(async (options: DbUpdateOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const startTime = Date.now();\n\n const ui = createTerminalUI(flags);\n\n let result = await executeDbUpdateCommand(options, flags, ui, startTime);\n\n // Interactive confirmation for destructive operations:\n // When the control API rejects destructive changes, prompt the user instead of failing.\n // In non-interactive mode (CI, piped, --no-interactive, --json), the error is returned as-is.\n if (\n !result.ok &&\n result.failure.code === ERROR_CODE_DESTRUCTIVE_CHANGES &&\n flags.interactive &&\n !flags.json &&\n !flags.yes\n ) {\n const meta = result.failure.meta as\n | { destructiveOperations?: readonly { id: string; label: string }[] }\n | undefined;\n const destructiveOps = meta?.destructiveOperations ?? [];\n\n if (destructiveOps.length > 0) {\n ui.warn(\n `${destructiveOps.length} destructive operation(s) that may cause data loss:\\n${destructiveOps.map((op) => ` ${ui.yellow('▸')} ${op.label}`).join('\\n')}`,\n );\n }\n\n const confirmed = await ui.confirm('Apply destructive changes? This cannot be undone.');\n\n if (confirmed) {\n result = await executeDbUpdateCommand(options, { ...flags, yes: true }, ui, Date.now());\n }\n }\n\n const exitCode = handleResult(result, flags, ui, (dbUpdateResult) => {\n if (flags.json) {\n ui.output(formatMigrationJson(dbUpdateResult));\n } else {\n const output =\n dbUpdateResult.mode === 'plan'\n ? formatMigrationPlanOutput(dbUpdateResult, flags)\n : formatMigrationApplyOutput(dbUpdateResult, flags);\n if (output) {\n ui.log(output);\n }\n }\n });\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,SAAS,mBAAmB,SAA8C;CACxE,IAAI,QAAQ,SAAS,mBACnB,OAAO,6BAA6B,EAAE,WAAW,QAAQ,aAAa,CAAC,EAAE,CAAC;CAG5E,IAAI,QAAQ,SAAS,iBAAiB;EAKpC,MAAM,OAHJ,OAAO,QAAQ,OAAO,uBAAuB,WACzC,QAAQ,KAAK,qBACb,KAAA,OAEW,kCACX,iMACA;EACN,OAAO,kBAAkB,QAAQ,SAAS;GACxC,KAAK,QAAQ,OAAO;GACpB;GACA,MAAM;IACJ,GAAG,QAAQ;IACX,GAAI,QAAQ,YAAY,QAAQ,SAAS,SAAS,IAC9C,EAAE,iBAAiB,QAAQ,SAAS,IACpC,CAAC;GACP;EACF,CAAC;CACH;CAEA,IAAI,QAAQ,SAAS,uBACnB,OAAO,wBAAwB,QAAQ,SAAS;EAC9C,GAAG,UAAU,OAAO,QAAQ,GAAG;EAC/B,KAAK;EACL,GAAG,UAAU,QAAQ,QAAQ,IAAI;CACnC,CAAC;CAGH,MAAM,aAAoB,QAAQ;CAClC,MAAM,IAAI,MAAM,mCAAmC,YAAY;AACjE;;;;AAKA,eAAe,uBACb,SACA,OACA,IACA,WAC6D;CAE7D,MAAM,YAAY,MAAM,wBAAwB,SAAS,OAAO,IAAI;EAClE,aAAa;EACb,aAAa;EACb,KAAK;CACP,CAAC;CACD,IAAI,CAAC,UAAU,IACb,OAAO;CAET,MAAM,EAAE,QAAQ,QAAQ,cAAc,YAAY,yBAAyB,UAAU;CACrF,IAAI,EAAE,iBAAiB,UAAU;CACjC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MAGC,yBAAyB,CAAC;GAEvD,IAAI,eAAe,SAAS,GAC1B,GAAG,KACD,GAAG,eAAe,OAAO,uDAAuD,eAAe,KAAK,OAAO,KAAK,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,GACzJ;GAKF,IAAI,MAFoB,GAAG,QAAQ,mDAAmD,GAGpF,SAAS,MAAM,uBAAuB,SAAS;IAAE,GAAG;IAAO,KAAK;GAAK,GAAG,IAAI,KAAK,IAAI,CAAC;EAE1F;EAEA,MAAM,WAAW,aAAa,QAAQ,OAAO,KAAK,mBAAmB;GACnE,IAAI,MAAM,MACR,GAAG,OAAO,oBAAoB,cAAc,CAAC;QACxC;IACL,MAAM,SACJ,eAAe,SAAS,SACpB,0BAA0B,gBAAgB,KAAK,IAC/C,2BAA2B,gBAAgB,KAAK;IACtD,IAAI,QACF,GAAG,IAAI,MAAM;GAEjB;EACF,CAAC;EACD,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAED,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  import { Command } from "commander";
2
-
3
2
  //#region src/commands/db-verify.d.ts
4
3
  declare function createDbVerifyCommand(): Command;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"db-verify.d.mts","names":[],"sources":["../../src/commands/db-verify.ts"],"mappings":";;;iBAqfgB,qBAAA,IAAyB,OAAO"}
1
+ {"version":3,"file":"db-verify.d.mts","names":[],"sources":["../../src/commands/db-verify.ts"],"mappings":";;iBAofgB,yBAAyB"}
@@ -1,2 +1,2 @@
1
- import { t as createDbVerifyCommand } from "../db-verify-CEsG5Gek.mjs";
1
+ import { t as createDbVerifyCommand } from "../db-verify-BEclUzki.mjs";
2
2
  export { createDbVerifyCommand };
@@ -1,6 +1,5 @@
1
- import { E as PerSpaceExecutionEntry, w as MigratePathDecision } from "../types-DFoqNIcQ.mjs";
1
+ import { E as PerSpaceExecutionEntry, w as MigratePathDecision } from "../types-D4r_HI9-.mjs";
2
2
  import { Command } from "commander";
3
-
4
3
  //#region src/commands/migrate.d.ts
5
4
  /**
6
5
  * One migration that will run in a `migrate --show` preview, in execution order.
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.mts","names":[],"sources":["../../src/commands/migrate.ts"],"mappings":";;;;;;AA6FA;UAAiB,oBAAA;EAAA,SACN,OAAA;EAAA,SACA,OAAA;EAAA,SACA,aAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;AAAA;;UAIM,iBAAA;EAAA,SACN,EAAA;EAAA,SACA,UAAA,WAAqB,oBAAoB;EAAA,SACzC,OAAA;;;;;;WAMA,WAAA;EAAA;;;;EAAA,SAKA,mBAAA;EAUM;;;;;;EAAA,SAHN,cAAA;AAAA;AAAA,UAGM,aAAA;EAAA,SACN,EAAA;EAAA,SACA,iBAAA;EAAA,SACA,eAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;IAAA,SACE,OAAA;IAAA,SACA,OAAA;IAAA,SACA,aAAA;IAAA,SACA,IAAA;IAAA,SACA,EAAA;IAAA,SACA,kBAAA;EAAA;EAAA,SAEF,OAAA;EAAA,SACA,QAAA,WAAmB,sBAAA;EAAA,SACnB,YAAA,GAAe,mBAAmB;EAAA,SAClC,OAAA;IAAA,SACE,KAAA;EAAA;EAAA,SAEF,WAAA;IAAA,SAAyB,IAAA;IAAA,SAAuB,IAAA;EAAA;AAAA;AAAA,iBAytB3C,oBAAA,IAAwB,OAAO"}
1
+ {"version":3,"file":"migrate.d.mts","names":[],"sources":["../../src/commands/migrate.ts"],"mappings":";;;;;;UA6FiB;WACN;WACA;WACA;WACA;WACA;;;UAIM;WACN;WACA,qBAAqB;WACrB;;;;;;WAMA;;;;;WAKA;;;;;;;WAOA;;UAGM;WACN;WACA;WACA;WACA;WACA;aACE;aACA;aACA;aACA;aACA;aACA;;WAEF;WACA,mBAAmB;WACnB,eAAe;WACf;aACE;;WAEF;aAAyB;aAAuB;;;iBAytB3C,wBAAwB"}
@@ -1,10 +1,10 @@
1
- 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-CUoKYTlG.mjs";
2
- import { n as planSpacePath, t as createControlClient } from "../client-DigVI8zX.mjs";
3
- import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
1
+ 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-Cpq44aVa.mjs";
2
+ import { n as planSpacePath, t as createControlClient } from "../client-KuBQftxz.mjs";
3
+ import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
4
4
  import { i as readContractIR, r as executeRefAdvancement } from "../ref-advancement-BkXlikCA.mjs";
5
- import { t as mapContractAtError } from "../contract-at-errors-D8CNDD7g.mjs";
5
+ import { t as mapContractAtError } from "../contract-at-errors-D9gEjYtg.mjs";
6
6
  import { d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as buildGrid, i as formatOnPathMigrationRow, m as buildMigrationGraphRows, n as computeMaxDirNameWidth, r as renderMigrationGraphCommand, t as computeLabelColumn } from "../migration-graph-command-render-B83xrnNy.mjs";
7
- import { r as listRefsByContractHash } from "../migration-list-DTYM8xvm.mjs";
7
+ import { r as listRefsByContractHash } from "../migration-list-BAKujUjh.mjs";
8
8
  import { Command } from "commander";
9
9
  import { loadConfig } from "@prisma-next/config-loader";
10
10
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -1,4 +1,4 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { f as migrationCheckResultSchema, n as MigrationCheckResult, t as CheckFailure } from "../schemas-CeGMYFYX.mjs";
3
3
  import { Command } from "commander";
4
4
  import { Result } from "@prisma-next/utils/result";
@@ -6,7 +6,6 @@ import { ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
6
6
  import { Refs } from "@prisma-next/migration-tools/refs";
7
7
  import { MigrationGraph } from "@prisma-next/migration-tools/graph";
8
8
  import { OnDiskMigrationPackage } from "@prisma-next/migration-tools/package";
9
-
10
9
  //#region src/commands/migration-check.d.ts
11
10
  /**
12
11
  * One contract space's on-disk state, resolved for the explicit graph
@@ -1 +1 @@
1
- {"version":3,"file":"migration-check.d.mts","names":[],"sources":["../../src/commands/migration-check.ts"],"mappings":";;;;;;;;;;AAoIA;;;;;;;AAAA,UAAiB,UAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA,WAAmB,sBAAA;EAAA,SACnB,IAAA,EAAM,IAAA;EAAA,SACN,KAAA,EAAO,cAAA;EAAA,SACP,aAAA;EAAA,SACA,OAAA;AAAA;;;;AAAO;AAWlB;;;;iBAAsB,oBAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,UAAA;;;;;;;UAyGH,uBAAA;EAAA,SACN,MAAA,WAAiB,UAAU;EAAA,SAC3B,WAAA;AAAA;AAFX;;;;;;;;AAEsB;AAetB;;;AAjBA,iBAiBgB,iBAAA,CACd,MAAA,EAAQ,uBAAA,GACP,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBA+ShB,2BAAA,IAA+B,OAAO"}
1
+ {"version":3,"file":"migration-check.d.mts","names":[],"sources":["../../src/commands/migration-check.ts"],"mappings":";;;;;;;;;;;;;;;;UAoIiB;WACN;WACA,mBAAmB;WACnB,MAAM;WACN,OAAO;WACP;WACA;;;;;;;;;;iBAWW,qBACpB,WAAW,wBACX,+BACC,iBAAiB;;;;;;;UAyGH;WACN,iBAAiB;WACjB;;;;;;;;;;;;;;iBAeK,kBACd,QAAQ,0BACP,OAAO,sBAAsB;iBA+ShB,+BAA+B"}
@@ -1,3 +1,3 @@
1
- import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "../migration-check-ByeQHOhK.mjs";
1
+ import { n as enumerateCheckSpaces, r as runMigrationCheck, t as createMigrationCheckCommand } from "../migration-check-VqN-iTcx.mjs";
2
2
  import { t as migrationCheckResultSchema } from "../schemas-KhXMzNA_.mjs";
3
3
  export { createMigrationCheckCommand, enumerateCheckSpaces, migrationCheckResultSchema, runMigrationCheck };
@@ -1,11 +1,10 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { o as MigrationSpaceGraphEntry } from "../schemas-CeGMYFYX.mjs";
3
3
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-BpoOYtNZ.mjs";
4
- import { t as TerminalUI } from "../terminal-ui-DGRNFWna.mjs";
4
+ import { t as TerminalUI } from "../terminal-ui-BN4QOsm5.mjs";
5
5
  import { Command } from "commander";
6
6
  import { Result } from "@prisma-next/utils/result";
7
7
  import { MigrationGraph } from "@prisma-next/migration-tools/graph";
8
-
9
8
  //#region src/commands/migration-graph.d.ts
10
9
  interface MigrationGraphOptions extends CommonCommandOptions {
11
10
  readonly config?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-graph.d.mts","names":[],"sources":["../../src/commands/migration-graph.ts"],"mappings":";;;;;;;;;UAmCU,qBAAA,SAA8B,oBAAoB;EAAA,SACjD,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,yBAAA;EAAA,SACN,KAAA;EAAA,SACA,IAAA;EAAA,SACA,WAAA;AAAA;AAAA,UAGM,oBAAA;EAAA,SACN,EAAA;EAP+B;EAAA,SAS/B,KAAA,EAAO,cAAA;EATwB;EAAA,SAW/B,MAAA,WAAiB,wBAAA;EAAA,SACjB,YAAA,WAAuB,yBAAA;EAAA,SACvB,OAAA;AAAA;AAAA,iBASK,+BAAA,CAAgC,MAA4B,EAApB,oBAAoB;AAAA,iBAiBtD,4BAAA,CACpB,OAAA,EAAS,qBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,oBAAA,EAAsB,kBAAA;AAAA,iBA0HxB,2BAAA,IAA+B,OAAO"}
1
+ {"version":3,"file":"migration-graph.d.mts","names":[],"sources":["../../src/commands/migration-graph.ts"],"mappings":";;;;;;;;UAmCU,8BAA8B;WAC7B;WACA;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;;UAGM;WACN;;WAEA,OAAO;;WAEP,iBAAiB;WACjB,uBAAuB;WACvB;;iBASK,gCAAgC,QAAQ;iBAiBlC,6BACpB,SAAS,uBACT,OAAO,aACP,IAAI,aACH,QAAQ,OAAO,sBAAsB;iBA0HxB,+BAA+B"}
@@ -1,7 +1,7 @@
1
- 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-CUoKYTlG.mjs";
2
- import { n as buildReadAggregate } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
1
+ 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-Cpq44aVa.mjs";
2
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
3
3
  import { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from "../migration-graph-command-render-B83xrnNy.mjs";
4
- import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-DTYM8xvm.mjs";
4
+ import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "../migration-list-BAKujUjh.mjs";
5
5
  import { Command } from "commander";
6
6
  import { loadConfig } from "@prisma-next/config-loader";
7
7
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -1,12 +1,11 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { r as MigrationListResult, s as MigrationSpaceListEntry } from "../schemas-CeGMYFYX.mjs";
3
3
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-BpoOYtNZ.mjs";
4
- import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-DGRNFWna.mjs";
4
+ import { n as GlyphMode, t as TerminalUI } from "../terminal-ui-BN4QOsm5.mjs";
5
5
  import { Command } from "commander";
6
6
  import { Result } from "@prisma-next/utils/result";
7
7
  import { AggregateContractSpace, ContractSpaceAggregate } from "@prisma-next/migration-tools/aggregate";
8
8
  import { MigrationGraph } from "@prisma-next/migration-tools/graph";
9
-
10
9
  //#region src/commands/migration-list.d.ts
11
10
  /**
12
11
  * Ref names decorating a space's destination contract hashes. The
@@ -1 +1 @@
1
- {"version":3,"file":"migration-list.d.mts","names":[],"sources":["../../src/commands/migration-list.ts"],"mappings":";;;;;;;;;;AAmEA;;;;;;;;AAAA,iBAAgB,sBAAA,CACd,KAAA,EAAO,sBAAA,GACN,WAAW;AA4Bd;;;;;;;;AAAA,iBAAsB,sCAAA,CACpB,SAAA,EAAW,sBAAA,EACX,oBAAA,WACC,OAAA,UAAiB,uBAAA;AAAA,UA6BV,oBAAA,SAA6B,oBAAoB;EAAA,SAChD,MAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,0BAAA;EAAA,SACN,IAAA,EAAM,mBAAA;EAAA,SACN,gBAAA;EAAA,SACA,SAAA,EAAW,sBAAsB;AAAA;AAAA,UAG3B,+BAAA;EAAA,SACN,SAAA,EAAW,SAAA;EAAA,SACX,QAAA;EAAA,SACA,gBAAA;EAAA,SACA,aAAA,GAAgB,OAAA,aAAoB,cAAc;EAAA,SAClD,UAAA;AAAA;AAAA,iBAGK,8BAAA,CACd,MAAA,EAAQ,mBAAA,EACR,OAAA,EAAS,+BAA+B;;;;;;;;;UAmBzB,sBAAA;EAAA,SACN,MAAA,WAAiB,uBAAuB;EAAA,SACxC,WAAA;AAAA;;;;;;;;;;iBAoBK,gBAAA,CACd,MAAA,EAAQ,sBAAA,GACP,MAAA,CAAO,mBAAA,EAAqB,kBAAA;AAhDV;AAGrB;;;;AAHqB,iBA6EC,2BAAA,CACpB,OAAA,EAAS,oBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,0BAAA,EAA4B,kBAAA;AAAA,iBAiD9B,0BAAA,IAA8B,OAAO"}
1
+ {"version":3,"file":"migration-list.d.mts","names":[],"sources":["../../src/commands/migration-list.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAmEgB,uBACd,OAAO,yBACN;;;;;;;;;iBA4BmB,uCACpB,WAAW,wBACX,+BACC,iBAAiB;UA6BV,6BAA6B;WAC5B;WACA;WACA;WACA;;UAGM;WACN,MAAM;WACN;WACA,WAAW;;UAGL;WACN,WAAW;WACX;WACA;WACA,gBAAgB,oBAAoB;WACpC;;iBAGK,+BACd,QAAQ,qBACR,SAAS;;;;;;;;;UAmBM;WACN,iBAAiB;WACjB;;;;;;;;;;;iBAoBK,iBACd,QAAQ,yBACP,OAAO,qBAAqB;;;;;;iBA6BT,4BACpB,SAAS,sBACT,OAAO,aACP,IAAI,aACH,QAAQ,OAAO,4BAA4B;iBAiD9B,8BAA8B"}
@@ -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-DTYM8xvm.mjs";
1
+ import { a as renderMigrationListHumanOutput, i as migrationSpaceListEntriesFromAggregate, n as executeMigrationListCommand, o as runMigrationList, r as listRefsByContractHash, t as createMigrationListCommand } from "../migration-list-BAKujUjh.mjs";
2
2
  export { createMigrationListCommand, executeMigrationListCommand, listRefsByContractHash, migrationSpaceListEntriesFromAggregate, renderMigrationListHumanOutput, runMigrationList };
@@ -1,11 +1,10 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { i as MigrationLogResult } from "../schemas-CeGMYFYX.mjs";
3
3
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-BpoOYtNZ.mjs";
4
- import { t as TerminalUI } from "../terminal-ui-DGRNFWna.mjs";
4
+ import { t as TerminalUI } from "../terminal-ui-BN4QOsm5.mjs";
5
5
  import { Command } from "commander";
6
6
  import { Result } from "@prisma-next/utils/result";
7
7
  import { LedgerEntryRecord } from "@prisma-next/contract/types";
8
-
9
8
  //#region src/commands/migration-log.d.ts
10
9
  interface MigrationLogOptions extends CommonCommandOptions {
11
10
  readonly db?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/commands/migration-log.ts"],"mappings":";;;;;;;;;UAqCU,mBAAA,SAA4B,oBAAoB;EAAA,SAC/C,EAAA;EAAA,SACA,MAAA;EAAA,SACA,GAAA;EAAA,SACA,KAAA;AAAA;AAAA,iBAGW,0BAAA,CACpB,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,UAAgB,iBAAA,IAAqB,kBAAA;AAAA,iBA0DhC,yBAAA,IAA6B,OAAO"}
1
+ {"version":3,"file":"migration-log.d.mts","names":[],"sources":["../../src/commands/migration-log.ts"],"mappings":";;;;;;;;UAqCU,4BAA4B;WAC3B;WACA;WACA;WACA;;iBAGW,2BACpB,SAAS,qBACT,OAAO,aACP,IAAI,aACH,QAAQ,gBAAgB,qBAAqB;iBA0DhC,6BAA6B"}
@@ -1,2 +1,2 @@
1
- import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-qZ8LpQIl.mjs";
1
+ import { n as executeMigrationLogCommand, t as createMigrationLogCommand } from "../migration-log-C_xam2HZ.mjs";
2
2
  export { createMigrationLogCommand, executeMigrationLogCommand };
@@ -1,5 +1,4 @@
1
1
  import { Command } from "commander";
2
-
3
2
  //#region src/commands/migration-new.d.ts
4
3
  declare function createMigrationNewCommand(): Command;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"migration-new.d.mts","names":[],"sources":["../../src/commands/migration-new.ts"],"mappings":";;;iBA4QgB,yBAAA,IAA6B,OAAO"}
1
+ {"version":3,"file":"migration-new.d.mts","names":[],"sources":["../../src/commands/migration-new.ts"],"mappings":";;iBA4QgB,6BAA6B"}
@@ -1,6 +1,6 @@
1
- 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-CUoKYTlG.mjs";
2
- import { t as assertFrameworkComponentsCompatible } from "../framework-components-BbnM1RYm.mjs";
3
- import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
1
+ 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-Cpq44aVa.mjs";
2
+ import { t as assertFrameworkComponentsCompatible } from "../framework-components-CnbUbiJw.mjs";
3
+ import { o as refusePackageCorruptionOnAggregate } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
4
4
  import { Command } from "commander";
5
5
  import { loadConfig } from "@prisma-next/config-loader";
6
6
  import { getEmittedArtifactPaths } from "@prisma-next/emitter";
@@ -2,7 +2,6 @@ import { n as GlobalFlags } from "../global-flags-BpoOYtNZ.mjs";
2
2
  import { Command } from "commander";
3
3
  import { Result } from "@prisma-next/utils/result";
4
4
  import { OperationPreview } from "@prisma-next/framework-components/control";
5
-
6
5
  //#region src/commands/migration-plan.d.ts
7
6
  interface MigrationPlanResult {
8
7
  readonly ok: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-plan.d.mts","names":[],"sources":["../../src/commands/migration-plan.ts"],"mappings":";;;;;;UAoLiB,mBAAA;EAAA,SACN,EAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA;EAAA,SACA,EAAA;EAAA,SACA,GAAA;EAAA,SACA,WAAA;EAJA;;;;;;;;;;;;EAAA,SAiBA,oBAAA;IAAA,SAA0C,OAAA;IAAA,SAA0B,OAAA;EAAA;EAAA,SACpE,UAAA;IAAA,SACE,EAAA;IAAA,SACA,KAAA;IAAA,SACA,cAAA;EAAA;EAqhB6B;;;AAAW;AA+ErD;EA/E0C,SA9gB/B,OAAA,GAAU,gBAAgB;EAAA,SAC1B,OAAA;EA4lB8E;;;;;EAAA,SAtlB9E,mBAAA;EAAA,SACA,OAAA;IAAA,SACE,KAAA;EAAA;AAAA;AAAA,iBAqgBG,0BAAA,IAA8B,OAAO;AAAA,iBA+ErC,yBAAA,CAA0B,MAAA,EAAQ,mBAAA,EAAqB,KAAA,EAAO,WAAW;AAAA,KAkI7E,uBAAA;EACN,MAAA;EAAqB,KAAA;AAAA;EACrB,MAAA;AAAA;;;;;;;;;;;;;;iBAeU,qBAAA;EAAkC,QAAA;IAAY,EAAA;EAAA;AAAA,GAC5D,OAAA,WAAkB,CAAA,IAClB,MAAA,WACC,MAAA,CAAO,CAAA,EAAG,uBAAA"}
1
+ {"version":3,"file":"migration-plan.d.mts","names":[],"sources":["../../src/commands/migration-plan.ts"],"mappings":";;;;;UAoLiB;WACN;WACA;WACA;WACA;WACA;WACA;;;;;;;;;;;;;WAaA;aAA0C;aAA0B;;WACpE;aACE;aACA;aACA;;;;;;;WAOF,UAAU;WACV;;;;;;WAMA;WACA;aACE;;;iBAqgBG,8BAA8B;iBA+E9B,0BAA0B,QAAQ,qBAAqB,OAAO;KAkIlE;EACN;EAAqB;;EACrB;;;;;;;;;;;;;;;iBAeU,sBAAsB;EAAY;IAAY;;GAC5D,kBAAkB,KAClB,iBACC,OAAO,GAAG"}
@@ -1,2 +1,2 @@
1
- import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-CfPrB80t.mjs";
1
+ import { n as formatMigrationPlanOutput, r as resolveBundleByPrefix, t as createMigrationPlanCommand } from "../migration-plan-CreSVtWZ.mjs";
2
2
  export { createMigrationPlanCommand, formatMigrationPlanOutput, resolveBundleByPrefix };
@@ -1,6 +1,5 @@
1
1
  import { a as MigrationShowResult } from "../schemas-CeGMYFYX.mjs";
2
2
  import { Command } from "commander";
3
-
4
3
  //#region src/commands/migration-show.d.ts
5
4
  interface MigrationShowPresent {
6
5
  readonly space: string;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":";;;;UAkDiB,oBAAA;EAAA,SACN,KAAA;EAAA,SACA,IAAA;EAAA,SACA,YAAA;EAAA,SACA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,SAAA;EAAA,SACA,UAAA;IAAc,EAAA;IAAY,KAAA;IAAe,cAAA;EAAA;EAAA,SACzC,OAAA;IACP,UAAA;MAAc,IAAA;MAAc,QAAA;IAAA;EAAA;AAAA;AAAA,iBAgKhB,0BAAA,IAA8B,OAAO"}
1
+ {"version":3,"file":"migration-show.d.mts","names":[],"sources":["../../src/commands/migration-show.ts"],"mappings":";;;UAkDiB;WACN;WACA;WACA;WACA;WACA;WACA;WACA;IAAc;IAAY;IAAe;;WACzC;IACP;MAAc;MAAc;;;;iBAgKhB,8BAA8B"}
@@ -1,6 +1,6 @@
1
- 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-CUoKYTlG.mjs";
2
- import { t as createControlClient } from "../client-DigVI8zX.mjs";
3
- import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-DmNwsDgs.mjs";
1
+ 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-Cpq44aVa.mjs";
2
+ import { t as createControlClient } from "../client-KuBQftxz.mjs";
3
+ import { n as looksLikePath, r as resolveAppTargetPath, t as findPackageByDirPath } from "../migration-path-target-DpPTsRCg.mjs";
4
4
  import { Command } from "commander";
5
5
  import { loadConfig } from "@prisma-next/config-loader";
6
6
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -1,10 +1,9 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { c as MigrationStatusEntry, d as StatusDiagnosticJson, l as MigrationStatusResult, p as migrationStatusJsonResultSchema, u as MigrationStatusSpace } from "../schemas-CeGMYFYX.mjs";
3
3
  import { n as GlobalFlags, t as CommonCommandOptions } from "../global-flags-BpoOYtNZ.mjs";
4
- import { t as TerminalUI } from "../terminal-ui-DGRNFWna.mjs";
4
+ import { t as TerminalUI } from "../terminal-ui-BN4QOsm5.mjs";
5
5
  import { Command } from "commander";
6
6
  import { Result } from "@prisma-next/utils/result";
7
-
8
7
  //#region src/utils/migration-types.d.ts
9
8
  interface StatusRef {
10
9
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/utils/migration-types.ts","../../src/commands/migration-status.ts"],"mappings":";;;;;;;;UAAiB,SAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;;;UCqFM,sBAAA,SAA+B,oBAAoB;EAAA,SACzD,EAAA;EAAA,SACA,MAAA;EAAA,SACA,EAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;EAAA,SACA,KAAA;AAAA;AAAA,UAGM,0BAAA;EAAA,SACN,KAAA;EAAA,SACA,IAAA;EAAA,SACA,WAAA;AAAA;AAAA,UAGD,4BAAA;EAAA,SACC,EAAA;EAAA,SACA,MAAA,WAAiB,oBAAA;EAAA,SACjB,OAAA;EAAA,SACA,WAAA,WAAsB,oBAAA;EAAA,SACtB,YAAA,WAAuB,0BAAA;AAAA;AAAA,iBA8DlB,kBAAA,CAAmB,IAAA;EAAA,SACxB,UAAA;EAAA,SACA,UAAA;EAAA,SACA,cAAA;EAAA,SACA,OAAA;AAAA;AAAA,iBAiBK,mBAAA,CAAoB,IAAA;EAAA,SACzB,YAAA;EAAA,SACA,UAAA;EAAA,SACA,cAAA;EAAA,SACA,UAAA;AAAA;AAAA,iBAWK,mBAAA,CACd,MAAA,EAAQ,4BAA4B,EACpC,QAAA;AAAA,iBAyBc,uBAAA,CACd,MAAA,EAAQ,4BAA4B,EACpC,QAAA;AAAA,iBAqCoB,6BAAA,CACpB,OAAA,EAAS,sBAAA,EACT,KAAA,EAAO,WAAA,EACP,EAAA,EAAI,UAAA,GACH,OAAA,CAAQ,MAAA,CAAO,4BAAA,EAA8B,kBAAA;AAAA,iBAmXhC,4BAAA,IAAgC,OAAO"}
1
+ {"version":3,"file":"migration-status.d.mts","names":[],"sources":["../../src/utils/migration-types.ts","../../src/commands/migration-status.ts"],"mappings":";;;;;;;UAAiB;WACN;WACA;WACA;;;;UCqFM,+BAA+B;WACrC;WACA;WACA;WACA;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;;UAGD;WACC;WACA,iBAAiB;WACjB;WACA,sBAAsB;WACtB,uBAAuB;;iBA8DlB,mBAAmB;WACxB;WACA;WACA;WACA;;iBAiBK,oBAAoB;WACzB;WACA;WACA;WACA;;iBAWK,oBACd,QAAQ,8BACR;iBAyBc,wBACd,QAAQ,8BACR;iBAqCoB,8BACpB,SAAS,wBACT,OAAO,aACP,IAAI,aACH,QAAQ,OAAO,8BAA8B;iBAmXhC,gCAAgC"}
@@ -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-DRuS-rP5.mjs";
2
+ import { a as formatStatusHumanOutput, i as executeMigrationStatusCommand, n as buildStatusHeadline, o as formatStatusSummary, r as createMigrationStatusCommand, t as buildNoPathSummary } from "../migration-status-DYErXpyF.mjs";
3
3
  export { buildNoPathSummary, buildStatusHeadline, createMigrationStatusCommand, executeMigrationStatusCommand, formatStatusHumanOutput, formatStatusSummary, migrationStatusJsonResultSchema };
@@ -1,8 +1,7 @@
1
- import { N as CliStructuredError } from "../types-DFoqNIcQ.mjs";
1
+ import { N as CliStructuredError } from "../types-D4r_HI9-.mjs";
2
2
  import { Command } from "commander";
3
3
  import { Result } from "@prisma-next/utils/result";
4
4
  import { RefEntry } from "@prisma-next/migration-tools/refs";
5
-
6
5
  //#region src/commands/ref.d.ts
7
6
  interface RefSetResult {
8
7
  readonly ok: true;
@@ -1 +1 @@
1
- {"version":3,"file":"ref.d.mts","names":[],"sources":["../../src/commands/ref.ts"],"mappings":";;;;;;UAwCU,YAAA;EAAA,SACC,EAAA;EAAA,SACA,GAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;AAAA;AAAA,UAGD,eAAA;EAAA,SACC,EAAA;EAAA,SACA,GAAA;EAAA,SACA,OAAA;AAAA;AAAA,UAGD,aAAA;EAAA,SACC,EAAA;EAAA,SACA,IAAA,EAAM,MAAM,SAAS,QAAA;AAAA;AAAA,iBAiBV,oBAAA,CACpB,IAAA,UACA,aAAA,UACA,OAAA;EAAW,MAAA;AAAA,IACV,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,kBAAA;AAAA,iBAmEV,uBAAA,CACpB,IAAA,UACA,OAAA;EAAW,MAAA;AAAA,IACV,OAAA,CAAQ,MAAA,CAAO,eAAA,EAAiB,kBAAA;AAAA,iBAYb,qBAAA,CAAsB,OAAA;EAC1C,MAAA;AAAA,IACE,OAAA,CAAQ,MAAA,CAAO,aAAA,EAAe,kBAAA;AAAA,iBAyGlB,gBAAA,IAAoB,OAAO"}
1
+ {"version":3,"file":"ref.d.mts","names":[],"sources":["../../src/commands/ref.ts"],"mappings":";;;;;UAwCU;WACC;WACA;WACA;WACA;;UAGD;WACC;WACA;WACA;;UAGD;WACC;WACA,MAAM,eAAe;;iBAiBV,qBACpB,cACA,uBACA;EAAW;IACV,QAAQ,OAAO,cAAc;iBAmEV,wBACpB,cACA;EAAW;IACV,QAAQ,OAAO,iBAAiB;iBAYb,sBAAsB;EAC1C;IACE,QAAQ,OAAO,eAAe;iBAyGlB,oBAAoB"}
@@ -1,5 +1,5 @@
1
- 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-CUoKYTlG.mjs";
2
- import { n as buildReadAggregate } from "../contract-space-aggregate-loader-DpB4x97a.mjs";
1
+ 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-Cpq44aVa.mjs";
2
+ import { n as buildReadAggregate } from "../contract-space-aggregate-loader-D_3VeHVb.mjs";
3
3
  import { i as readContractIR } from "../ref-advancement-BkXlikCA.mjs";
4
4
  import { Command } from "commander";
5
5
  import { loadConfig } from "@prisma-next/config-loader";
@@ -1,5 +1,4 @@
1
1
  import { Command } from "commander";
2
-
3
2
  //#region src/commands/telemetry/index.d.ts
4
3
  declare function createTelemetryCommand(): Command;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/commands/telemetry/index.ts"],"mappings":";;;iBAoFgB,sBAAA,IAA0B,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/commands/telemetry/index.ts"],"mappings":";;iBAoFgB,0BAA0B"}
@@ -1,2 +1,2 @@
1
- import { t as createTelemetryCommand } from "../../telemetry-DHBBq5wT.mjs";
1
+ import { t as createTelemetryCommand } from "../../telemetry-DVr6RFnq.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-CUoKYTlG.mjs";
1
+ import { B as errorContractValidationFailed, F as CliStructuredError, W as errorFileNotFound, ct as errorUnexpected, it as errorSnapshotMissing, lt as mapMigrationToolsError } from "./command-helpers-Cpq44aVa.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-D8CNDD7g.mjs.map
42
+ //# sourceMappingURL=contract-at-errors-D9gEjYtg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-at-errors-D8CNDD7g.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
+ {"version":3,"file":"contract-at-errors-D9gEjYtg.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,5 +1,5 @@
1
- import { n as executeContractEmit } from "./contract-emit-sYrqzsdN.mjs";
2
- import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-CUoKYTlG.mjs";
1
+ import { n as executeContractEmit } from "./contract-emit-cJQBlvGb.mjs";
2
+ import { A as formatStyledHeader, F as CliStructuredError$1, P as isVerbose, _ as createTerminalUI, ct as errorUnexpected, g as parseGlobalFlagsOrExit, j as formatSuccessMessage, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples, y as handleResult } from "./command-helpers-Cpq44aVa.mjs";
3
3
  import { t as createProgressAdapter } from "./progress-adapter-CjAeTxY_.mjs";
4
4
  import { Command } from "commander";
5
5
  import { loadConfig } from "@prisma-next/config-loader";
@@ -147,4 +147,4 @@ function createContractEmitCommand() {
147
147
  //#endregion
148
148
  export { createContractEmitCommand as t };
149
149
 
150
- //# sourceMappingURL=contract-emit-wgqrOXUI.mjs.map
150
+ //# sourceMappingURL=contract-emit-CgnXSANN.mjs.map