@prisma-next/core-control-plane 0.3.0-dev.9 → 0.3.0-dev.90

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 (97) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -99
  3. package/dist/constants.d.mts +9 -0
  4. package/dist/constants.d.mts.map +1 -0
  5. package/dist/constants.mjs +10 -0
  6. package/dist/constants.mjs.map +1 -0
  7. package/dist/emission.d.mts +58 -0
  8. package/dist/emission.d.mts.map +1 -0
  9. package/dist/emission.mjs +315 -0
  10. package/dist/emission.mjs.map +1 -0
  11. package/dist/errors.d.mts +232 -0
  12. package/dist/errors.d.mts.map +1 -0
  13. package/dist/errors.mjs +330 -0
  14. package/dist/errors.mjs.map +1 -0
  15. package/dist/{schema-view.d.ts → schema-view-DObwT8x9.d.mts} +17 -14
  16. package/dist/schema-view-DObwT8x9.d.mts.map +1 -0
  17. package/dist/schema-view.d.mts +2 -0
  18. package/dist/schema-view.mjs +1 -0
  19. package/dist/stack.d.mts +30 -0
  20. package/dist/stack.d.mts.map +1 -0
  21. package/dist/stack.mjs +30 -0
  22. package/dist/stack.mjs.map +1 -0
  23. package/dist/types-BArIWumw.d.mts +615 -0
  24. package/dist/types-BArIWumw.d.mts.map +1 -0
  25. package/dist/types.d.mts +2 -0
  26. package/dist/types.mjs +1 -0
  27. package/package.json +31 -43
  28. package/src/constants.ts +5 -0
  29. package/src/emission/canonicalization.ts +68 -21
  30. package/src/emission/emit.ts +82 -21
  31. package/src/emission/hashing.ts +29 -27
  32. package/src/emission/types.ts +13 -2
  33. package/src/errors.ts +127 -20
  34. package/src/exports/constants.ts +1 -0
  35. package/src/exports/emission.ts +1 -1
  36. package/src/exports/errors.ts +6 -1
  37. package/src/exports/types.ts +0 -1
  38. package/src/migrations.ts +27 -1
  39. package/src/schema-view.ts +5 -5
  40. package/src/types.ts +24 -12
  41. package/dist/chunk-473ODD3P.js +0 -14
  42. package/dist/chunk-473ODD3P.js.map +0 -1
  43. package/dist/chunk-U5RYT6PT.js +0 -229
  44. package/dist/chunk-U5RYT6PT.js.map +0 -1
  45. package/dist/config-types.d.ts +0 -68
  46. package/dist/config-types.d.ts.map +0 -1
  47. package/dist/config-validation.d.ts +0 -10
  48. package/dist/config-validation.d.ts.map +0 -1
  49. package/dist/emission/canonicalization.d.ts +0 -6
  50. package/dist/emission/canonicalization.d.ts.map +0 -1
  51. package/dist/emission/emit.d.ts +0 -5
  52. package/dist/emission/emit.d.ts.map +0 -1
  53. package/dist/emission/hashing.d.ts +0 -17
  54. package/dist/emission/hashing.d.ts.map +0 -1
  55. package/dist/emission/types.d.ts +0 -16
  56. package/dist/emission/types.d.ts.map +0 -1
  57. package/dist/errors.d.ts +0 -183
  58. package/dist/errors.d.ts.map +0 -1
  59. package/dist/exports/config-types.d.ts +0 -3
  60. package/dist/exports/config-types.d.ts.map +0 -1
  61. package/dist/exports/config-types.js +0 -53
  62. package/dist/exports/config-types.js.map +0 -1
  63. package/dist/exports/config-validation.d.ts +0 -2
  64. package/dist/exports/config-validation.d.ts.map +0 -1
  65. package/dist/exports/config-validation.js +0 -252
  66. package/dist/exports/config-validation.js.map +0 -1
  67. package/dist/exports/emission.d.ts +0 -5
  68. package/dist/exports/emission.d.ts.map +0 -1
  69. package/dist/exports/emission.js +0 -310
  70. package/dist/exports/emission.js.map +0 -1
  71. package/dist/exports/errors.d.ts +0 -3
  72. package/dist/exports/errors.d.ts.map +0 -1
  73. package/dist/exports/errors.js +0 -43
  74. package/dist/exports/errors.js.map +0 -1
  75. package/dist/exports/schema-view.d.ts +0 -2
  76. package/dist/exports/schema-view.d.ts.map +0 -1
  77. package/dist/exports/schema-view.js +0 -1
  78. package/dist/exports/schema-view.js.map +0 -1
  79. package/dist/exports/stack.d.ts +0 -2
  80. package/dist/exports/stack.d.ts.map +0 -1
  81. package/dist/exports/stack.js +0 -7
  82. package/dist/exports/stack.js.map +0 -1
  83. package/dist/exports/types.d.ts +0 -3
  84. package/dist/exports/types.d.ts.map +0 -1
  85. package/dist/exports/types.js +0 -7
  86. package/dist/exports/types.js.map +0 -1
  87. package/dist/migrations.d.ts +0 -190
  88. package/dist/migrations.d.ts.map +0 -1
  89. package/dist/schema-view.d.ts.map +0 -1
  90. package/dist/stack.d.ts +0 -25
  91. package/dist/stack.d.ts.map +0 -1
  92. package/dist/types.d.ts +0 -411
  93. package/dist/types.d.ts.map +0 -1
  94. package/src/config-types.ts +0 -157
  95. package/src/config-validation.ts +0 -270
  96. package/src/exports/config-types.ts +0 -5
  97. package/src/exports/config-validation.ts +0 -1
@@ -0,0 +1,330 @@
1
+ import { ifDefined } from "@prisma-next/utils/defined";
2
+
3
+ //#region src/errors.ts
4
+ /**
5
+ * Structured CLI error that contains all information needed for error envelopes.
6
+ * Call sites throw these errors with full context.
7
+ */
8
+ var CliStructuredError = class extends Error {
9
+ code;
10
+ domain;
11
+ severity;
12
+ why;
13
+ fix;
14
+ where;
15
+ meta;
16
+ docsUrl;
17
+ constructor(code, summary, options) {
18
+ super(summary);
19
+ this.name = "CliStructuredError";
20
+ this.code = code;
21
+ this.domain = options?.domain ?? "CLI";
22
+ this.severity = options?.severity ?? "error";
23
+ this.why = options?.why;
24
+ this.fix = options?.fix === options?.why ? void 0 : options?.fix;
25
+ this.where = options?.where ? {
26
+ path: options.where.path,
27
+ line: options.where.line
28
+ } : void 0;
29
+ this.meta = options?.meta;
30
+ this.docsUrl = options?.docsUrl;
31
+ }
32
+ /**
33
+ * Converts this error to a CLI error envelope for output formatting.
34
+ */
35
+ toEnvelope() {
36
+ return {
37
+ ok: false,
38
+ code: `${this.domain === "CLI" ? "PN-CLI-" : "PN-RUN-"}${this.code}`,
39
+ domain: this.domain,
40
+ severity: this.severity,
41
+ summary: this.message,
42
+ why: this.why,
43
+ fix: this.fix,
44
+ where: this.where,
45
+ meta: this.meta,
46
+ docsUrl: this.docsUrl
47
+ };
48
+ }
49
+ /**
50
+ * Type guard to check if an error is a CliStructuredError.
51
+ * Uses duck-typing to work across module boundaries where instanceof may fail.
52
+ */
53
+ static is(error) {
54
+ if (!(error instanceof Error)) return false;
55
+ const candidate = error;
56
+ return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && (candidate.domain === "CLI" || candidate.domain === "RUN") && typeof candidate.toEnvelope === "function";
57
+ }
58
+ };
59
+ /**
60
+ * Config file not found or missing.
61
+ */
62
+ function errorConfigFileNotFound(configPath, options) {
63
+ return new CliStructuredError("4001", "Config file not found", {
64
+ domain: "CLI",
65
+ ...options?.why ? { why: options.why } : { why: "Config file not found" },
66
+ fix: "Run 'prisma-next init' to create a config file",
67
+ docsUrl: "https://prisma-next.dev/docs/cli/config",
68
+ ...configPath ? { where: { path: configPath } } : {}
69
+ });
70
+ }
71
+ /**
72
+ * Contract configuration missing from config.
73
+ */
74
+ function errorContractConfigMissing(options) {
75
+ return new CliStructuredError("4002", "Contract configuration missing", {
76
+ domain: "CLI",
77
+ why: options?.why ?? "The contract configuration is required for emit",
78
+ fix: "Add contract configuration to your prisma-next.config.ts",
79
+ docsUrl: "https://prisma-next.dev/docs/cli/contract-emit"
80
+ });
81
+ }
82
+ /**
83
+ * Contract validation failed.
84
+ */
85
+ function errorContractValidationFailed(reason, options) {
86
+ return new CliStructuredError("4003", "Contract validation failed", {
87
+ domain: "CLI",
88
+ why: reason,
89
+ fix: "Re-run `prisma-next contract emit`, or fix the contract file and try again",
90
+ docsUrl: "https://prisma-next.dev/docs/contracts",
91
+ ...options?.where ? { where: options.where } : {}
92
+ });
93
+ }
94
+ /**
95
+ * File not found.
96
+ */
97
+ function errorFileNotFound(filePath, options) {
98
+ return new CliStructuredError("4004", "File not found", {
99
+ domain: "CLI",
100
+ why: options?.why ?? `File not found: ${filePath}`,
101
+ fix: options?.fix ?? "Check that the file path is correct",
102
+ where: { path: filePath },
103
+ ...options?.docsUrl ? { docsUrl: options.docsUrl } : {}
104
+ });
105
+ }
106
+ /**
107
+ * Database connection is required but not provided.
108
+ */
109
+ function errorDatabaseConnectionRequired(options) {
110
+ const runHint = options?.retryCommand ? `Run \`${options.retryCommand}\`` : options?.commandName ? `Run \`prisma-next ${options.commandName} --db <url>\`` : "Provide `--db <url>`";
111
+ return new CliStructuredError("4005", "Database connection is required", {
112
+ domain: "CLI",
113
+ why: options?.why ?? "Database connection is required for this command",
114
+ fix: `${runHint}, or set \`db: { connection: "postgres://…" }\` in prisma-next.config.ts`
115
+ });
116
+ }
117
+ /**
118
+ * Query runner factory is required but not provided in config.
119
+ */
120
+ function errorQueryRunnerFactoryRequired(options) {
121
+ return new CliStructuredError("4006", "Query runner factory is required", {
122
+ domain: "CLI",
123
+ why: options?.why ?? "Config.db.queryRunnerFactory is required for db verify",
124
+ fix: "Add db.queryRunnerFactory to prisma-next.config.ts",
125
+ docsUrl: "https://prisma-next.dev/docs/cli/db-verify"
126
+ });
127
+ }
128
+ /**
129
+ * Family verify.readMarker is required but not provided.
130
+ */
131
+ function errorFamilyReadMarkerSqlRequired(options) {
132
+ return new CliStructuredError("4007", "Family readMarker() is required", {
133
+ domain: "CLI",
134
+ why: options?.why ?? "Family verify.readMarker is required for db verify",
135
+ fix: "Ensure family.verify.readMarker() is exported by your family package",
136
+ docsUrl: "https://prisma-next.dev/docs/cli/db-verify"
137
+ });
138
+ }
139
+ /**
140
+ * JSON output format not supported.
141
+ */
142
+ function errorJsonFormatNotSupported(options) {
143
+ return new CliStructuredError("4008", "Unsupported JSON format", {
144
+ domain: "CLI",
145
+ why: `The ${options.command} command does not support --json ${options.format}`,
146
+ fix: `Use --json ${options.supportedFormats.join(" or ")}, or omit --json for human output`,
147
+ meta: {
148
+ command: options.command,
149
+ format: options.format,
150
+ supportedFormats: options.supportedFormats
151
+ }
152
+ });
153
+ }
154
+ /**
155
+ * Driver is required for DB-connected commands but not provided.
156
+ */
157
+ function errorDriverRequired(options) {
158
+ return new CliStructuredError("4010", "Driver is required for DB-connected commands", {
159
+ domain: "CLI",
160
+ why: options?.why ?? "Config.driver is required for DB-connected commands",
161
+ fix: "Add a control-plane driver to prisma-next.config.ts (e.g. import a driver descriptor and set `driver: postgresDriver`)",
162
+ docsUrl: "https://prisma-next.dev/docs/cli/config"
163
+ });
164
+ }
165
+ /**
166
+ * Contract requires extension packs that are not provided by config descriptors.
167
+ */
168
+ function errorContractMissingExtensionPacks(options) {
169
+ const missing = [...options.missingExtensionPacks].sort();
170
+ return new CliStructuredError("4011", "Missing extension packs in config", {
171
+ domain: "CLI",
172
+ why: missing.length === 1 ? `Contract requires extension pack '${missing[0]}', but CLI config does not provide a matching descriptor.` : `Contract requires extension packs ${missing.map((p) => `'${p}'`).join(", ")}, but CLI config does not provide matching descriptors.`,
173
+ fix: "Add the missing extension descriptors to `extensions` in prisma-next.config.ts",
174
+ docsUrl: "https://prisma-next.dev/docs/cli/config",
175
+ meta: {
176
+ missingExtensionPacks: missing,
177
+ providedComponentIds: [...options.providedComponentIds].sort()
178
+ }
179
+ });
180
+ }
181
+ /**
182
+ * Migration planning failed due to conflicts.
183
+ */
184
+ function errorMigrationPlanningFailed(options) {
185
+ const conflictSummaries = options.conflicts.map((c) => c.summary);
186
+ const computedWhy = options.why ?? conflictSummaries.join("\n");
187
+ const conflictFixes = options.conflicts.map((c) => c.why).filter((why) => typeof why === "string");
188
+ return new CliStructuredError("4020", "Migration planning failed", {
189
+ domain: "CLI",
190
+ why: computedWhy,
191
+ fix: conflictFixes.length > 0 ? conflictFixes.join("\n") : "Use `db verify --schema-only` to inspect conflicts, or ensure the database is empty",
192
+ meta: { conflicts: options.conflicts },
193
+ docsUrl: "https://prisma-next.dev/docs/cli/db-init"
194
+ });
195
+ }
196
+ /**
197
+ * Target does not support migrations (missing createPlanner/createRunner).
198
+ */
199
+ function errorTargetMigrationNotSupported(options) {
200
+ return new CliStructuredError("4021", "Target does not support migrations", {
201
+ domain: "CLI",
202
+ why: options?.why ?? "The configured target does not provide migration planner/runner",
203
+ fix: "Select a target that provides migrations (it must export `target.migrations` for db init)",
204
+ docsUrl: "https://prisma-next.dev/docs/cli/db-init"
205
+ });
206
+ }
207
+ /**
208
+ * Config validation error (missing required fields).
209
+ */
210
+ function errorConfigValidation(field, options) {
211
+ return new CliStructuredError("4009", "Config validation error", {
212
+ domain: "CLI",
213
+ why: options?.why ?? `Config must have a "${field}" field`,
214
+ fix: "Check your prisma-next.config.ts and ensure all required fields are provided",
215
+ docsUrl: "https://prisma-next.dev/docs/cli/config"
216
+ });
217
+ }
218
+ /**
219
+ * Contract marker not found in database.
220
+ */
221
+ function errorMarkerMissing(options) {
222
+ return new CliStructuredError("3001", "Database not signed", {
223
+ domain: "RUN",
224
+ why: options?.why ?? "No database signature (marker) found",
225
+ fix: "Run `prisma-next db sign --db <url>` to sign the database"
226
+ });
227
+ }
228
+ /**
229
+ * Contract hash does not match database marker.
230
+ */
231
+ function errorHashMismatch(options) {
232
+ return new CliStructuredError("3002", "Hash mismatch", {
233
+ domain: "RUN",
234
+ why: options?.why ?? "Contract hash does not match database marker",
235
+ fix: "Migrate database or re-sign if intentional",
236
+ ...options?.expected || options?.actual ? { meta: {
237
+ ...options.expected ? { expected: options.expected } : {},
238
+ ...options.actual ? { actual: options.actual } : {}
239
+ } } : {}
240
+ });
241
+ }
242
+ /**
243
+ * Contract target does not match config target.
244
+ */
245
+ function errorTargetMismatch(expected, actual, options) {
246
+ return new CliStructuredError("3003", "Target mismatch", {
247
+ domain: "RUN",
248
+ why: options?.why ?? `Contract target does not match config target (expected: ${expected}, actual: ${actual})`,
249
+ fix: "Align contract target and config target",
250
+ meta: {
251
+ expected,
252
+ actual
253
+ }
254
+ });
255
+ }
256
+ /**
257
+ * Database marker is required but not found.
258
+ * Used by commands that require a pre-existing marker as a precondition.
259
+ */
260
+ function errorMarkerRequired(options) {
261
+ return new CliStructuredError("3010", "Database must be signed first", {
262
+ domain: "RUN",
263
+ why: options?.why ?? "No database signature (marker) found",
264
+ fix: options?.fix ?? "Run `prisma-next db init` first to sign the database"
265
+ });
266
+ }
267
+ /**
268
+ * Schema verification found mismatches between the database and the contract.
269
+ * The full verification tree is preserved in `meta.verificationResult`.
270
+ */
271
+ function errorSchemaVerificationFailed(options) {
272
+ return new CliStructuredError("3004", options.summary, {
273
+ domain: "RUN",
274
+ why: "Database schema does not satisfy the contract",
275
+ fix: "Run `prisma-next db update` to reconcile, or adjust your contract to match the database",
276
+ meta: {
277
+ verificationResult: options.verificationResult,
278
+ ...ifDefined("issues", options.issues)
279
+ }
280
+ });
281
+ }
282
+ /**
283
+ * Migration runner failed during execution.
284
+ */
285
+ function errorRunnerFailed(summary, options) {
286
+ return new CliStructuredError("3020", summary, {
287
+ domain: "RUN",
288
+ why: options?.why ?? "Migration runner failed",
289
+ fix: options?.fix ?? "Inspect the reported conflict and reconcile schema drift",
290
+ ...options?.meta ? { meta: options.meta } : {}
291
+ });
292
+ }
293
+ /** Error code for destructive changes that require explicit confirmation. */
294
+ const ERROR_CODE_DESTRUCTIVE_CHANGES = "3030";
295
+ /**
296
+ * Destructive operations require explicit confirmation via -y/--yes.
297
+ */
298
+ function errorDestructiveChanges(summary, options) {
299
+ return new CliStructuredError(ERROR_CODE_DESTRUCTIVE_CHANGES, summary, {
300
+ domain: "RUN",
301
+ why: options?.why ?? "Planned operations include destructive changes that require confirmation",
302
+ fix: options?.fix ?? "Re-run with `-y` to apply, or use `--dry-run` to preview first",
303
+ ...options?.meta ? { meta: options.meta } : {}
304
+ });
305
+ }
306
+ /**
307
+ * Generic runtime error.
308
+ */
309
+ function errorRuntime(summary, options) {
310
+ return new CliStructuredError("3000", summary, {
311
+ domain: "RUN",
312
+ ...options?.why ? { why: options.why } : { why: "Verification failed" },
313
+ ...options?.fix ? { fix: options.fix } : { fix: "Check contract and database state" },
314
+ ...options?.meta ? { meta: options.meta } : {}
315
+ });
316
+ }
317
+ /**
318
+ * Generic unexpected error.
319
+ */
320
+ function errorUnexpected(message, options) {
321
+ return new CliStructuredError("4999", "Unexpected error", {
322
+ domain: "CLI",
323
+ why: options?.why ?? message,
324
+ fix: options?.fix ?? "Check the error message and try again"
325
+ });
326
+ }
327
+
328
+ //#endregion
329
+ export { CliStructuredError, ERROR_CODE_DESTRUCTIVE_CHANGES, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDestructiveChanges, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMarkerRequired, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRunnerFailed, errorRuntime, errorSchemaVerificationFailed, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected };
330
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\nimport type { SchemaIssue, VerifyDatabaseSchemaResult } from './types';\n\n/**\n * CLI error envelope for output formatting.\n * This is the serialized form of a CliStructuredError.\n */\nexport interface CliErrorEnvelope {\n readonly ok: false;\n readonly code: string;\n readonly domain: string;\n readonly severity: 'error' | 'warn' | 'info';\n readonly summary: string;\n readonly why: string | undefined;\n readonly fix: string | undefined;\n readonly where:\n | {\n readonly path: string | undefined;\n readonly line: number | undefined;\n }\n | undefined;\n readonly meta: Record<string, unknown> | undefined;\n readonly docsUrl: string | undefined;\n}\n\n/**\n * Minimal conflict data structure expected by CLI output.\n */\nexport interface CliErrorConflict {\n readonly kind: string;\n readonly summary: string;\n readonly why?: string;\n}\n\n/**\n * Structured CLI error that contains all information needed for error envelopes.\n * Call sites throw these errors with full context.\n */\nexport class CliStructuredError extends Error {\n readonly code: string;\n readonly domain: 'CLI' | 'RUN';\n readonly severity: 'error' | 'warn' | 'info';\n readonly why: string | undefined;\n readonly fix: string | undefined;\n readonly where:\n | {\n readonly path: string | undefined;\n readonly line: number | undefined;\n }\n | undefined;\n readonly meta: Record<string, unknown> | undefined;\n readonly docsUrl: string | undefined;\n\n constructor(\n code: string,\n summary: string,\n options?: {\n readonly domain?: 'CLI' | 'RUN';\n readonly severity?: 'error' | 'warn' | 'info';\n readonly why?: string;\n readonly fix?: string;\n readonly where?: { readonly path?: string; readonly line?: number };\n readonly meta?: Record<string, unknown>;\n readonly docsUrl?: string;\n },\n ) {\n super(summary);\n this.name = 'CliStructuredError';\n this.code = code;\n this.domain = options?.domain ?? 'CLI';\n this.severity = options?.severity ?? 'error';\n this.why = options?.why;\n this.fix = options?.fix === options?.why ? undefined : options?.fix;\n this.where = options?.where\n ? {\n path: options.where.path,\n line: options.where.line,\n }\n : undefined;\n this.meta = options?.meta;\n this.docsUrl = options?.docsUrl;\n }\n\n /**\n * Converts this error to a CLI error envelope for output formatting.\n */\n toEnvelope(): CliErrorEnvelope {\n const codePrefix = this.domain === 'CLI' ? 'PN-CLI-' : 'PN-RUN-';\n return {\n ok: false as const,\n code: `${codePrefix}${this.code}`,\n domain: this.domain,\n severity: this.severity,\n summary: this.message,\n why: this.why,\n fix: this.fix,\n where: this.where,\n meta: this.meta,\n docsUrl: this.docsUrl,\n };\n }\n\n /**\n * Type guard to check if an error is a CliStructuredError.\n * Uses duck-typing to work across module boundaries where instanceof may fail.\n */\n static is(error: unknown): error is CliStructuredError {\n if (!(error instanceof Error)) {\n return false;\n }\n const candidate = error as CliStructuredError;\n return (\n candidate.name === 'CliStructuredError' &&\n typeof candidate.code === 'string' &&\n (candidate.domain === 'CLI' || candidate.domain === 'RUN') &&\n typeof candidate.toEnvelope === 'function'\n );\n }\n}\n\n// ============================================================================\n// Config Errors (PN-CLI-4001-4007)\n// ============================================================================\n\n/**\n * Config file not found or missing.\n */\nexport function errorConfigFileNotFound(\n configPath?: string,\n options?: {\n readonly why?: string;\n },\n): CliStructuredError {\n return new CliStructuredError('4001', 'Config file not found', {\n domain: 'CLI',\n ...(options?.why ? { why: options.why } : { why: 'Config file not found' }),\n fix: \"Run 'prisma-next init' to create a config file\",\n docsUrl: 'https://prisma-next.dev/docs/cli/config',\n ...(configPath ? { where: { path: configPath } } : {}),\n });\n}\n\n/**\n * Contract configuration missing from config.\n */\nexport function errorContractConfigMissing(options?: {\n readonly why?: string;\n}): CliStructuredError {\n return new CliStructuredError('4002', 'Contract configuration missing', {\n domain: 'CLI',\n why: options?.why ?? 'The contract configuration is required for emit',\n fix: 'Add contract configuration to your prisma-next.config.ts',\n docsUrl: 'https://prisma-next.dev/docs/cli/contract-emit',\n });\n}\n\n/**\n * Contract validation failed.\n */\nexport function errorContractValidationFailed(\n reason: string,\n options?: {\n readonly where?: { readonly path?: string; readonly line?: number };\n },\n): CliStructuredError {\n return new CliStructuredError('4003', 'Contract validation failed', {\n domain: 'CLI',\n why: reason,\n fix: 'Re-run `prisma-next contract emit`, or fix the contract file and try again',\n docsUrl: 'https://prisma-next.dev/docs/contracts',\n ...(options?.where ? { where: options.where } : {}),\n });\n}\n\n/**\n * File not found.\n */\nexport function errorFileNotFound(\n filePath: string,\n options?: {\n readonly why?: string;\n readonly fix?: string;\n readonly docsUrl?: string;\n },\n): CliStructuredError {\n return new CliStructuredError('4004', 'File not found', {\n domain: 'CLI',\n why: options?.why ?? `File not found: ${filePath}`,\n fix: options?.fix ?? 'Check that the file path is correct',\n where: { path: filePath },\n ...(options?.docsUrl ? { docsUrl: options.docsUrl } : {}),\n });\n}\n\n/**\n * Database connection is required but not provided.\n */\nexport function errorDatabaseConnectionRequired(options?: {\n readonly why?: string;\n readonly commandName?: string;\n readonly retryCommand?: string;\n}): CliStructuredError {\n const runHint = options?.retryCommand\n ? `Run \\`${options.retryCommand}\\``\n : options?.commandName\n ? `Run \\`prisma-next ${options.commandName} --db <url>\\``\n : 'Provide `--db <url>`';\n return new CliStructuredError('4005', 'Database connection is required', {\n domain: 'CLI',\n why: options?.why ?? 'Database connection is required for this command',\n fix: `${runHint}, or set \\`db: { connection: \"postgres://…\" }\\` in prisma-next.config.ts`,\n });\n}\n\n/**\n * Query runner factory is required but not provided in config.\n */\nexport function errorQueryRunnerFactoryRequired(options?: {\n readonly why?: string;\n}): CliStructuredError {\n return new CliStructuredError('4006', 'Query runner factory is required', {\n domain: 'CLI',\n why: options?.why ?? 'Config.db.queryRunnerFactory is required for db verify',\n fix: 'Add db.queryRunnerFactory to prisma-next.config.ts',\n docsUrl: 'https://prisma-next.dev/docs/cli/db-verify',\n });\n}\n\n/**\n * Family verify.readMarker is required but not provided.\n */\nexport function errorFamilyReadMarkerSqlRequired(options?: {\n readonly why?: string;\n}): CliStructuredError {\n return new CliStructuredError('4007', 'Family readMarker() is required', {\n domain: 'CLI',\n why: options?.why ?? 'Family verify.readMarker is required for db verify',\n fix: 'Ensure family.verify.readMarker() is exported by your family package',\n docsUrl: 'https://prisma-next.dev/docs/cli/db-verify',\n });\n}\n\n/**\n * JSON output format not supported.\n */\nexport function errorJsonFormatNotSupported(options: {\n readonly command: string;\n readonly format: string;\n readonly supportedFormats: readonly string[];\n}): CliStructuredError {\n return new CliStructuredError('4008', 'Unsupported JSON format', {\n domain: 'CLI',\n why: `The ${options.command} command does not support --json ${options.format}`,\n fix: `Use --json ${options.supportedFormats.join(' or ')}, or omit --json for human output`,\n meta: {\n command: options.command,\n format: options.format,\n supportedFormats: options.supportedFormats,\n },\n });\n}\n\n/**\n * Driver is required for DB-connected commands but not provided.\n */\nexport function errorDriverRequired(options?: { readonly why?: string }): CliStructuredError {\n return new CliStructuredError('4010', 'Driver is required for DB-connected commands', {\n domain: 'CLI',\n why: options?.why ?? 'Config.driver is required for DB-connected commands',\n fix: 'Add a control-plane driver to prisma-next.config.ts (e.g. import a driver descriptor and set `driver: postgresDriver`)',\n docsUrl: 'https://prisma-next.dev/docs/cli/config',\n });\n}\n\n/**\n * Contract requires extension packs that are not provided by config descriptors.\n */\nexport function errorContractMissingExtensionPacks(options: {\n readonly missingExtensionPacks: readonly string[];\n readonly providedComponentIds: readonly string[];\n}): CliStructuredError {\n const missing = [...options.missingExtensionPacks].sort();\n return new CliStructuredError('4011', 'Missing extension packs in config', {\n domain: 'CLI',\n why:\n missing.length === 1\n ? `Contract requires extension pack '${missing[0]}', but CLI config does not provide a matching descriptor.`\n : `Contract requires extension packs ${missing.map((p) => `'${p}'`).join(', ')}, but CLI config does not provide matching descriptors.`,\n fix: 'Add the missing extension descriptors to `extensions` in prisma-next.config.ts',\n docsUrl: 'https://prisma-next.dev/docs/cli/config',\n meta: {\n missingExtensionPacks: missing,\n providedComponentIds: [...options.providedComponentIds].sort(),\n },\n });\n}\n\n/**\n * Migration planning failed due to conflicts.\n */\nexport function errorMigrationPlanningFailed(options: {\n readonly conflicts: readonly CliErrorConflict[];\n readonly why?: string;\n}): CliStructuredError {\n // Build \"why\" from conflict summaries - these contain the actual problem description\n const conflictSummaries = options.conflicts.map((c) => c.summary);\n const computedWhy = options.why ?? conflictSummaries.join('\\n');\n\n // Build \"fix\" from conflict \"why\" fields - these contain actionable advice\n const conflictFixes = options.conflicts\n .map((c) => c.why)\n .filter((why): why is string => typeof why === 'string');\n const computedFix =\n conflictFixes.length > 0\n ? conflictFixes.join('\\n')\n : 'Use `db verify --schema-only` to inspect conflicts, or ensure the database is empty';\n\n return new CliStructuredError('4020', 'Migration planning failed', {\n domain: 'CLI',\n why: computedWhy,\n fix: computedFix,\n meta: { conflicts: options.conflicts },\n docsUrl: 'https://prisma-next.dev/docs/cli/db-init',\n });\n}\n\n/**\n * Target does not support migrations (missing createPlanner/createRunner).\n */\nexport function errorTargetMigrationNotSupported(options?: {\n readonly why?: string;\n}): CliStructuredError {\n return new CliStructuredError('4021', 'Target does not support migrations', {\n domain: 'CLI',\n why: options?.why ?? 'The configured target does not provide migration planner/runner',\n fix: 'Select a target that provides migrations (it must export `target.migrations` for db init)',\n docsUrl: 'https://prisma-next.dev/docs/cli/db-init',\n });\n}\n\n/**\n * Config validation error (missing required fields).\n */\nexport function errorConfigValidation(\n field: string,\n options?: {\n readonly why?: string;\n },\n): CliStructuredError {\n return new CliStructuredError('4009', 'Config validation error', {\n domain: 'CLI',\n why: options?.why ?? `Config must have a \"${field}\" field`,\n fix: 'Check your prisma-next.config.ts and ensure all required fields are provided',\n docsUrl: 'https://prisma-next.dev/docs/cli/config',\n });\n}\n\n// ============================================================================\n// Runtime Errors (PN-RUN-3000-3030)\n// ============================================================================\n\n/**\n * Contract marker not found in database.\n */\nexport function errorMarkerMissing(options?: {\n readonly why?: string;\n readonly dbUrl?: string;\n}): CliStructuredError {\n return new CliStructuredError('3001', 'Database not signed', {\n domain: 'RUN',\n why: options?.why ?? 'No database signature (marker) found',\n fix: 'Run `prisma-next db sign --db <url>` to sign the database',\n });\n}\n\n/**\n * Contract hash does not match database marker.\n */\nexport function errorHashMismatch(options?: {\n readonly why?: string;\n readonly expected?: string;\n readonly actual?: string;\n}): CliStructuredError {\n return new CliStructuredError('3002', 'Hash mismatch', {\n domain: 'RUN',\n why: options?.why ?? 'Contract hash does not match database marker',\n fix: 'Migrate database or re-sign if intentional',\n ...(options?.expected || options?.actual\n ? {\n meta: {\n ...(options.expected ? { expected: options.expected } : {}),\n ...(options.actual ? { actual: options.actual } : {}),\n },\n }\n : {}),\n });\n}\n\n/**\n * Contract target does not match config target.\n */\nexport function errorTargetMismatch(\n expected: string,\n actual: string,\n options?: {\n readonly why?: string;\n },\n): CliStructuredError {\n return new CliStructuredError('3003', 'Target mismatch', {\n domain: 'RUN',\n why:\n options?.why ??\n `Contract target does not match config target (expected: ${expected}, actual: ${actual})`,\n fix: 'Align contract target and config target',\n meta: { expected, actual },\n });\n}\n\n/**\n * Database marker is required but not found.\n * Used by commands that require a pre-existing marker as a precondition.\n */\nexport function errorMarkerRequired(options?: {\n readonly why?: string;\n readonly fix?: string;\n}): CliStructuredError {\n return new CliStructuredError('3010', 'Database must be signed first', {\n domain: 'RUN',\n why: options?.why ?? 'No database signature (marker) found',\n fix: options?.fix ?? 'Run `prisma-next db init` first to sign the database',\n });\n}\n\n/**\n * Schema verification found mismatches between the database and the contract.\n * The full verification tree is preserved in `meta.verificationResult`.\n */\nexport function errorSchemaVerificationFailed(options: {\n readonly summary: string;\n readonly verificationResult: VerifyDatabaseSchemaResult;\n readonly issues?: readonly SchemaIssue[];\n}): CliStructuredError {\n return new CliStructuredError('3004', options.summary, {\n domain: 'RUN',\n why: 'Database schema does not satisfy the contract',\n fix: 'Run `prisma-next db update` to reconcile, or adjust your contract to match the database',\n meta: {\n verificationResult: options.verificationResult,\n ...ifDefined('issues', options.issues),\n },\n });\n}\n\n/**\n * Migration runner failed during execution.\n */\nexport function errorRunnerFailed(\n summary: string,\n options?: {\n readonly why?: string;\n readonly fix?: string;\n readonly meta?: Record<string, unknown>;\n },\n): CliStructuredError {\n return new CliStructuredError('3020', summary, {\n domain: 'RUN',\n why: options?.why ?? 'Migration runner failed',\n fix: options?.fix ?? 'Inspect the reported conflict and reconcile schema drift',\n ...(options?.meta ? { meta: options.meta } : {}),\n });\n}\n\n/** Error code for destructive changes that require explicit confirmation. */\nexport const ERROR_CODE_DESTRUCTIVE_CHANGES = '3030';\n\n/**\n * Destructive operations require explicit confirmation via -y/--yes.\n */\nexport function errorDestructiveChanges(\n summary: string,\n options?: {\n readonly why?: string;\n readonly fix?: string;\n readonly meta?: Record<string, unknown>;\n },\n): CliStructuredError {\n return new CliStructuredError(ERROR_CODE_DESTRUCTIVE_CHANGES, summary, {\n domain: 'RUN',\n why: options?.why ?? 'Planned operations include destructive changes that require confirmation',\n fix: options?.fix ?? 'Re-run with `-y` to apply, or use `--dry-run` to preview first',\n ...(options?.meta ? { meta: options.meta } : {}),\n });\n}\n\n/**\n * Generic runtime error.\n */\nexport function errorRuntime(\n summary: string,\n options?: {\n readonly why?: string;\n readonly fix?: string;\n readonly meta?: Record<string, unknown>;\n },\n): CliStructuredError {\n return new CliStructuredError('3000', summary, {\n domain: 'RUN',\n ...(options?.why ? { why: options.why } : { why: 'Verification failed' }),\n ...(options?.fix ? { fix: options.fix } : { fix: 'Check contract and database state' }),\n ...(options?.meta ? { meta: options.meta } : {}),\n });\n}\n\n// ============================================================================\n// Generic Error\n// ============================================================================\n\n/**\n * Generic unexpected error.\n */\nexport function errorUnexpected(\n message: string,\n options?: {\n readonly why?: string;\n readonly fix?: string;\n },\n): CliStructuredError {\n return new CliStructuredError('4999', 'Unexpected error', {\n domain: 'CLI',\n why: options?.why ?? message,\n fix: options?.fix ?? 'Check the error message and try again',\n });\n}\n"],"mappings":";;;;;;;AAsCA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAMT,AAAS;CACT,AAAS;CAET,YACE,MACA,SACA,SASA;AACA,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;AACZ,OAAK,SAAS,SAAS,UAAU;AACjC,OAAK,WAAW,SAAS,YAAY;AACrC,OAAK,MAAM,SAAS;AACpB,OAAK,MAAM,SAAS,QAAQ,SAAS,MAAM,SAAY,SAAS;AAChE,OAAK,QAAQ,SAAS,QAClB;GACE,MAAM,QAAQ,MAAM;GACpB,MAAM,QAAQ,MAAM;GACrB,GACD;AACJ,OAAK,OAAO,SAAS;AACrB,OAAK,UAAU,SAAS;;;;;CAM1B,aAA+B;AAE7B,SAAO;GACL,IAAI;GACJ,MAAM,GAHW,KAAK,WAAW,QAAQ,YAAY,YAG/B,KAAK;GAC3B,QAAQ,KAAK;GACb,UAAU,KAAK;GACf,SAAS,KAAK;GACd,KAAK,KAAK;GACV,KAAK,KAAK;GACV,OAAO,KAAK;GACZ,MAAM,KAAK;GACX,SAAS,KAAK;GACf;;;;;;CAOH,OAAO,GAAG,OAA6C;AACrD,MAAI,EAAE,iBAAiB,OACrB,QAAO;EAET,MAAM,YAAY;AAClB,SACE,UAAU,SAAS,wBACnB,OAAO,UAAU,SAAS,aACzB,UAAU,WAAW,SAAS,UAAU,WAAW,UACpD,OAAO,UAAU,eAAe;;;;;;AAYtC,SAAgB,wBACd,YACA,SAGoB;AACpB,QAAO,IAAI,mBAAmB,QAAQ,yBAAyB;EAC7D,QAAQ;EACR,GAAI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chemaIR structure:
16
17
  * // {
17
18
  * // tables: { user: { columns: {...}, primaryKey: {...}, ... }, ... },
18
- * // extensions: ['pgvector'],
19
+ * // dependencies: [{ id: 'postgres.extension.vector' }],
19
20
  * // annotations: {...}
20
21
  * // }
21
22
  *
@@ -47,9 +48,9 @@
47
48
  * // ]
48
49
  * // },
49
50
  * // {
50
- * // kind: 'extension',
51
- * // id: 'extension-pgvector',
52
- * // label: 'extension pgvector',
51
+ * // kind: 'dependency',
52
+ * // id: 'dependency-postgres.extension.pgvector',
53
+ * // label: 'pgvector extension is enabled',
53
54
  * // meta: { ... }
54
55
  * // }
55
56
  * // ]
@@ -64,23 +65,25 @@
64
65
  * Node kinds for schema tree nodes.
65
66
  * Designed to be generic enough for SQL, document, KV, and future families.
66
67
  */
67
- export type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' | 'index' | 'extension';
68
+ type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' | 'index' | 'dependency';
68
69
  /**
69
70
  * A node in the schema tree.
70
71
  * Tree-shaped structure good for Command Tree-style CLI output.
71
72
  */
72
- export interface SchemaTreeNode {
73
- readonly kind: SchemaNodeKind;
74
- readonly id: string;
75
- readonly label: string;
76
- readonly meta?: Record<string, unknown>;
77
- readonly children?: readonly SchemaTreeNode[];
73
+ interface SchemaTreeNode {
74
+ readonly kind: SchemaNodeKind;
75
+ readonly id: string;
76
+ readonly label: string;
77
+ readonly meta?: Record<string, unknown>;
78
+ readonly children?: readonly SchemaTreeNode[];
78
79
  }
79
80
  /**
80
81
  * Core schema view providing a family-agnostic tree representation of a schema.
81
82
  * Used by CLI and cross-family tooling for visualization.
82
83
  */
83
- export interface CoreSchemaView {
84
- readonly root: SchemaTreeNode;
84
+ interface CoreSchemaView {
85
+ readonly root: SchemaTreeNode;
85
86
  }
86
- //# sourceMappingURL=schema-view.d.ts.map
87
+ //#endregion
88
+ export { SchemaNodeKind as n, SchemaTreeNode as r, CoreSchemaView as t };
89
+ //# sourceMappingURL=schema-view-DObwT8x9.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-view-DObwT8x9.d.mts","names":[],"sources":["../src/schema-view.ts"],"sourcesContent":[],"mappings":";;AAmEA;AAaA;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAzBY,cAAA;;;;;UAaK,cAAA;iBACA;;;kBAGC;+BACa;;;;;;UAOd,cAAA;iBACA"}
@@ -0,0 +1,2 @@
1
+ import { n as SchemaNodeKind, r as SchemaTreeNode, t as CoreSchemaView } from "./schema-view-DObwT8x9.mjs";
2
+ export { type CoreSchemaView, type SchemaNodeKind, type SchemaTreeNode };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,30 @@
1
+ import { a as ControlExtensionDescriptor, l as ControlPlaneStack, r as ControlDriverDescriptor, t as ControlAdapterDescriptor, u as ControlTargetDescriptor } from "./types-BArIWumw.mjs";
2
+
3
+ //#region src/stack.d.ts
4
+
5
+ /**
6
+ * Creates a ControlPlaneStack from component descriptors.
7
+ *
8
+ * Provides sensible defaults:
9
+ * - `driver` defaults to `undefined` (optional for commands that don't need DB connection)
10
+ * - `extensionPacks` defaults to `[]` (empty array)
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const stack = createControlPlaneStack({
15
+ * target: postgresTarget,
16
+ * adapter: postgresAdapter,
17
+ * driver: postgresDriver, // optional
18
+ * extensionPacks: [pgvector], // optional
19
+ * });
20
+ * ```
21
+ */
22
+ declare function createControlPlaneStack<TFamilyId extends string, TTargetId extends string>(input: {
23
+ readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
24
+ readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
25
+ readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
26
+ readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[] | undefined;
27
+ }): ControlPlaneStack<TFamilyId, TTargetId>;
28
+ //#endregion
29
+ export { createControlPlaneStack };
30
+ //# sourceMappingURL=stack.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.mts","names":[],"sources":["../src/stack.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;AAKI,iBALY,uBAKZ,CAAA,kBAAA,MAAA,EAAA,kBAAA,MAAA,CAAA,CAAA,KAAA,EAAA;EAAiB,SAAA,MAAA,EAJF,uBAIE,CAJsB,SAItB,EAJiC,SAIjC,CAAA;oBAHD,yBAAyB,WAAW;oBACpC,wBAAwB,WAAW;qCAClB,2BAA2B,WAAW;IACvE,kBAAkB,WAAW"}
package/dist/stack.mjs ADDED
@@ -0,0 +1,30 @@
1
+ //#region src/stack.ts
2
+ /**
3
+ * Creates a ControlPlaneStack from component descriptors.
4
+ *
5
+ * Provides sensible defaults:
6
+ * - `driver` defaults to `undefined` (optional for commands that don't need DB connection)
7
+ * - `extensionPacks` defaults to `[]` (empty array)
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const stack = createControlPlaneStack({
12
+ * target: postgresTarget,
13
+ * adapter: postgresAdapter,
14
+ * driver: postgresDriver, // optional
15
+ * extensionPacks: [pgvector], // optional
16
+ * });
17
+ * ```
18
+ */
19
+ function createControlPlaneStack(input) {
20
+ return {
21
+ target: input.target,
22
+ adapter: input.adapter,
23
+ driver: input.driver,
24
+ extensionPacks: input.extensionPacks ?? []
25
+ };
26
+ }
27
+
28
+ //#endregion
29
+ export { createControlPlaneStack };
30
+ //# sourceMappingURL=stack.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.mjs","names":[],"sources":["../src/stack.ts"],"sourcesContent":["import type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlPlaneStack,\n ControlTargetDescriptor,\n} from './types';\n\n/**\n * Creates a ControlPlaneStack from component descriptors.\n *\n * Provides sensible defaults:\n * - `driver` defaults to `undefined` (optional for commands that don't need DB connection)\n * - `extensionPacks` defaults to `[]` (empty array)\n *\n * @example\n * ```ts\n * const stack = createControlPlaneStack({\n * target: postgresTarget,\n * adapter: postgresAdapter,\n * driver: postgresDriver, // optional\n * extensionPacks: [pgvector], // optional\n * });\n * ```\n */\nexport function createControlPlaneStack<TFamilyId extends string, TTargetId extends string>(input: {\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;\n readonly driver?: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;\n readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[] | undefined;\n}): ControlPlaneStack<TFamilyId, TTargetId> {\n return {\n target: input.target,\n adapter: input.adapter,\n driver: input.driver,\n extensionPacks: input.extensionPacks ?? [],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,SAAgB,wBAA4E,OAKhD;AAC1C,QAAO;EACL,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,gBAAgB,MAAM,kBAAkB,EAAE;EAC3C"}