@prisma-next/cli 0.14.0 → 0.15.0-dev.10
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 +2 -2
- package/dist/cli.mjs +33 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-CJzuo5wX.mjs → client-DwOyZz0a.mjs} +141 -123
- package/dist/client-DwOyZz0a.mjs.map +1 -0
- package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-CNwURRf9.mjs} +30 -11
- package/dist/command-helpers-CNwURRf9.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +5 -5
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +37 -38
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +9 -9
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.d.mts +6 -6
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +4 -4
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +4 -4
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-BHbY04pl.mjs} +2 -2
- package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-BHbY04pl.mjs.map} +1 -1
- package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-BeidkyUC.mjs} +9 -11
- package/dist/contract-emit-BeidkyUC.mjs.map +1 -0
- package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-IQBYv351.mjs} +6 -6
- package/dist/contract-emit-IQBYv351.mjs.map +1 -0
- package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-B3Wq2cu1.mjs} +3 -3
- package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-B3Wq2cu1.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-BirzMmW1.mjs} +63 -5
- package/dist/contract-space-aggregate-loader-BirzMmW1.mjs.map +1 -0
- package/dist/{db-verify-C24FKhb7.mjs → db-verify-DpRrecs7.mjs} +57 -61
- package/dist/db-verify-DpRrecs7.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +3 -3
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.d.mts +5 -1
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +4 -3
- package/dist/exports/index.mjs.map +1 -1
- package/dist/format-CaCF63ld.mjs +102 -0
- package/dist/format-CaCF63ld.mjs.map +1 -0
- package/dist/{framework-components-YVQHhPH7.mjs → framework-components-CnBcJDmF.mjs} +2 -2
- package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-CnBcJDmF.mjs.map} +1 -1
- package/dist/{init-0HwB-Vh8.mjs → init-Boa0LzeJ.mjs} +27 -19
- package/dist/init-Boa0LzeJ.mjs.map +1 -0
- package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-CldSQjVI.mjs} +4 -4
- package/dist/inspect-live-schema-CldSQjVI.mjs.map +1 -0
- package/dist/{migration-check-VwM8xCZV.mjs → migration-check-CGtYnR9k.mjs} +10 -11
- package/dist/migration-check-CGtYnR9k.mjs.map +1 -0
- package/dist/migration-cli.mjs +1 -1
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-B3m-MMAx.mjs} +4 -4
- package/dist/migration-command-scaffold-B3m-MMAx.mjs.map +1 -0
- package/dist/{migration-graph-command-render-CEez7YUK.mjs → migration-graph-command-render-B83xrnNy.mjs} +24 -24
- package/dist/{migration-graph-command-render-CEez7YUK.mjs.map → migration-graph-command-render-B83xrnNy.mjs.map} +1 -1
- package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-DBU6Pneg.mjs} +16 -16
- package/dist/migration-list-DBU6Pneg.mjs.map +1 -0
- package/dist/{migration-log-CG0qQAFm.mjs → migration-log-BYngyvXa.mjs} +5 -5
- package/dist/migration-log-BYngyvXa.mjs.map +1 -0
- package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-DQa4Caoc.mjs} +2 -2
- package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-DQa4Caoc.mjs.map} +1 -1
- package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-D6bHpCzE.mjs} +30 -30
- package/dist/migration-plan-D6bHpCzE.mjs.map +1 -0
- package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-CpQ5UhcU.mjs} +14 -14
- package/dist/migration-status-CpQ5UhcU.mjs.map +1 -0
- package/dist/{telemetry-BIM4beEO.mjs → telemetry-BQJ_XHa9.mjs} +2 -2
- package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-BQJ_XHa9.mjs.map} +1 -1
- package/dist/{types-C_tYiJYx.d.mts → types-DFoqNIcQ.d.mts} +27 -21
- package/dist/types-DFoqNIcQ.d.mts.map +1 -0
- package/dist/{verify-DcOYZ1tH.mjs → verify-CInGyt4U.mjs} +58 -159
- package/dist/verify-CInGyt4U.mjs.map +1 -0
- package/package.json +28 -30
- package/src/cli.ts +7 -0
- package/src/commands/contract-emit.ts +1 -1
- package/src/commands/db-sign.ts +1 -1
- package/src/commands/db-verify.ts +34 -20
- package/src/commands/format.ts +75 -0
- package/src/commands/init/detect-package-manager.ts +8 -4
- package/src/commands/init/hygiene-package-scripts.ts +16 -3
- package/src/commands/inspect-live-schema.ts +1 -1
- package/src/commands/lsp.ts +32 -0
- package/src/commands/migrate.ts +47 -44
- package/src/commands/migration-check.ts +6 -6
- package/src/commands/migration-graph.ts +5 -5
- package/src/commands/migration-list.ts +13 -13
- package/src/commands/migration-log.ts +1 -1
- package/src/commands/migration-new.ts +1 -1
- package/src/commands/migration-plan.ts +15 -4
- package/src/commands/migration-show.ts +1 -1
- package/src/commands/migration-status.ts +10 -10
- package/src/commands/ref.ts +1 -1
- package/src/control-api/client.ts +8 -23
- package/src/control-api/operations/contract-emit.ts +9 -27
- package/src/control-api/operations/db-init.ts +2 -2
- package/src/control-api/operations/db-run.ts +18 -17
- package/src/control-api/operations/db-verify.ts +52 -44
- package/src/control-api/operations/format.ts +98 -0
- package/src/control-api/operations/migrate.ts +139 -95
- package/src/control-api/operations/run-migration.ts +6 -5
- package/src/control-api/types.ts +8 -8
- package/src/exports/index.ts +1 -0
- package/src/migration-cli.ts +1 -1
- package/src/utils/cli-errors.ts +14 -1
- package/src/utils/combine-verify-results.ts +94 -0
- package/src/utils/extension-pack-inputs.ts +1 -1
- package/src/utils/formatters/errors.ts +34 -5
- package/src/utils/formatters/verify.ts +89 -227
- package/src/utils/migration-command-scaffold.ts +1 -1
- package/src/utils/plan-resolution.ts +18 -18
- package/dist/client-CJzuo5wX.mjs.map +0 -1
- package/dist/command-helpers-DGMvGBeX.mjs.map +0 -1
- package/dist/config-loader-p9JMrekQ.mjs +0 -88
- package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
- package/dist/config-loader.d.mts +0 -16
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/config-loader.mjs +0 -2
- package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
- package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-ClI1KN6d.mjs.map +0 -1
- package/dist/db-verify-C24FKhb7.mjs.map +0 -1
- package/dist/extension-pack-inputs-1ySHqxKG.mjs +0 -62
- package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +0 -1
- package/dist/init-0HwB-Vh8.mjs.map +0 -1
- package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
- package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
- package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
- package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
- package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
- package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
- package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
- package/dist/types-C_tYiJYx.d.mts.map +0 -1
- package/dist/verify-DcOYZ1tH.mjs.map +0 -1
- package/src/config-loader.ts +0 -92
- package/src/config-path-validation.ts +0 -74
- package/src/utils/combine-schema-results.ts +0 -84
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ContractSourceProvider,
|
|
3
|
-
normalizeContractConfig,
|
|
4
|
-
type PrismaNextConfig,
|
|
5
|
-
} from '@prisma-next/config/config-types';
|
|
6
|
-
import { ConfigValidationError } from '@prisma-next/config/config-validation';
|
|
7
|
-
import { getEmittedArtifactPaths } from '@prisma-next/emitter';
|
|
8
|
-
import { resolve } from 'pathe';
|
|
9
|
-
|
|
10
|
-
function throwValidation(field: string, why: string): never {
|
|
11
|
-
throw new ConfigValidationError(field, why);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function finalizeContractSource(
|
|
15
|
-
source: ContractSourceProvider,
|
|
16
|
-
configDir: string,
|
|
17
|
-
): ContractSourceProvider {
|
|
18
|
-
const resolvedInputs = source.inputs?.map((input) => resolve(configDir, input));
|
|
19
|
-
if (resolvedInputs === undefined) {
|
|
20
|
-
return source;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
...source,
|
|
25
|
-
inputs: resolvedInputs,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function validateNoOutputsAreInputs(
|
|
30
|
-
inputs: readonly string[] | undefined,
|
|
31
|
-
output: string | undefined,
|
|
32
|
-
): void {
|
|
33
|
-
if (inputs === undefined || output === undefined) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let emittedArtifactPaths: ReturnType<typeof getEmittedArtifactPaths>;
|
|
38
|
-
try {
|
|
39
|
-
emittedArtifactPaths = getEmittedArtifactPaths(output);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
throwValidation('contract.output', error instanceof Error ? error.message : String(error));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const emittedPaths = new Set([emittedArtifactPaths.jsonPath, emittedArtifactPaths.dtsPath]);
|
|
45
|
-
|
|
46
|
-
for (const input of inputs) {
|
|
47
|
-
if (emittedPaths.has(input)) {
|
|
48
|
-
throwValidation(
|
|
49
|
-
'contract.source.inputs[]',
|
|
50
|
-
'Config.contract.source.inputs must not include emitted artifact paths derived from contract.output',
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function finalizeConfig(config: PrismaNextConfig, configDir: string): PrismaNextConfig {
|
|
57
|
-
if (!config.contract) {
|
|
58
|
-
return config;
|
|
59
|
-
}
|
|
60
|
-
const contract = normalizeContractConfig(config.contract);
|
|
61
|
-
const source = finalizeContractSource(contract.source, configDir);
|
|
62
|
-
const output = resolve(configDir, contract.output);
|
|
63
|
-
|
|
64
|
-
validateNoOutputsAreInputs(source.inputs, output);
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
...config,
|
|
68
|
-
contract: {
|
|
69
|
-
...contract,
|
|
70
|
-
source,
|
|
71
|
-
output,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { VerifyDatabaseSchemaResult } from '@prisma-next/framework-components/control';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Collapse the aggregate verifier's per-space schema results into a
|
|
5
|
-
* single {@link VerifyDatabaseSchemaResult} for the existing CLI
|
|
6
|
-
* display surface. Concatenates issues across members; sums counts;
|
|
7
|
-
* uses the app member's result as the structural envelope (storage
|
|
8
|
-
* hash, target).
|
|
9
|
-
*
|
|
10
|
-
* **Summary policy.** Preserve the per-family phrasing whenever the
|
|
11
|
-
* combined `ok` flag agrees with the app member's `ok` flag — this is
|
|
12
|
-
* the common case (single-family deployments, single-app deployments)
|
|
13
|
-
* and the family's "satisfies / does not satisfy contract" phrasing
|
|
14
|
-
* stays user-visible. When the app passes but an extension fails (or
|
|
15
|
-
* vice versa) the app's summary contradicts the envelope, so fall back
|
|
16
|
-
* to the first failing member's summary. This keeps family phrasing
|
|
17
|
-
* intact and the envelope internally consistent (`ok: false` ↔ failure
|
|
18
|
-
* summary).
|
|
19
|
-
*/
|
|
20
|
-
export function combineSchemaResults(
|
|
21
|
-
perSpace: ReadonlyMap<string, VerifyDatabaseSchemaResult>,
|
|
22
|
-
appSpaceId: string,
|
|
23
|
-
strict: boolean,
|
|
24
|
-
): VerifyDatabaseSchemaResult {
|
|
25
|
-
const appResult = perSpace.get(appSpaceId) ?? perSpace.values().next().value;
|
|
26
|
-
if (appResult === undefined) {
|
|
27
|
-
throw new Error('Aggregate verifier returned no schema results — this is a wiring bug.');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let okAll = true;
|
|
31
|
-
let firstFailure: VerifyDatabaseSchemaResult | undefined;
|
|
32
|
-
let issues: VerifyDatabaseSchemaResult['schema']['issues'] = [];
|
|
33
|
-
const counts = { pass: 0, warn: 0, fail: 0, totalNodes: 0 };
|
|
34
|
-
const childRoots: Array<VerifyDatabaseSchemaResult['schema']['root']> = [];
|
|
35
|
-
for (const [, result] of perSpace) {
|
|
36
|
-
if (!result.ok) {
|
|
37
|
-
okAll = false;
|
|
38
|
-
if (firstFailure === undefined) firstFailure = result;
|
|
39
|
-
}
|
|
40
|
-
issues = [...issues, ...result.schema.issues];
|
|
41
|
-
counts.pass += result.schema.counts.pass;
|
|
42
|
-
counts.warn += result.schema.counts.warn;
|
|
43
|
-
counts.fail += result.schema.counts.fail;
|
|
44
|
-
counts.totalNodes += result.schema.counts.totalNodes;
|
|
45
|
-
childRoots.push(result.schema.root);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// When `okAll !== appResult.ok`, exactly one shape is reachable: app passes
|
|
49
|
-
// (`appResult.ok === true`) and at least one other member failed
|
|
50
|
-
// (`okAll === false`). In that shape the failure was assigned to
|
|
51
|
-
// `firstFailure` during iteration, so non-null assertion is safe. The mirror
|
|
52
|
-
// shape (app fails while every member passes) is impossible because
|
|
53
|
-
// `appResult` either *is* a member of `perSpace` or is the first iterator
|
|
54
|
-
// value; either way its `ok` flag participates in `okAll`.
|
|
55
|
-
const summary =
|
|
56
|
-
okAll === appResult.ok
|
|
57
|
-
? appResult.summary
|
|
58
|
-
: (firstFailure as VerifyDatabaseSchemaResult).summary;
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
ok: okAll,
|
|
62
|
-
...(okAll ? {} : { code: appResult.code ?? 'PN-RUN-3010' }),
|
|
63
|
-
summary,
|
|
64
|
-
contract: appResult.contract,
|
|
65
|
-
target: appResult.target,
|
|
66
|
-
schema: {
|
|
67
|
-
issues,
|
|
68
|
-
root: {
|
|
69
|
-
status: okAll ? 'pass' : 'fail',
|
|
70
|
-
kind: 'aggregate',
|
|
71
|
-
name: 'aggregate',
|
|
72
|
-
contractPath: '',
|
|
73
|
-
code: 'AGGREGATE',
|
|
74
|
-
message: okAll ? 'Aggregate schema matches' : 'Aggregate schema mismatch',
|
|
75
|
-
expected: undefined,
|
|
76
|
-
actual: undefined,
|
|
77
|
-
children: childRoots,
|
|
78
|
-
},
|
|
79
|
-
counts,
|
|
80
|
-
},
|
|
81
|
-
meta: { strict },
|
|
82
|
-
timings: { total: 0 },
|
|
83
|
-
};
|
|
84
|
-
}
|