@prisma-next/cli 0.14.0 → 0.15.0-dev.1

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 (156) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.mjs +33 -14
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/{client-CJzuo5wX.mjs → client-DigVI8zX.mjs} +90 -104
  5. package/dist/client-DigVI8zX.mjs.map +1 -0
  6. package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-CUoKYTlG.mjs} +13 -10
  7. package/dist/command-helpers-CUoKYTlG.mjs.map +1 -0
  8. package/dist/commands/contract-emit.mjs +1 -1
  9. package/dist/commands/contract-infer.mjs +1 -1
  10. package/dist/commands/db-init.mjs +3 -3
  11. package/dist/commands/db-schema.mjs +3 -3
  12. package/dist/commands/db-sign.mjs +5 -5
  13. package/dist/commands/db-sign.mjs.map +1 -1
  14. package/dist/commands/db-update.mjs +4 -4
  15. package/dist/commands/db-verify.d.mts.map +1 -1
  16. package/dist/commands/db-verify.mjs +1 -1
  17. package/dist/commands/migrate.d.mts +1 -1
  18. package/dist/commands/migrate.d.mts.map +1 -1
  19. package/dist/commands/migrate.mjs +37 -38
  20. package/dist/commands/migrate.mjs.map +1 -1
  21. package/dist/commands/migration-check.d.mts +1 -1
  22. package/dist/commands/migration-check.mjs +1 -1
  23. package/dist/commands/migration-graph.d.mts +1 -1
  24. package/dist/commands/migration-graph.mjs +9 -9
  25. package/dist/commands/migration-graph.mjs.map +1 -1
  26. package/dist/commands/migration-list.d.mts +6 -6
  27. package/dist/commands/migration-list.d.mts.map +1 -1
  28. package/dist/commands/migration-list.mjs +1 -1
  29. package/dist/commands/migration-log.d.mts +1 -1
  30. package/dist/commands/migration-log.mjs +1 -1
  31. package/dist/commands/migration-new.mjs +4 -4
  32. package/dist/commands/migration-new.mjs.map +1 -1
  33. package/dist/commands/migration-plan.d.mts.map +1 -1
  34. package/dist/commands/migration-plan.mjs +1 -1
  35. package/dist/commands/migration-show.mjs +4 -4
  36. package/dist/commands/migration-show.mjs.map +1 -1
  37. package/dist/commands/migration-status.d.mts +1 -1
  38. package/dist/commands/migration-status.mjs +1 -1
  39. package/dist/commands/ref.d.mts +1 -1
  40. package/dist/commands/ref.mjs +3 -3
  41. package/dist/commands/ref.mjs.map +1 -1
  42. package/dist/commands/telemetry/index.mjs +1 -1
  43. package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-D8CNDD7g.mjs} +2 -2
  44. package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-D8CNDD7g.mjs.map} +1 -1
  45. package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-sYrqzsdN.mjs} +9 -11
  46. package/dist/contract-emit-sYrqzsdN.mjs.map +1 -0
  47. package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-wgqrOXUI.mjs} +6 -6
  48. package/dist/contract-emit-wgqrOXUI.mjs.map +1 -0
  49. package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-6SQnnVj7.mjs} +3 -3
  50. package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-6SQnnVj7.mjs.map} +1 -1
  51. package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-DpB4x97a.mjs} +63 -5
  52. package/dist/contract-space-aggregate-loader-DpB4x97a.mjs.map +1 -0
  53. package/dist/{db-verify-C24FKhb7.mjs → db-verify-CEsG5Gek.mjs} +57 -61
  54. package/dist/db-verify-CEsG5Gek.mjs.map +1 -0
  55. package/dist/exports/control-api.d.mts +3 -3
  56. package/dist/exports/control-api.d.mts.map +1 -1
  57. package/dist/exports/control-api.mjs +2 -2
  58. package/dist/exports/index.d.mts +5 -1
  59. package/dist/exports/index.d.mts.map +1 -1
  60. package/dist/exports/index.mjs +4 -3
  61. package/dist/exports/index.mjs.map +1 -1
  62. package/dist/format-CjongNb1.mjs +102 -0
  63. package/dist/format-CjongNb1.mjs.map +1 -0
  64. package/dist/{framework-components-YVQHhPH7.mjs → framework-components-BbnM1RYm.mjs} +2 -2
  65. package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-BbnM1RYm.mjs.map} +1 -1
  66. package/dist/{init-0HwB-Vh8.mjs → init-D8YFfaD6.mjs} +27 -19
  67. package/dist/init-D8YFfaD6.mjs.map +1 -0
  68. package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-CEt_ztBJ.mjs} +4 -4
  69. package/dist/inspect-live-schema-CEt_ztBJ.mjs.map +1 -0
  70. package/dist/{migration-check-VwM8xCZV.mjs → migration-check-ByeQHOhK.mjs} +10 -12
  71. package/dist/migration-check-ByeQHOhK.mjs.map +1 -0
  72. package/dist/migration-cli.mjs +1 -1
  73. package/dist/migration-cli.mjs.map +1 -1
  74. package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-CJO3tjiR.mjs} +4 -4
  75. package/dist/migration-command-scaffold-CJO3tjiR.mjs.map +1 -0
  76. package/dist/{migration-graph-command-render-CEez7YUK.mjs → migration-graph-command-render-B83xrnNy.mjs} +24 -24
  77. package/dist/{migration-graph-command-render-CEez7YUK.mjs.map → migration-graph-command-render-B83xrnNy.mjs.map} +1 -1
  78. package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-DTYM8xvm.mjs} +16 -16
  79. package/dist/migration-list-DTYM8xvm.mjs.map +1 -0
  80. package/dist/{migration-log-CG0qQAFm.mjs → migration-log-qZ8LpQIl.mjs} +5 -5
  81. package/dist/migration-log-qZ8LpQIl.mjs.map +1 -0
  82. package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-DmNwsDgs.mjs} +2 -2
  83. package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-DmNwsDgs.mjs.map} +1 -1
  84. package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-CfPrB80t.mjs} +30 -30
  85. package/dist/migration-plan-CfPrB80t.mjs.map +1 -0
  86. package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-DRuS-rP5.mjs} +14 -15
  87. package/dist/migration-status-DRuS-rP5.mjs.map +1 -0
  88. package/dist/{telemetry-BIM4beEO.mjs → telemetry-DHBBq5wT.mjs} +2 -2
  89. package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-DHBBq5wT.mjs.map} +1 -1
  90. package/dist/{types-C_tYiJYx.d.mts → types-DFoqNIcQ.d.mts} +27 -21
  91. package/dist/types-DFoqNIcQ.d.mts.map +1 -0
  92. package/dist/{verify-DcOYZ1tH.mjs → verify-DDCb0R2r.mjs} +57 -159
  93. package/dist/verify-DDCb0R2r.mjs.map +1 -0
  94. package/package.json +28 -30
  95. package/src/cli.ts +7 -0
  96. package/src/commands/contract-emit.ts +1 -1
  97. package/src/commands/db-sign.ts +1 -1
  98. package/src/commands/db-verify.ts +34 -20
  99. package/src/commands/format.ts +75 -0
  100. package/src/commands/init/detect-package-manager.ts +8 -4
  101. package/src/commands/init/hygiene-package-scripts.ts +16 -3
  102. package/src/commands/inspect-live-schema.ts +1 -1
  103. package/src/commands/lsp.ts +32 -0
  104. package/src/commands/migrate.ts +47 -44
  105. package/src/commands/migration-check.ts +6 -6
  106. package/src/commands/migration-graph.ts +5 -5
  107. package/src/commands/migration-list.ts +13 -13
  108. package/src/commands/migration-log.ts +1 -1
  109. package/src/commands/migration-new.ts +1 -1
  110. package/src/commands/migration-plan.ts +15 -4
  111. package/src/commands/migration-show.ts +1 -1
  112. package/src/commands/migration-status.ts +10 -10
  113. package/src/commands/ref.ts +1 -1
  114. package/src/control-api/client.ts +8 -23
  115. package/src/control-api/operations/contract-emit.ts +9 -27
  116. package/src/control-api/operations/db-init.ts +2 -2
  117. package/src/control-api/operations/db-run.ts +18 -17
  118. package/src/control-api/operations/db-verify.ts +52 -44
  119. package/src/control-api/operations/format.ts +98 -0
  120. package/src/control-api/operations/migrate.ts +72 -72
  121. package/src/control-api/operations/run-migration.ts +6 -5
  122. package/src/control-api/types.ts +8 -8
  123. package/src/exports/index.ts +1 -0
  124. package/src/migration-cli.ts +1 -1
  125. package/src/utils/combine-verify-results.ts +94 -0
  126. package/src/utils/extension-pack-inputs.ts +1 -1
  127. package/src/utils/formatters/errors.ts +13 -5
  128. package/src/utils/formatters/verify.ts +88 -227
  129. package/src/utils/migration-command-scaffold.ts +1 -1
  130. package/src/utils/plan-resolution.ts +18 -18
  131. package/dist/client-CJzuo5wX.mjs.map +0 -1
  132. package/dist/command-helpers-DGMvGBeX.mjs.map +0 -1
  133. package/dist/config-loader-p9JMrekQ.mjs +0 -88
  134. package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
  135. package/dist/config-loader.d.mts +0 -16
  136. package/dist/config-loader.d.mts.map +0 -1
  137. package/dist/config-loader.mjs +0 -2
  138. package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
  139. package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
  140. package/dist/contract-space-aggregate-loader-ClI1KN6d.mjs.map +0 -1
  141. package/dist/db-verify-C24FKhb7.mjs.map +0 -1
  142. package/dist/extension-pack-inputs-1ySHqxKG.mjs +0 -62
  143. package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +0 -1
  144. package/dist/init-0HwB-Vh8.mjs.map +0 -1
  145. package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
  146. package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
  147. package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
  148. package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
  149. package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
  150. package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
  151. package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
  152. package/dist/types-C_tYiJYx.d.mts.map +0 -1
  153. package/dist/verify-DcOYZ1tH.mjs.map +0 -1
  154. package/src/config-loader.ts +0 -92
  155. package/src/config-path-validation.ts +0 -74
  156. package/src/utils/combine-schema-results.ts +0 -84
@@ -1,11 +1,10 @@
1
- import { t as loadConfig } from "./config-loader-p9JMrekQ.mjs";
2
- import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, 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-CJzuo5wX.mjs";
4
- import { n as buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from "./contract-space-aggregate-loader-ClI1KN6d.mjs";
5
- import { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from "./migration-graph-command-render-CEez7YUK.mjs";
6
- import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "./migration-list-DlJJ_38Z.mjs";
7
- import "./schemas-KhXMzNA_.mjs";
1
+ import { A as formatStyledHeader, F as CliStructuredError, _ as createTerminalUI, a as readContractEnvelope, ct as errorUnexpected, d as setCommandSeeAlso, dt as requireLiveDatabase, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, p as toStructuralEdge, 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 buildReadAggregate, o as refusePackageCorruptionOnAggregate, r as loadContractRawSafely } from "./contract-space-aggregate-loader-DpB4x97a.mjs";
4
+ import { a as renderMigrationGraphLegend, f as indentMigrationGraphTreeBlock, l as computeGlobalMaxDirNameWidth, p as renderMigrationGraphSpaceTree, u as computeGlobalMaxEdgeTreePrefixWidth } from "./migration-graph-command-render-B83xrnNy.mjs";
5
+ import { c as validateLegendOptions, i as migrationSpaceListEntriesFromAggregate, o as runMigrationList, r as listRefsByContractHash, s as shouldShowLegend } from "./migration-list-DTYM8xvm.mjs";
8
6
  import { Command } from "commander";
7
+ import { loadConfig } from "@prisma-next/config-loader";
9
8
  import { ifDefined } from "@prisma-next/utils/defined";
10
9
  import { notOk, ok } from "@prisma-next/utils/result";
11
10
  import { dim, yellow } from "colorette";
@@ -51,13 +50,13 @@ function buildStatusMigrations(listMigrations, annotations) {
51
50
  }));
52
51
  }
53
52
  function renderSpaceTree(args) {
54
- const graph = args.member.graph();
53
+ const graph = args.space.graph();
55
54
  if (graph.nodes.size === 0) return "";
56
55
  return renderMigrationGraphSpaceTree({
57
56
  graph,
58
57
  migrations: args.migrations,
59
58
  liveContractHash: args.liveContractHash,
60
- refsByHash: listRefsByContractHash(args.member),
59
+ refsByHash: listRefsByContractHash(args.space),
61
60
  statusOverlayByHash: args.statusOverlay,
62
61
  colorize: args.colorize,
63
62
  glyphMode: args.glyphMode,
@@ -282,10 +281,10 @@ async function executeMigrationStatusCommand(options, flags, ui) {
282
281
  const globalMaxEdgeTreePrefixWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs) : void 0;
283
282
  const globalMaxDirNameWidth = globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : void 0;
284
283
  for (const spaceEntry of scopedSpaces) {
285
- const member = aggregate.space(spaceEntry.space);
286
- if (member === void 0) continue;
287
- const graph = member.graph();
288
- const spaceContractHash = member.contract().storage.storageHash;
284
+ const space = aggregate.space(spaceEntry.space);
285
+ if (space === void 0) continue;
286
+ const graph = space.graph();
287
+ const spaceContractHash = space.contract().storage.storageHash;
289
288
  const targetHash = resolveTarget(spaceContractHash, activeRefHash);
290
289
  if (spaceEntry.space === aggregate.app.spaceId) headlineTargetHash = targetHash;
291
290
  const markerRecord = markersBySpace.get(spaceEntry.space);
@@ -312,7 +311,7 @@ async function executeMigrationStatusCommand(options, flags, ui) {
312
311
  });
313
312
  const isAppSpace = spaceEntry.space === aggregate.app.spaceId;
314
313
  const tree = renderSpaceTree({
315
- member,
314
+ space,
316
315
  liveContractHash: contractHash,
317
316
  migrations: spaceEntry.migrations,
318
317
  markerHash,
@@ -444,4 +443,4 @@ function createMigrationStatusCommand() {
444
443
  //#endregion
445
444
  export { formatStatusHumanOutput as a, executeMigrationStatusCommand as i, buildStatusHeadline as n, formatStatusSummary as o, createMigrationStatusCommand as r, buildNoPathSummary as t };
446
445
 
447
- //# sourceMappingURL=migration-status-CD-LC2Ip.mjs.map
446
+ //# sourceMappingURL=migration-status-DRuS-rP5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-status-DRuS-rP5.mjs","names":[],"sources":["../src/commands/migration-status-overlay.ts","../src/commands/migration-status.ts"],"sourcesContent":["import type { MigrationGraph } from '@prisma-next/migration-tools/graph';\nimport { findPath } from '@prisma-next/migration-tools/migration-graph';\nimport type { MigrationEdgeAnnotation } from '../utils/formatters/migration-graph-labels';\n\nexport interface DeriveStatusEdgeAnnotationsInput {\n readonly graph: MigrationGraph;\n readonly targetHash: string;\n readonly originHash: string;\n readonly appliedMigrationHashes: ReadonlySet<string>;\n readonly showAppliedOverlay: boolean;\n}\n\nexport function deriveStatusEdgeAnnotations(\n input: DeriveStatusEdgeAnnotationsInput,\n): ReadonlyMap<string, MigrationEdgeAnnotation> {\n const annotations = new Map<string, MigrationEdgeAnnotation>();\n\n if (input.showAppliedOverlay) {\n for (const edge of input.graph.migrationByHash.values()) {\n if (input.appliedMigrationHashes.has(edge.migrationHash)) {\n annotations.set(edge.migrationHash, { status: 'applied' });\n }\n }\n }\n\n if (!input.graph.nodes.has(input.originHash)) {\n return annotations;\n }\n\n const pendingPath = findPath(input.graph, input.originHash, input.targetHash);\n if (!pendingPath) {\n return annotations;\n }\n\n for (const edge of pendingPath) {\n if (input.appliedMigrationHashes.has(edge.migrationHash)) {\n continue;\n }\n const existing = annotations.get(edge.migrationHash);\n if (existing?.status === 'applied') {\n continue;\n }\n annotations.set(edge.migrationHash, { status: 'pending' });\n }\n\n return annotations;\n}\n\nexport function appliedHashesFromLedger(\n ledgerEntries: ReadonlyArray<{ readonly migrationHash: string }>,\n): ReadonlySet<string> {\n return new Set(ledgerEntries.map((entry) => entry.migrationHash));\n}\n\nexport function statusForMigrationHash(\n migrationHash: string,\n annotations: ReadonlyMap<string, MigrationEdgeAnnotation>,\n): 'applied' | 'pending' | null {\n const status = annotations.get(migrationHash)?.status;\n return status ?? null;\n}\n","import { loadConfig } from '@prisma-next/config-loader';\nimport type { LedgerEntryRecord } from '@prisma-next/contract/types';\nimport type {\n AggregateContractSpace,\n ContractMarkerRecordLike,\n} from '@prisma-next/migration-tools/aggregate';\nimport { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';\nimport {\n errorNoInvariantPath,\n errorUnknownInvariant,\n MigrationToolsError,\n} from '@prisma-next/migration-tools/errors';\nimport { findPath, findPathWithDecision } 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 { dim, yellow } from 'colorette';\nimport { Command } from 'commander';\nimport { createControlClient } from '../control-api/client';\nimport {\n CliStructuredError,\n errorUnexpected,\n mapMigrationToolsError,\n mapRefResolutionError,\n requireLiveDatabase,\n} from '../utils/cli-errors';\nimport {\n addGlobalOptions,\n collectDeclaredInvariants,\n maskConnectionUrl,\n readContractEnvelope,\n resolveMigrationPaths,\n setCommandDescriptions,\n setCommandExamples,\n setCommandSeeAlso,\n toStructuralEdge,\n} from '../utils/command-helpers';\nimport {\n buildReadAggregate,\n loadContractRawSafely,\n refusePackageCorruptionOnAggregate,\n} from '../utils/contract-space-aggregate-loader';\nimport {\n type MigrationEdgeAnnotation,\n renderMigrationGraphLegend,\n} from '../utils/formatters/migration-graph-labels';\nimport {\n computeGlobalMaxDirNameWidth,\n computeGlobalMaxEdgeTreePrefixWidth,\n indentMigrationGraphTreeBlock,\n renderMigrationGraphSpaceTree,\n} from '../utils/formatters/migration-graph-space-render';\nimport type { MigrationListEntry } from '../utils/formatters/migration-list-types';\nimport { formatStyledHeader } from '../utils/formatters/styled';\nimport type { CommonCommandOptions } from '../utils/global-flags';\nimport { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';\nimport { shouldShowLegend, validateLegendOptions } from '../utils/legend';\nimport { handleResult } from '../utils/result-handler';\nimport { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';\nimport type {\n MigrationStatusEntry,\n MigrationStatusResult,\n MigrationStatusSpace,\n StatusDiagnosticJson,\n} from './json/schemas';\nimport { migrationStatusJsonResultSchema } from './json/schemas';\nimport {\n listRefsByContractHash,\n migrationSpaceListEntriesFromAggregate,\n runMigrationList,\n} from './migration-list';\nimport {\n appliedHashesFromLedger,\n deriveStatusEdgeAnnotations,\n statusForMigrationHash,\n} from './migration-status-overlay';\n\nexport type { StatusRef } from '../utils/migration-types';\nexport type {\n MigrationStatusEntry,\n MigrationStatusResult,\n MigrationStatusSpace,\n StatusDiagnosticJson,\n};\nexport { migrationStatusJsonResultSchema };\n\nexport interface MigrationStatusOptions extends CommonCommandOptions {\n readonly db?: string;\n readonly config?: string;\n readonly to?: string;\n readonly from?: string;\n readonly space?: string;\n readonly legend?: boolean;\n readonly ascii?: boolean;\n}\n\nexport interface MigrationStatusTreeSection {\n readonly space: string;\n readonly tree: string;\n readonly showHeading: boolean;\n}\n\ninterface MigrationStatusCommandResult {\n readonly ok: true;\n readonly spaces: readonly MigrationStatusSpace[];\n readonly summary: string;\n readonly diagnostics: readonly StatusDiagnosticJson[];\n readonly treeSections: readonly MigrationStatusTreeSection[];\n}\n\nfunction shortDisplayHash(hash: string): string {\n const stripped = hash.startsWith('sha256:') ? hash.slice(7) : hash;\n return stripped.slice(0, 12);\n}\n\nfunction resolveTarget(contractHash: string, activeRefHash: string | undefined): string {\n return activeRefHash ?? contractHash;\n}\n\nfunction buildStatusMigrations(\n listMigrations: readonly MigrationListEntry[],\n annotations: ReadonlyMap<string, MigrationEdgeAnnotation>,\n): readonly MigrationStatusEntry[] {\n return listMigrations.map((migration) => ({\n ...migration,\n status: statusForMigrationHash(migration.hash, annotations),\n }));\n}\n\nfunction renderSpaceTree(args: {\n readonly space: AggregateContractSpace;\n readonly liveContractHash: string;\n readonly migrations: readonly MigrationListEntry[];\n readonly markerHash: string | undefined;\n readonly showDbMarker: boolean;\n readonly statusOverlay: ReadonlyMap<string, MigrationEdgeAnnotation>;\n readonly colorize: boolean;\n readonly glyphMode: 'unicode' | 'ascii';\n readonly isAppSpace: boolean;\n readonly globalMaxEdgeTreePrefixWidth?: number;\n readonly globalMaxDirNameWidth?: number;\n}): string {\n const graph = args.space.graph();\n if (graph.nodes.size === 0) {\n return '';\n }\n return renderMigrationGraphSpaceTree({\n graph,\n migrations: args.migrations,\n liveContractHash: args.liveContractHash,\n refsByHash: listRefsByContractHash(args.space),\n statusOverlayByHash: args.statusOverlay,\n colorize: args.colorize,\n glyphMode: args.glyphMode,\n isAppSpace: args.isAppSpace,\n ...(args.showDbMarker && args.markerHash !== undefined ? { dbHash: args.markerHash } : {}),\n ...(args.globalMaxEdgeTreePrefixWidth !== undefined\n ? { globalMaxEdgeTreePrefixWidth: args.globalMaxEdgeTreePrefixWidth }\n : {}),\n ...(args.globalMaxDirNameWidth !== undefined\n ? { globalMaxDirNameWidth: args.globalMaxDirNameWidth }\n : {}),\n });\n}\n\nfunction countPending(migrations: readonly MigrationStatusEntry[]): number {\n return migrations.filter((m) => m.status === 'pending').length;\n}\n\nexport function buildNoPathSummary(args: {\n readonly markerHash: string | undefined;\n readonly targetHash: string;\n readonly explicitTarget: boolean;\n readonly refName: string | undefined;\n}): string {\n const markerPart =\n args.markerHash !== undefined\n ? `the database state (${shortDisplayHash(args.markerHash)})`\n : 'the database state';\n const targetShort = shortDisplayHash(args.targetHash);\n if (!args.explicitTarget) {\n return `No migration path from ${markerPart} to the application's contract (${targetShort}). Run \\`prisma-next migration plan --name <name>\\` to author one.`;\n }\n const targetLabel =\n args.refName !== undefined\n ? `the target (${targetShort} via \\`${args.refName}\\`)`\n : `the target (${targetShort})`;\n return `No migration path from ${markerPart} to ${targetLabel}. Run \\`prisma-next migration plan --name <name>\\` to author one, or pass \\`--to <contract>\\` to pick a reachable target.`;\n}\n\nexport function buildStatusHeadline(args: {\n readonly pendingCount: number;\n readonly targetHash: string;\n readonly markerDiverged: boolean;\n readonly markerHash: string | undefined;\n}): string {\n if (args.markerDiverged && args.markerHash !== undefined) {\n return `Database marker ${shortDisplayHash(args.markerHash)} is not in the on-disk migration graph`;\n }\n if (args.pendingCount === 0) {\n return 'Up to date';\n }\n return `${args.pendingCount} pending — run \\`prisma-next migrate --to ${shortDisplayHash(args.targetHash)}\\``;\n}\n\nexport function formatStatusSummary(\n result: MigrationStatusCommandResult,\n colorize: boolean,\n): string {\n const c = (fn: (s: string) => string, s: string) => (colorize ? fn(s) : s);\n const lines: string[] = [];\n const pendingTotal = result.spaces.reduce(\n (sum, space) => sum + countPending(space.migrations),\n 0,\n );\n const hasDivergence = result.diagnostics.some(\n (d) => d.code === 'MIGRATION.MARKER_NOT_IN_HISTORY',\n );\n if (hasDivergence || pendingTotal > 0) {\n lines.push(c(yellow, result.summary));\n } else {\n lines.push(result.summary);\n }\n const missingInvariantsDiagnostic = result.diagnostics.find(\n (d) => d.code === 'MIGRATION.MISSING_INVARIANTS',\n );\n if (missingInvariantsDiagnostic !== undefined) {\n lines.push(c(dim, missingInvariantsDiagnostic.message));\n }\n return lines.join('\\n');\n}\n\nexport function formatStatusHumanOutput(\n result: MigrationStatusCommandResult,\n colorize: boolean,\n): string {\n const sections: string[] = [];\n for (const section of result.treeSections) {\n if (section.showHeading) {\n sections.push(`${section.space}:`);\n }\n if (section.tree.length > 0) {\n sections.push(section.tree);\n } else {\n sections.push('(no migrations)');\n }\n sections.push('');\n }\n sections.push(formatStatusSummary(result, colorize));\n return sections.join('\\n').trimEnd();\n}\n\nasync function readMarkersAndLedgers(args: {\n readonly client: ReturnType<typeof createControlClient>;\n readonly spaceIds: readonly string[];\n}): Promise<{\n readonly markersBySpace: ReadonlyMap<string, ContractMarkerRecordLike>;\n readonly ledgersBySpace: ReadonlyMap<string, readonly LedgerEntryRecord[]>;\n}> {\n const markersBySpace = new Map<string, ContractMarkerRecordLike>();\n const all = await args.client.readAllMarkers();\n for (const [spaceId, marker] of all) {\n markersBySpace.set(spaceId, marker);\n }\n const ledgersBySpace = new Map<string, readonly LedgerEntryRecord[]>();\n for (const spaceId of args.spaceIds) {\n ledgersBySpace.set(spaceId, await args.client.readLedger(spaceId));\n }\n return { markersBySpace, ledgersBySpace };\n}\n\nexport async function executeMigrationStatusCommand(\n options: MigrationStatusOptions,\n flags: GlobalFlags,\n ui: TerminalUI,\n): Promise<Result<MigrationStatusCommandResult, CliStructuredError>> {\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 usingFromOverride = options.from !== undefined;\n\n if (!usingFromOverride) {\n const missingDb = requireLiveDatabase({\n dbConnection,\n hasDriver,\n why: 'migration status needs a database connection to read the marker and ledger (or pass --from for offline path preview)',\n retryCommand: 'prisma-next migration status --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 diagnostics: StatusDiagnosticJson[] = [];\n let contractHash: string = EMPTY_CONTRACT_HASH;\n try {\n const envelope = await readContractEnvelope(config);\n contractHash = envelope.storageHash;\n } catch (error) {\n diagnostics.push({\n code: 'CONTRACT.UNREADABLE',\n severity: 'warn',\n message: `Could not read contract: ${error instanceof Error ? error.message : 'unknown error'}`,\n hints: [\"Run 'prisma-next contract emit' to generate a valid contract\"],\n });\n }\n\n const loaded = await buildReadAggregate(config, { migrationsDir });\n if (!loaded.ok) {\n return notOk(loaded.failure);\n }\n\n const { aggregate } = loaded.value;\n const contractRawForAggregate = await loadContractRawSafely(config);\n if (contractRawForAggregate !== null) {\n const corruptionFailure = refusePackageCorruptionOnAggregate(aggregate);\n if (corruptionFailure) {\n return notOk(corruptionFailure);\n }\n }\n const appGraph = aggregate.app.graph();\n\n let activeRefHash: string | undefined;\n let activeRefName: string | undefined;\n let activeRefEntry: RefEntry | undefined;\n let fromOverrideHash: string | undefined;\n\n if (options.to) {\n const refResult = parseContractRef(options.to, { graph: appGraph, refs: allRefs });\n if (!refResult.ok) {\n return notOk(mapRefResolutionError(refResult.failure));\n }\n activeRefHash = refResult.value.hash;\n if (refResult.value.provenance.kind === 'ref') {\n activeRefName = refResult.value.provenance.refName;\n activeRefEntry = allRefs[activeRefName];\n }\n }\n\n if (options.from) {\n const fromResult = parseContractRef(options.from, { graph: appGraph, refs: allRefs });\n if (!fromResult.ok) {\n return notOk(mapRefResolutionError(fromResult.failure));\n }\n fromOverrideHash = fromResult.value.hash;\n }\n\n const requiredInvariants: readonly string[] = [...(activeRefEntry?.invariants ?? [])].sort();\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 && hasDriver) {\n details.push({ label: 'database', value: maskConnectionUrl(String(dbConnection)) });\n }\n if (activeRefName) {\n details.push({ label: 'ref', value: activeRefName });\n }\n if (options.from) {\n details.push({ label: 'from', value: options.from });\n }\n if (options.space) {\n details.push({ label: 'space', value: options.space });\n }\n const header = formatStyledHeader({\n command: 'migration status',\n description: 'Show migration history and applied status',\n details,\n flags,\n });\n ui.stderr(header);\n if (shouldShowLegend(options, flags)) {\n ui.stderr(\n renderMigrationGraphLegend({\n colorize: flags.color !== false,\n glyphMode: ui.resolveGlyphMode(options.ascii === true),\n }),\n );\n ui.stderr('');\n }\n }\n\n const listSpaces = await migrationSpaceListEntriesFromAggregate(aggregate, migrationsDir);\n const listResult = runMigrationList({\n spaces: listSpaces,\n ...ifDefined('spaceFilter', options.space),\n });\n if (!listResult.ok) {\n return listResult;\n }\n\n const scopedSpaces = listResult.value.spaces;\n const showSpaceHeadings = scopedSpaces.length > 1;\n\n let markersBySpace = new Map<string, ContractMarkerRecordLike>();\n let ledgersBySpace = new Map<string, readonly LedgerEntryRecord[]>();\n let connected = false;\n\n if (dbConnection && hasDriver && !usingFromOverride) {\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 connected = true;\n const read = await readMarkersAndLedgers({\n client,\n spaceIds: scopedSpaces.map((s) => s.space),\n });\n markersBySpace = new Map(read.markersBySpace);\n ledgersBySpace = new Map(read.ledgersBySpace);\n } catch (error) {\n if (CliStructuredError.is(error)) {\n return notOk(error);\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read database state: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n }\n\n if (activeRefEntry && activeRefEntry.invariants.length > 0 && connected) {\n const declared = collectDeclaredInvariants(appGraph);\n const markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n const known = new Set<string>(declared);\n for (const id of markerInvariants) known.add(id);\n const unknown = activeRefEntry.invariants.filter((id) => !known.has(id));\n if (unknown.length > 0) {\n return notOk(\n mapMigrationToolsError(\n errorUnknownInvariant({\n ...ifDefined('refName', activeRefName),\n unknown,\n declared: [...declared].sort(),\n }),\n ),\n );\n }\n }\n\n const showAppliedOverlay = connected && !usingFromOverride;\n const showDbMarker = connected && !usingFromOverride;\n const glyphMode = ui.resolveGlyphMode(options.ascii === true);\n const colorize = flags.color !== false;\n\n const statusSpaces: MigrationStatusSpace[] = [];\n const treeSections: MigrationStatusTreeSection[] = [];\n let markerDiverged = false;\n let markerCannotReachTarget = false;\n let headlineTargetHash = activeRefHash ?? contractHash;\n let totalPending = 0;\n\n const globalLayoutInputs = showSpaceHeadings\n ? scopedSpaces\n .filter((spaceEntry) => spaceEntry.migrations.length > 0)\n .map((spaceEntry) => ({\n graph: aggregate.space(spaceEntry.space)!.graph(),\n liveContractHash: contractHash,\n }))\n : [];\n const globalMaxEdgeTreePrefixWidth =\n globalLayoutInputs.length > 0\n ? computeGlobalMaxEdgeTreePrefixWidth(globalLayoutInputs)\n : undefined;\n const globalMaxDirNameWidth =\n globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : undefined;\n\n for (const spaceEntry of scopedSpaces) {\n const space = aggregate.space(spaceEntry.space);\n if (space === undefined) {\n continue;\n }\n const graph = space.graph();\n const spaceContractHash = space.contract().storage.storageHash;\n const targetHash = resolveTarget(spaceContractHash, activeRefHash);\n if (spaceEntry.space === aggregate.app.spaceId) {\n headlineTargetHash = targetHash;\n }\n\n const markerRecord = markersBySpace.get(spaceEntry.space);\n const markerHash = usingFromOverride\n ? fromOverrideHash\n : (markerRecord?.storageHash ?? undefined);\n const originHash = markerHash ?? EMPTY_CONTRACT_HASH;\n const markerInGraph =\n markerHash === undefined || graph.nodes.has(markerHash) || markerHash === spaceContractHash;\n if (\n connected &&\n !usingFromOverride &&\n markerInGraph &&\n originHash !== targetHash &&\n findPath(graph, originHash, targetHash) === null\n ) {\n markerCannotReachTarget = true;\n }\n\n if (connected && !usingFromOverride && markerHash !== undefined && !markerInGraph) {\n markerDiverged = true;\n diagnostics.push({\n code: 'MIGRATION.MARKER_NOT_IN_HISTORY',\n severity: 'warn',\n message:\n 'Database was updated outside the migration system (marker does not match any migration)',\n hints: [\n \"Run 'prisma-next db sign' to overwrite the marker if the database already matches the contract\",\n \"Run 'prisma-next db update' to push the current contract to the database\",\n ],\n });\n }\n\n const ledger = ledgersBySpace.get(spaceEntry.space) ?? [];\n const appliedHashes = showAppliedOverlay ? appliedHashesFromLedger(ledger) : new Set<string>();\n\n const annotations = deriveStatusEdgeAnnotations({\n graph,\n targetHash,\n originHash,\n appliedMigrationHashes: appliedHashes,\n showAppliedOverlay,\n });\n const isAppSpace = spaceEntry.space === aggregate.app.spaceId;\n const tree = renderSpaceTree({\n space,\n liveContractHash: contractHash,\n migrations: spaceEntry.migrations,\n markerHash,\n showDbMarker,\n statusOverlay: annotations,\n colorize,\n glyphMode,\n isAppSpace,\n ...(globalMaxEdgeTreePrefixWidth !== undefined ? { globalMaxEdgeTreePrefixWidth } : {}),\n ...(globalMaxDirNameWidth !== undefined ? { globalMaxDirNameWidth } : {}),\n });\n const migrations = buildStatusMigrations(spaceEntry.migrations, annotations);\n const pending = countPending(migrations);\n totalPending += pending;\n\n statusSpaces.push({\n space: spaceEntry.space,\n currentContract: markerHash ?? null,\n targetContract: targetHash,\n migrations: [...migrations],\n });\n const displayTree =\n showSpaceHeadings && tree.length > 0 ? indentMigrationGraphTreeBlock(tree, ' ') : tree;\n treeSections.push({\n space: spaceEntry.space,\n tree: displayTree,\n showHeading: showSpaceHeadings,\n });\n }\n\n if (connected && requiredInvariants.length > 0) {\n const markerInvariants = markersBySpace.get(aggregate.app.spaceId)?.invariants ?? [];\n const markerSet = new Set(markerInvariants);\n const missing = requiredInvariants.filter((id) => !markerSet.has(id));\n if (missing.length > 0) {\n diagnostics.push({\n code: 'MIGRATION.MISSING_INVARIANTS',\n ...ifDefined('ref', activeRefName),\n invariants: missing,\n message: `missing invariant(s): ${missing.join(', ')}`,\n });\n if (activeRefHash !== undefined) {\n const originHash =\n markersBySpace.get(aggregate.app.spaceId)?.storageHash ?? EMPTY_CONTRACT_HASH;\n const outcome = findPathWithDecision(appGraph, originHash, activeRefHash, {\n ...ifDefined('refName', activeRefName),\n required: new Set(missing),\n });\n if (outcome.kind === 'unsatisfiable') {\n return notOk(\n mapMigrationToolsError(\n errorNoInvariantPath({\n ...ifDefined('refName', activeRefName),\n required: [...missing].sort(),\n missing: outcome.missing,\n structuralPath: outcome.structuralPath.map(toStructuralEdge),\n }),\n ),\n );\n }\n }\n }\n }\n\n const appMarkerHash = markersBySpace.get(aggregate.app.spaceId)?.storageHash;\n const summary = markerCannotReachTarget\n ? buildNoPathSummary({\n markerHash: appMarkerHash,\n targetHash: headlineTargetHash,\n explicitTarget: options.to !== undefined,\n refName: activeRefName,\n })\n : buildStatusHeadline({\n pendingCount: totalPending,\n targetHash: headlineTargetHash,\n markerDiverged,\n markerHash: appMarkerHash,\n });\n\n if (scopedSpaces.every((s) => s.migrations.length === 0)) {\n return ok({\n ok: true,\n spaces: statusSpaces,\n summary: 'No migrations found',\n diagnostics,\n treeSections,\n });\n }\n\n return ok({\n ok: true,\n spaces: statusSpaces,\n summary,\n diagnostics,\n treeSections,\n });\n}\n\nexport function createMigrationStatusCommand(): Command {\n const command = new Command('status');\n setCommandDescriptions(\n command,\n 'Show migration path and pending status',\n 'Shows which migrations are pending between the database marker and\\n' +\n 'the target contract. Requires a database connection.\\n' +\n 'Pass --from for an offline path preview without a database.\\n' +\n 'Use `migration graph` for topology, `migration log` for history,\\n' +\n 'and `migration list` for on-disk enumeration.',\n );\n setCommandExamples(command, [\n 'prisma-next migration status --db $DATABASE_URL',\n 'prisma-next migration status --to production --db $DATABASE_URL',\n 'prisma-next migration status --from sha256:abc --to production',\n 'prisma-next migration status --from sha256:abc --to production --json',\n 'prisma-next migration status --ascii --from sha256:abc --to production',\n 'prisma-next migration status --legend --from sha256:abc --to production',\n ]);\n setCommandSeeAlso(command, [\n { verb: 'migration log', oneLiner: 'Show executed migration history' },\n { verb: 'migration list', oneLiner: 'List on-disk migrations' },\n { verb: 'migration graph', oneLiner: 'Show the migration graph topology' },\n { verb: 'migration show', oneLiner: 'Display migration package contents' },\n ]);\n addGlobalOptions(command)\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--space <id>', 'Narrow output to a single contract space')\n .option(\n '--to <contract>',\n 'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',\n )\n .option(\n '--from <contract>',\n 'Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.',\n )\n .option('--legend', 'Print a key for the tree glyphs and lane colors')\n .option('--ascii', 'Use ASCII glyphs (pipe-friendly)')\n .action(async (options: MigrationStatusOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n\n const legendValidation = validateLegendOptions(options, flags);\n if (!legendValidation.ok) {\n process.exit(handleResult(legendValidation, flags, ui));\n }\n\n const result = await executeMigrationStatusCommand(options, flags, ui);\n\n const exitCode = handleResult(result, flags, ui, (statusResult) => {\n if (flags.json) {\n const jsonResult: MigrationStatusResult = {\n ok: true,\n spaces: [...statusResult.spaces],\n summary: statusResult.summary,\n diagnostics: [...statusResult.diagnostics],\n };\n ui.output(JSON.stringify(jsonResult, null, 2));\n } else if (!flags.quiet) {\n ui.output(formatStatusHumanOutput(statusResult, flags.color !== false));\n }\n });\n\n process.exit(exitCode);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,SAAgB,4BACd,OAC8C;CAC9C,MAAM,8BAAc,IAAI,IAAqC;CAE7D,IAAI,MAAM;OACH,MAAM,QAAQ,MAAM,MAAM,gBAAgB,OAAO,GACpD,IAAI,MAAM,uBAAuB,IAAI,KAAK,aAAa,GACrD,YAAY,IAAI,KAAK,eAAe,EAAE,QAAQ,UAAU,CAAC;CAAA;CAK/D,IAAI,CAAC,MAAM,MAAM,MAAM,IAAI,MAAM,UAAU,GACzC,OAAO;CAGT,MAAM,cAAc,SAAS,MAAM,OAAO,MAAM,YAAY,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AC,CACA,OACC,qBACA,yGACF,CAAC,CACA,OAAO,YAAY,iDAAiD,CAAC,CACrE,OAAO,WAAW,kCAAkC,CAAC,CACrD,OAAO,OAAO,YAAoC;EACjD,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,MAAM,KAAK,iBAAiB,KAAK;EAEjC,MAAM,mBAAmB,sBAAsB,SAAS,KAAK;EAC7D,IAAI,CAAC,iBAAiB,IACpB,QAAQ,KAAK,aAAa,kBAAkB,OAAO,EAAE,CAAC;EAKxD,MAAM,WAAW,aAAa,MAFT,8BAA8B,SAAS,OAAO,EAAE,GAE/B,OAAO,KAAK,iBAAiB;GACjE,IAAI,MAAM,MAAM;IACd,MAAM,aAAoC;KACxC,IAAI;KACJ,QAAQ,CAAC,GAAG,aAAa,MAAM;KAC/B,SAAS,aAAa;KACtB,aAAa,CAAC,GAAG,aAAa,WAAW;IAC3C;IACA,GAAG,OAAO,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;GAC/C,OAAO,IAAI,CAAC,MAAM,OAChB,GAAG,OAAO,wBAAwB,cAAc,MAAM,UAAU,KAAK,CAAC;EAE1E,CAAC;EAED,QAAQ,KAAK,QAAQ;CACvB,CAAC;CAEH,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { D as isCI, O as formatCommandHelp, _ as createTerminalUI, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples } from "./command-helpers-DGMvGBeX.mjs";
1
+ import { D as isCI, O as formatCommandHelp, _ as createTerminalUI, g as parseGlobalFlagsOrExit, h as parseGlobalFlags, l as setCommandDescriptions, t as addGlobalOptions, u as setCommandExamples } from "./command-helpers-CUoKYTlG.mjs";
2
2
  import { Command } from "commander";
3
3
  import { readUserConfig, resolveGating, userConfigPath, writeUserConfig } from "@prisma-next/cli-telemetry";
4
4
  //#region src/commands/telemetry/status.ts
@@ -119,4 +119,4 @@ function createTelemetryCommand() {
119
119
  //#endregion
120
120
  export { createTelemetryCommand as t };
121
121
 
122
- //# sourceMappingURL=telemetry-BIM4beEO.mjs.map
122
+ //# sourceMappingURL=telemetry-DHBBq5wT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-BIM4beEO.mjs","names":[],"sources":["../src/commands/telemetry/status.ts","../src/commands/telemetry/index.ts"],"sourcesContent":["import { readUserConfig, resolveGating, userConfigPath } from '@prisma-next/cli-telemetry';\n\n/**\n * Why telemetry resolves the way it does, in the order the CLI's\n * `resolveTelemetryGate` evaluates: CI hard-disables first, then the env\n * opt-outs, then the stored `enableTelemetry`, then the opt-out default.\n */\nexport type TelemetryStatusReason =\n | 'ci'\n | 'env-opt-out'\n | 'stored-opt-out'\n | 'stored-opt-in'\n | 'default-on';\n\nexport interface TelemetryStatus {\n readonly enabled: boolean;\n readonly reason: TelemetryStatusReason;\n readonly configPath: string;\n readonly installationIdStored: boolean;\n}\n\n/**\n * Resolves the same gate the runtime uses (CI check + `resolveGating`) and\n * projects it into a user-facing status. Pure read: never mints, never\n * writes. The `installationId` value itself is never surfaced — only its\n * presence — so `status` discloses nothing identifying.\n */\nexport function resolveTelemetryStatus(inputs: {\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly inCI: boolean;\n}): TelemetryStatus {\n const config = readUserConfig();\n const configPath = userConfigPath();\n const installationIdStored =\n typeof config.installationId === 'string' && config.installationId.length > 0;\n\n if (inputs.inCI) {\n return { enabled: false, reason: 'ci', configPath, installationIdStored };\n }\n\n const gating = resolveGating({ env: inputs.env, config });\n if (!gating.enabled) {\n const reason: TelemetryStatusReason =\n gating.reason === 'env-override' ? 'env-opt-out' : 'stored-opt-out';\n return { enabled: false, reason, configPath, installationIdStored };\n }\n\n const reason: TelemetryStatusReason =\n config.enableTelemetry === true ? 'stored-opt-in' : 'default-on';\n return { enabled: true, reason, configPath, installationIdStored };\n}\n\nconst REASON_EXPLANATION: Record<TelemetryStatusReason, string> = {\n ci: 'CI environment detected — telemetry is hard-disabled.',\n 'env-opt-out': 'an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).',\n 'stored-opt-out': '\"enableTelemetry\": false is stored in your config.',\n 'stored-opt-in': '\"enableTelemetry\": true is stored in your config.',\n 'default-on': 'no explicit choice is stored, so the opt-out default applies.',\n};\n\nexport function formatTelemetryStatusLines(status: TelemetryStatus): string[] {\n return [\n `Telemetry is ${status.enabled ? 'enabled' : 'disabled'}: ${REASON_EXPLANATION[status.reason]}`,\n `Config file: ${status.configPath}`,\n `Installation ID: ${status.installationIdStored ? 'stored' : 'not stored'}`,\n ];\n}\n","import { userConfigPath, writeUserConfig } from '@prisma-next/cli-telemetry';\nimport { Command } from 'commander';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../../utils/command-helpers';\nimport { formatCommandHelp } from '../../utils/formatters/help';\nimport {\n type CommonCommandOptions,\n parseGlobalFlags,\n parseGlobalFlagsOrExit,\n} from '../../utils/global-flags';\nimport { isCI } from '../../utils/is-ci';\nimport { createTerminalUI } from '../../utils/terminal-ui';\nimport { formatTelemetryStatusLines, resolveTelemetryStatus } from './status';\n\nfunction createTelemetryStatusCommand(): Command {\n const command = new Command('status');\n setCommandDescriptions(\n command,\n 'Show whether anonymous CLI telemetry is enabled and why',\n 'Reports whether telemetry is currently enabled or disabled and the reason\\n' +\n '(default-on, stored opt-out, environment opt-out, or CI), the path to your\\n' +\n 'user-level config file, and whether an installation ID has been stored.\\n' +\n 'Read-only: never sends an event, never mints an ID, never writes anything.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const status = resolveTelemetryStatus({ env: process.env, inCI: isCI() });\n if (flags.json) {\n ui.output(JSON.stringify(status));\n } else {\n for (const line of formatTelemetryStatusLines(status)) {\n ui.output(line);\n }\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryEnableCommand(): Command {\n const command = new Command('enable');\n setCommandDescriptions(\n command,\n 'Enable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": true in your user-level config and mints an\\n' +\n 'installation ID if one is not already stored.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: true });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: true, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryDisableCommand(): Command {\n const command = new Command('disable');\n setCommandDescriptions(\n command,\n 'Disable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": false in your user-level config. No installation\\n' +\n 'ID is minted and no event is sent.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: false });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: false, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nexport function createTelemetryCommand(): Command {\n const command = new Command('telemetry');\n setCommandDescriptions(\n command,\n 'Inspect and change anonymous CLI telemetry',\n 'Show telemetry status, or enable / disable anonymous CLI usage data.\\n' +\n 'Telemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\\n' +\n 'for what is collected and why.',\n );\n setCommandExamples(command, [\n 'prisma-next telemetry status',\n 'prisma-next telemetry disable',\n 'prisma-next telemetry enable',\n ]);\n command.configureHelp({\n formatHelp: (cmd) => formatCommandHelp({ command: cmd, flags: parseGlobalFlags({}) }),\n subcommandDescription: () => '',\n });\n command.addCommand(createTelemetryStatusCommand());\n command.addCommand(createTelemetryEnableCommand());\n command.addCommand(createTelemetryDisableCommand());\n return command;\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,uBAAuB,QAGnB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sources":["../src/commands/telemetry/status.ts","../src/commands/telemetry/index.ts"],"sourcesContent":["import { readUserConfig, resolveGating, userConfigPath } from '@prisma-next/cli-telemetry';\n\n/**\n * Why telemetry resolves the way it does, in the order the CLI's\n * `resolveTelemetryGate` evaluates: CI hard-disables first, then the env\n * opt-outs, then the stored `enableTelemetry`, then the opt-out default.\n */\nexport type TelemetryStatusReason =\n | 'ci'\n | 'env-opt-out'\n | 'stored-opt-out'\n | 'stored-opt-in'\n | 'default-on';\n\nexport interface TelemetryStatus {\n readonly enabled: boolean;\n readonly reason: TelemetryStatusReason;\n readonly configPath: string;\n readonly installationIdStored: boolean;\n}\n\n/**\n * Resolves the same gate the runtime uses (CI check + `resolveGating`) and\n * projects it into a user-facing status. Pure read: never mints, never\n * writes. The `installationId` value itself is never surfaced — only its\n * presence — so `status` discloses nothing identifying.\n */\nexport function resolveTelemetryStatus(inputs: {\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly inCI: boolean;\n}): TelemetryStatus {\n const config = readUserConfig();\n const configPath = userConfigPath();\n const installationIdStored =\n typeof config.installationId === 'string' && config.installationId.length > 0;\n\n if (inputs.inCI) {\n return { enabled: false, reason: 'ci', configPath, installationIdStored };\n }\n\n const gating = resolveGating({ env: inputs.env, config });\n if (!gating.enabled) {\n const reason: TelemetryStatusReason =\n gating.reason === 'env-override' ? 'env-opt-out' : 'stored-opt-out';\n return { enabled: false, reason, configPath, installationIdStored };\n }\n\n const reason: TelemetryStatusReason =\n config.enableTelemetry === true ? 'stored-opt-in' : 'default-on';\n return { enabled: true, reason, configPath, installationIdStored };\n}\n\nconst REASON_EXPLANATION: Record<TelemetryStatusReason, string> = {\n ci: 'CI environment detected — telemetry is hard-disabled.',\n 'env-opt-out': 'an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).',\n 'stored-opt-out': '\"enableTelemetry\": false is stored in your config.',\n 'stored-opt-in': '\"enableTelemetry\": true is stored in your config.',\n 'default-on': 'no explicit choice is stored, so the opt-out default applies.',\n};\n\nexport function formatTelemetryStatusLines(status: TelemetryStatus): string[] {\n return [\n `Telemetry is ${status.enabled ? 'enabled' : 'disabled'}: ${REASON_EXPLANATION[status.reason]}`,\n `Config file: ${status.configPath}`,\n `Installation ID: ${status.installationIdStored ? 'stored' : 'not stored'}`,\n ];\n}\n","import { userConfigPath, writeUserConfig } from '@prisma-next/cli-telemetry';\nimport { Command } from 'commander';\nimport {\n addGlobalOptions,\n setCommandDescriptions,\n setCommandExamples,\n} from '../../utils/command-helpers';\nimport { formatCommandHelp } from '../../utils/formatters/help';\nimport {\n type CommonCommandOptions,\n parseGlobalFlags,\n parseGlobalFlagsOrExit,\n} from '../../utils/global-flags';\nimport { isCI } from '../../utils/is-ci';\nimport { createTerminalUI } from '../../utils/terminal-ui';\nimport { formatTelemetryStatusLines, resolveTelemetryStatus } from './status';\n\nfunction createTelemetryStatusCommand(): Command {\n const command = new Command('status');\n setCommandDescriptions(\n command,\n 'Show whether anonymous CLI telemetry is enabled and why',\n 'Reports whether telemetry is currently enabled or disabled and the reason\\n' +\n '(default-on, stored opt-out, environment opt-out, or CI), the path to your\\n' +\n 'user-level config file, and whether an installation ID has been stored.\\n' +\n 'Read-only: never sends an event, never mints an ID, never writes anything.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n const ui = createTerminalUI(flags);\n const status = resolveTelemetryStatus({ env: process.env, inCI: isCI() });\n if (flags.json) {\n ui.output(JSON.stringify(status));\n } else {\n for (const line of formatTelemetryStatusLines(status)) {\n ui.output(line);\n }\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryEnableCommand(): Command {\n const command = new Command('enable');\n setCommandDescriptions(\n command,\n 'Enable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": true in your user-level config and mints an\\n' +\n 'installation ID if one is not already stored.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: true });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: true, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nfunction createTelemetryDisableCommand(): Command {\n const command = new Command('disable');\n setCommandDescriptions(\n command,\n 'Disable anonymous CLI telemetry',\n 'Stores \"enableTelemetry\": false in your user-level config. No installation\\n' +\n 'ID is minted and no event is sent.',\n );\n return addGlobalOptions(command).action((options: CommonCommandOptions) => {\n const flags = parseGlobalFlagsOrExit(options);\n writeUserConfig({ enableTelemetry: false });\n const ui = createTerminalUI(flags);\n if (flags.json) {\n ui.output(JSON.stringify({ enableTelemetry: false, configPath: userConfigPath() }));\n } else {\n ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);\n }\n process.exit(0);\n });\n}\n\nexport function createTelemetryCommand(): Command {\n const command = new Command('telemetry');\n setCommandDescriptions(\n command,\n 'Inspect and change anonymous CLI telemetry',\n 'Show telemetry status, or enable / disable anonymous CLI usage data.\\n' +\n 'Telemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\\n' +\n 'for what is collected and why.',\n );\n setCommandExamples(command, [\n 'prisma-next telemetry status',\n 'prisma-next telemetry disable',\n 'prisma-next telemetry enable',\n ]);\n command.configureHelp({\n formatHelp: (cmd) => formatCommandHelp({ command: cmd, flags: parseGlobalFlags({}) }),\n subcommandDescription: () => '',\n });\n command.addCommand(createTelemetryStatusCommand());\n command.addCommand(createTelemetryEnableCommand());\n command.addCommand(createTelemetryDisableCommand());\n return command;\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,uBAAuB,QAGnB;CAClB,MAAM,SAAS,eAAe;CAC9B,MAAM,aAAa,eAAe;CAClC,MAAM,uBACJ,OAAO,OAAO,mBAAmB,YAAY,OAAO,eAAe,SAAS;CAE9E,IAAI,OAAO,MACT,OAAO;EAAE,SAAS;EAA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,KAAK,iBAAiB,KAAK;EACjC,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU;GAAE,iBAAiB;GAAM,YAAY,eAAe;EAAE,CAAC,CAAC;OAEjF,GAAG,OAAO,2CAA2C,eAAe,EAAE,EAAE;EAE1E,QAAQ,KAAK,CAAC;CAChB,CAAC;AACH;AAEA,SAAS,gCAAyC;CAChD,MAAM,UAAU,IAAI,QAAQ,SAAS;CACrC,uBACE,SACA,mCACA,kHAEF;CACA,OAAO,iBAAiB,OAAO,CAAC,CAAC,QAAQ,YAAkC;EACzE,MAAM,QAAQ,uBAAuB,OAAO;EAC5C,gBAAgB,EAAE,iBAAiB,MAAM,CAAC;EAC1C,MAAM,KAAK,iBAAiB,KAAK;EACjC,IAAI,MAAM,MACR,GAAG,OAAO,KAAK,UAAU;GAAE,iBAAiB;GAAO,YAAY,eAAe;EAAE,CAAC,CAAC;OAElF,GAAG,OAAO,4CAA4C,eAAe,EAAE,EAAE;EAE3E,QAAQ,KAAK,CAAC;CAChB,CAAC;AACH;AAEA,SAAgB,yBAAkC;CAChD,MAAM,UAAU,IAAI,QAAQ,WAAW;CACvC,uBACE,SACA,8CACA,4LAGF;CACA,mBAAmB,SAAS;EAC1B;EACA;EACA;CACF,CAAC;CACD,QAAQ,cAAc;EACpB,aAAa,QAAQ,kBAAkB;GAAE,SAAS;GAAK,OAAO,iBAAiB,CAAC,CAAC;EAAE,CAAC;EACpF,6BAA6B;CAC/B,CAAC;CACD,QAAQ,WAAW,6BAA6B,CAAC;CACjD,QAAQ,WAAW,6BAA6B,CAAC;CACjD,QAAQ,WAAW,8BAA8B,CAAC;CAClD,OAAO;AACT"}
@@ -1,10 +1,10 @@
1
1
  import { CliStructuredError as CliStructuredError$1 } from "@prisma-next/errors/control";
2
2
  import { Result } from "@prisma-next/utils/result";
3
- import { ContractSourceDiagnostics, ContractSourceProvider } from "@prisma-next/config/config-types";
4
3
  import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
5
4
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
6
- import { ContractSpaceMember } from "@prisma-next/migration-tools/aggregate";
5
+ import { AggregateContractSpace } from "@prisma-next/migration-tools/aggregate";
7
6
  import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
7
+ import { ContractSourceDiagnostics, ContractSourceProvider } from "@prisma-next/config/config-types";
8
8
  import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
9
9
  import { AuthoringPslBlockDescriptorNamespace } from "@prisma-next/framework-components/authoring";
10
10
  import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
@@ -15,9 +15,9 @@ import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
15
15
  *
16
16
  * Loader → verifier pipeline. The loader (sole descriptor-import
17
17
  * boundary) builds a {@link import('@prisma-next/migration-tools/aggregate').ContractSpaceAggregate};
18
- * the aggregate verifier bundles `markerCheck` + per-space pre-projected
19
- * `schemaCheck`. `mode: 'strict' | 'lenient'` maps directly to the user
20
- * facing `--strict` flag.
18
+ * the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
19
+ * (each contract space verified against the full schema; extras stripped to its own view).
20
+ * `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
21
21
  */
22
22
  interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
23
23
  readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
@@ -40,13 +40,19 @@ interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends str
40
40
  * emitted, so downstream tooling and integration tests assert on the
41
41
  * same shape).
42
42
  *
43
- * On success, the per-space schema results are returned for the CLI to
43
+ * On success, the per-space verify results are returned for the CLI to
44
44
  * render. When `skipSchema` is true (`--marker-only`), the schema map
45
45
  * is empty.
46
46
  */
47
47
  interface ExecuteDbVerifySuccess {
48
48
  readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult>;
49
- readonly memberOrder: readonly string[];
49
+ /**
50
+ * Live element names no contract space declares, deduplicated and reported
51
+ * once for the whole database (never per space). Strict mode fails on a
52
+ * non-empty list; lenient mode surfaces it informationally.
53
+ */
54
+ readonly unclaimed: readonly string[];
55
+ readonly spaceOrder: readonly string[];
50
56
  readonly appSpaceId: string;
51
57
  }
52
58
  type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$1>;
@@ -60,11 +66,11 @@ type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$1
60
66
  * structured CLI error.
61
67
  * 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
62
68
  * schema introspection.
63
- * 3. **Verify**: {@link verifyMigration} returns per-space
64
- * `markerCheck` + per-space pre-projected `schemaCheck` (closes F23).
65
- * Marker mismatches map to `CliStructuredError` (code `5002`) so
66
- * callers (CLI command) can render and exit. Schema results are
67
- * returned to the caller verbatim.
69
+ * 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
70
+ * per-space `schemaCheck` (each contract space verified against the full schema,
71
+ * then scoped to its own contract space). Marker mismatches map to
72
+ * `CliStructuredError` (code `5002`) so callers (CLI command) can render
73
+ * and exit. Verify results are returned to the caller verbatim.
68
74
  */
69
75
  declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
70
76
  //#endregion
@@ -523,7 +529,7 @@ type EmitResult = Result<EmitSuccess, EmitFailure>;
523
529
  *
524
530
  * The control-api operation is responsible for: loading the
525
531
  * contract-space aggregate, reading per-space marker rows from the
526
- * live database, plotting per-space paths via `graphWalkStrategy`
532
+ * live database, plotting per-space paths via `resolveRecordedPath`
527
533
  * (replay-only — no synth, no introspection), and dispatching
528
534
  * through the shared `runMigration` primitive. The CLI command
529
535
  * just resolves the descriptor surface (config, refs, contract
@@ -535,9 +541,9 @@ interface MigrateOptions {
535
541
  /** Migrations root directory (`migrations/` under the project). */
536
542
  readonly migrationsDir: string;
537
543
  /**
538
- * Optional app-space ref override. When provided, the app member's
544
+ * Optional app-space ref override. When provided, the app space's
539
545
  * graph-walk targets this hash instead of `contract.storage.storageHash`.
540
- * Extension members always walk to their own `headRef.hash`.
546
+ * Extension spaces always walk to their own `headRef.hash`.
541
547
  */
542
548
  readonly refHash?: string;
543
549
  /**
@@ -584,17 +590,17 @@ interface MigrateRanEntry {
584
590
  }
585
591
  /**
586
592
  * Successful migrate result. Carries both the top-level fields
587
- * (`markerHash` is the **app member's** post-migrate marker) and the
593
+ * (`markerHash` is the **app space's** post-migrate marker) and the
588
594
  * per-space breakdown (`perSpace` — markers / operations in canonical
589
595
  * schedule order).
590
596
  */
591
597
  /**
592
- * Path-decision summary for the **app member** post-migrate. Surfaced
598
+ * Path-decision summary for the **app space** post-migrate. Surfaced
593
599
  * at the top level (and consumed by the cli-journeys suite, which
594
600
  * inspects `requiredInvariants`/`satisfiedInvariants`/
595
601
  * `selectedPath` to validate invariant routing).
596
602
  *
597
- * Per-space path decisions for extension members are not surfaced —
603
+ * Per-space path decisions for extension spaces are not surfaced —
598
604
  * extensions own their own ref/invariant control.
599
605
  */
600
606
  interface MigratePathDecision {
@@ -625,7 +631,7 @@ interface MigrateSuccess {
625
631
  */
626
632
  readonly perSpace: ReadonlyArray<PerSpaceExecutionEntry>;
627
633
  /**
628
- * Path-decision data for the app member. Present whenever the
634
+ * Path-decision data for the app space. Present whenever the
629
635
  * graph-walk strategy ran for the app (i.e. always for the
630
636
  * aggregate-walking migrate path). Absent only for the no-op
631
637
  * "Already up to date" early return when the app has no plan.
@@ -792,7 +798,7 @@ interface ControlClient {
792
798
  * markers, and (unless `skipSchema` is true) per-space schema
793
799
  * verification with pre-projection (closes F23).
794
800
  *
795
- * @returns Result pattern: per-space schema results on success;
801
+ * @returns Result pattern: per-space verify results on success;
796
802
  * structured CLI error on marker / loader failure.
797
803
  * @throws If not connected or infrastructure failure
798
804
  */
@@ -881,4 +887,4 @@ interface ControlClient {
881
887
  }
882
888
  //#endregion
883
889
  export { ExecuteDbVerifyOptions as A, IntrospectOptions as C, SchemaVerifyOptions as D, PerSpaceExecutionEntry as E, executeDbVerify as M, CliStructuredError$1 as N, SignOptions as O, EmitSuccess as S, OnControlProgress as T, EmitContractConfig as _, ControlClientOptions as a, EmitOptions as b, DbInitFailureCode as c, DbInitSuccess as d, DbUpdateFailure as f, DbUpdateSuccess as g, DbUpdateResult as h, ControlClient as i, ExecuteDbVerifyResult as j, VerifyOptions as k, DbInitOptions as l, DbUpdateOptions as m, ContractEmitResult as n, ControlProgressEvent as o, DbUpdateFailureCode as p, ControlActionName as r, DbInitFailure as s, ContractEmitOptions as t, DbInitResult as u, EmitFailure as v, MigratePathDecision as w, EmitResult as x, EmitFailureCode as y };
884
- //# sourceMappingURL=types-C_tYiJYx.d.mts.map
890
+ //# sourceMappingURL=types-DFoqNIcQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DFoqNIcQ.d.mts","names":[],"sources":["../src/control-api/operations/db-verify.ts","../src/control-api/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8CA;UAAiB,sBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,aAAA;EAAA,SACA,QAAA,EAAU,SAAA;EAAA,SACV,cAAA,EAAgB,aAAA,CAAc,0BAAA,CAA2B,SAAA,EAAW,SAAA;EAAA,SACpE,mBAAA,EAAqB,aAAA,CAAc,8BAAA,CAA+B,SAAA,EAAW,SAAA;EAAA,SAC7E,IAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA;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AA,GAAc,OAAA,CAAQ,UAAA;AAAA"}
@@ -1,7 +1,22 @@
1
- import { M as createColorFormatter, N as formatDim, P as isVerbose } from "./command-helpers-DGMvGBeX.mjs";
1
+ import { M as createColorFormatter, N as formatDim, P as isVerbose } from "./command-helpers-CUoKYTlG.mjs";
2
2
  import { ifDefined } from "@prisma-next/utils/defined";
3
3
  import { bold, cyan, dim, green, magenta, red, yellow } from "colorette";
4
4
  //#region src/utils/formatters/verify.ts
5
+ /** Human-readable label for each failure reason, prefixed onto an issue's message for display. */
6
+ const REASON_LABEL = {
7
+ "not-found": "missing",
8
+ "not-expected": "extra",
9
+ "not-equal": "mismatch"
10
+ };
11
+ /**
12
+ * The issue's display text: its own path, prefixed with a human label for
13
+ * why it's flagged. Turning `reason` (and the path) into prose is this
14
+ * formatter's job, not the differ's — the differ's issue is data (`path` +
15
+ * `reason` + nodes), not prose.
16
+ */
17
+ function formatIssueMessage(issue) {
18
+ return `${REASON_LABEL[issue.reason]}: ${issue.path.join("/")}`;
19
+ }
5
20
  /**
6
21
  * Formats human-readable output for database verify.
7
22
  */
@@ -17,7 +32,16 @@ function formatVerifyOutput(result, flags) {
17
32
  lines.push(`${formatDimText(` verification: ${verificationMode}`)}`);
18
33
  lines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);
19
34
  if (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);
20
- if (result.mode === "full" && result.schema && isVerbose(flags, 1)) lines.push(`${formatDimText(` schema: pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`);
35
+ if (result.schema?.warnings && result.schema.warnings.length > 0) {
36
+ lines.push("");
37
+ lines.push(formatYellow("Schema warnings:"));
38
+ for (const message of result.schema.warnings) lines.push(` ${formatYellow("⚠")} ${message}`);
39
+ }
40
+ if (result.unclaimed && result.unclaimed.length > 0) {
41
+ lines.push("");
42
+ lines.push(formatYellow("Unclaimed elements (declared by no contract):"));
43
+ for (const name of result.unclaimed) lines.push(` ${formatYellow("⚠")} ${name}`);
44
+ }
21
45
  if (result.warning) {
22
46
  lines.push("");
23
47
  lines.push(`${formatYellow("⚠")} ${result.warning}`);
@@ -42,6 +66,7 @@ function formatVerifyJson(result) {
42
66
  ...ifDefined("missingCodecs", result.missingCodecs),
43
67
  ...ifDefined("codecCoverageSkipped", result.codecCoverageSkipped),
44
68
  ...ifDefined("schema", result.schema),
69
+ unclaimed: result.unclaimed ?? [],
45
70
  ...ifDefined("warning", result.warning),
46
71
  ...ifDefined("meta", result.meta),
47
72
  timings: result.timings
@@ -56,7 +81,7 @@ function formatIntrospectJson(result) {
56
81
  }
57
82
  /**
58
83
  * Renders a schema tree structure from CoreSchemaView.
59
- * Matches the style of renderSchemaVerificationTree for consistency.
84
+ * Status-glyph tree styling shared with the retired verification-tree renderer.
60
85
  */
61
86
  function renderSchemaTree(node, flags, options) {
62
87
  const { isLast, prefix, useColor, formatDimText, isRoot = false } = options;
@@ -175,167 +200,35 @@ function formatIntrospectOutput(result, schemaView, flags) {
175
200
  return lines.join("\n");
176
201
  }
177
202
  /**
178
- * Renders a schema verification tree structure from SchemaVerificationNode.
179
- * Similar to renderSchemaTree but for verification nodes with status-based colors and glyphs.
180
- */
181
- function renderSchemaVerificationTree(node, flags, options) {
182
- const { isLast, prefix, useColor, formatDimText, isRoot = false } = options;
183
- const lines = [];
184
- let statusGlyph = "";
185
- let statusColor = (text) => text;
186
- if (useColor) switch (node.status) {
187
- case "pass":
188
- statusGlyph = "✔";
189
- statusColor = green;
190
- break;
191
- case "warn":
192
- statusGlyph = "⚠";
193
- statusColor = (text) => useColor ? yellow(text) : text;
194
- break;
195
- case "fail":
196
- statusGlyph = "✖";
197
- statusColor = red;
198
- break;
199
- }
200
- else switch (node.status) {
201
- case "pass":
202
- statusGlyph = "✔";
203
- break;
204
- case "warn":
205
- statusGlyph = "⚠";
206
- break;
207
- case "fail":
208
- statusGlyph = "✖";
209
- break;
210
- }
211
- let labelColor = (text) => text;
212
- let formattedLabel = node.name;
213
- if (useColor) switch (node.kind) {
214
- case "contract":
215
- case "schema":
216
- labelColor = bold;
217
- formattedLabel = labelColor(node.name);
218
- break;
219
- case "table": {
220
- const tableMatch = node.name.match(/^table\s+(.+)$/);
221
- if (tableMatch?.[1]) {
222
- const tableName = tableMatch[1];
223
- formattedLabel = `${dim("table")} ${cyan(tableName)}`;
224
- } else formattedLabel = dim(node.name);
225
- break;
226
- }
227
- case "columns":
228
- labelColor = dim;
229
- formattedLabel = labelColor(node.name);
230
- break;
231
- case "column": {
232
- const columnMatch = node.name.match(/^([^:]+):\s*(.+)$/);
233
- if (columnMatch?.[1] && columnMatch[2]) {
234
- const columnName = columnMatch[1];
235
- const rest = columnMatch[2];
236
- const typeMatch = rest.match(/^([^\s→]+)\s*→\s*([^\s(]+)\s*(\([^)]+\))$/);
237
- if (typeMatch?.[1] && typeMatch[2] && typeMatch[3]) {
238
- const contractType = typeMatch[1];
239
- const nativeType = typeMatch[2];
240
- const nullability = typeMatch[3];
241
- formattedLabel = `${cyan(columnName)}: ${contractType} → ${dim(nativeType)} ${dim(nullability)}`;
242
- } else formattedLabel = `${cyan(columnName)}: ${rest}`;
243
- } else formattedLabel = node.name;
244
- break;
245
- }
246
- case "type":
247
- case "nullability":
248
- labelColor = (text) => text;
249
- formattedLabel = labelColor(node.name);
250
- break;
251
- case "primaryKey": {
252
- const pkMatch = node.name.match(/^primary key:\s*(.+)$/);
253
- if (pkMatch?.[1]) {
254
- const columnNames = pkMatch[1];
255
- formattedLabel = `${dim("primary key")}: ${cyan(columnNames)}`;
256
- } else formattedLabel = dim(node.name);
257
- break;
258
- }
259
- case "foreignKey":
260
- case "unique":
261
- case "index":
262
- labelColor = dim;
263
- formattedLabel = labelColor(node.name);
264
- break;
265
- case "dependency": {
266
- const dbMatch = node.name.match(/^database is\s+(.+)$/);
267
- if (dbMatch?.[1]) {
268
- const dbName = dbMatch[1];
269
- formattedLabel = `${dim("database is")} ${cyan(dbName)}`;
270
- } else {
271
- const extMatch = node.name.match(/^([^\s]+)\s+(extension is enabled)$/);
272
- if (extMatch?.[1] && extMatch[2]) {
273
- const extName = extMatch[1];
274
- const rest = extMatch[2];
275
- formattedLabel = `${cyan(extName)} ${dim(rest)}`;
276
- } else {
277
- labelColor = magenta;
278
- formattedLabel = labelColor(node.name);
279
- }
280
- }
281
- break;
282
- }
283
- default:
284
- formattedLabel = node.name;
285
- break;
286
- }
287
- else formattedLabel = node.name;
288
- const statusGlyphColored = statusColor(statusGlyph);
289
- let nodeLabel = formattedLabel;
290
- if ((node.status === "fail" || node.status === "warn") && node.message && node.message.length > 0) {
291
- const messageText = formatDimText(`(${node.message})`);
292
- nodeLabel = `${formattedLabel} ${messageText}`;
293
- }
294
- if (isRoot) lines.push(`${statusGlyphColored} ${nodeLabel}`);
295
- else {
296
- const treePrefix = `${formatDimText(isLast ? "└" : "├")}─ `;
297
- lines.push(`${prefix}${treePrefix}${statusGlyphColored} ${nodeLabel}`);
298
- }
299
- if (node.children && node.children.length > 0) {
300
- const childPrefix = isRoot ? "" : `${prefix}${isLast ? " " : `${formatDimText("│")} `}`;
301
- for (let i = 0; i < node.children.length; i++) {
302
- const child = node.children[i];
303
- if (!child) continue;
304
- const childLines = renderSchemaVerificationTree(child, flags, {
305
- isLast: i === node.children.length - 1,
306
- prefix: childPrefix,
307
- useColor,
308
- formatDimText,
309
- isRoot: false
310
- });
311
- lines.push(...childLines);
312
- }
313
- }
314
- return lines;
315
- }
316
- /**
317
203
  * Formats human-readable output for database schema verification.
318
204
  */
319
- function formatSchemaVerifyOutput(result, flags) {
205
+ function formatSchemaVerifyOutput(result, flags, unclaimed = []) {
320
206
  if (flags.quiet) return "";
321
207
  const lines = [];
322
208
  const useColor = flags.color !== false;
323
209
  const formatGreen = createColorFormatter(useColor, green);
324
210
  const formatRed = createColorFormatter(useColor, red);
211
+ const formatYellow = createColorFormatter(useColor, yellow);
325
212
  const formatDimText = (text) => formatDim(useColor, text);
326
- const treeLines = renderSchemaVerificationTree(result.schema.root, flags, {
327
- isLast: true,
328
- prefix: "",
329
- useColor,
330
- formatDimText,
331
- isRoot: true
332
- });
333
- lines.push(...treeLines);
334
- if (isVerbose(flags, 1)) {
335
- lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
336
- lines.push(`${formatDimText(` pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`);
213
+ const issueMessages = result.schema.issues.map(formatIssueMessage);
214
+ if (issueMessages.length > 0) {
215
+ lines.push(formatRed("Schema issues:"));
216
+ for (const message of issueMessages) lines.push(` ${formatRed("✖")} ${message}`);
337
217
  }
338
- lines.push("");
218
+ const warningMessages = (result.schema.warnings?.issues ?? []).map(formatIssueMessage);
219
+ if (warningMessages.length > 0) {
220
+ if (lines.length > 0) lines.push("");
221
+ lines.push(formatYellow("Schema warnings:"));
222
+ for (const message of warningMessages) lines.push(` ${formatYellow("⚠")} ${message}`);
223
+ }
224
+ if (unclaimed.length > 0) {
225
+ const strict = result.meta?.strict ?? false;
226
+ if (lines.length > 0) lines.push("");
227
+ lines.push((strict ? formatRed : formatYellow)("Unclaimed elements (declared by no contract):"));
228
+ for (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? "✖" : "⚠")} ${name}`);
229
+ }
230
+ if (isVerbose(flags, 1)) lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
231
+ if (lines.length > 0) lines.push("");
339
232
  if (result.ok) lines.push(`${formatGreen("✔")} ${result.summary}`);
340
233
  else {
341
234
  const codeText = result.code ? ` (${result.code})` : "";
@@ -344,10 +237,15 @@ function formatSchemaVerifyOutput(result, flags) {
344
237
  return lines.join("\n");
345
238
  }
346
239
  /**
347
- * Formats JSON output for database schema verification.
240
+ * Formats JSON output for database schema verification. The unclaimed-elements
241
+ * list is a top-level field alongside the combined result, reported once for
242
+ * the whole database.
348
243
  */
349
- function formatSchemaVerifyJson(result) {
350
- return JSON.stringify(result, null, 2);
244
+ function formatSchemaVerifyJson(result, unclaimed = []) {
245
+ return JSON.stringify({
246
+ ...result,
247
+ unclaimed
248
+ }, null, 2);
351
249
  }
352
250
  /**
353
251
  * Formats human-readable output for database sign.
@@ -381,4 +279,4 @@ function formatSignJson(result) {
381
279
  //#endregion
382
280
  export { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };
383
281
 
384
- //# sourceMappingURL=verify-DcOYZ1tH.mjs.map
282
+ //# sourceMappingURL=verify-DDCb0R2r.mjs.map