@prisma-next/cli 0.3.0-dev.9 → 0.3.0-pr.100.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.
- package/README.md +111 -27
- package/dist/{chunk-BZMBKEEQ.js → chunk-AGOTG4L3.js} +44 -76
- package/dist/chunk-AGOTG4L3.js.map +1 -0
- package/dist/chunk-HLLI4YL7.js +180 -0
- package/dist/chunk-HLLI4YL7.js.map +1 -0
- package/dist/chunk-VG2R7DGF.js +735 -0
- package/dist/chunk-VG2R7DGF.js.map +1 -0
- package/dist/cli.js +1502 -942
- package/dist/cli.js.map +1 -1
- package/dist/commands/contract-emit.d.ts.map +1 -1
- package/dist/commands/contract-emit.js +3 -2
- package/dist/commands/db-init.d.ts.map +1 -1
- package/dist/commands/db-init.js +205 -285
- package/dist/commands/db-init.js.map +1 -1
- package/dist/commands/db-introspect.d.ts.map +1 -1
- package/dist/commands/db-introspect.js +108 -139
- package/dist/commands/db-introspect.js.map +1 -1
- package/dist/commands/db-schema-verify.d.ts.map +1 -1
- package/dist/commands/db-schema-verify.js +120 -109
- package/dist/commands/db-schema-verify.js.map +1 -1
- package/dist/commands/db-sign.d.ts.map +1 -1
- package/dist/commands/db-sign.js +152 -152
- package/dist/commands/db-sign.js.map +1 -1
- package/dist/commands/db-verify.d.ts.map +1 -1
- package/dist/commands/db-verify.js +142 -118
- package/dist/commands/db-verify.js.map +1 -1
- package/dist/control-api/client.d.ts +13 -0
- package/dist/control-api/client.d.ts.map +1 -0
- package/dist/control-api/operations/db-init.d.ts +29 -0
- package/dist/control-api/operations/db-init.d.ts.map +1 -0
- package/dist/control-api/types.d.ts +387 -0
- package/dist/control-api/types.d.ts.map +1 -0
- package/dist/exports/control-api.d.ts +13 -0
- package/dist/exports/control-api.d.ts.map +1 -0
- package/dist/exports/control-api.js +7 -0
- package/dist/exports/control-api.js.map +1 -0
- package/dist/exports/index.js +3 -2
- package/dist/exports/index.js.map +1 -1
- package/dist/utils/cli-errors.d.ts +1 -1
- package/dist/utils/cli-errors.d.ts.map +1 -1
- package/dist/utils/progress-adapter.d.ts +26 -0
- package/dist/utils/progress-adapter.d.ts.map +1 -0
- package/package.json +20 -16
- package/src/commands/contract-emit.ts +179 -102
- package/src/commands/db-init.ts +263 -355
- package/src/commands/db-introspect.ts +151 -180
- package/src/commands/db-schema-verify.ts +151 -145
- package/src/commands/db-sign.ts +202 -196
- package/src/commands/db-verify.ts +180 -151
- package/src/control-api/client.ts +589 -0
- package/src/control-api/operations/db-init.ts +281 -0
- package/src/control-api/types.ts +461 -0
- package/src/exports/control-api.ts +46 -0
- package/src/utils/cli-errors.ts +1 -1
- package/src/utils/progress-adapter.ts +86 -0
- package/dist/chunk-BZMBKEEQ.js.map +0 -1
- package/dist/chunk-CVNWLFXO.js +0 -91
- package/dist/chunk-CVNWLFXO.js.map +0 -1
- package/dist/chunk-QUPBU4KV.js +0 -131
- package/dist/chunk-QUPBU4KV.js.map +0 -1
- package/dist/utils/action.d.ts +0 -16
- package/dist/utils/action.d.ts.map +0 -1
- package/dist/utils/spinner.d.ts +0 -29
- package/dist/utils/spinner.d.ts.map +0 -1
- package/src/utils/action.ts +0 -43
- package/src/utils/spinner.ts +0 -67
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-sign.d.ts","sourceRoot":"","sources":["../../src/commands/db-sign.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db-sign.d.ts","sourceRoot":"","sources":["../../src/commands/db-sign.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgMpC,wBAAgB,mBAAmB,IAAI,OAAO,CA+E7C"}
|
package/dist/commands/db-sign.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
assertFrameworkComponentsCompatible
|
|
4
|
-
} from "../chunk-CVNWLFXO.js";
|
|
5
|
-
import {
|
|
2
|
+
createProgressAdapter,
|
|
6
3
|
formatCommandHelp,
|
|
7
4
|
formatSchemaVerifyJson,
|
|
8
5
|
formatSchemaVerifyOutput,
|
|
@@ -11,26 +8,133 @@ import {
|
|
|
11
8
|
formatStyledHeader,
|
|
12
9
|
handleResult,
|
|
13
10
|
parseGlobalFlags,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
withSpinner
|
|
17
|
-
} from "../chunk-BZMBKEEQ.js";
|
|
11
|
+
setCommandDescriptions
|
|
12
|
+
} from "../chunk-AGOTG4L3.js";
|
|
18
13
|
import {
|
|
19
14
|
loadConfig
|
|
20
15
|
} from "../chunk-HWYQOCAJ.js";
|
|
21
|
-
|
|
22
|
-
// src/commands/db-sign.ts
|
|
23
|
-
import { readFile } from "fs/promises";
|
|
24
|
-
import { relative, resolve } from "path";
|
|
25
16
|
import {
|
|
26
|
-
|
|
17
|
+
CliStructuredError,
|
|
18
|
+
createControlClient,
|
|
19
|
+
errorContractValidationFailed,
|
|
20
|
+
errorDatabaseConnectionRequired,
|
|
27
21
|
errorDriverRequired,
|
|
28
22
|
errorFileNotFound,
|
|
29
|
-
|
|
23
|
+
errorJsonFormatNotSupported,
|
|
30
24
|
errorUnexpected
|
|
31
|
-
} from "
|
|
32
|
-
|
|
25
|
+
} from "../chunk-VG2R7DGF.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/db-sign.ts
|
|
28
|
+
import { readFile } from "fs/promises";
|
|
29
|
+
import { relative, resolve } from "path";
|
|
30
|
+
import { notOk, ok } from "@prisma-next/utils/result";
|
|
33
31
|
import { Command } from "commander";
|
|
32
|
+
async function executeDbSignCommand(options, flags) {
|
|
33
|
+
const config = await loadConfig(options.config);
|
|
34
|
+
const configPath = options.config ? relative(process.cwd(), resolve(options.config)) : "prisma-next.config.ts";
|
|
35
|
+
const contractPathAbsolute = config.contract?.output ? resolve(config.contract.output) : resolve("src/prisma/contract.json");
|
|
36
|
+
const contractPath = relative(process.cwd(), contractPathAbsolute);
|
|
37
|
+
if (flags.json !== "object" && !flags.quiet) {
|
|
38
|
+
const details = [
|
|
39
|
+
{ label: "config", value: configPath },
|
|
40
|
+
{ label: "contract", value: contractPath }
|
|
41
|
+
];
|
|
42
|
+
if (options.db) {
|
|
43
|
+
details.push({ label: "database", value: options.db });
|
|
44
|
+
}
|
|
45
|
+
const header = formatStyledHeader({
|
|
46
|
+
command: "db sign",
|
|
47
|
+
description: "Sign the database with your contract so you can safely run queries",
|
|
48
|
+
url: "https://pris.ly/db-sign",
|
|
49
|
+
details,
|
|
50
|
+
flags
|
|
51
|
+
});
|
|
52
|
+
console.log(header);
|
|
53
|
+
}
|
|
54
|
+
let contractJsonContent;
|
|
55
|
+
try {
|
|
56
|
+
contractJsonContent = await readFile(contractPathAbsolute, "utf-8");
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (error instanceof Error && error.code === "ENOENT") {
|
|
59
|
+
return notOk(
|
|
60
|
+
errorFileNotFound(contractPathAbsolute, {
|
|
61
|
+
why: `Contract file not found at ${contractPathAbsolute}`,
|
|
62
|
+
fix: `Run \`prisma-next contract emit\` to generate ${contractPath}, or update \`config.contract.output\` in ${configPath}`
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return notOk(
|
|
67
|
+
errorUnexpected(error instanceof Error ? error.message : String(error), {
|
|
68
|
+
why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
let contractJson;
|
|
73
|
+
try {
|
|
74
|
+
contractJson = JSON.parse(contractJsonContent);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return notOk(
|
|
77
|
+
errorContractValidationFailed(
|
|
78
|
+
`Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`,
|
|
79
|
+
{ where: { path: contractPathAbsolute } }
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const dbConnection = options.db ?? config.db?.connection;
|
|
84
|
+
if (!dbConnection) {
|
|
85
|
+
return notOk(
|
|
86
|
+
errorDatabaseConnectionRequired({
|
|
87
|
+
why: `Database connection is required for db sign (set db.connection in ${configPath}, or pass --db <url>)`
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (!config.driver) {
|
|
92
|
+
return notOk(errorDriverRequired({ why: "Config.driver is required for db sign" }));
|
|
93
|
+
}
|
|
94
|
+
const client = createControlClient({
|
|
95
|
+
family: config.family,
|
|
96
|
+
target: config.target,
|
|
97
|
+
adapter: config.adapter,
|
|
98
|
+
driver: config.driver,
|
|
99
|
+
extensionPacks: config.extensionPacks ?? []
|
|
100
|
+
});
|
|
101
|
+
const onProgress = createProgressAdapter({ flags });
|
|
102
|
+
try {
|
|
103
|
+
const schemaVerifyResult = await client.schemaVerify({
|
|
104
|
+
contractIR: contractJson,
|
|
105
|
+
strict: false,
|
|
106
|
+
connection: dbConnection,
|
|
107
|
+
onProgress
|
|
108
|
+
});
|
|
109
|
+
if (!schemaVerifyResult.ok) {
|
|
110
|
+
if (!flags.quiet && flags.json !== "object" && process.stdout.isTTY) {
|
|
111
|
+
console.log("");
|
|
112
|
+
}
|
|
113
|
+
return notOk(schemaVerifyResult);
|
|
114
|
+
}
|
|
115
|
+
const signResult = await client.sign({
|
|
116
|
+
contractIR: contractJson,
|
|
117
|
+
contractPath,
|
|
118
|
+
configPath,
|
|
119
|
+
onProgress
|
|
120
|
+
});
|
|
121
|
+
if (!flags.quiet && flags.json !== "object" && process.stdout.isTTY) {
|
|
122
|
+
console.log("");
|
|
123
|
+
}
|
|
124
|
+
return ok(signResult);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof CliStructuredError) {
|
|
127
|
+
return notOk(error);
|
|
128
|
+
}
|
|
129
|
+
return notOk(
|
|
130
|
+
errorUnexpected(error instanceof Error ? error.message : String(error), {
|
|
131
|
+
why: `Unexpected error during db sign: ${error instanceof Error ? error.message : String(error)}`
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
} finally {
|
|
135
|
+
await client.close();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
34
138
|
function createDbSignCommand() {
|
|
35
139
|
const command = new Command("sign");
|
|
36
140
|
setCommandDescriptions(
|
|
@@ -43,149 +147,45 @@ function createDbSignCommand() {
|
|
|
43
147
|
const flags = parseGlobalFlags({});
|
|
44
148
|
return formatCommandHelp({ command: cmd, flags });
|
|
45
149
|
}
|
|
46
|
-
}).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--json [format]", "Output as JSON (object
|
|
150
|
+
}).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--json [format]", "Output as JSON (object)", false).option("-q, --quiet", "Quiet mode: errors only").option("-v, --verbose", "Verbose output: debug info, timings").option("-vv, --trace", "Trace output: deep internals, stack traces").option("--timestamps", "Add timestamps to output").option("--color", "Force color output").option("--no-color", "Disable color output").action(async (options) => {
|
|
47
151
|
const flags = parseGlobalFlags(options);
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const contractPathAbsolute = config.contract?.output ? resolve(config.contract.output) : resolve("src/prisma/contract.json");
|
|
52
|
-
const contractPath = relative(process.cwd(), contractPathAbsolute);
|
|
53
|
-
if (flags.json !== "object" && !flags.quiet) {
|
|
54
|
-
const details = [
|
|
55
|
-
{ label: "config", value: configPath },
|
|
56
|
-
{ label: "contract", value: contractPath }
|
|
57
|
-
];
|
|
58
|
-
if (options.db) {
|
|
59
|
-
details.push({ label: "database", value: options.db });
|
|
60
|
-
}
|
|
61
|
-
const header = formatStyledHeader({
|
|
152
|
+
if (flags.json === "ndjson") {
|
|
153
|
+
const result2 = notOk(
|
|
154
|
+
errorJsonFormatNotSupported({
|
|
62
155
|
command: "db sign",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
flags
|
|
67
|
-
});
|
|
68
|
-
console.log(header);
|
|
69
|
-
}
|
|
70
|
-
let contractJsonContent;
|
|
71
|
-
try {
|
|
72
|
-
contractJsonContent = await readFile(contractPathAbsolute, "utf-8");
|
|
73
|
-
} catch (error) {
|
|
74
|
-
if (error instanceof Error && error.code === "ENOENT") {
|
|
75
|
-
throw errorFileNotFound(contractPathAbsolute, {
|
|
76
|
-
why: `Contract file not found at ${contractPathAbsolute}`
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
throw errorUnexpected(error instanceof Error ? error.message : String(error), {
|
|
80
|
-
why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const contractJson = JSON.parse(contractJsonContent);
|
|
84
|
-
const dbUrl = options.db ?? config.db?.url;
|
|
85
|
-
if (!dbUrl) {
|
|
86
|
-
throw errorDatabaseUrlRequired();
|
|
87
|
-
}
|
|
88
|
-
if (!config.driver) {
|
|
89
|
-
throw errorDriverRequired();
|
|
90
|
-
}
|
|
91
|
-
const driverDescriptor = config.driver;
|
|
92
|
-
const stack = createControlPlaneStack({
|
|
93
|
-
target: config.target,
|
|
94
|
-
adapter: config.adapter,
|
|
95
|
-
driver: driverDescriptor,
|
|
96
|
-
extensionPacks: config.extensionPacks
|
|
97
|
-
});
|
|
98
|
-
const familyInstance = config.family.create(stack);
|
|
99
|
-
const contractIR = familyInstance.validateContractIR(contractJson);
|
|
100
|
-
assertContractRequirementsSatisfied({ contract: contractIR, stack });
|
|
101
|
-
const rawComponents = [config.target, config.adapter, ...config.extensionPacks ?? []];
|
|
102
|
-
const frameworkComponents = assertFrameworkComponentsCompatible(
|
|
103
|
-
config.family.familyId,
|
|
104
|
-
config.target.targetId,
|
|
105
|
-
rawComponents
|
|
156
|
+
format: "ndjson",
|
|
157
|
+
supportedFormats: ["object"]
|
|
158
|
+
})
|
|
106
159
|
);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
frameworkComponents
|
|
119
|
-
}),
|
|
120
|
-
{
|
|
121
|
-
message: "Verifying database satisfies contract",
|
|
122
|
-
flags
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
} catch (error) {
|
|
126
|
-
throw errorRuntime(error instanceof Error ? error.message : String(error), {
|
|
127
|
-
why: `Failed to verify database schema: ${error instanceof Error ? error.message : String(error)}`
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
if (!schemaVerifyResult.ok) {
|
|
131
|
-
return { schemaVerifyResult, signResult: void 0 };
|
|
132
|
-
}
|
|
133
|
-
let signResult;
|
|
134
|
-
try {
|
|
135
|
-
signResult = await withSpinner(
|
|
136
|
-
() => familyInstance.sign({
|
|
137
|
-
driver,
|
|
138
|
-
contractIR,
|
|
139
|
-
contractPath: contractPathAbsolute,
|
|
140
|
-
configPath
|
|
141
|
-
}),
|
|
142
|
-
{
|
|
143
|
-
message: "Signing database...",
|
|
144
|
-
flags
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
} catch (error) {
|
|
148
|
-
throw errorRuntime(error instanceof Error ? error.message : String(error), {
|
|
149
|
-
why: `Failed to sign database: ${error instanceof Error ? error.message : String(error)}`
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
if (!flags.quiet && flags.json !== "object" && process.stdout.isTTY) {
|
|
153
|
-
console.log("");
|
|
154
|
-
}
|
|
155
|
-
return { schemaVerifyResult: void 0, signResult };
|
|
156
|
-
} finally {
|
|
157
|
-
await driver.close();
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
const exitCode = handleResult(result, flags, (value) => {
|
|
161
|
-
const { schemaVerifyResult, signResult } = value;
|
|
162
|
-
if (schemaVerifyResult && !schemaVerifyResult.ok) {
|
|
163
|
-
if (flags.json === "object") {
|
|
164
|
-
console.log(formatSchemaVerifyJson(schemaVerifyResult));
|
|
165
|
-
} else {
|
|
166
|
-
const output = formatSchemaVerifyOutput(schemaVerifyResult, flags);
|
|
167
|
-
if (output) {
|
|
168
|
-
console.log(output);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (signResult) {
|
|
174
|
-
if (flags.json === "object") {
|
|
175
|
-
console.log(formatSignJson(signResult));
|
|
176
|
-
} else {
|
|
177
|
-
const output = formatSignOutput(signResult, flags);
|
|
178
|
-
if (output) {
|
|
179
|
-
console.log(output);
|
|
180
|
-
}
|
|
160
|
+
const exitCode = handleResult(result2, flags);
|
|
161
|
+
process.exit(exitCode);
|
|
162
|
+
}
|
|
163
|
+
const result = await executeDbSignCommand(options, flags);
|
|
164
|
+
if (result.ok) {
|
|
165
|
+
if (flags.json === "object") {
|
|
166
|
+
console.log(formatSignJson(result.value));
|
|
167
|
+
} else {
|
|
168
|
+
const output = formatSignOutput(result.value, flags);
|
|
169
|
+
if (output) {
|
|
170
|
+
console.log(output);
|
|
181
171
|
}
|
|
182
172
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
173
|
+
process.exit(0);
|
|
174
|
+
}
|
|
175
|
+
const failure = result.failure;
|
|
176
|
+
if (failure instanceof CliStructuredError) {
|
|
177
|
+
const exitCode = handleResult(result, flags);
|
|
187
178
|
process.exit(exitCode);
|
|
188
179
|
}
|
|
180
|
+
if (flags.json === "object") {
|
|
181
|
+
console.log(formatSchemaVerifyJson(failure));
|
|
182
|
+
} else {
|
|
183
|
+
const output = formatSchemaVerifyOutput(failure, flags);
|
|
184
|
+
if (output) {
|
|
185
|
+
console.log(output);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
process.exit(1);
|
|
189
189
|
});
|
|
190
190
|
return command;
|
|
191
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/db-sign.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport {\n errorDatabaseUrlRequired,\n errorDriverRequired,\n errorFileNotFound,\n errorRuntime,\n errorUnexpected,\n} from '@prisma-next/core-control-plane/errors';\nimport type {\n SignDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/core-control-plane/types';\nimport { createControlPlaneStack } from '@prisma-next/core-control-plane/types';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport { performAction } from '../utils/action';\nimport { setCommandDescriptions } from '../utils/command-helpers';\nimport {\n assertContractRequirementsSatisfied,\n assertFrameworkComponentsCompatible,\n} from '../utils/framework-components';\nimport { parseGlobalFlags } from '../utils/global-flags';\nimport {\n formatCommandHelp,\n formatSchemaVerifyJson,\n formatSchemaVerifyOutput,\n formatSignJson,\n formatSignOutput,\n formatStyledHeader,\n} from '../utils/output';\nimport { handleResult } from '../utils/result-handler';\nimport { withSpinner } from '../utils/spinner';\n\ninterface DbSignOptions {\n readonly db?: string;\n readonly config?: string;\n readonly json?: string | boolean;\n readonly quiet?: boolean;\n readonly q?: boolean;\n readonly verbose?: boolean;\n readonly v?: boolean;\n readonly vv?: boolean;\n readonly trace?: boolean;\n readonly timestamps?: boolean;\n readonly color?: boolean;\n readonly 'no-color'?: boolean;\n}\n\nexport function createDbSignCommand(): Command {\n const command = new Command('sign');\n setCommandDescriptions(\n command,\n 'Sign the database with your contract so you can safely run queries',\n 'Verifies that your database schema satisfies the emitted contract, and if so, writes or\\n' +\n 'updates the contract marker in the database. This command is idempotent and safe to run\\n' +\n 'in CI/deployment pipelines. The marker records that this database instance is aligned\\n' +\n 'with a specific contract version.',\n );\n command\n .configureHelp({\n formatHelp: (cmd) => {\n const flags = parseGlobalFlags({});\n return formatCommandHelp({ command: cmd, flags });\n },\n })\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--json [format]', 'Output as JSON (object or ndjson)', false)\n .option('-q, --quiet', 'Quiet mode: errors only')\n .option('-v, --verbose', 'Verbose output: debug info, timings')\n .option('-vv, --trace', 'Trace output: deep internals, stack traces')\n .option('--timestamps', 'Add timestamps to output')\n .option('--color', 'Force color output')\n .option('--no-color', 'Disable color output')\n .action(async (options: DbSignOptions) => {\n const flags = parseGlobalFlags(options);\n\n const result = await performAction(async () => {\n // Load config (file I/O)\n const config = await loadConfig(options.config);\n // Normalize config path for display (match contract path format - no ./ prefix)\n const configPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n const contractPathAbsolute = config.contract?.output\n ? resolve(config.contract.output)\n : resolve('src/prisma/contract.json');\n // Convert to relative path for display\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n // Output header (only for human-readable output)\n if (flags.json !== 'object' && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n ];\n if (options.db) {\n details.push({ label: 'database', value: options.db });\n }\n const header = formatStyledHeader({\n command: 'db sign',\n description: 'Sign the database with your contract so you can safely run queries',\n url: 'https://pris.ly/db-sign',\n details,\n flags,\n });\n console.log(header);\n }\n\n // Load contract file (file I/O)\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as { code?: string }).code === 'ENOENT') {\n throw errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n });\n }\n throw errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n const contractJson = JSON.parse(contractJsonContent) as Record<string, unknown>;\n\n // Resolve database URL\n const dbUrl = options.db ?? config.db?.url;\n if (!dbUrl) {\n throw errorDatabaseUrlRequired();\n }\n\n // Check for driver\n if (!config.driver) {\n throw errorDriverRequired();\n }\n\n // Store driver descriptor after null check\n const driverDescriptor = config.driver;\n\n // Create family instance (needed for contract validation - no DB connection required)\n const stack = createControlPlaneStack({\n target: config.target,\n adapter: config.adapter,\n driver: driverDescriptor,\n extensionPacks: config.extensionPacks,\n });\n const familyInstance = config.family.create(stack);\n\n // Validate contract using instance validator (fail-fast before DB connection)\n const contractIR = familyInstance.validateContractIR(contractJson);\n assertContractRequirementsSatisfied({ contract: contractIR, stack });\n\n const rawComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];\n const frameworkComponents = assertFrameworkComponentsCompatible(\n config.family.familyId,\n config.target.targetId,\n rawComponents,\n );\n\n // Create driver (expensive operation - done after validation)\n const driver = await driverDescriptor.create(dbUrl);\n\n try {\n // Schema verification precondition with spinner\n let schemaVerifyResult: VerifyDatabaseSchemaResult;\n try {\n schemaVerifyResult = await withSpinner(\n () =>\n familyInstance.schemaVerify({\n driver,\n contractIR,\n strict: false,\n contractPath: contractPathAbsolute,\n configPath,\n frameworkComponents,\n }),\n {\n message: 'Verifying database satisfies contract',\n flags,\n },\n );\n } catch (error) {\n // Wrap errors from schemaVerify() in structured error\n throw errorRuntime(error instanceof Error ? error.message : String(error), {\n why: `Failed to verify database schema: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n // If schema verification failed, return both results for handling outside performAction\n if (!schemaVerifyResult.ok) {\n return { schemaVerifyResult, signResult: undefined };\n }\n\n // Schema verification passed - proceed with signing\n let signResult: SignDatabaseResult;\n try {\n signResult = await withSpinner(\n () =>\n familyInstance.sign({\n driver,\n contractIR,\n contractPath: contractPathAbsolute,\n configPath,\n }),\n {\n message: 'Signing database...',\n flags,\n },\n );\n } catch (error) {\n // Wrap errors from sign() in structured error\n throw errorRuntime(error instanceof Error ? error.message : String(error), {\n why: `Failed to sign database: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n // Add blank line after all async operations if spinners were shown\n if (!flags.quiet && flags.json !== 'object' && process.stdout.isTTY) {\n console.log('');\n }\n\n return { schemaVerifyResult: undefined, signResult };\n } finally {\n // Ensure driver connection is closed\n await driver.close();\n }\n });\n\n // Handle result - formats output and returns exit code\n const exitCode = handleResult(result, flags, (value) => {\n const { schemaVerifyResult, signResult } = value;\n\n // If schema verification failed, format and print schema verification output\n if (schemaVerifyResult && !schemaVerifyResult.ok) {\n if (flags.json === 'object') {\n console.log(formatSchemaVerifyJson(schemaVerifyResult));\n } else {\n const output = formatSchemaVerifyOutput(schemaVerifyResult, flags);\n if (output) {\n console.log(output);\n }\n }\n // Don't proceed to sign output formatting\n return;\n }\n\n // Schema verification passed - format sign output\n if (signResult) {\n if (flags.json === 'object') {\n console.log(formatSignJson(signResult));\n } else {\n const output = formatSignOutput(signResult, flags);\n if (output) {\n console.log(output);\n }\n }\n }\n });\n\n // For logical schema mismatches, check if schema verification passed\n // Infra errors already handled by handleResult (returns non-zero exit code)\n if (result.ok && result.value.schemaVerifyResult && !result.value.schemaVerifyResult.ok) {\n // Schema verification failed - exit with code 1\n process.exit(1);\n } else {\n // Success or infra error - use exit code from handleResult\n process.exit(exitCode);\n }\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,UAAU,eAAe;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,+BAA+B;AACxC,SAAS,eAAe;AAmCjB,SAAS,sBAA+B;AAC7C,QAAM,UAAU,IAAI,QAAQ,MAAM;AAClC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAIF;AACA,UACG,cAAc;AAAA,IACb,YAAY,CAAC,QAAQ;AACnB,YAAM,QAAQ,iBAAiB,CAAC,CAAC;AACjC,aAAO,kBAAkB,EAAE,SAAS,KAAK,MAAM,CAAC;AAAA,IAClD;AAAA,EACF,CAAC,EACA,OAAO,cAAc,4BAA4B,EACjD,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,mBAAmB,qCAAqC,KAAK,EACpE,OAAO,eAAe,yBAAyB,EAC/C,OAAO,iBAAiB,qCAAqC,EAC7D,OAAO,gBAAgB,4CAA4C,EACnE,OAAO,gBAAgB,0BAA0B,EACjD,OAAO,WAAW,oB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AO,MAAM,mBAAmB,IAAI;AAEvF,cAAQ,KAAK,CAAC;AAAA,IAChB,OAAO;AAEL,cAAQ,KAAK,QAAQ;AAAA,IACvB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/db-sign.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport type {\n SignDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/core-control-plane/types';\nimport { notOk, ok, type Result } from '@prisma-next/utils/result';\nimport { Command } from 'commander';\nimport { loadConfig } from '../config-loader';\nimport { createControlClient } from '../control-api/client';\nimport {\n CliStructuredError,\n errorContractValidationFailed,\n errorDatabaseConnectionRequired,\n errorDriverRequired,\n errorFileNotFound,\n errorJsonFormatNotSupported,\n errorUnexpected,\n} from '../utils/cli-errors';\nimport { setCommandDescriptions } from '../utils/command-helpers';\nimport { type GlobalFlags, parseGlobalFlags } from '../utils/global-flags';\nimport {\n formatCommandHelp,\n formatSchemaVerifyJson,\n formatSchemaVerifyOutput,\n formatSignJson,\n formatSignOutput,\n formatStyledHeader,\n} from '../utils/output';\nimport { createProgressAdapter } from '../utils/progress-adapter';\nimport { handleResult } from '../utils/result-handler';\n\ninterface DbSignOptions {\n readonly db?: string;\n readonly config?: string;\n readonly json?: string | boolean;\n readonly quiet?: boolean;\n readonly q?: boolean;\n readonly verbose?: boolean;\n readonly v?: boolean;\n readonly vv?: boolean;\n readonly trace?: boolean;\n readonly timestamps?: boolean;\n readonly color?: boolean;\n readonly 'no-color'?: boolean;\n}\n\n/**\n * Failure type for db sign command.\n * Either an infrastructure error (CliStructuredError) or a logical failure (schema verification failed).\n */\ntype DbSignFailure = CliStructuredError | VerifyDatabaseSchemaResult;\n\n/**\n * Executes the db sign command and returns a structured Result.\n * Success: SignDatabaseResult (sign happened)\n * Failure: CliStructuredError (infra error) or VerifyDatabaseSchemaResult (schema mismatch)\n */\nasync function executeDbSignCommand(\n options: DbSignOptions,\n flags: GlobalFlags,\n): Promise<Result<SignDatabaseResult, DbSignFailure>> {\n // Load config\n const config = await loadConfig(options.config);\n const configPath = options.config\n ? relative(process.cwd(), resolve(options.config))\n : 'prisma-next.config.ts';\n const contractPathAbsolute = config.contract?.output\n ? resolve(config.contract.output)\n : resolve('src/prisma/contract.json');\n const contractPath = relative(process.cwd(), contractPathAbsolute);\n\n // Output header\n if (flags.json !== 'object' && !flags.quiet) {\n const details: Array<{ label: string; value: string }> = [\n { label: 'config', value: configPath },\n { label: 'contract', value: contractPath },\n ];\n if (options.db) {\n details.push({ label: 'database', value: options.db });\n }\n const header = formatStyledHeader({\n command: 'db sign',\n description: 'Sign the database with your contract so you can safely run queries',\n url: 'https://pris.ly/db-sign',\n details,\n flags,\n });\n console.log(header);\n }\n\n // Load contract file\n let contractJsonContent: string;\n try {\n contractJsonContent = await readFile(contractPathAbsolute, 'utf-8');\n } catch (error) {\n if (error instanceof Error && (error as { code?: string }).code === 'ENOENT') {\n return notOk(\n errorFileNotFound(contractPathAbsolute, {\n why: `Contract file not found at ${contractPathAbsolute}`,\n fix: `Run \\`prisma-next contract emit\\` to generate ${contractPath}, or update \\`config.contract.output\\` in ${configPath}`,\n }),\n );\n }\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n }\n\n let contractJson: Record<string, unknown>;\n try {\n contractJson = JSON.parse(contractJsonContent) as Record<string, unknown>;\n } catch (error) {\n return notOk(\n errorContractValidationFailed(\n `Contract JSON is invalid: ${error instanceof Error ? error.message : String(error)}`,\n { where: { path: contractPathAbsolute } },\n ),\n );\n }\n\n // Resolve database connection (--db flag or config.db.connection)\n const dbConnection = options.db ?? config.db?.connection;\n if (!dbConnection) {\n return notOk(\n errorDatabaseConnectionRequired({\n why: `Database connection is required for db sign (set db.connection in ${configPath}, or pass --db <url>)`,\n }),\n );\n }\n\n // Check for driver\n if (!config.driver) {\n return notOk(errorDriverRequired({ why: 'Config.driver is required for db sign' }));\n }\n\n // Create control client\n const client = createControlClient({\n family: config.family,\n target: config.target,\n adapter: config.adapter,\n driver: config.driver,\n extensionPacks: config.extensionPacks ?? [],\n });\n\n // Create progress adapter\n const onProgress = createProgressAdapter({ flags });\n\n try {\n // Step 1: Schema verification - connect here\n const schemaVerifyResult = await client.schemaVerify({\n contractIR: contractJson,\n strict: false,\n connection: dbConnection,\n onProgress,\n });\n\n // If schema verification failed, return as failure\n if (!schemaVerifyResult.ok) {\n // Add blank line after all async operations if spinners were shown\n if (!flags.quiet && flags.json !== 'object' && process.stdout.isTTY) {\n console.log('');\n }\n return notOk(schemaVerifyResult);\n }\n\n // Step 2: Sign (already connected from schemaVerify)\n const signResult = await client.sign({\n contractIR: contractJson,\n contractPath,\n configPath,\n onProgress,\n });\n\n // Add blank line after all async operations if spinners were shown\n if (!flags.quiet && flags.json !== 'object' && process.stdout.isTTY) {\n console.log('');\n }\n\n return ok(signResult);\n } catch (error) {\n // Driver already throws CliStructuredError for connection failures\n if (error instanceof CliStructuredError) {\n return notOk(error);\n }\n\n // Wrap unexpected errors\n return notOk(\n errorUnexpected(error instanceof Error ? error.message : String(error), {\n why: `Unexpected error during db sign: ${error instanceof Error ? error.message : String(error)}`,\n }),\n );\n } finally {\n await client.close();\n }\n}\n\nexport function createDbSignCommand(): Command {\n const command = new Command('sign');\n setCommandDescriptions(\n command,\n 'Sign the database with your contract so you can safely run queries',\n 'Verifies that your database schema satisfies the emitted contract, and if so, writes or\\n' +\n 'updates the contract marker in the database. This command is idempotent and safe to run\\n' +\n 'in CI/deployment pipelines. The marker records that this database instance is aligned\\n' +\n 'with a specific contract version.',\n );\n command\n .configureHelp({\n formatHelp: (cmd) => {\n const flags = parseGlobalFlags({});\n return formatCommandHelp({ command: cmd, flags });\n },\n })\n .option('--db <url>', 'Database connection string')\n .option('--config <path>', 'Path to prisma-next.config.ts')\n .option('--json [format]', 'Output as JSON (object)', false)\n .option('-q, --quiet', 'Quiet mode: errors only')\n .option('-v, --verbose', 'Verbose output: debug info, timings')\n .option('-vv, --trace', 'Trace output: deep internals, stack traces')\n .option('--timestamps', 'Add timestamps to output')\n .option('--color', 'Force color output')\n .option('--no-color', 'Disable color output')\n .action(async (options: DbSignOptions) => {\n const flags = parseGlobalFlags(options);\n\n // Validate JSON format option\n if (flags.json === 'ndjson') {\n const result = notOk(\n errorJsonFormatNotSupported({\n command: 'db sign',\n format: 'ndjson',\n supportedFormats: ['object'],\n }),\n );\n const exitCode = handleResult(result, flags);\n process.exit(exitCode);\n }\n\n const result = await executeDbSignCommand(options, flags);\n\n if (result.ok) {\n // Success - format sign output\n if (flags.json === 'object') {\n console.log(formatSignJson(result.value));\n } else {\n const output = formatSignOutput(result.value, flags);\n if (output) {\n console.log(output);\n }\n }\n process.exit(0);\n }\n\n // Failure - determine type and handle appropriately\n const failure = result.failure;\n\n if (failure instanceof CliStructuredError) {\n // Infrastructure error - use standard handler\n const exitCode = handleResult(result as Result<never, CliStructuredError>, flags);\n process.exit(exitCode);\n }\n\n // Schema verification failed - format and print schema verification output\n if (flags.json === 'object') {\n console.log(formatSchemaVerifyJson(failure));\n } else {\n const output = formatSchemaVerifyOutput(failure, flags);\n if (output) {\n console.log(output);\n }\n }\n process.exit(1);\n });\n\n return command;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,UAAU,eAAe;AAKlC,SAAS,OAAO,UAAuB;AACvC,SAAS,eAAe;AAmDxB,eAAe,qBACb,SACA,OACoD;AAEpD,QAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;AAC9C,QAAM,aAAa,QAAQ,SACvB,SAAS,QAAQ,IAAI,GAAG,QAAQ,QAAQ,MAAM,CAAC,IAC/C;AACJ,QAAM,uBAAuB,OAAO,UAAU,SAC1C,QAAQ,OAAO,SAAS,MAAM,IAC9B,QAAQ,0BAA0B;AACtC,QAAM,eAAe,SAAS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AA,IAChB;AAGA,UAAM,UAAU,OAAO;AAEvB,QAAI,mBAAmB,oBAAoB;AAEzC,YAAM,WAAW,aAAa,QAA6C,KAAK;AAChF,cAAQ,KAAK,QAAQ;AAAA,IACvB;AAGA,QAAI,MAAM,SAAS,UAAU;AAC3B,cAAQ,IAAI,uBAAuB,OAAO,CAAC;AAAA,IAC7C,OAAO;AACL,YAAM,SAAS,yBAAyB,SAAS,KAAK;AACtD,UAAI,QAAQ;AACV,gBAAQ,IAAI,MAAM;AAAA,MACpB;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAEH,SAAO;AACT;","names":["result"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-verify.d.ts","sourceRoot":"","sources":["../../src/commands/db-verify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db-verify.d.ts","sourceRoot":"","sources":["../../src/commands/db-verify.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqMpC,wBAAgB,qBAAqB,IAAI,OAAO,CAwD/C"}
|