@prisma-next/core-control-plane 0.3.0-dev.4 → 0.3.0-dev.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/config-types-fYE9X8bc.d.mts +72 -0
- package/dist/config-types-fYE9X8bc.d.mts.map +1 -0
- package/dist/config-types.d.mts +2 -0
- package/dist/config-types.mjs +60 -0
- package/dist/config-types.mjs.map +1 -0
- package/dist/{exports/config-validation.d.ts → config-validation.d.mts} +5 -8
- package/dist/config-validation.d.mts.map +1 -0
- package/dist/config-validation.mjs +78 -0
- package/dist/config-validation.mjs.map +1 -0
- package/dist/emission.d.mts +61 -0
- package/dist/emission.d.mts.map +1 -0
- package/dist/emission.mjs +298 -0
- package/dist/emission.mjs.map +1 -0
- package/dist/errors-Qlh0sdcb.mjs +276 -0
- package/dist/errors-Qlh0sdcb.mjs.map +1 -0
- package/dist/{exports/errors.d.ts → errors.d.mts} +86 -79
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +3 -0
- package/dist/{exports/schema-view.d.ts → schema-view-BG_ebqoV.d.mts} +10 -8
- package/dist/schema-view-BG_ebqoV.d.mts.map +1 -0
- package/dist/schema-view.d.mts +2 -0
- package/dist/schema-view.mjs +1 -0
- package/dist/stack.d.mts +30 -0
- package/dist/stack.d.mts.map +1 -0
- package/dist/stack.mjs +30 -0
- package/dist/stack.mjs.map +1 -0
- package/dist/types-yiR2kXAj.d.mts +597 -0
- package/dist/types-yiR2kXAj.d.mts.map +1 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +33 -39
- package/src/config-types.ts +159 -0
- package/src/config-validation.ts +265 -0
- package/src/emission/canonicalization.ts +287 -0
- package/src/emission/emit.ts +149 -0
- package/src/emission/hashing.ts +77 -0
- package/src/emission/types.ts +28 -0
- package/src/errors.ts +445 -0
- package/src/exports/config-types.ts +5 -0
- package/src/exports/config-validation.ts +1 -0
- package/src/exports/emission.ts +6 -0
- package/src/exports/errors.ts +22 -0
- package/src/exports/schema-view.ts +1 -0
- package/src/exports/stack.ts +1 -0
- package/src/exports/types.ts +38 -0
- package/src/migrations.ts +247 -0
- package/src/schema-view.ts +95 -0
- package/src/stack.ts +38 -0
- package/src/types.ts +536 -0
- package/dist/chunk-U5RYT6PT.js +0 -229
- package/dist/chunk-U5RYT6PT.js.map +0 -1
- package/dist/exports/config-types.d.ts +0 -70
- package/dist/exports/config-types.js +0 -53
- package/dist/exports/config-types.js.map +0 -1
- package/dist/exports/config-validation.js +0 -252
- package/dist/exports/config-validation.js.map +0 -1
- package/dist/exports/emission.d.ts +0 -42
- package/dist/exports/emission.js +0 -310
- package/dist/exports/emission.js.map +0 -1
- package/dist/exports/errors.js +0 -43
- package/dist/exports/errors.js.map +0 -1
- package/dist/exports/schema-view.js +0 -1
- package/dist/exports/schema-view.js.map +0 -1
- package/dist/exports/types.d.ts +0 -589
- package/dist/exports/types.js +0 -1
- package/dist/exports/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-Qlh0sdcb.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * CLI error envelope for output formatting.\n * This is the serialized form of a CliStructuredError.\n */\nexport interface CliErrorEnvelope {\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' | 'RTM';\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' | 'RTM';\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;\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-RTM-';\n return {\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 === 'RTM') &&\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}): CliStructuredError {\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: 'Provide `--db <url>` 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 schema-verify` 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('4001', 'Config file not found', {\n domain: 'CLI',\n why: options?.why ?? `Config must have a \"${field}\" field`,\n fix: \"Run 'prisma-next init' to create a config file\",\n docsUrl: 'https://prisma-next.dev/docs/cli/config',\n });\n}\n\n// ============================================================================\n// Runtime Errors (PN-RTM-3000-3003)\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', 'Marker missing', {\n domain: 'RTM',\n why: options?.why ?? 'Contract marker not found in database',\n fix: 'Run `prisma-next db sign --db <url>` to create marker',\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: 'RTM',\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: 'RTM',\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 * 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: 'RTM',\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":";;;;;AAkCA,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;AACpB,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,MAAM,GAFW,KAAK,WAAW,QAAQ,YAAY,YAE/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,SAAS,MAAM,EAAE,KAAK,QAAQ,KAAK,GAAG,EAAE,KAAK,yBAAyB;EAC1E,KAAK;EACL,SAAS;EACT,GAAI,aAAa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,QAAQ,oBAAoB;EACxD,QAAQ;EACR,KAAK,SAAS,OAAO;EACrB,KAAK,SAAS,OAAO;EACtB,CAAC"}
|
|
@@ -1,184 +1,191 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* CLI error envelope for output formatting.
|
|
3
4
|
* This is the serialized form of a CliStructuredError.
|
|
4
5
|
*/
|
|
5
6
|
interface CliErrorEnvelope {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly domain: string;
|
|
9
|
+
readonly severity: 'error' | 'warn' | 'info';
|
|
10
|
+
readonly summary: string;
|
|
11
|
+
readonly why: string | undefined;
|
|
12
|
+
readonly fix: string | undefined;
|
|
13
|
+
readonly where: {
|
|
14
|
+
readonly path: string | undefined;
|
|
15
|
+
readonly line: number | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
readonly meta: Record<string, unknown> | undefined;
|
|
18
|
+
readonly docsUrl: string | undefined;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Minimal conflict data structure expected by CLI output.
|
|
21
22
|
*/
|
|
22
23
|
interface CliErrorConflict {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
readonly kind: string;
|
|
25
|
+
readonly summary: string;
|
|
26
|
+
readonly why?: string;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* Structured CLI error that contains all information needed for error envelopes.
|
|
29
30
|
* Call sites throw these errors with full context.
|
|
30
31
|
*/
|
|
31
32
|
declare class CliStructuredError extends Error {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
readonly code: string;
|
|
34
|
+
readonly domain: 'CLI' | 'RTM';
|
|
35
|
+
readonly severity: 'error' | 'warn' | 'info';
|
|
36
|
+
readonly why: string | undefined;
|
|
37
|
+
readonly fix: string | undefined;
|
|
38
|
+
readonly where: {
|
|
39
|
+
readonly path: string | undefined;
|
|
40
|
+
readonly line: number | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
readonly meta: Record<string, unknown> | undefined;
|
|
43
|
+
readonly docsUrl: string | undefined;
|
|
44
|
+
constructor(code: string, summary: string, options?: {
|
|
45
|
+
readonly domain?: 'CLI' | 'RTM';
|
|
46
|
+
readonly severity?: 'error' | 'warn' | 'info';
|
|
47
|
+
readonly why?: string;
|
|
48
|
+
readonly fix?: string;
|
|
49
|
+
readonly where?: {
|
|
50
|
+
readonly path?: string;
|
|
51
|
+
readonly line?: number;
|
|
52
|
+
};
|
|
53
|
+
readonly meta?: Record<string, unknown>;
|
|
54
|
+
readonly docsUrl?: string;
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Converts this error to a CLI error envelope for output formatting.
|
|
58
|
+
*/
|
|
59
|
+
toEnvelope(): CliErrorEnvelope;
|
|
60
|
+
/**
|
|
61
|
+
* Type guard to check if an error is a CliStructuredError.
|
|
62
|
+
* Uses duck-typing to work across module boundaries where instanceof may fail.
|
|
63
|
+
*/
|
|
64
|
+
static is(error: unknown): error is CliStructuredError;
|
|
59
65
|
}
|
|
60
66
|
/**
|
|
61
67
|
* Config file not found or missing.
|
|
62
68
|
*/
|
|
63
69
|
declare function errorConfigFileNotFound(configPath?: string, options?: {
|
|
64
|
-
|
|
70
|
+
readonly why?: string;
|
|
65
71
|
}): CliStructuredError;
|
|
66
72
|
/**
|
|
67
73
|
* Contract configuration missing from config.
|
|
68
74
|
*/
|
|
69
75
|
declare function errorContractConfigMissing(options?: {
|
|
70
|
-
|
|
76
|
+
readonly why?: string;
|
|
71
77
|
}): CliStructuredError;
|
|
72
78
|
/**
|
|
73
79
|
* Contract validation failed.
|
|
74
80
|
*/
|
|
75
81
|
declare function errorContractValidationFailed(reason: string, options?: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
readonly where?: {
|
|
83
|
+
readonly path?: string;
|
|
84
|
+
readonly line?: number;
|
|
85
|
+
};
|
|
80
86
|
}): CliStructuredError;
|
|
81
87
|
/**
|
|
82
88
|
* File not found.
|
|
83
89
|
*/
|
|
84
90
|
declare function errorFileNotFound(filePath: string, options?: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
readonly why?: string;
|
|
92
|
+
readonly fix?: string;
|
|
93
|
+
readonly docsUrl?: string;
|
|
88
94
|
}): CliStructuredError;
|
|
89
95
|
/**
|
|
90
|
-
* Database
|
|
96
|
+
* Database connection is required but not provided.
|
|
91
97
|
*/
|
|
92
|
-
declare function
|
|
93
|
-
|
|
98
|
+
declare function errorDatabaseConnectionRequired(options?: {
|
|
99
|
+
readonly why?: string;
|
|
94
100
|
}): CliStructuredError;
|
|
95
101
|
/**
|
|
96
102
|
* Query runner factory is required but not provided in config.
|
|
97
103
|
*/
|
|
98
104
|
declare function errorQueryRunnerFactoryRequired(options?: {
|
|
99
|
-
|
|
105
|
+
readonly why?: string;
|
|
100
106
|
}): CliStructuredError;
|
|
101
107
|
/**
|
|
102
108
|
* Family verify.readMarker is required but not provided.
|
|
103
109
|
*/
|
|
104
110
|
declare function errorFamilyReadMarkerSqlRequired(options?: {
|
|
105
|
-
|
|
111
|
+
readonly why?: string;
|
|
106
112
|
}): CliStructuredError;
|
|
107
113
|
/**
|
|
108
114
|
* JSON output format not supported.
|
|
109
115
|
*/
|
|
110
116
|
declare function errorJsonFormatNotSupported(options: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
readonly command: string;
|
|
118
|
+
readonly format: string;
|
|
119
|
+
readonly supportedFormats: readonly string[];
|
|
114
120
|
}): CliStructuredError;
|
|
115
121
|
/**
|
|
116
122
|
* Driver is required for DB-connected commands but not provided.
|
|
117
123
|
*/
|
|
118
124
|
declare function errorDriverRequired(options?: {
|
|
119
|
-
|
|
125
|
+
readonly why?: string;
|
|
120
126
|
}): CliStructuredError;
|
|
121
127
|
/**
|
|
122
128
|
* Contract requires extension packs that are not provided by config descriptors.
|
|
123
129
|
*/
|
|
124
130
|
declare function errorContractMissingExtensionPacks(options: {
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
readonly missingExtensionPacks: readonly string[];
|
|
132
|
+
readonly providedComponentIds: readonly string[];
|
|
127
133
|
}): CliStructuredError;
|
|
128
134
|
/**
|
|
129
135
|
* Migration planning failed due to conflicts.
|
|
130
136
|
*/
|
|
131
137
|
declare function errorMigrationPlanningFailed(options: {
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
readonly conflicts: readonly CliErrorConflict[];
|
|
139
|
+
readonly why?: string;
|
|
134
140
|
}): CliStructuredError;
|
|
135
141
|
/**
|
|
136
142
|
* Target does not support migrations (missing createPlanner/createRunner).
|
|
137
143
|
*/
|
|
138
144
|
declare function errorTargetMigrationNotSupported(options?: {
|
|
139
|
-
|
|
145
|
+
readonly why?: string;
|
|
140
146
|
}): CliStructuredError;
|
|
141
147
|
/**
|
|
142
148
|
* Config validation error (missing required fields).
|
|
143
149
|
*/
|
|
144
150
|
declare function errorConfigValidation(field: string, options?: {
|
|
145
|
-
|
|
151
|
+
readonly why?: string;
|
|
146
152
|
}): CliStructuredError;
|
|
147
153
|
/**
|
|
148
154
|
* Contract marker not found in database.
|
|
149
155
|
*/
|
|
150
156
|
declare function errorMarkerMissing(options?: {
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
readonly why?: string;
|
|
158
|
+
readonly dbUrl?: string;
|
|
153
159
|
}): CliStructuredError;
|
|
154
160
|
/**
|
|
155
161
|
* Contract hash does not match database marker.
|
|
156
162
|
*/
|
|
157
163
|
declare function errorHashMismatch(options?: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
readonly why?: string;
|
|
165
|
+
readonly expected?: string;
|
|
166
|
+
readonly actual?: string;
|
|
161
167
|
}): CliStructuredError;
|
|
162
168
|
/**
|
|
163
169
|
* Contract target does not match config target.
|
|
164
170
|
*/
|
|
165
171
|
declare function errorTargetMismatch(expected: string, actual: string, options?: {
|
|
166
|
-
|
|
172
|
+
readonly why?: string;
|
|
167
173
|
}): CliStructuredError;
|
|
168
174
|
/**
|
|
169
175
|
* Generic runtime error.
|
|
170
176
|
*/
|
|
171
177
|
declare function errorRuntime(summary: string, options?: {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
readonly why?: string;
|
|
179
|
+
readonly fix?: string;
|
|
180
|
+
readonly meta?: Record<string, unknown>;
|
|
175
181
|
}): CliStructuredError;
|
|
176
182
|
/**
|
|
177
183
|
* Generic unexpected error.
|
|
178
184
|
*/
|
|
179
185
|
declare function errorUnexpected(message: string, options?: {
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
readonly why?: string;
|
|
187
|
+
readonly fix?: string;
|
|
182
188
|
}): CliStructuredError;
|
|
183
|
-
|
|
184
|
-
export { type CliErrorConflict, type CliErrorEnvelope, CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed,
|
|
189
|
+
//#endregion
|
|
190
|
+
export { type CliErrorConflict, type CliErrorEnvelope, CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected };
|
|
191
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;AAIA;AAoBA;AAUA;AAYiB,UA1CA,gBAAA,CA0CA;EAYK,SAAA,IAAA,EAAA,MAAA;EAwBN,SAAA,MAAA,EAAA,MAAA;EAmBsB,SAAA,QAAA,EAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAnEE,SAAA,OAAA,EAAA,MAAA;EAAK,SAAA,GAAA,EAAA,MAAA,GAAA,SAAA;EAwF7B,SAAA,GAAA,EAAA,MAAA,GAAA,SAAuB;EAkBvB,SAAA,KAAA,EAAA;IAcA,SAAA,IAAA,EAAA,MAAA,GAAA,SAA6B;IAkB7B,SAAA,IAAA,EAAA,MAAiB,GAAA,SAO9B;EAaa,CAAA,GAAA,SAAA;EAaA,SAAA,IAAA,EA5LC,MA4LD,CAAA,MAAA,EAAA,OAA+B,CAAA,GAAA,SAE3C;EAYY,SAAA,OAAA,EAAA,MAAA,GAAA,SAAgC;AAchD;AAoBA;AAYA;AAuBA;AA6BgB,UArSC,gBAAA,CAqSD;EAcA,SAAA,IAAA,EAAA,MAAA;EAqBA,SAAA,OAAA,EAAA,MAAkB;EAclB,SAAA,GAAA,CAAA,EAAA,MAAiB;AAuBjC;AAoBA;AAuBA;;;cA9Ya,kBAAA,SAA2B,KAAA;;;;;;;;;;iBAYvB;;;;;;;;;;;oBAYK;;;;;;gBAwBN;;;;;sCAmBsB;;;;;iBAqBtB,uBAAA;;IAKb;;;;iBAaa,0BAAA;;IAEZ;;;;iBAYY,6BAAA;;;;;IAKb;;;;iBAaa,iBAAA;;;;IAOb;;;;iBAaa,+BAAA;;IAEZ;;;;iBAWY,+BAAA;;IAEZ;;;;iBAYY,gCAAA;;IAEZ;;;;iBAYY,2BAAA;;;;IAIZ;;;;iBAgBY,mBAAA;;IAA0D;;;;iBAY1D,kCAAA;;;IAGZ;;;;iBAoBY,4BAAA;+BACe;;IAE3B;;;;iBA0BY,gCAAA;;IAEZ;;;;iBAYY,qBAAA;;IAKb;;;;iBAgBa,kBAAA;;;IAGZ;;;;iBAWY,iBAAA;;;;IAIZ;;;;iBAmBY,mBAAA;;IAMb;;;;iBAca,YAAA;;;kBAKI;IAEjB;;;;iBAgBa,eAAA;;;IAMb"}
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { _ as errorTargetMigrationNotSupported, a as errorContractMissingExtensionPacks, c as errorDriverRequired, d as errorHashMismatch, f as errorJsonFormatNotSupported, g as errorRuntime, h as errorQueryRunnerFactoryRequired, i as errorContractConfigMissing, l as errorFamilyReadMarkerSqlRequired, m as errorMigrationPlanningFailed, n as errorConfigFileNotFound, o as errorContractValidationFailed, p as errorMarkerMissing, r as errorConfigValidation, s as errorDatabaseConnectionRequired, t as CliStructuredError, u as errorFileNotFound, v as errorTargetMismatch, y as errorUnexpected } from "./errors-Qlh0sdcb.mjs";
|
|
2
|
+
|
|
3
|
+
export { CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/schema-view.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Core schema view types for family-agnostic schema visualization.
|
|
3
4
|
*
|
|
@@ -70,18 +71,19 @@ type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' |
|
|
|
70
71
|
* Tree-shaped structure good for Command Tree-style CLI output.
|
|
71
72
|
*/
|
|
72
73
|
interface SchemaTreeNode {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
84
|
interface CoreSchemaView {
|
|
84
|
-
|
|
85
|
+
readonly root: SchemaTreeNode;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
export
|
|
87
|
+
//#endregion
|
|
88
|
+
export { SchemaNodeKind as n, SchemaTreeNode as r, CoreSchemaView as t };
|
|
89
|
+
//# sourceMappingURL=schema-view-BG_ebqoV.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-view-BG_ebqoV.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 @@
|
|
|
1
|
+
export { };
|
package/dist/stack.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { a as ControlExtensionDescriptor, l as ControlPlaneStack, r as ControlDriverDescriptor, t as ControlAdapterDescriptor, u as ControlTargetDescriptor } from "./types-yiR2kXAj.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"}
|