prisma-next 0.5.0-dev.9 → 0.5.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 (142) hide show
  1. package/dist/cli-errors-B9OBbled.d.mts +3 -0
  2. package/dist/cli-errors-D3_sMh2K.mjs +33 -0
  3. package/dist/cli-errors-D3_sMh2K.mjs.map +1 -0
  4. package/dist/cli.mjs +16 -78
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/client-BCnP7cHo.mjs +1485 -0
  7. package/dist/client-BCnP7cHo.mjs.map +1 -0
  8. package/dist/{result-handler-Ba3zWQsI.mjs → command-helpers-BeZHkxV8.mjs} +70 -47
  9. package/dist/command-helpers-BeZHkxV8.mjs.map +1 -0
  10. package/dist/commands/contract-emit.d.mts.map +1 -1
  11. package/dist/commands/contract-emit.mjs +2 -4
  12. package/dist/commands/contract-infer.d.mts.map +1 -1
  13. package/dist/commands/contract-infer.mjs +2 -4
  14. package/dist/commands/db-init.d.mts.map +1 -1
  15. package/dist/commands/db-init.mjs +16 -13
  16. package/dist/commands/db-init.mjs.map +1 -1
  17. package/dist/commands/db-schema.d.mts.map +1 -1
  18. package/dist/commands/db-schema.mjs +6 -7
  19. package/dist/commands/db-schema.mjs.map +1 -1
  20. package/dist/commands/db-sign.d.mts.map +1 -1
  21. package/dist/commands/db-sign.mjs +9 -9
  22. package/dist/commands/db-sign.mjs.map +1 -1
  23. package/dist/commands/db-update.d.mts.map +1 -1
  24. package/dist/commands/db-update.mjs +15 -13
  25. package/dist/commands/db-update.mjs.map +1 -1
  26. package/dist/commands/db-verify.d.mts.map +1 -1
  27. package/dist/commands/db-verify.mjs +1 -321
  28. package/dist/commands/migration-apply.d.mts +28 -13
  29. package/dist/commands/migration-apply.d.mts.map +1 -1
  30. package/dist/commands/migration-apply.mjs +55 -151
  31. package/dist/commands/migration-apply.mjs.map +1 -1
  32. package/dist/commands/migration-new.d.mts +0 -1
  33. package/dist/commands/migration-new.d.mts.map +1 -1
  34. package/dist/commands/migration-new.mjs +34 -40
  35. package/dist/commands/migration-new.mjs.map +1 -1
  36. package/dist/commands/migration-plan.d.mts +33 -6
  37. package/dist/commands/migration-plan.d.mts.map +1 -1
  38. package/dist/commands/migration-plan.mjs +2 -348
  39. package/dist/commands/migration-ref.d.mts +1 -1
  40. package/dist/commands/migration-ref.d.mts.map +1 -1
  41. package/dist/commands/migration-ref.mjs +8 -12
  42. package/dist/commands/migration-ref.mjs.map +1 -1
  43. package/dist/commands/migration-show.d.mts +64 -10
  44. package/dist/commands/migration-show.d.mts.map +1 -1
  45. package/dist/commands/migration-show.mjs +166 -60
  46. package/dist/commands/migration-show.mjs.map +1 -1
  47. package/dist/commands/migration-status.d.mts +126 -5
  48. package/dist/commands/migration-status.d.mts.map +1 -1
  49. package/dist/commands/migration-status.mjs +2 -4
  50. package/dist/{config-loader-C25b63rJ.mjs → config-loader-B6sJjXTv.mjs} +3 -5
  51. package/dist/config-loader-B6sJjXTv.mjs.map +1 -0
  52. package/dist/config-loader.d.mts +0 -1
  53. package/dist/config-loader.d.mts.map +1 -1
  54. package/dist/config-loader.mjs +2 -3
  55. package/dist/contract-emit-9DBda5Ou.mjs +150 -0
  56. package/dist/contract-emit-9DBda5Ou.mjs.map +1 -0
  57. package/dist/contract-emit-B77TsJqf.mjs +327 -0
  58. package/dist/contract-emit-B77TsJqf.mjs.map +1 -0
  59. package/dist/{contract-enrichment-CAOELa-H.mjs → contract-enrichment-Dani0mMW.mjs} +4 -6
  60. package/dist/contract-enrichment-Dani0mMW.mjs.map +1 -0
  61. package/dist/{contract-infer-D9cC3rJm.mjs → contract-infer-ByxhPjpW.mjs} +13 -22
  62. package/dist/contract-infer-ByxhPjpW.mjs.map +1 -0
  63. package/dist/contract-space-aggregate-loader-BrwKK6Q6.mjs +160 -0
  64. package/dist/contract-space-aggregate-loader-BrwKK6Q6.mjs.map +1 -0
  65. package/dist/db-verify-Czm5T-J4.mjs +404 -0
  66. package/dist/db-verify-Czm5T-J4.mjs.map +1 -0
  67. package/dist/exports/config-types.mjs +1 -2
  68. package/dist/exports/control-api.d.mts +101 -586
  69. package/dist/exports/control-api.d.mts.map +1 -1
  70. package/dist/exports/control-api.mjs +4 -6
  71. package/dist/exports/index.d.mts.map +1 -1
  72. package/dist/exports/index.mjs +28 -30
  73. package/dist/exports/index.mjs.map +1 -1
  74. package/dist/exports/init-output.d.mts +2 -4
  75. package/dist/exports/init-output.d.mts.map +1 -1
  76. package/dist/exports/init-output.mjs +2 -3
  77. package/dist/{framework-components-Cr--XBKy.mjs → framework-components-ChqVUxR-.mjs} +3 -4
  78. package/dist/{framework-components-Cr--XBKy.mjs.map → framework-components-ChqVUxR-.mjs.map} +1 -1
  79. package/dist/global-flags-Icqpxk23.d.mts +12 -0
  80. package/dist/global-flags-Icqpxk23.d.mts.map +1 -0
  81. package/dist/helpers-eqdN8tH6.mjs +25 -0
  82. package/dist/helpers-eqdN8tH6.mjs.map +1 -0
  83. package/dist/{init-C5220SY9.mjs → init-DETSgw3h.mjs} +40 -49
  84. package/dist/init-DETSgw3h.mjs.map +1 -0
  85. package/dist/{inspect-live-schema-yrHAvG71.mjs → inspect-live-schema-DxdBd4Er.mjs} +10 -11
  86. package/dist/inspect-live-schema-DxdBd4Er.mjs.map +1 -0
  87. package/dist/migration-cli.d.mts +41 -12
  88. package/dist/migration-cli.d.mts.map +1 -1
  89. package/dist/migration-cli.mjs +309 -86
  90. package/dist/migration-cli.mjs.map +1 -1
  91. package/dist/{migration-command-scaffold-B3B09et6.mjs → migration-command-scaffold-BdV8JYXV.mjs} +8 -9
  92. package/dist/migration-command-scaffold-BdV8JYXV.mjs.map +1 -0
  93. package/dist/migration-plan-mRu5K81L.mjs +494 -0
  94. package/dist/migration-plan-mRu5K81L.mjs.map +1 -0
  95. package/dist/{migration-status-DUMiH8_G.mjs → migration-status-By9G5p2H.mjs} +270 -65
  96. package/dist/migration-status-By9G5p2H.mjs.map +1 -0
  97. package/dist/migrations-CTsyBXCA.mjs +229 -0
  98. package/dist/migrations-CTsyBXCA.mjs.map +1 -0
  99. package/dist/{output-BpcQrnnq.mjs → output-B16Kefzx.mjs} +9 -3
  100. package/dist/output-B16Kefzx.mjs.map +1 -0
  101. package/dist/{progress-adapter-DvQWB1nK.mjs → progress-adapter-DFfvZcYL.mjs} +2 -2
  102. package/dist/{progress-adapter-DvQWB1nK.mjs.map → progress-adapter-DFfvZcYL.mjs.map} +1 -1
  103. package/dist/result-handler-rmPVKIP2.mjs +25 -0
  104. package/dist/result-handler-rmPVKIP2.mjs.map +1 -0
  105. package/dist/rolldown-runtime-twds-ZHy.mjs +14 -0
  106. package/dist/{terminal-ui-C3ZLwQxK.mjs → terminal-ui-C_hFNbAn.mjs} +4 -28
  107. package/dist/terminal-ui-C_hFNbAn.mjs.map +1 -0
  108. package/dist/types-LItU7E4l.d.mts +856 -0
  109. package/dist/types-LItU7E4l.d.mts.map +1 -0
  110. package/dist/{verify-Bkycc-Tf.mjs → verify-CiwNWM9N.mjs} +3 -4
  111. package/dist/verify-CiwNWM9N.mjs.map +1 -0
  112. package/package.json +19 -17
  113. package/dist/cli-errors-BFYgBH3L.d.mts +0 -4
  114. package/dist/cli-errors-Cd79vmTH.mjs +0 -5
  115. package/dist/client-CrsnY58k.mjs +0 -997
  116. package/dist/client-CrsnY58k.mjs.map +0 -1
  117. package/dist/commands/db-verify.mjs.map +0 -1
  118. package/dist/commands/migration-plan.mjs.map +0 -1
  119. package/dist/config-loader-C25b63rJ.mjs.map +0 -1
  120. package/dist/contract-emit--feXyNd7.mjs +0 -4
  121. package/dist/contract-emit-NJ01hiiv.mjs +0 -195
  122. package/dist/contract-emit-NJ01hiiv.mjs.map +0 -1
  123. package/dist/contract-emit-V5SSitUT.mjs +0 -122
  124. package/dist/contract-emit-V5SSitUT.mjs.map +0 -1
  125. package/dist/contract-enrichment-CAOELa-H.mjs.map +0 -1
  126. package/dist/contract-infer-D9cC3rJm.mjs.map +0 -1
  127. package/dist/extract-operation-statements-DsFfxXVZ.mjs +0 -13
  128. package/dist/extract-operation-statements-DsFfxXVZ.mjs.map +0 -1
  129. package/dist/extract-sql-ddl-D9UbZDyz.mjs +0 -26
  130. package/dist/extract-sql-ddl-D9UbZDyz.mjs.map +0 -1
  131. package/dist/init-C5220SY9.mjs.map +0 -1
  132. package/dist/inspect-live-schema-yrHAvG71.mjs.map +0 -1
  133. package/dist/migration-command-scaffold-B3B09et6.mjs.map +0 -1
  134. package/dist/migration-status-DUMiH8_G.mjs.map +0 -1
  135. package/dist/migrations-Bo5WtTla.mjs +0 -153
  136. package/dist/migrations-Bo5WtTla.mjs.map +0 -1
  137. package/dist/output-BpcQrnnq.mjs.map +0 -1
  138. package/dist/result-handler-Ba3zWQsI.mjs.map +0 -1
  139. package/dist/terminal-ui-C3ZLwQxK.mjs.map +0 -1
  140. package/dist/validate-contract-deps-B_Cs29TL.mjs +0 -37
  141. package/dist/validate-contract-deps-B_Cs29TL.mjs.map +0 -1
  142. package/dist/verify-Bkycc-Tf.mjs.map +0 -1
@@ -1,322 +1,2 @@
1
- import { t as loadConfig } from "../config-loader-C25b63rJ.mjs";
2
- import { _ as errorUnexpected, a as errorContractValidationFailed, c as errorDriverRequired, d as errorMarkerMissing, g as errorTargetMismatch, l as errorFileNotFound, m as errorRuntime, o as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorHashMismatch } from "../cli-errors-Cd79vmTH.mjs";
3
- import { n as ContractValidationError, t as createControlClient } from "../client-CrsnY58k.mjs";
4
- import { t as TerminalUI } from "../terminal-ui-C3ZLwQxK.mjs";
5
- import { _ as formatStyledHeader, a as maskConnectionUrl, d as setCommandExamples, m as parseGlobalFlags, n as addGlobalOptions, s as resolveContractPath, t as handleResult, u as setCommandDescriptions } from "../result-handler-Ba3zWQsI.mjs";
6
- import { t as createProgressAdapter } from "../progress-adapter-DvQWB1nK.mjs";
7
- import { c as formatVerifyOutput, i as formatSchemaVerifyOutput, r as formatSchemaVerifyJson, s as formatVerifyJson } from "../verify-Bkycc-Tf.mjs";
8
- import { Command } from "commander";
9
- import { notOk, ok } from "@prisma-next/utils/result";
10
- import { relative, resolve } from "pathe";
11
- import { ifDefined } from "@prisma-next/utils/defined";
12
- import { VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH } from "@prisma-next/framework-components/control";
13
- import { readFile } from "node:fs/promises";
14
-
15
- //#region src/commands/db-verify.ts
16
- /**
17
- * Maps a VerifyDatabaseResult failure to a CliStructuredError.
18
- */
19
- function mapVerifyFailure(verifyResult) {
20
- if (!verifyResult.ok && verifyResult.code) {
21
- if (verifyResult.code === VERIFY_CODE_MARKER_MISSING) return errorMarkerMissing();
22
- if (verifyResult.code === VERIFY_CODE_HASH_MISMATCH) {
23
- const storageMatch = verifyResult.marker?.storageHash === verifyResult.contract.storageHash;
24
- const profileMatch = !verifyResult.contract.profileHash || verifyResult.marker?.profileHash === verifyResult.contract.profileHash;
25
- if (!storageMatch) return errorHashMismatch({
26
- why: "Contract storageHash does not match database marker",
27
- expected: verifyResult.contract.storageHash,
28
- ...ifDefined("actual", verifyResult.marker?.storageHash)
29
- });
30
- return errorHashMismatch({
31
- why: profileMatch ? "Contract hash does not match database marker" : "Contract profileHash does not match database marker",
32
- ...ifDefined("expected", verifyResult.contract.profileHash),
33
- ...ifDefined("actual", verifyResult.marker?.profileHash)
34
- });
35
- }
36
- if (verifyResult.code === VERIFY_CODE_TARGET_MISMATCH) return errorTargetMismatch(verifyResult.target.expected, verifyResult.target.actual ?? "unknown");
37
- }
38
- return errorRuntime(verifyResult.summary);
39
- }
40
- function errorInvalidVerifyMode(options) {
41
- return new CliStructuredError("4012", "Invalid verify mode", {
42
- domain: "CLI",
43
- why: options.why,
44
- fix: options.fix,
45
- docsUrl: "https://pris.ly/db-verify"
46
- });
47
- }
48
- function resolveDbVerifyMode(options) {
49
- if (options.markerOnly && options.schemaOnly) return notOk(errorInvalidVerifyMode({
50
- why: "`--marker-only` and `--schema-only` cannot be used together",
51
- fix: "Choose one mode: omit both to check the marker and schema, use `--marker-only` to check only the marker, or use `--schema-only` to check only the live schema."
52
- }));
53
- if (options.markerOnly && options.strict) return notOk(errorInvalidVerifyMode({
54
- why: "`--strict` requires schema verification, but `--marker-only` skips it",
55
- fix: "Remove `--strict`, or use `db verify` / `db verify --schema-only` when you want to check the live schema in strict mode."
56
- }));
57
- if (options.schemaOnly) return ok("schema-only");
58
- if (options.markerOnly) return ok("marker-only");
59
- return ok("full");
60
- }
61
- function formatDbVerifyModeLabel(mode, strict) {
62
- if (mode === "marker-only") return "marker only";
63
- if (mode === "schema-only") return `schema only (${strict ? "strict" : "tolerant"})`;
64
- return `full (marker + schema, ${strict ? "strict" : "tolerant"})`;
65
- }
66
- function formatDbVerifyInvocation(mode, strict) {
67
- const args = ["db verify"];
68
- if (mode === "marker-only") args.push("--marker-only");
69
- if (mode === "schema-only") args.push("--schema-only");
70
- if (strict) args.push("--strict");
71
- return args.join(" ");
72
- }
73
- function createDbVerifyConnectionRequiredError(options) {
74
- const invocation = formatDbVerifyInvocation(options.mode, options.strict);
75
- return errorDatabaseConnectionRequired({
76
- why: `Database connection is required for ${invocation} (set db.connection in ${options.configPath}, or pass --db <url>)`,
77
- retryCommand: `prisma-next ${invocation} --db <url>`
78
- });
79
- }
80
- function renderVerifyHeader(paths, options, mode, flags, ui) {
81
- if (flags.json || flags.quiet) return;
82
- const description = mode === "schema-only" ? "Check whether the live database schema matches your contract" : mode === "marker-only" ? "Check whether the database marker matches your contract" : "Check whether the database marker and live schema match your contract";
83
- const details = [
84
- {
85
- label: "config",
86
- value: paths.configPath
87
- },
88
- {
89
- label: "contract",
90
- value: paths.contractPath
91
- },
92
- {
93
- label: "mode",
94
- value: formatDbVerifyModeLabel(mode, options.strict ?? false)
95
- }
96
- ];
97
- if (options.db) details.push({
98
- label: "database",
99
- value: maskConnectionUrl(options.db)
100
- });
101
- ui.stderr(formatStyledHeader({
102
- command: "db verify",
103
- description,
104
- url: "https://pris.ly/db-verify",
105
- details,
106
- flags
107
- }));
108
- }
109
- async function resolveVerifyPaths(options) {
110
- const config = await loadConfig(options.config);
111
- const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
112
- const contractPathAbsolute = resolveContractPath(config);
113
- return {
114
- config,
115
- configPath,
116
- contractPathAbsolute,
117
- contractPath: relative(process.cwd(), contractPathAbsolute)
118
- };
119
- }
120
- async function resolveVerifySetup(paths, options, mode) {
121
- const { config, configPath, contractPathAbsolute, contractPath } = paths;
122
- let contractJsonContent;
123
- try {
124
- contractJsonContent = await readFile(contractPathAbsolute, "utf-8");
125
- } catch (error) {
126
- if (error instanceof Error && error.code === "ENOENT") return notOk(errorFileNotFound(contractPathAbsolute, {
127
- why: `Contract file not found at ${contractPathAbsolute}`,
128
- fix: `Run \`prisma-next contract emit\` to generate ${contractPath}, or update \`config.contract.output\` in ${configPath}`
129
- }));
130
- return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));
131
- }
132
- let contractJson;
133
- try {
134
- contractJson = JSON.parse(contractJsonContent);
135
- } catch (error) {
136
- return notOk(errorContractValidationFailed(`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));
137
- }
138
- const dbConnection = options.db ?? config.db?.connection;
139
- if (typeof dbConnection !== "string" || dbConnection.length === 0) return notOk(createDbVerifyConnectionRequiredError({
140
- configPath,
141
- mode,
142
- strict: options.strict ?? false
143
- }));
144
- if (!config.driver) return notOk(errorDriverRequired({ why: `Config.driver is required for ${formatDbVerifyInvocation(mode, options.strict ?? false)}` }));
145
- return ok({
146
- ...paths,
147
- contractJson,
148
- dbConnection
149
- });
150
- }
151
- function createVerifyClient(setup) {
152
- return createControlClient({
153
- family: setup.config.family,
154
- target: setup.config.target,
155
- adapter: setup.config.adapter,
156
- driver: setup.config.driver,
157
- extensionPacks: setup.config.extensionPacks ?? []
158
- });
159
- }
160
- function wrapVerifyError(error, contractPathAbsolute, modeLabel) {
161
- if (error instanceof CliStructuredError) return notOk(error);
162
- if (error instanceof ContractValidationError) return notOk(errorContractValidationFailed(`Contract validation failed: ${error.message}`, { where: { path: contractPathAbsolute } }));
163
- return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during ${modeLabel}: ${error instanceof Error ? error.message : String(error)}` }));
164
- }
165
- /**
166
- * Executes the db verify command and returns a structured Result.
167
- */
168
- async function executeDbVerifyCommand(options, flags, ui, mode) {
169
- const startTime = Date.now();
170
- const paths = await resolveVerifyPaths(options);
171
- renderVerifyHeader(paths, options, mode, flags, ui);
172
- const setupResult = await resolveVerifySetup(paths, options, mode);
173
- if (!setupResult.ok) return setupResult;
174
- const { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;
175
- const client = createVerifyClient(setupResult.value);
176
- const onProgress = createProgressAdapter({
177
- ui,
178
- flags
179
- });
180
- try {
181
- const verifyResult = await client.verify({
182
- contract: contractJson,
183
- connection: dbConnection,
184
- onProgress
185
- });
186
- if (!verifyResult.ok) return notOk(mapVerifyFailure(verifyResult));
187
- if (mode === "marker-only") return ok({
188
- ok: true,
189
- mode: "marker-only",
190
- summary: "Database marker matches contract",
191
- contract: verifyResult.contract,
192
- marker: verifyResult.marker,
193
- target: verifyResult.target,
194
- ...ifDefined("missingCodecs", verifyResult.missingCodecs),
195
- ...ifDefined("codecCoverageSkipped", verifyResult.codecCoverageSkipped),
196
- warning: "Schema verification skipped because --marker-only was provided",
197
- meta: {
198
- ...verifyResult.meta ?? {},
199
- schemaVerification: "skipped"
200
- },
201
- timings: { total: Date.now() - startTime }
202
- });
203
- const schemaVerifyResult = await client.schemaVerify({
204
- contract: contractJson,
205
- strict: options.strict ?? false,
206
- onProgress
207
- });
208
- if (!schemaVerifyResult.ok) return notOk(schemaVerifyResult);
209
- return ok({
210
- ok: true,
211
- mode: "full",
212
- summary: "Database marker and schema match contract",
213
- contract: verifyResult.contract,
214
- marker: verifyResult.marker,
215
- target: verifyResult.target,
216
- ...ifDefined("missingCodecs", verifyResult.missingCodecs),
217
- ...ifDefined("codecCoverageSkipped", verifyResult.codecCoverageSkipped),
218
- schema: {
219
- summary: schemaVerifyResult.summary,
220
- counts: schemaVerifyResult.schema.counts,
221
- strict: schemaVerifyResult.meta?.strict ?? false
222
- },
223
- meta: {
224
- ...verifyResult.meta ?? {},
225
- schemaVerification: "performed"
226
- },
227
- timings: { total: Date.now() - startTime }
228
- });
229
- } catch (error) {
230
- return wrapVerifyError(error, contractPathAbsolute, "db verify");
231
- } finally {
232
- await client.close();
233
- }
234
- }
235
- async function executeDbSchemaOnlyVerifyCommand(options, flags, ui) {
236
- const paths = await resolveVerifyPaths(options);
237
- renderVerifyHeader(paths, options, "schema-only", flags, ui);
238
- const setupResult = await resolveVerifySetup(paths, options, "schema-only");
239
- if (!setupResult.ok) return setupResult;
240
- const { contractJson, dbConnection, contractPathAbsolute } = setupResult.value;
241
- const client = createVerifyClient(setupResult.value);
242
- const onProgress = createProgressAdapter({
243
- ui,
244
- flags
245
- });
246
- try {
247
- return ok(await client.schemaVerify({
248
- contract: contractJson,
249
- strict: options.strict ?? false,
250
- connection: dbConnection,
251
- onProgress
252
- }));
253
- } catch (error) {
254
- return wrapVerifyError(error, contractPathAbsolute, "db verify --schema-only");
255
- } finally {
256
- await client.close();
257
- }
258
- }
259
- function createDbVerifyCommand() {
260
- const command = new Command("verify");
261
- setCommandDescriptions(command, "Check whether the database marker and live schema match your contract", "Verifies the database marker first, then checks the database schema matches your contract.\nUse `--marker-only` for marker-only verification, `--schema-only` to skip marker checks and\ninspect only the live schema, and `--strict` to fail if the database includes elements\nnot present in the contract.");
262
- setCommandExamples(command, [
263
- "prisma-next db verify --db $DATABASE_URL",
264
- "prisma-next db verify --db $DATABASE_URL --strict",
265
- "prisma-next db verify --db $DATABASE_URL --schema-only",
266
- "prisma-next db verify --db $DATABASE_URL --schema-only --strict",
267
- "prisma-next db verify --db $DATABASE_URL --marker-only",
268
- "prisma-next db verify --db $DATABASE_URL --json"
269
- ]);
270
- addGlobalOptions(command).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--marker-only", "Skip schema verification and only check the database marker").option("--schema-only", "Skip marker verification and only check whether the live schema satisfies the contract").option("--strict", "Strict mode: schema elements not present in the contract are considered an error", false).action(async (options) => {
271
- const flags = parseGlobalFlags(options);
272
- const ui = new TerminalUI({
273
- color: flags.color,
274
- interactive: flags.interactive
275
- });
276
- const modeResult = resolveDbVerifyMode(options);
277
- if (!modeResult.ok) {
278
- const exitCode = handleResult(modeResult, flags, ui);
279
- process.exit(exitCode);
280
- }
281
- const mode = modeResult.value;
282
- if (mode === "schema-only") {
283
- const result$1 = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);
284
- const exitCode = handleResult(result$1, flags, ui, (schemaVerifyResult) => {
285
- if (flags.json) ui.output(formatSchemaVerifyJson(schemaVerifyResult));
286
- else {
287
- const output = formatSchemaVerifyOutput(schemaVerifyResult, flags);
288
- if (output) ui.log(output);
289
- }
290
- });
291
- if (result$1.ok && !result$1.value.ok) process.exit(1);
292
- process.exit(exitCode);
293
- }
294
- const result = await executeDbVerifyCommand(options, flags, ui, mode);
295
- if (result.ok) {
296
- if (flags.json) ui.output(formatVerifyJson(result.value));
297
- else {
298
- const output = formatVerifyOutput(result.value, flags);
299
- if (output) ui.log(output);
300
- }
301
- process.exit(0);
302
- }
303
- if (CliStructuredError.is(result.failure)) {
304
- const exitCode = handleResult(result, flags, ui);
305
- process.exit(exitCode);
306
- }
307
- if (flags.json) ui.output(formatSchemaVerifyJson(result.failure));
308
- else {
309
- const output = formatSchemaVerifyOutput(result.failure, {
310
- ...flags,
311
- quiet: false
312
- });
313
- if (output) ui.log(output);
314
- }
315
- process.exit(1);
316
- });
317
- return command;
318
- }
319
-
320
- //#endregion
1
+ import { t as createDbVerifyCommand } from "../db-verify-Czm5T-J4.mjs";
321
2
  export { createDbVerifyCommand };
322
- //# sourceMappingURL=db-verify.mjs.map
@@ -1,31 +1,46 @@
1
+ import { T as MigrationApplyPathDecision, t as AggregatePerSpaceExecutionEntry } from "../types-LItU7E4l.mjs";
1
2
  import { Command } from "commander";
2
3
 
3
4
  //#region src/commands/migration-apply.d.ts
5
+ /**
6
+ * Per-space breakdown of an apply run. The CLI command surfaces these
7
+ * for both the JSON shape (`appliedSpaces[]`) and the human-readable
8
+ * formatter (per-space block — same shape `db init` / `db update`
9
+ * use, M6 sub-spec § Output shape contract).
10
+ */
4
11
  interface MigrationApplyResult {
5
12
  readonly ok: boolean;
13
+ /** Number of contract spaces that had non-zero pending operations applied. */
6
14
  readonly migrationsApplied: number;
15
+ /** Total contract spaces visible in the aggregate (pending + already-up-to-date). */
7
16
  readonly migrationsTotal: number;
17
+ /**
18
+ * Marker hash for the **app member** post-apply. Surfaced for
19
+ * back-compat with single-space callers; per-space markers live on
20
+ * `perSpace[].marker.storageHash`.
21
+ */
8
22
  readonly markerHash: string;
9
23
  readonly applied: readonly {
24
+ readonly spaceId: string;
10
25
  readonly dirName: string;
26
+ readonly migrationHash: string;
11
27
  readonly from: string;
12
28
  readonly to: string;
13
29
  readonly operationsExecuted: number;
14
30
  }[];
15
31
  readonly summary: string;
16
- readonly pathDecision?: {
17
- readonly fromHash: string;
18
- readonly toHash: string;
19
- readonly alternativeCount: number;
20
- readonly tieBreakReasons: readonly string[];
21
- readonly refName?: string;
22
- readonly selectedPath: readonly {
23
- readonly dirName: string;
24
- readonly migrationId: string;
25
- readonly from: string;
26
- readonly to: string;
27
- }[];
28
- };
32
+ /**
33
+ * Per-space breakdown in canonical schedule order (extensions
34
+ * alphabetically, then app). Always present for the aggregate-walking
35
+ * apply path.
36
+ */
37
+ readonly perSpace: readonly AggregatePerSpaceExecutionEntry[];
38
+ /**
39
+ * Path-decision data for the app member. Surfaced for back-compat
40
+ * with single-space callers (cli-journeys invariant tests).
41
+ * Absent for no-op applies where the app had nothing to do.
42
+ */
43
+ readonly pathDecision?: MigrationApplyPathDecision;
29
44
  readonly timings: {
30
45
  readonly total: number;
31
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"migration-apply.d.mts","names":[],"sources":["../../src/commands/migration-apply.ts"],"sourcesContent":[],"mappings":";;;UA8CiB,oBAAA;;EAAA,SAAA,iBAAoB,EAAA,MAAA;EAiWrB,SAAA,eAAA,EAAA,MAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA3B,2BAAA,CAAA,GAA+B"}
1
+ {"version":3,"file":"migration-apply.d.mts","names":[],"sources":["../../src/commands/migration-apply.ts"],"mappings":";;;;;;AA0DA;;;;UAAiB,oBAAA;EAAA,SACN,EAAA;EAIA;EAAA,SAFA,iBAAA;EASA;EAAA,SAPA,eAAA;EASE;;;;;EAAA,SAHF,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;EA8NgC;;;;;EAAA,SAxNhC,QAAA,WAAmB,+BAAA;;;;;;WAMnB,YAAA,GAAe,0BAAA;EAAA,SACf,OAAA;IAAA,SACE,KAAA;EAAA;AAAA;AAAA,iBAgNG,2BAAA,CAAA,GAA+B,OAAA"}