@prisma-next/cli 0.3.0-pr.94.3 → 0.3.0-pr.95.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/chunk-AGOTG4L3.js +965 -0
  2. package/dist/chunk-AGOTG4L3.js.map +1 -0
  3. package/dist/chunk-HLLI4YL7.js +180 -0
  4. package/dist/chunk-HLLI4YL7.js.map +1 -0
  5. package/dist/chunk-HWYQOCAJ.js +47 -0
  6. package/dist/chunk-HWYQOCAJ.js.map +1 -0
  7. package/dist/chunk-VG2R7DGF.js +735 -0
  8. package/dist/chunk-VG2R7DGF.js.map +1 -0
  9. package/dist/cli.d.ts +2 -2
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +2764 -2522
  12. package/dist/cli.js.map +1 -1
  13. package/dist/commands/contract-emit.d.ts +3 -0
  14. package/dist/commands/contract-emit.d.ts.map +1 -0
  15. package/dist/commands/contract-emit.js +10 -0
  16. package/dist/commands/contract-emit.js.map +1 -0
  17. package/dist/commands/db-init.d.ts +3 -0
  18. package/dist/commands/db-init.d.ts.map +1 -0
  19. package/dist/commands/db-init.js +257 -0
  20. package/dist/commands/db-init.js.map +1 -0
  21. package/dist/commands/db-introspect.d.ts +3 -0
  22. package/dist/commands/db-introspect.d.ts.map +1 -0
  23. package/dist/commands/db-introspect.js +155 -0
  24. package/dist/commands/db-introspect.js.map +1 -0
  25. package/dist/commands/db-schema-verify.d.ts +3 -0
  26. package/dist/commands/db-schema-verify.d.ts.map +1 -0
  27. package/dist/commands/db-schema-verify.js +171 -0
  28. package/dist/commands/db-schema-verify.js.map +1 -0
  29. package/dist/commands/db-sign.d.ts +3 -0
  30. package/dist/commands/db-sign.d.ts.map +1 -0
  31. package/dist/commands/db-sign.js +195 -0
  32. package/dist/commands/db-sign.js.map +1 -0
  33. package/dist/commands/db-verify.d.ts +3 -0
  34. package/dist/commands/db-verify.d.ts.map +1 -0
  35. package/dist/commands/db-verify.js +193 -0
  36. package/dist/commands/db-verify.js.map +1 -0
  37. package/dist/{config-loader.d.mts → config-loader.d.ts} +3 -8
  38. package/dist/config-loader.d.ts.map +1 -0
  39. package/dist/config-loader.js +7 -0
  40. package/dist/config-loader.js.map +1 -0
  41. package/dist/control-api/client.d.ts +13 -0
  42. package/dist/control-api/client.d.ts.map +1 -0
  43. package/dist/control-api/operations/db-init.d.ts +29 -0
  44. package/dist/control-api/operations/db-init.d.ts.map +1 -0
  45. package/dist/control-api/types.d.ts +387 -0
  46. package/dist/control-api/types.d.ts.map +1 -0
  47. package/dist/exports/config-types.d.ts +3 -0
  48. package/dist/exports/config-types.d.ts.map +1 -0
  49. package/dist/exports/config-types.js +6 -0
  50. package/dist/exports/config-types.js.map +1 -0
  51. package/dist/exports/control-api.d.ts +13 -0
  52. package/dist/exports/control-api.d.ts.map +1 -0
  53. package/dist/exports/control-api.js +7 -0
  54. package/dist/exports/control-api.js.map +1 -0
  55. package/dist/exports/index.d.ts +4 -0
  56. package/dist/exports/index.d.ts.map +1 -0
  57. package/dist/exports/index.js +176 -0
  58. package/dist/exports/index.js.map +1 -0
  59. package/dist/{exports/index.d.mts → load-ts-contract.d.ts} +5 -10
  60. package/dist/load-ts-contract.d.ts.map +1 -0
  61. package/dist/utils/cli-errors.d.ts +7 -0
  62. package/dist/utils/cli-errors.d.ts.map +1 -0
  63. package/dist/utils/command-helpers.d.ts +12 -0
  64. package/dist/utils/command-helpers.d.ts.map +1 -0
  65. package/dist/utils/framework-components.d.ts +70 -0
  66. package/dist/utils/framework-components.d.ts.map +1 -0
  67. package/dist/utils/global-flags.d.ts +25 -0
  68. package/dist/utils/global-flags.d.ts.map +1 -0
  69. package/dist/utils/output.d.ts +142 -0
  70. package/dist/utils/output.d.ts.map +1 -0
  71. package/dist/utils/progress-adapter.d.ts +26 -0
  72. package/dist/utils/progress-adapter.d.ts.map +1 -0
  73. package/dist/utils/result-handler.d.ts +15 -0
  74. package/dist/utils/result-handler.d.ts.map +1 -0
  75. package/package.json +54 -29
  76. package/dist/client-CoxxGz_7.mjs +0 -692
  77. package/dist/client-CoxxGz_7.mjs.map +0 -1
  78. package/dist/commands/contract-emit.d.mts +0 -7
  79. package/dist/commands/contract-emit.d.mts.map +0 -1
  80. package/dist/commands/contract-emit.mjs +0 -139
  81. package/dist/commands/contract-emit.mjs.map +0 -1
  82. package/dist/commands/db-init.d.mts +0 -7
  83. package/dist/commands/db-init.d.mts.map +0 -1
  84. package/dist/commands/db-init.mjs +0 -178
  85. package/dist/commands/db-init.mjs.map +0 -1
  86. package/dist/commands/db-introspect.d.mts +0 -7
  87. package/dist/commands/db-introspect.d.mts.map +0 -1
  88. package/dist/commands/db-introspect.mjs +0 -120
  89. package/dist/commands/db-introspect.mjs.map +0 -1
  90. package/dist/commands/db-schema-verify.d.mts +0 -7
  91. package/dist/commands/db-schema-verify.d.mts.map +0 -1
  92. package/dist/commands/db-schema-verify.mjs +0 -116
  93. package/dist/commands/db-schema-verify.mjs.map +0 -1
  94. package/dist/commands/db-sign.d.mts +0 -7
  95. package/dist/commands/db-sign.d.mts.map +0 -1
  96. package/dist/commands/db-sign.mjs +0 -138
  97. package/dist/commands/db-sign.mjs.map +0 -1
  98. package/dist/commands/db-verify.d.mts +0 -7
  99. package/dist/commands/db-verify.d.mts.map +0 -1
  100. package/dist/commands/db-verify.mjs +0 -128
  101. package/dist/commands/db-verify.mjs.map +0 -1
  102. package/dist/config-loader-B-pobG0R.mjs +0 -42
  103. package/dist/config-loader-B-pobG0R.mjs.map +0 -1
  104. package/dist/config-loader.d.mts.map +0 -1
  105. package/dist/config-loader.mjs +0 -3
  106. package/dist/exports/config-types.d.mts +0 -2
  107. package/dist/exports/config-types.mjs +0 -3
  108. package/dist/exports/control-api.d.mts +0 -405
  109. package/dist/exports/control-api.d.mts.map +0 -1
  110. package/dist/exports/control-api.mjs +0 -3
  111. package/dist/exports/index.d.mts.map +0 -1
  112. package/dist/exports/index.mjs +0 -128
  113. package/dist/exports/index.mjs.map +0 -1
  114. package/dist/result-handler-Do_4Fi4U.mjs +0 -959
  115. package/dist/result-handler-Do_4Fi4U.mjs.map +0 -1
@@ -0,0 +1,176 @@
1
+ import {
2
+ createContractEmitCommand
3
+ } from "../chunk-HLLI4YL7.js";
4
+ import "../chunk-AGOTG4L3.js";
5
+ import "../chunk-HWYQOCAJ.js";
6
+ import "../chunk-VG2R7DGF.js";
7
+
8
+ // src/load-ts-contract.ts
9
+ import { existsSync, unlinkSync, writeFileSync } from "fs";
10
+ import { tmpdir } from "os";
11
+ import { join } from "path";
12
+ import { build } from "esbuild";
13
+ var DEFAULT_ALLOWLIST = ["@prisma-next/*"];
14
+ function isAllowedImport(importPath, allowlist) {
15
+ for (const pattern of allowlist) {
16
+ if (pattern.endsWith("/*")) {
17
+ const prefix = pattern.slice(0, -2);
18
+ if (importPath === prefix || importPath.startsWith(`${prefix}/`)) {
19
+ return true;
20
+ }
21
+ } else if (importPath === pattern) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
27
+ function validatePurity(value) {
28
+ if (typeof value !== "object" || value === null) {
29
+ return;
30
+ }
31
+ const seen = /* @__PURE__ */ new WeakSet();
32
+ function check(value2) {
33
+ if (value2 === null || typeof value2 !== "object") {
34
+ return;
35
+ }
36
+ if (seen.has(value2)) {
37
+ throw new Error("Contract export contains circular references");
38
+ }
39
+ seen.add(value2);
40
+ for (const key in value2) {
41
+ const descriptor = Object.getOwnPropertyDescriptor(value2, key);
42
+ if (descriptor && (descriptor.get || descriptor.set)) {
43
+ throw new Error(`Contract export contains getter/setter at key "${key}"`);
44
+ }
45
+ if (descriptor && typeof descriptor.value === "function") {
46
+ throw new Error(`Contract export contains function at key "${key}"`);
47
+ }
48
+ check(value2[key]);
49
+ }
50
+ }
51
+ try {
52
+ check(value);
53
+ JSON.stringify(value);
54
+ } catch (error) {
55
+ if (error instanceof Error) {
56
+ if (error.message.includes("getter") || error.message.includes("circular")) {
57
+ throw error;
58
+ }
59
+ throw new Error(`Contract export is not JSON-serializable: ${error.message}`);
60
+ }
61
+ throw new Error("Contract export is not JSON-serializable");
62
+ }
63
+ }
64
+ function createImportAllowlistPlugin(allowlist, entryPath) {
65
+ return {
66
+ name: "import-allowlist",
67
+ setup(build2) {
68
+ build2.onResolve({ filter: /.*/ }, (args) => {
69
+ if (args.kind === "entry-point") {
70
+ return void 0;
71
+ }
72
+ if (args.path.startsWith(".") || args.path.startsWith("/")) {
73
+ return void 0;
74
+ }
75
+ const isFromEntryPoint = args.importer === entryPath || args.importer === "<stdin>";
76
+ if (isFromEntryPoint && !isAllowedImport(args.path, allowlist)) {
77
+ return {
78
+ path: args.path,
79
+ external: true
80
+ };
81
+ }
82
+ return void 0;
83
+ });
84
+ }
85
+ };
86
+ }
87
+ async function loadContractFromTs(entryPath, options) {
88
+ const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;
89
+ if (!existsSync(entryPath)) {
90
+ throw new Error(`Contract file not found: ${entryPath}`);
91
+ }
92
+ const tempFile = join(
93
+ tmpdir(),
94
+ `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
95
+ );
96
+ try {
97
+ const result = await build({
98
+ entryPoints: [entryPath],
99
+ bundle: true,
100
+ format: "esm",
101
+ platform: "node",
102
+ target: "es2022",
103
+ outfile: tempFile,
104
+ write: false,
105
+ metafile: true,
106
+ plugins: [createImportAllowlistPlugin(allowlist, entryPath)],
107
+ logLevel: "error"
108
+ });
109
+ if (result.errors.length > 0) {
110
+ const errorMessages = result.errors.map((e) => e.text).join("\n");
111
+ throw new Error(`Failed to bundle contract file: ${errorMessages}`);
112
+ }
113
+ if (!result.outputFiles || result.outputFiles.length === 0) {
114
+ throw new Error("No output files generated from bundling");
115
+ }
116
+ const disallowedImports = [];
117
+ if (result.metafile) {
118
+ const inputs = result.metafile.inputs;
119
+ for (const [, inputData] of Object.entries(inputs)) {
120
+ const imports = inputData.imports || [];
121
+ for (const imp of imports) {
122
+ if (imp.external && !imp.path.startsWith(".") && !imp.path.startsWith("/") && !isAllowedImport(imp.path, allowlist)) {
123
+ disallowedImports.push(imp.path);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ if (disallowedImports.length > 0) {
129
+ throw new Error(
130
+ `Disallowed imports detected. Only imports matching the allowlist are permitted:
131
+ Allowlist: ${allowlist.join(", ")}
132
+ Disallowed imports: ${disallowedImports.join(", ")}
133
+
134
+ Only @prisma-next/* packages are allowed in contract files.`
135
+ );
136
+ }
137
+ const bundleContent = result.outputFiles[0]?.text;
138
+ if (bundleContent === void 0) {
139
+ throw new Error("Bundle content is undefined");
140
+ }
141
+ writeFileSync(tempFile, bundleContent, "utf-8");
142
+ const module = await import(`file://${tempFile}`);
143
+ unlinkSync(tempFile);
144
+ let contract;
145
+ if (module.default !== void 0) {
146
+ contract = module.default;
147
+ } else if (module.contract !== void 0) {
148
+ contract = module.contract;
149
+ } else {
150
+ throw new Error(
151
+ `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module).join(", ") || "none"}`
152
+ );
153
+ }
154
+ if (typeof contract !== "object" || contract === null) {
155
+ throw new Error(`Contract export must be an object, got ${typeof contract}`);
156
+ }
157
+ validatePurity(contract);
158
+ return contract;
159
+ } catch (error) {
160
+ try {
161
+ if (tempFile) {
162
+ unlinkSync(tempFile);
163
+ }
164
+ } catch {
165
+ }
166
+ if (error instanceof Error) {
167
+ throw error;
168
+ }
169
+ throw new Error(`Failed to load contract from ${entryPath}: ${String(error)}`);
170
+ }
171
+ }
172
+ export {
173
+ createContractEmitCommand,
174
+ loadContractFromTs
175
+ };
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/load-ts-contract.ts"],"sourcesContent":["import { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport type { ContractIR } from '@prisma-next/contract/ir';\nimport type { Plugin } from 'esbuild';\nimport { build } from 'esbuild';\n\nexport interface LoadTsContractOptions {\n readonly allowlist?: ReadonlyArray<string>;\n}\n\nconst DEFAULT_ALLOWLIST = ['@prisma-next/*'];\n\nfunction isAllowedImport(importPath: string, allowlist: ReadonlyArray<string>): boolean {\n for (const pattern of allowlist) {\n if (pattern.endsWith('/*')) {\n const prefix = pattern.slice(0, -2);\n if (importPath === prefix || importPath.startsWith(`${prefix}/`)) {\n return true;\n }\n } else if (importPath === pattern) {\n return true;\n }\n }\n return false;\n}\n\nfunction validatePurity(value: unknown): void {\n if (typeof value !== 'object' || value === null) {\n return;\n }\n\n const seen = new WeakSet();\n function check(value: unknown): void {\n if (value === null || typeof value !== 'object') {\n return;\n }\n\n if (seen.has(value)) {\n throw new Error('Contract export contains circular references');\n }\n seen.add(value);\n\n for (const key in value) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor && (descriptor.get || descriptor.set)) {\n throw new Error(`Contract export contains getter/setter at key \"${key}\"`);\n }\n if (descriptor && typeof descriptor.value === 'function') {\n throw new Error(`Contract export contains function at key \"${key}\"`);\n }\n check((value as Record<string, unknown>)[key]);\n }\n }\n\n try {\n check(value);\n JSON.stringify(value);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('getter') || error.message.includes('circular')) {\n throw error;\n }\n throw new Error(`Contract export is not JSON-serializable: ${error.message}`);\n }\n throw new Error('Contract export is not JSON-serializable');\n }\n}\n\nfunction createImportAllowlistPlugin(allowlist: ReadonlyArray<string>, entryPath: string): Plugin {\n return {\n name: 'import-allowlist',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (args.kind === 'entry-point') {\n return undefined;\n }\n if (args.path.startsWith('.') || args.path.startsWith('/')) {\n return undefined;\n }\n const isFromEntryPoint = args.importer === entryPath || args.importer === '<stdin>';\n if (isFromEntryPoint && !isAllowedImport(args.path, allowlist)) {\n return {\n path: args.path,\n external: true,\n };\n }\n return undefined;\n });\n },\n };\n}\n\n/**\n * Loads a contract from a TypeScript file and returns it as ContractIR.\n *\n * **Responsibility: Parsing Only**\n * This function loads and parses a TypeScript contract file. It does NOT normalize the contract.\n * The contract should already be normalized if it was built using the contract builder.\n *\n * Normalization must happen in the contract builder when the contract is created.\n * This function only validates that the contract is JSON-serializable and returns it as-is.\n *\n * @param entryPath - Path to the TypeScript contract file\n * @param options - Optional configuration (import allowlist)\n * @returns The contract as ContractIR (should already be normalized)\n * @throws Error if the contract cannot be loaded or is not JSON-serializable\n */\nexport async function loadContractFromTs(\n entryPath: string,\n options?: LoadTsContractOptions,\n): Promise<ContractIR> {\n const allowlist = options?.allowlist ?? DEFAULT_ALLOWLIST;\n\n if (!existsSync(entryPath)) {\n throw new Error(`Contract file not found: ${entryPath}`);\n }\n\n const tempFile = join(\n tmpdir(),\n `prisma-next-contract-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`,\n );\n\n try {\n const result = await build({\n entryPoints: [entryPath],\n bundle: true,\n format: 'esm',\n platform: 'node',\n target: 'es2022',\n outfile: tempFile,\n write: false,\n metafile: true,\n plugins: [createImportAllowlistPlugin(allowlist, entryPath)],\n logLevel: 'error',\n });\n\n if (result.errors.length > 0) {\n const errorMessages = result.errors.map((e: { text: string }) => e.text).join('\\n');\n throw new Error(`Failed to bundle contract file: ${errorMessages}`);\n }\n\n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated from bundling');\n }\n\n const disallowedImports: string[] = [];\n if (result.metafile) {\n const inputs = result.metafile.inputs;\n for (const [, inputData] of Object.entries(inputs)) {\n const imports =\n (inputData as { imports?: Array<{ path: string; external?: boolean }> }).imports || [];\n for (const imp of imports) {\n if (\n imp.external &&\n !imp.path.startsWith('.') &&\n !imp.path.startsWith('/') &&\n !isAllowedImport(imp.path, allowlist)\n ) {\n disallowedImports.push(imp.path);\n }\n }\n }\n }\n\n if (disallowedImports.length > 0) {\n throw new Error(\n `Disallowed imports detected. Only imports matching the allowlist are permitted:\\n Allowlist: ${allowlist.join(', ')}\\n Disallowed imports: ${disallowedImports.join(', ')}\\n\\nOnly @prisma-next/* packages are allowed in contract files.`,\n );\n }\n\n const bundleContent = result.outputFiles[0]?.text;\n if (bundleContent === undefined) {\n throw new Error('Bundle content is undefined');\n }\n writeFileSync(tempFile, bundleContent, 'utf-8');\n\n const module = (await import(`file://${tempFile}`)) as {\n default?: unknown;\n contract?: unknown;\n };\n unlinkSync(tempFile);\n\n let contract: unknown;\n\n if (module.default !== undefined) {\n contract = module.default;\n } else if (module.contract !== undefined) {\n contract = module.contract;\n } else {\n throw new Error(\n `Contract file must export a contract as default export or named export 'contract'. Found exports: ${Object.keys(module as Record<string, unknown>).join(', ') || 'none'}`,\n );\n }\n\n if (typeof contract !== 'object' || contract === null) {\n throw new Error(`Contract export must be an object, got ${typeof contract}`);\n }\n\n validatePurity(contract);\n\n return contract as ContractIR;\n } catch (error) {\n try {\n if (tempFile) {\n unlinkSync(tempFile);\n }\n } catch {\n // Ignore cleanup errors\n }\n\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(`Failed to load contract from ${entryPath}: ${String(error)}`);\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,YAAY,YAAY,qBAAqB;AACtD,SAAS,cAAc;AACvB,SAAS,YAAY;AAGrB,SAAS,aAAa;AAMtB,IAAM,oBAAoB,CAAC,gBAAgB;AAE3C,SAAS,gBAAgB,YAAoB,WAA2C;AACtF,aAAW,WAAW,WAAW;AAC/B,QAAI,QAAQ,SAAS,IAAI,GAAG;AAC1B,YAAM,SAAS,QAAQ,MAAM,GAAG,EAAE;AAClC,UAAI,eAAe,UAAU,WAAW,WAAW,GAAG,MAAM,GAAG,GAAG;AAChE,eAAO;AAAA,MACT;AAAA,IACF,WAAW,eAAe,SAAS;AACjC,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,eAAe,OAAsB;AAC5C,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C;AAAA,EACF;AAEA,QAAM,OAAO,oBAAI,QAAQ;AACzB,WAAS,MAAMA,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ContractEmitCommand } from "../commands/contract-emit.mjs";
2
- import { ContractIR } from "@prisma-next/contract/ir";
3
-
4
- //#region src/load-ts-contract.d.ts
5
- interface LoadTsContractOptions {
6
- readonly allowlist?: ReadonlyArray<string>;
1
+ import type { ContractIR } from '@prisma-next/contract/ir';
2
+ export interface LoadTsContractOptions {
3
+ readonly allowlist?: ReadonlyArray<string>;
7
4
  }
8
5
  /**
9
6
  * Loads a contract from a TypeScript file and returns it as ContractIR.
@@ -20,7 +17,5 @@ interface LoadTsContractOptions {
20
17
  * @returns The contract as ContractIR (should already be normalized)
21
18
  * @throws Error if the contract cannot be loaded or is not JSON-serializable
22
19
  */
23
- declare function loadContractFromTs(entryPath: string, options?: LoadTsContractOptions): Promise<ContractIR>;
24
- //#endregion
25
- export { type LoadTsContractOptions, createContractEmitCommand, loadContractFromTs };
26
- //# sourceMappingURL=index.d.mts.map
20
+ export declare function loadContractFromTs(entryPath: string, options?: LoadTsContractOptions): Promise<ContractIR>;
21
+ //# sourceMappingURL=load-ts-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-ts-contract.d.ts","sourceRoot":"","sources":["../src/load-ts-contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAI3D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C;AAoFD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAyGrB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Re-export all domain error factories from core-control-plane for convenience.
3
+ * CLI-specific errors (e.g., Commander.js argument validation) can be added here if needed.
4
+ */
5
+ export type { CliErrorConflict, CliErrorEnvelope } from '@prisma-next/core-control-plane/errors';
6
+ export { CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected, } from '@prisma-next/core-control-plane/errors';
7
+ //# sourceMappingURL=cli-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-errors.d.ts","sourceRoot":"","sources":["../../src/utils/cli-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,kCAAkC,EAClC,6BAA6B,EAC7B,+BAA+B,EAC/B,mBAAmB,EACnB,gCAAgC,EAChC,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,YAAY,EACZ,gCAAgC,EAChC,mBAAmB,EACnB,eAAe,GAChB,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Sets both short and long descriptions for a command.
4
+ * The short description is used in command trees and headers.
5
+ * The long description is shown at the bottom of help output.
6
+ */
7
+ export declare function setCommandDescriptions(command: Command, shortDescription: string, longDescription?: string): Command;
8
+ /**
9
+ * Gets the long description from a command if it was set via setCommandDescriptions.
10
+ */
11
+ export declare function getLongDescription(command: Command): string | undefined;
12
+ //# sourceMappingURL=command-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/command-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,EACxB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEvE"}
@@ -0,0 +1,70 @@
1
+ import { type TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
2
+ import type { ContractIR } from '@prisma-next/contract/ir';
3
+ import type { ControlPlaneStack } from '@prisma-next/core-control-plane/types';
4
+ /**
5
+ * Asserts that all framework components are compatible with the expected family and target.
6
+ *
7
+ * This function validates that each component in the framework components array:
8
+ * - Has kind 'target', 'adapter', 'extension', or 'driver'
9
+ * - Has familyId matching expectedFamilyId
10
+ * - Has targetId matching expectedTargetId
11
+ *
12
+ * This validation happens at the CLI composition boundary, before passing components
13
+ * to typed planner/runner instances. It fills the gap between runtime validation
14
+ * (via `validateConfig()`) and compile-time type enforcement.
15
+ *
16
+ * @param expectedFamilyId - The expected family ID (e.g., 'sql')
17
+ * @param expectedTargetId - The expected target ID (e.g., 'postgres')
18
+ * @param frameworkComponents - Array of framework components to validate
19
+ * @returns The same array typed as TargetBoundComponentDescriptor
20
+ * @throws CliStructuredError if any component is incompatible
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const config = await loadConfig();
25
+ * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];
26
+ *
27
+ * // Validate and type-narrow components before passing to planner
28
+ * const typedComponents = assertFrameworkComponentsCompatible(
29
+ * config.family.familyId,
30
+ * config.target.targetId,
31
+ * frameworkComponents
32
+ * );
33
+ *
34
+ * const planner = target.migrations.createPlanner(familyInstance);
35
+ * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });
36
+ * ```
37
+ */
38
+ export declare function assertFrameworkComponentsCompatible<TFamilyId extends string, TTargetId extends string>(expectedFamilyId: TFamilyId, expectedTargetId: TTargetId, frameworkComponents: ReadonlyArray<unknown>): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
39
+ /**
40
+ * Validates that a contract is compatible with the configured target, adapter,
41
+ * and extension packs. Throws on family/target mismatches or missing extension packs.
42
+ *
43
+ * This check ensures the emitted contract matches the CLI config before running
44
+ * commands that depend on the contract (e.g., db verify, db sign).
45
+ *
46
+ * @param contract - The contract IR to validate (must include targetFamily, target, extensionPacks).
47
+ * @param stack - The control plane stack (target, adapter, driver, extensionPacks).
48
+ *
49
+ * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target
50
+ * doesn't match the configured family/target.
51
+ * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires
52
+ * extension packs that are not provided in the config (includes all missing packs in error.meta).
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * import { assertContractRequirementsSatisfied } from './framework-components';
57
+ *
58
+ * const config = await loadConfig();
59
+ * const contractIR = await loadContractJson(config.contract.output);
60
+ * const stack = createControlPlaneStack({ target: config.target, adapter: config.adapter, ... });
61
+ *
62
+ * // Throws if contract is incompatible with config
63
+ * assertContractRequirementsSatisfied({ contract: contractIR, stack });
64
+ * ```
65
+ */
66
+ export declare function assertContractRequirementsSatisfied<TFamilyId extends string, TTargetId extends string>({ contract, stack, }: {
67
+ readonly contract: Pick<ContractIR, 'targetFamily' | 'target' | 'extensionPacks'>;
68
+ readonly stack: ControlPlaneStack<TFamilyId, TTargetId>;
69
+ }): void;
70
+ //# sourceMappingURL=framework-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components.d.ts","sourceRoot":"","sources":["../../src/utils/framework-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,EAExB,gBAAgB,EAAE,SAAS,EAC3B,gBAAgB,EAAE,SAAS,EAC3B,mBAAmB,EAAE,aAAa,CAAC,OAAO,CAAC,GAC1C,aAAa,CAAC,8BAA8B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CA0DrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,SAAS,MAAM,EACxB,SAAS,SAAS,MAAM,EACxB,EACA,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,GAAG,QAAQ,GAAG,gBAAgB,CAAC,CAAC;IAClF,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CACzD,GAAG,IAAI,CA+BP"}
@@ -0,0 +1,25 @@
1
+ export interface GlobalFlags {
2
+ readonly json?: 'object' | 'ndjson';
3
+ readonly quiet?: boolean;
4
+ readonly verbose?: number;
5
+ readonly timestamps?: boolean;
6
+ readonly color?: boolean;
7
+ }
8
+ export interface CliOptions {
9
+ readonly json?: string | boolean;
10
+ readonly quiet?: boolean;
11
+ readonly q?: boolean;
12
+ readonly verbose?: boolean;
13
+ readonly v?: boolean;
14
+ readonly vv?: boolean;
15
+ readonly trace?: boolean;
16
+ readonly timestamps?: boolean;
17
+ readonly color?: boolean;
18
+ readonly 'no-color'?: boolean;
19
+ }
20
+ /**
21
+ * Parses global flags from CLI options.
22
+ * Handles verbosity flags (-v, -vv, --trace), JSON output, quiet mode, timestamps, and color.
23
+ */
24
+ export declare function parseGlobalFlags(options: CliOptions): GlobalFlags;
25
+ //# sourceMappingURL=global-flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-flags.d.ts","sourceRoot":"","sources":["../../src/utils/global-flags.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,CAiDjE"}
@@ -0,0 +1,142 @@
1
+ import type { Command } from 'commander';
2
+ export interface EmitContractResult {
3
+ readonly coreHash: string;
4
+ readonly profileHash: string;
5
+ readonly outDir: string;
6
+ readonly files: {
7
+ readonly json: string;
8
+ readonly dts: string;
9
+ };
10
+ readonly timings: {
11
+ readonly total: number;
12
+ };
13
+ }
14
+ import type { CoreSchemaView } from '@prisma-next/core-control-plane/schema-view';
15
+ import type { IntrospectSchemaResult, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from '@prisma-next/core-control-plane/types';
16
+ import type { CliErrorEnvelope } from './cli-errors';
17
+ import type { GlobalFlags } from './global-flags';
18
+ /**
19
+ * Formats human-readable output for contract emit.
20
+ */
21
+ export declare function formatEmitOutput(result: EmitContractResult, flags: GlobalFlags): string;
22
+ /**
23
+ * Formats JSON output for contract emit.
24
+ */
25
+ export declare function formatEmitJson(result: EmitContractResult): string;
26
+ /**
27
+ * Formats error output for human-readable display.
28
+ */
29
+ export declare function formatErrorOutput(error: CliErrorEnvelope, flags: GlobalFlags): string;
30
+ /**
31
+ * Formats error output as JSON.
32
+ */
33
+ export declare function formatErrorJson(error: CliErrorEnvelope): string;
34
+ /**
35
+ * Formats human-readable output for database verify.
36
+ */
37
+ export declare function formatVerifyOutput(result: VerifyDatabaseResult, flags: GlobalFlags): string;
38
+ /**
39
+ * Formats JSON output for database verify.
40
+ */
41
+ export declare function formatVerifyJson(result: VerifyDatabaseResult): string;
42
+ /**
43
+ * Formats JSON output for database introspection.
44
+ */
45
+ export declare function formatIntrospectJson(result: IntrospectSchemaResult<unknown>): string;
46
+ /**
47
+ * Formats human-readable output for database introspection.
48
+ */
49
+ export declare function formatIntrospectOutput(result: IntrospectSchemaResult<unknown>, schemaView: CoreSchemaView | undefined, flags: GlobalFlags): string;
50
+ /**
51
+ * Formats human-readable output for database schema verification.
52
+ */
53
+ export declare function formatSchemaVerifyOutput(result: VerifyDatabaseSchemaResult, flags: GlobalFlags): string;
54
+ /**
55
+ * Formats JSON output for database schema verification.
56
+ */
57
+ export declare function formatSchemaVerifyJson(result: VerifyDatabaseSchemaResult): string;
58
+ /**
59
+ * Formats human-readable output for database sign.
60
+ */
61
+ export declare function formatSignOutput(result: SignDatabaseResult, flags: GlobalFlags): string;
62
+ /**
63
+ * Formats JSON output for database sign.
64
+ */
65
+ export declare function formatSignJson(result: SignDatabaseResult): string;
66
+ /**
67
+ * Result type for db init command.
68
+ */
69
+ export interface DbInitResult {
70
+ readonly ok: boolean;
71
+ readonly mode: 'plan' | 'apply';
72
+ readonly plan?: {
73
+ readonly targetId: string;
74
+ readonly destination: {
75
+ readonly coreHash: string;
76
+ readonly profileHash?: string;
77
+ };
78
+ readonly operations: readonly {
79
+ readonly id: string;
80
+ readonly label: string;
81
+ readonly operationClass: string;
82
+ }[];
83
+ };
84
+ readonly execution?: {
85
+ readonly operationsPlanned: number;
86
+ readonly operationsExecuted: number;
87
+ };
88
+ readonly marker?: {
89
+ readonly coreHash: string;
90
+ readonly profileHash?: string;
91
+ };
92
+ readonly summary: string;
93
+ readonly timings: {
94
+ readonly total: number;
95
+ };
96
+ }
97
+ /**
98
+ * Formats human-readable output for db init plan mode.
99
+ */
100
+ export declare function formatDbInitPlanOutput(result: DbInitResult, flags: GlobalFlags): string;
101
+ /**
102
+ * Formats human-readable output for db init apply mode.
103
+ */
104
+ export declare function formatDbInitApplyOutput(result: DbInitResult, flags: GlobalFlags): string;
105
+ /**
106
+ * Formats JSON output for db init command.
107
+ */
108
+ export declare function formatDbInitJson(result: DbInitResult): string;
109
+ /**
110
+ * Formats the header in the new experimental visual style.
111
+ * This header appears at the start of command output, showing the operation,
112
+ * intent, documentation link, and parameters.
113
+ */
114
+ export declare function formatStyledHeader(options: {
115
+ readonly command: string;
116
+ readonly description: string;
117
+ readonly url?: string;
118
+ readonly details: ReadonlyArray<{
119
+ readonly label: string;
120
+ readonly value: string;
121
+ }>;
122
+ readonly flags: GlobalFlags;
123
+ }): string;
124
+ /**
125
+ * Formats a success message in the styled output format.
126
+ */
127
+ export declare function formatSuccessMessage(flags: GlobalFlags): string;
128
+ /**
129
+ * Formats help output for a command using the styled format.
130
+ */
131
+ export declare function formatCommandHelp(options: {
132
+ readonly command: Command;
133
+ readonly flags: GlobalFlags;
134
+ }): string;
135
+ /**
136
+ * Formats help output for the root program using the styled format.
137
+ */
138
+ export declare function formatRootHelp(options: {
139
+ readonly program: Command;
140
+ readonly flags: GlobalFlags;
141
+ }): string;
142
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,6CAA6C,CAAC;AAClG,OAAO,KAAK,EACV,sBAAsB,EAEtB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiDlD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAuBvF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAWjE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAiErF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,C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AG,MAAM,CAsCT;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAI/D;AA8BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,GAAG,MAAM,CAyGT;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,GAAG,MAAM,CA2FT"}
@@ -0,0 +1,26 @@
1
+ import type { OnControlProgress } from '../control-api/types';
2
+ import type { GlobalFlags } from './global-flags';
3
+ /**
4
+ * Options for creating a progress adapter.
5
+ */
6
+ interface ProgressAdapterOptions {
7
+ /**
8
+ * Global flags that control progress output behavior (quiet, json, color).
9
+ */
10
+ readonly flags: GlobalFlags;
11
+ }
12
+ /**
13
+ * Creates a progress adapter that converts control-api progress events
14
+ * into CLI spinner/progress output.
15
+ *
16
+ * The adapter:
17
+ * - Starts/succeeds spinners for top-level span boundaries
18
+ * - Prints per-operation lines for nested spans (e.g., migration operations under 'apply')
19
+ * - Respects quiet/json/non-TTY flags (no-op in those cases)
20
+ *
21
+ * @param options - Progress adapter configuration
22
+ * @returns An onProgress callback compatible with control-api operations
23
+ */
24
+ export declare function createProgressAdapter(options: ProgressAdapterOptions): OnControlProgress;
25
+ export {};
26
+ //# sourceMappingURL=progress-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-adapter.d.ts","sourceRoot":"","sources":["../../src/utils/progress-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,UAAU,sBAAsB;IAC9B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAUD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,CAmDxF"}
@@ -0,0 +1,15 @@
1
+ import type { Result } from '@prisma-next/utils/result';
2
+ import type { CliStructuredError } from './cli-errors';
3
+ import type { GlobalFlags } from './global-flags';
4
+ /**
5
+ * Processes a CLI command result, handling both success and error cases.
6
+ * Formats output appropriately and returns the exit code.
7
+ * Never throws - returns exit code for commands to use with process.exit().
8
+ *
9
+ * @param result - The result from a CLI command
10
+ * @param flags - Global flags for output formatting
11
+ * @param onSuccess - Optional callback for successful results (for custom success output)
12
+ * @returns The exit code that should be used (0 for success, non-zero for errors)
13
+ */
14
+ export declare function handleResult<T>(result: Result<T, CliStructuredError>, flags: GlobalFlags, onSuccess?: (value: T) => void): number;
15
+ //# sourceMappingURL=result-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-handler.d.ts","sourceRoot":"","sources":["../../src/utils/result-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,kBAAkB,CAAC,EACrC,KAAK,EAAE,WAAW,EAClB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAC7B,MAAM,CAwBR"}