@prisma-next/cli 0.12.0-dev.6 → 0.12.0-dev.60
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 +180 -163
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-KgJorIvG.mjs → client-DQvxtihf.mjs} +194 -105
- package/dist/client-DQvxtihf.mjs.map +1 -0
- package/dist/{command-helpers-Bbw1GbwL.mjs → command-helpers-CxHSiwEg.mjs} +318 -25
- package/dist/command-helpers-CxHSiwEg.mjs.map +1 -0
- package/dist/commands/contract-emit.d.mts.map +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.d.mts.map +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +4 -5
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.d.mts.map +1 -1
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-schema.mjs.map +1 -1
- package/dist/commands/db-sign.d.mts.map +1 -1
- package/dist/commands/db-sign.mjs +6 -6
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +10 -7
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +37 -3
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +291 -12
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +55 -13
- package/dist/commands/migration-check.d.mts.map +1 -1
- package/dist/commands/migration-check.mjs +3 -2
- package/dist/commands/migration-graph.d.mts +17 -8
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +185 -2
- package/dist/commands/migration-graph.mjs.map +1 -0
- package/dist/commands/migration-list.d.mts +26 -27
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +2 -190
- package/dist/commands/migration-log.d.mts +9 -19
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +1 -137
- package/dist/commands/migration-new.d.mts.map +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 +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.d.mts +17 -21
- package/dist/commands/migration-show.d.mts.map +1 -1
- package/dist/commands/migration-show.mjs +24 -36
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +42 -144
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +3 -759
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.d.mts.map +1 -1
- package/dist/commands/ref.mjs +4 -4
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.d.mts +7 -0
- package/dist/commands/telemetry/index.d.mts.map +1 -0
- package/dist/commands/telemetry/index.mjs +2 -0
- package/dist/{config-loader-B6sJjXTv.mjs → config-loader-p9JMrekQ.mjs} +1 -1
- package/dist/{config-loader-B6sJjXTv.mjs.map → config-loader-p9JMrekQ.mjs.map} +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-at-errors-BxP-TOMl.mjs → contract-at-errors-gBvfOS8r.mjs} +2 -2
- package/dist/{contract-at-errors-BxP-TOMl.mjs.map → contract-at-errors-gBvfOS8r.mjs.map} +1 -1
- package/dist/{contract-emit-DxcGl4Uq.mjs → contract-emit-By59Nmmn.mjs} +5 -5
- package/dist/{contract-emit-DxcGl4Uq.mjs.map → contract-emit-By59Nmmn.mjs.map} +1 -1
- package/dist/{contract-emit-D-4jrNve.mjs → contract-emit-OpMbysHj.mjs} +7 -7
- package/dist/{contract-emit-D-4jrNve.mjs.map → contract-emit-OpMbysHj.mjs.map} +1 -1
- package/dist/{contract-enrichment-a0V5Y_mL.mjs → contract-enrichment-gn9sWbPw.mjs} +1 -1
- package/dist/{contract-enrichment-a0V5Y_mL.mjs.map → contract-enrichment-gn9sWbPw.mjs.map} +1 -1
- package/dist/{contract-infer-D8uEbJuu.mjs → contract-infer-BkyyYGDf.mjs} +3 -3
- package/dist/{contract-infer-D8uEbJuu.mjs.map → contract-infer-BkyyYGDf.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs → contract-space-aggregate-loader-Bup14UkI.mjs} +63 -5
- package/dist/{contract-space-aggregate-loader-DvZwdkrr.mjs.map → contract-space-aggregate-loader-Bup14UkI.mjs.map} +1 -1
- package/dist/{db-verify-v_vUKXTU.mjs → db-verify-DbmfgeYc.mjs} +6 -6
- package/dist/{db-verify-v_vUKXTU.mjs.map → db-verify-DbmfgeYc.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +2 -2
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +3 -3
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/init-output.d.mts +1 -3
- package/dist/exports/init-output.d.mts.map +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-fYXjz_in.mjs → framework-components-CmBpbvzV.mjs} +2 -2
- package/dist/{framework-components-fYXjz_in.mjs.map → framework-components-CmBpbvzV.mjs.map} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts → global-flags-BpoOYtNZ.d.mts} +1 -1
- package/dist/{global-flags-DEHjV8_s.d.mts.map → global-flags-BpoOYtNZ.d.mts.map} +1 -1
- package/dist/{init-Cv9UzWL5.mjs → init-tidQpK21.mjs} +5 -58
- package/dist/init-tidQpK21.mjs.map +1 -0
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs → inspect-live-schema-CUvD_9uF.mjs} +5 -5
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs.map → inspect-live-schema-CUvD_9uF.mjs.map} +1 -1
- package/dist/migration-check-BjNlXTGF.mjs +572 -0
- package/dist/migration-check-BjNlXTGF.mjs.map +1 -0
- package/dist/migration-cli.mjs +1 -1
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-CjvwO6at.mjs → migration-command-scaffold-DWlpBp98.mjs} +5 -5
- package/dist/{migration-command-scaffold-CjvwO6at.mjs.map → migration-command-scaffold-DWlpBp98.mjs.map} +1 -1
- package/dist/migration-graph-space-render-Cpg0ql8v.mjs +2370 -0
- package/dist/migration-graph-space-render-Cpg0ql8v.mjs.map +1 -0
- package/dist/migration-list-zP59uUBC.mjs +230 -0
- package/dist/migration-list-zP59uUBC.mjs.map +1 -0
- package/dist/migration-log-DoytJNuF.mjs +222 -0
- package/dist/migration-log-DoytJNuF.mjs.map +1 -0
- package/dist/migration-path-target-DjbhWi_5.mjs +38 -0
- package/dist/migration-path-target-DjbhWi_5.mjs.map +1 -0
- package/dist/{migration-plan-9DJ7q7_z.mjs → migration-plan-CgCXpjYD.mjs} +6 -7
- package/dist/{migration-plan-9DJ7q7_z.mjs.map → migration-plan-CgCXpjYD.mjs.map} +1 -1
- package/dist/migration-status-ByptVtRZ.mjs +446 -0
- package/dist/migration-status-ByptVtRZ.mjs.map +1 -0
- package/dist/{output-B60Gw5fu.mjs → output-mEQ74_nd.mjs} +1 -1
- package/dist/{output-B60Gw5fu.mjs.map → output-mEQ74_nd.mjs.map} +1 -1
- package/dist/{progress-adapter-C644QK8l.mjs → progress-adapter-CjAeTxY_.mjs} +1 -1
- package/dist/{progress-adapter-C644QK8l.mjs.map → progress-adapter-CjAeTxY_.mjs.map} +1 -1
- package/dist/{ref-advancement-DUZqsue6.mjs → ref-advancement-BkXlikCA.mjs} +1 -1
- package/dist/{ref-advancement-DUZqsue6.mjs.map → ref-advancement-BkXlikCA.mjs.map} +1 -1
- package/dist/schemas-CeGMYFYX.d.mts +191 -0
- package/dist/schemas-CeGMYFYX.d.mts.map +1 -0
- package/dist/schemas-KhXMzNA_.mjs +112 -0
- package/dist/schemas-KhXMzNA_.mjs.map +1 -0
- package/dist/telemetry-DVv3V0gj.mjs +122 -0
- package/dist/telemetry-DVv3V0gj.mjs.map +1 -0
- package/dist/{terminal-ui-5Y6mrg93.d.mts → terminal-ui-DGRNFWna.d.mts} +1 -1
- package/dist/terminal-ui-DGRNFWna.d.mts.map +1 -0
- package/dist/{types-Dt_SfqFm.d.mts → types-BepB6ydp.d.mts} +44 -31
- package/dist/types-BepB6ydp.d.mts.map +1 -0
- package/dist/{verify-DCA9Sldu.mjs → verify-CJpG9m7-.mjs} +2 -2
- package/dist/{verify-DCA9Sldu.mjs.map → verify-CJpG9m7-.mjs.map} +1 -1
- package/package.json +25 -22
- package/src/cli.ts +5 -0
- package/src/commands/db-update.ts +7 -1
- package/src/commands/init/index.ts +6 -35
- package/src/commands/init/init.ts +1 -14
- package/src/commands/init/inputs.ts +0 -75
- package/src/commands/json/schemas.ts +195 -0
- package/src/commands/migrate.ts +518 -8
- package/src/commands/migration-check.ts +469 -134
- package/src/commands/migration-graph.ts +164 -91
- package/src/commands/migration-list.ts +72 -39
- package/src/commands/migration-log.ts +52 -102
- package/src/commands/migration-show.ts +31 -66
- package/src/commands/migration-status-overlay.ts +61 -0
- package/src/commands/migration-status.ts +457 -1067
- package/src/commands/telemetry/index.ts +107 -0
- package/src/commands/telemetry/status.ts +67 -0
- package/src/control-api/client.ts +20 -9
- package/src/control-api/operations/contract-emit.ts +2 -2
- package/src/control-api/operations/db-init.ts +3 -3
- package/src/control-api/operations/{db-apply.ts → db-run.ts} +51 -13
- package/src/control-api/operations/db-update.ts +4 -4
- package/src/control-api/operations/db-verify.ts +15 -5
- package/src/control-api/operations/{migration-apply.ts → migrate.ts} +181 -80
- package/src/control-api/operations/{apply.ts → run-migration.ts} +33 -27
- package/src/control-api/types.ts +46 -29
- package/src/utils/cli-errors.ts +70 -2
- package/src/utils/formatters/errors.ts +11 -0
- package/src/utils/formatters/migration-graph-lane-colors.ts +194 -0
- package/src/utils/formatters/migration-graph-layout.ts +227 -38
- package/src/utils/formatters/migration-graph-rows.ts +128 -15
- package/src/utils/formatters/migration-graph-space-render.ts +148 -0
- package/src/utils/formatters/migration-graph-tree-render.ts +959 -81
- package/src/utils/formatters/migration-list-data-column.ts +4 -91
- package/src/utils/formatters/migration-list-graph-topology.ts +72 -94
- package/src/utils/formatters/migration-list-render.ts +135 -71
- package/src/utils/formatters/migration-list-styler.ts +46 -5
- package/src/utils/formatters/migration-list-types.ts +5 -21
- package/src/utils/formatters/migration-log-table.ts +205 -0
- package/src/utils/formatters/migrations.ts +33 -11
- package/src/utils/global-flags.ts +35 -0
- package/src/utils/integrity-violation-to-check-failure.ts +28 -19
- package/src/utils/legend.ts +38 -0
- package/src/utils/migration-path-target.ts +60 -0
- package/src/utils/telemetry.ts +68 -32
- package/dist/client-KgJorIvG.mjs.map +0 -1
- package/dist/command-helpers-Bbw1GbwL.mjs.map +0 -1
- package/dist/commands/migration-list.mjs.map +0 -1
- package/dist/commands/migration-log.mjs.map +0 -1
- package/dist/commands/migration-status.mjs.map +0 -1
- package/dist/extension-pack-inputs-IDvjRCi3.mjs +0 -62
- package/dist/extension-pack-inputs-IDvjRCi3.mjs.map +0 -1
- package/dist/graph-render-rFAqZujX.mjs +0 -1081
- package/dist/graph-render-rFAqZujX.mjs.map +0 -1
- package/dist/init-Cv9UzWL5.mjs.map +0 -1
- package/dist/migration-check-BiBJoYYW.mjs +0 -341
- package/dist/migration-check-BiBJoYYW.mjs.map +0 -1
- package/dist/migration-graph-D7DVUElV.mjs +0 -1232
- package/dist/migration-graph-D7DVUElV.mjs.map +0 -1
- package/dist/migration-list-styler-BRwF4-gy.mjs +0 -399
- package/dist/migration-list-styler-BRwF4-gy.mjs.map +0 -1
- package/dist/migration-types-D2FW63pr.d.mts +0 -15
- package/dist/migration-types-D2FW63pr.d.mts.map +0 -1
- package/dist/migrations-Cv2jxNNK.mjs +0 -228
- package/dist/migrations-Cv2jxNNK.mjs.map +0 -1
- package/dist/terminal-ui-5Y6mrg93.d.mts.map +0 -1
- package/dist/types-Dt_SfqFm.d.mts.map +0 -1
- package/src/utils/formatters/graph-migration-mapper.ts +0 -235
- package/src/utils/formatters/graph-render.ts +0 -1323
- package/src/utils/formatters/graph-types.ts +0 -120
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { userConfigPath, writeUserConfig } from '@prisma-next/cli-telemetry';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import {
|
|
4
|
+
addGlobalOptions,
|
|
5
|
+
setCommandDescriptions,
|
|
6
|
+
setCommandExamples,
|
|
7
|
+
} from '../../utils/command-helpers';
|
|
8
|
+
import { formatCommandHelp } from '../../utils/formatters/help';
|
|
9
|
+
import {
|
|
10
|
+
type CommonCommandOptions,
|
|
11
|
+
parseGlobalFlags,
|
|
12
|
+
parseGlobalFlagsOrExit,
|
|
13
|
+
} from '../../utils/global-flags';
|
|
14
|
+
import { isCI } from '../../utils/is-ci';
|
|
15
|
+
import { createTerminalUI } from '../../utils/terminal-ui';
|
|
16
|
+
import { formatTelemetryStatusLines, resolveTelemetryStatus } from './status';
|
|
17
|
+
|
|
18
|
+
function createTelemetryStatusCommand(): Command {
|
|
19
|
+
const command = new Command('status');
|
|
20
|
+
setCommandDescriptions(
|
|
21
|
+
command,
|
|
22
|
+
'Show whether anonymous CLI telemetry is enabled and why',
|
|
23
|
+
'Reports whether telemetry is currently enabled or disabled and the reason\n' +
|
|
24
|
+
'(default-on, stored opt-out, environment opt-out, or CI), the path to your\n' +
|
|
25
|
+
'user-level config file, and whether an installation ID has been stored.\n' +
|
|
26
|
+
'Read-only: never sends an event, never mints an ID, never writes anything.',
|
|
27
|
+
);
|
|
28
|
+
return addGlobalOptions(command).action((options: CommonCommandOptions) => {
|
|
29
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
30
|
+
const ui = createTerminalUI(flags);
|
|
31
|
+
const status = resolveTelemetryStatus({ env: process.env, inCI: isCI() });
|
|
32
|
+
if (flags.json) {
|
|
33
|
+
ui.output(JSON.stringify(status));
|
|
34
|
+
} else {
|
|
35
|
+
for (const line of formatTelemetryStatusLines(status)) {
|
|
36
|
+
ui.output(line);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
process.exit(0);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function createTelemetryEnableCommand(): Command {
|
|
44
|
+
const command = new Command('enable');
|
|
45
|
+
setCommandDescriptions(
|
|
46
|
+
command,
|
|
47
|
+
'Enable anonymous CLI telemetry',
|
|
48
|
+
'Stores "enableTelemetry": true in your user-level config and mints an\n' +
|
|
49
|
+
'installation ID if one is not already stored.',
|
|
50
|
+
);
|
|
51
|
+
return addGlobalOptions(command).action((options: CommonCommandOptions) => {
|
|
52
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
53
|
+
writeUserConfig({ enableTelemetry: true });
|
|
54
|
+
const ui = createTerminalUI(flags);
|
|
55
|
+
if (flags.json) {
|
|
56
|
+
ui.output(JSON.stringify({ enableTelemetry: true, configPath: userConfigPath() }));
|
|
57
|
+
} else {
|
|
58
|
+
ui.output(`Telemetry enabled. Preference stored in ${userConfigPath()}.`);
|
|
59
|
+
}
|
|
60
|
+
process.exit(0);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function createTelemetryDisableCommand(): Command {
|
|
65
|
+
const command = new Command('disable');
|
|
66
|
+
setCommandDescriptions(
|
|
67
|
+
command,
|
|
68
|
+
'Disable anonymous CLI telemetry',
|
|
69
|
+
'Stores "enableTelemetry": false in your user-level config. No installation\n' +
|
|
70
|
+
'ID is minted and no event is sent.',
|
|
71
|
+
);
|
|
72
|
+
return addGlobalOptions(command).action((options: CommonCommandOptions) => {
|
|
73
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
74
|
+
writeUserConfig({ enableTelemetry: false });
|
|
75
|
+
const ui = createTerminalUI(flags);
|
|
76
|
+
if (flags.json) {
|
|
77
|
+
ui.output(JSON.stringify({ enableTelemetry: false, configPath: userConfigPath() }));
|
|
78
|
+
} else {
|
|
79
|
+
ui.output(`Telemetry disabled. Preference stored in ${userConfigPath()}.`);
|
|
80
|
+
}
|
|
81
|
+
process.exit(0);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function createTelemetryCommand(): Command {
|
|
86
|
+
const command = new Command('telemetry');
|
|
87
|
+
setCommandDescriptions(
|
|
88
|
+
command,
|
|
89
|
+
'Inspect and change anonymous CLI telemetry',
|
|
90
|
+
'Show telemetry status, or enable / disable anonymous CLI usage data.\n' +
|
|
91
|
+
'Telemetry is on by default (opt-out); see https://prisma-next.dev/docs/cli/telemetry\n' +
|
|
92
|
+
'for what is collected and why.',
|
|
93
|
+
);
|
|
94
|
+
setCommandExamples(command, [
|
|
95
|
+
'prisma-next telemetry status',
|
|
96
|
+
'prisma-next telemetry disable',
|
|
97
|
+
'prisma-next telemetry enable',
|
|
98
|
+
]);
|
|
99
|
+
command.configureHelp({
|
|
100
|
+
formatHelp: (cmd) => formatCommandHelp({ command: cmd, flags: parseGlobalFlags({}) }),
|
|
101
|
+
subcommandDescription: () => '',
|
|
102
|
+
});
|
|
103
|
+
command.addCommand(createTelemetryStatusCommand());
|
|
104
|
+
command.addCommand(createTelemetryEnableCommand());
|
|
105
|
+
command.addCommand(createTelemetryDisableCommand());
|
|
106
|
+
return command;
|
|
107
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readUserConfig, resolveGating, userConfigPath } from '@prisma-next/cli-telemetry';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Why telemetry resolves the way it does, in the order the CLI's
|
|
5
|
+
* `resolveTelemetryGate` evaluates: CI hard-disables first, then the env
|
|
6
|
+
* opt-outs, then the stored `enableTelemetry`, then the opt-out default.
|
|
7
|
+
*/
|
|
8
|
+
export type TelemetryStatusReason =
|
|
9
|
+
| 'ci'
|
|
10
|
+
| 'env-opt-out'
|
|
11
|
+
| 'stored-opt-out'
|
|
12
|
+
| 'stored-opt-in'
|
|
13
|
+
| 'default-on';
|
|
14
|
+
|
|
15
|
+
export interface TelemetryStatus {
|
|
16
|
+
readonly enabled: boolean;
|
|
17
|
+
readonly reason: TelemetryStatusReason;
|
|
18
|
+
readonly configPath: string;
|
|
19
|
+
readonly installationIdStored: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the same gate the runtime uses (CI check + `resolveGating`) and
|
|
24
|
+
* projects it into a user-facing status. Pure read: never mints, never
|
|
25
|
+
* writes. The `installationId` value itself is never surfaced — only its
|
|
26
|
+
* presence — so `status` discloses nothing identifying.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveTelemetryStatus(inputs: {
|
|
29
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
30
|
+
readonly inCI: boolean;
|
|
31
|
+
}): TelemetryStatus {
|
|
32
|
+
const config = readUserConfig();
|
|
33
|
+
const configPath = userConfigPath();
|
|
34
|
+
const installationIdStored =
|
|
35
|
+
typeof config.installationId === 'string' && config.installationId.length > 0;
|
|
36
|
+
|
|
37
|
+
if (inputs.inCI) {
|
|
38
|
+
return { enabled: false, reason: 'ci', configPath, installationIdStored };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const gating = resolveGating({ env: inputs.env, config });
|
|
42
|
+
if (!gating.enabled) {
|
|
43
|
+
const reason: TelemetryStatusReason =
|
|
44
|
+
gating.reason === 'env-override' ? 'env-opt-out' : 'stored-opt-out';
|
|
45
|
+
return { enabled: false, reason, configPath, installationIdStored };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const reason: TelemetryStatusReason =
|
|
49
|
+
config.enableTelemetry === true ? 'stored-opt-in' : 'default-on';
|
|
50
|
+
return { enabled: true, reason, configPath, installationIdStored };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const REASON_EXPLANATION: Record<TelemetryStatusReason, string> = {
|
|
54
|
+
ci: 'CI environment detected — telemetry is hard-disabled.',
|
|
55
|
+
'env-opt-out': 'an environment opt-out is set (DO_NOT_TRACK / PRISMA_NEXT_DISABLE_TELEMETRY).',
|
|
56
|
+
'stored-opt-out': '"enableTelemetry": false is stored in your config.',
|
|
57
|
+
'stored-opt-in': '"enableTelemetry": true is stored in your config.',
|
|
58
|
+
'default-on': 'no explicit choice is stored, so the opt-out default applies.',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export function formatTelemetryStatusLines(status: TelemetryStatus): string[] {
|
|
62
|
+
return [
|
|
63
|
+
`Telemetry is ${status.enabled ? 'enabled' : 'disabled'}: ${REASON_EXPLANATION[status.reason]}`,
|
|
64
|
+
`Config file: ${status.configPath}`,
|
|
65
|
+
`Installation ID: ${status.installationIdStored ? 'stored' : 'not stored'}`,
|
|
66
|
+
];
|
|
67
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Contract,
|
|
3
|
+
ContractMarkerRecord,
|
|
4
|
+
LedgerEntryRecord,
|
|
5
|
+
} from '@prisma-next/contract/types';
|
|
2
6
|
import { emit as emitContractArtifacts } from '@prisma-next/emitter';
|
|
3
7
|
import type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';
|
|
4
8
|
import type {
|
|
@@ -29,7 +33,7 @@ import { ContractValidationError } from './errors';
|
|
|
29
33
|
import { executeDbInit } from './operations/db-init';
|
|
30
34
|
import { executeDbUpdate } from './operations/db-update';
|
|
31
35
|
import { type ExecuteDbVerifyResult, executeDbVerify } from './operations/db-verify';
|
|
32
|
-
import {
|
|
36
|
+
import { executeMigrate } from './operations/migrate';
|
|
33
37
|
|
|
34
38
|
import type {
|
|
35
39
|
ControlActionName,
|
|
@@ -43,8 +47,8 @@ import type {
|
|
|
43
47
|
EmitOptions,
|
|
44
48
|
EmitResult,
|
|
45
49
|
IntrospectOptions,
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
MigrateOptions,
|
|
51
|
+
MigrateResult,
|
|
48
52
|
OnControlProgress,
|
|
49
53
|
SchemaVerifyOptions,
|
|
50
54
|
SignOptions,
|
|
@@ -447,9 +451,15 @@ class ControlClientImpl implements ControlClient {
|
|
|
447
451
|
return familyInstance.readAllMarkers({ driver });
|
|
448
452
|
}
|
|
449
453
|
|
|
450
|
-
|
|
454
|
+
/** Reads the per-migration journal; omit `space` to return every space. */
|
|
455
|
+
async readLedger(space?: string): Promise<readonly LedgerEntryRecord[]> {
|
|
456
|
+
const { driver, familyInstance } = await this.ensureConnected();
|
|
457
|
+
return familyInstance.readLedger({ driver, ...ifDefined('space', space) });
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
async migrate(options: MigrateOptions): Promise<MigrateResult> {
|
|
451
461
|
const { onProgress } = options;
|
|
452
|
-
await this.connectWithProgress(options.connection, '
|
|
462
|
+
await this.connectWithProgress(options.connection, 'migrate', onProgress);
|
|
453
463
|
const { driver, familyInstance, frameworkComponents } = await this.ensureConnected();
|
|
454
464
|
|
|
455
465
|
if (!hasMigrations(this.options.target)) {
|
|
@@ -464,7 +474,7 @@ class ControlClientImpl implements ControlClient {
|
|
|
464
474
|
throw new ContractValidationError(message, error);
|
|
465
475
|
}
|
|
466
476
|
|
|
467
|
-
return
|
|
477
|
+
return executeMigrate({
|
|
468
478
|
driver,
|
|
469
479
|
familyInstance,
|
|
470
480
|
contract,
|
|
@@ -644,8 +654,9 @@ class ControlClientImpl implements ControlClient {
|
|
|
644
654
|
this.frameworkComponents ?? [],
|
|
645
655
|
);
|
|
646
656
|
|
|
657
|
+
let deserializedContract: Contract;
|
|
647
658
|
try {
|
|
648
|
-
this.familyInstance.deserializeContract(enrichedIR);
|
|
659
|
+
deserializedContract = this.familyInstance.deserializeContract(enrichedIR);
|
|
649
660
|
} catch (error) {
|
|
650
661
|
onProgress?.({
|
|
651
662
|
action: 'emit',
|
|
@@ -663,7 +674,7 @@ class ControlClientImpl implements ControlClient {
|
|
|
663
674
|
}
|
|
664
675
|
|
|
665
676
|
const result = await emitContractArtifacts(
|
|
666
|
-
|
|
677
|
+
deserializedContract,
|
|
667
678
|
this.stack!,
|
|
668
679
|
this.options.family.emission,
|
|
669
680
|
{
|
|
@@ -247,7 +247,7 @@ export async function executeContractEmit(
|
|
|
247
247
|
validatedContract.value as unknown as Contract,
|
|
248
248
|
frameworkComponents,
|
|
249
249
|
);
|
|
250
|
-
familyInstance.deserializeContract(enrichedIR);
|
|
250
|
+
const deserializedContract = familyInstance.deserializeContract(enrichedIR);
|
|
251
251
|
// Each target's descriptor ships a `contractSerializer` SPI; the
|
|
252
252
|
// framework canonicalizer threads its `serializeContract` so the
|
|
253
253
|
// on-disk JSON envelope is constructed by target-owned code
|
|
@@ -260,7 +260,7 @@ export async function executeContractEmit(
|
|
|
260
260
|
const serializeContract = (c: Contract): JsonObject =>
|
|
261
261
|
contractSerializer.serializeContract(c);
|
|
262
262
|
emitResult = await unlessAborted(
|
|
263
|
-
emit(
|
|
263
|
+
emit(deserializedContract, stack, config.family.emission, {
|
|
264
264
|
outputJsonPath,
|
|
265
265
|
serializeContract,
|
|
266
266
|
...ifDefined('shouldPreserveEmpty', contractSerializer.shouldPreserveEmpty),
|
|
@@ -8,14 +8,14 @@ import type {
|
|
|
8
8
|
} from '@prisma-next/framework-components/control';
|
|
9
9
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
10
10
|
import type { DbInitResult, OnControlProgress } from '../types';
|
|
11
|
-
import {
|
|
11
|
+
import { executeRun } from './db-run';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Options for executing the `db init` operation.
|
|
15
15
|
*
|
|
16
16
|
* `db init` runs the loader → planner → runner pipeline:
|
|
17
17
|
*
|
|
18
|
-
* 1. {@link
|
|
18
|
+
* 1. {@link executeRun} loads a `ContractSpaceAggregate` via
|
|
19
19
|
* {@link import('@prisma-next/migration-tools/aggregate').loadContractSpaceAggregate}
|
|
20
20
|
* from the supplied descriptor set + on-disk on-disk artefacts.
|
|
21
21
|
* 2. The aggregate planner runs with `callerPolicy.ignoreGraphFor`
|
|
@@ -68,7 +68,7 @@ export interface ExecuteDbInitOptions<TFamilyId extends string, TTargetId extend
|
|
|
68
68
|
export async function executeDbInit<TFamilyId extends string, TTargetId extends string>(
|
|
69
69
|
options: ExecuteDbInitOptions<TFamilyId, TTargetId>,
|
|
70
70
|
): Promise<DbInitResult> {
|
|
71
|
-
const result = await
|
|
71
|
+
const result = await executeRun<TFamilyId, TTargetId>({
|
|
72
72
|
driver: options.driver,
|
|
73
73
|
familyInstance: options.familyInstance,
|
|
74
74
|
contract: options.contract,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backs `db init` / `db update`. Strategy: introspect → planMigration; synth-for-app + graph-walk-extensions; plan-mode + orphan-marker preflight.
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import type { Contract } from '@prisma-next/contract/types';
|
|
2
6
|
import type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';
|
|
3
7
|
import type {
|
|
@@ -5,6 +9,7 @@ import type {
|
|
|
5
9
|
ControlExtensionDescriptor,
|
|
6
10
|
ControlFamilyInstance,
|
|
7
11
|
MigrationOperationPolicy,
|
|
12
|
+
MigrationPlannerConflict,
|
|
8
13
|
MigrationPlanOperation,
|
|
9
14
|
OperationPreview,
|
|
10
15
|
TargetMigrationsCapability,
|
|
@@ -12,9 +17,11 @@ import type {
|
|
|
12
17
|
import { hasOperationPreview } from '@prisma-next/framework-components/control';
|
|
13
18
|
import {
|
|
14
19
|
type ContractSpaceAggregate,
|
|
20
|
+
collectAggregateNamespaces,
|
|
15
21
|
type PlannerError,
|
|
16
22
|
planMigration,
|
|
17
23
|
} from '@prisma-next/migration-tools/aggregate';
|
|
24
|
+
import { blindCast } from '@prisma-next/utils/casts';
|
|
18
25
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
19
26
|
import { notOk, ok } from '@prisma-next/utils/result';
|
|
20
27
|
import { CliStructuredError } from '../../utils/cli-errors';
|
|
@@ -32,14 +39,19 @@ import type {
|
|
|
32
39
|
OnControlProgress,
|
|
33
40
|
PerSpaceExecutionEntry,
|
|
34
41
|
} from '../types';
|
|
35
|
-
import { applyMigration, buildPerSpaceBreakdown, collectOrdered } from './apply';
|
|
36
42
|
import { stripOperations } from './migration-helpers';
|
|
43
|
+
import {
|
|
44
|
+
buildPerSpaceBreakdown,
|
|
45
|
+
collectOrdered,
|
|
46
|
+
type OrderedResolution,
|
|
47
|
+
runMigration,
|
|
48
|
+
} from './run-migration';
|
|
37
49
|
|
|
38
50
|
/**
|
|
39
|
-
* Span IDs emitted via `onProgress` during the
|
|
51
|
+
* Span IDs emitted via `onProgress` during the run flow.
|
|
40
52
|
* Stable identifiers consumed by the structured-output renderer and by
|
|
41
53
|
* tests asserting on span ids. The `apply` span itself is owned by
|
|
42
|
-
* the {@link
|
|
54
|
+
* the {@link runMigration} primitive — only the introspect / plan
|
|
43
55
|
* spans are emitted directly here.
|
|
44
56
|
*/
|
|
45
57
|
const SPAN_IDS = {
|
|
@@ -48,13 +60,13 @@ const SPAN_IDS = {
|
|
|
48
60
|
} as const;
|
|
49
61
|
|
|
50
62
|
/**
|
|
51
|
-
* Inputs shared by `db init` and `db update`
|
|
63
|
+
* Inputs shared by `db init` and `db update` run flows.
|
|
52
64
|
*
|
|
53
65
|
* Accepts the already-validated app contract + descriptor list — the
|
|
54
66
|
* loader gathers the rest from disk + descriptors. The CLI is the
|
|
55
67
|
* descriptor-import boundary; everything downstream is descriptor-free.
|
|
56
68
|
*/
|
|
57
|
-
export interface
|
|
69
|
+
export interface ExecuteRunOptions<TFamilyId extends string, TTargetId extends string> {
|
|
58
70
|
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
59
71
|
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
60
72
|
readonly contract: Contract;
|
|
@@ -92,8 +104,8 @@ export interface ExecuteApplyOptions<TFamilyId extends string, TTargetId extends
|
|
|
92
104
|
* transaction across every space; failure on any space rolls back
|
|
93
105
|
* every space's writes.
|
|
94
106
|
*/
|
|
95
|
-
export async function
|
|
96
|
-
options:
|
|
107
|
+
export async function executeRun<TFamilyId extends string, TTargetId extends string>(
|
|
108
|
+
options: ExecuteRunOptions<TFamilyId, TTargetId>,
|
|
97
109
|
): Promise<DbInitResult | DbUpdateResult> {
|
|
98
110
|
const {
|
|
99
111
|
driver,
|
|
@@ -147,7 +159,10 @@ export async function executeApply<TFamilyId extends string, TTargetId extends s
|
|
|
147
159
|
spanId: SPAN_IDS.introspect,
|
|
148
160
|
label: 'Introspecting database schema',
|
|
149
161
|
});
|
|
150
|
-
const schemaIR = await familyInstance.introspect({
|
|
162
|
+
const schemaIR = await familyInstance.introspect({
|
|
163
|
+
driver,
|
|
164
|
+
contract: collectAggregateNamespaces(aggregate),
|
|
165
|
+
});
|
|
151
166
|
onProgress?.({ action, kind: 'spanEnd', spanId: SPAN_IDS.introspect, outcome: 'ok' });
|
|
152
167
|
|
|
153
168
|
// 3. Plan via aggregate planner. App is forced through synth (today's
|
|
@@ -175,6 +190,7 @@ export async function executeApply<TFamilyId extends string, TTargetId extends s
|
|
|
175
190
|
onProgress?.({ action, kind: 'spanEnd', spanId: SPAN_IDS.plan, outcome: 'ok' });
|
|
176
191
|
|
|
177
192
|
const orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);
|
|
193
|
+
const plannerWarnings = aggregatePlannerWarnings(orderedResolutions);
|
|
178
194
|
|
|
179
195
|
// The destination's structural shape comes from the app's plan — its
|
|
180
196
|
// `destination` is the storage hash users see in CLI output.
|
|
@@ -202,16 +218,17 @@ export async function executeApply<TFamilyId extends string, TTargetId extends s
|
|
|
202
218
|
preview,
|
|
203
219
|
perSpace,
|
|
204
220
|
summary,
|
|
221
|
+
...ifDefined('warnings', plannerWarnings),
|
|
205
222
|
});
|
|
206
223
|
}
|
|
207
224
|
|
|
208
|
-
// 5.
|
|
225
|
+
// 5. Run mode: hand off to the shared `runMigration` primitive.
|
|
209
226
|
// The runner-driving tail is identical for `db init` / `db update` /
|
|
210
227
|
// `migrate` — only how each caller produces `perSpacePlans`
|
|
211
228
|
// differs (synth + graph-walk via planMigration here; graph-walk
|
|
212
229
|
// only for migrate). Each caller produces perSpacePlans differently;
|
|
213
|
-
// this helper handles the shared
|
|
214
|
-
const applied = await
|
|
230
|
+
// this helper handles the shared run tail.
|
|
231
|
+
const applied = await runMigration({
|
|
215
232
|
aggregate,
|
|
216
233
|
perSpacePlans: planResult.value.perSpace,
|
|
217
234
|
applyOrder: planResult.value.applyOrder,
|
|
@@ -228,6 +245,7 @@ export async function executeApply<TFamilyId extends string, TTargetId extends s
|
|
|
228
245
|
summary: applied.failure.summary,
|
|
229
246
|
...ifDefined('why', applied.failure.why),
|
|
230
247
|
meta: applied.failure.meta,
|
|
248
|
+
...ifDefined('warnings', plannerWarnings),
|
|
231
249
|
});
|
|
232
250
|
}
|
|
233
251
|
|
|
@@ -246,9 +264,17 @@ export async function executeApply<TFamilyId extends string, TTargetId extends s
|
|
|
246
264
|
operationsExecuted: applied.value.totalOpsExecuted,
|
|
247
265
|
perSpace: applied.value.perSpace,
|
|
248
266
|
summary,
|
|
267
|
+
...ifDefined('warnings', plannerWarnings),
|
|
249
268
|
});
|
|
250
269
|
}
|
|
251
270
|
|
|
271
|
+
function aggregatePlannerWarnings(
|
|
272
|
+
orderedResolutions: readonly OrderedResolution[],
|
|
273
|
+
): readonly MigrationPlannerConflict[] | undefined {
|
|
274
|
+
const warnings = orderedResolutions.flatMap((r) => r.entry.warnings ?? []);
|
|
275
|
+
return warnings.length > 0 ? warnings : undefined;
|
|
276
|
+
}
|
|
277
|
+
|
|
252
278
|
/**
|
|
253
279
|
* Compare the live `_prisma_marker` rows against the aggregate's
|
|
254
280
|
* declared members. Any marker row whose `space` is not a member of
|
|
@@ -307,7 +333,10 @@ function mapPlannerError(error: PlannerError): DbInitResult | DbUpdateResult {
|
|
|
307
333
|
why: undefined,
|
|
308
334
|
meta: undefined,
|
|
309
335
|
};
|
|
310
|
-
return
|
|
336
|
+
return blindCast<
|
|
337
|
+
DbInitResult | DbUpdateResult,
|
|
338
|
+
'notOk(failure) is shape-compatible with both DbInitResult and DbUpdateResult; the union is the return type of the surrounding function'
|
|
339
|
+
>(notOk(failure));
|
|
311
340
|
}
|
|
312
341
|
if (error.kind === 'extensionPathUnreachable') {
|
|
313
342
|
return buildRunnerFailure({
|
|
@@ -339,6 +368,7 @@ function wrapPlanResult(args: {
|
|
|
339
368
|
readonly preview: OperationPreview | undefined;
|
|
340
369
|
readonly perSpace: readonly PerSpaceExecutionEntry[];
|
|
341
370
|
readonly summary: string;
|
|
371
|
+
readonly warnings?: readonly MigrationPlannerConflict[];
|
|
342
372
|
}): DbInitResult | DbUpdateResult {
|
|
343
373
|
const success: DbInitSuccess | DbUpdateSuccess = {
|
|
344
374
|
mode: 'plan',
|
|
@@ -352,6 +382,7 @@ function wrapPlanResult(args: {
|
|
|
352
382
|
},
|
|
353
383
|
perSpace: args.perSpace,
|
|
354
384
|
summary: args.summary,
|
|
385
|
+
...ifDefined('warnings', args.warnings),
|
|
355
386
|
};
|
|
356
387
|
return ok(success);
|
|
357
388
|
}
|
|
@@ -363,6 +394,7 @@ function wrapApplyResult(args: {
|
|
|
363
394
|
readonly operationsExecuted: number;
|
|
364
395
|
readonly perSpace: readonly PerSpaceExecutionEntry[];
|
|
365
396
|
readonly summary: string;
|
|
397
|
+
readonly warnings?: readonly MigrationPlannerConflict[];
|
|
366
398
|
}): DbInitResult | DbUpdateResult {
|
|
367
399
|
const success: DbInitSuccess | DbUpdateSuccess = {
|
|
368
400
|
mode: 'apply',
|
|
@@ -380,6 +412,7 @@ function wrapApplyResult(args: {
|
|
|
380
412
|
: { storageHash: args.destination.storageHash },
|
|
381
413
|
perSpace: args.perSpace,
|
|
382
414
|
summary: args.summary,
|
|
415
|
+
...ifDefined('warnings', args.warnings),
|
|
383
416
|
};
|
|
384
417
|
return ok(success);
|
|
385
418
|
}
|
|
@@ -388,6 +421,7 @@ function buildRunnerFailure(args: {
|
|
|
388
421
|
readonly summary: string;
|
|
389
422
|
readonly why?: string;
|
|
390
423
|
readonly meta: Record<string, unknown>;
|
|
424
|
+
readonly warnings?: readonly MigrationPlannerConflict[];
|
|
391
425
|
}): DbInitResult | DbUpdateResult {
|
|
392
426
|
const failure: DbInitFailure | DbUpdateFailure = {
|
|
393
427
|
code: 'RUNNER_FAILED',
|
|
@@ -395,6 +429,10 @@ function buildRunnerFailure(args: {
|
|
|
395
429
|
why: args.why,
|
|
396
430
|
meta: args.meta,
|
|
397
431
|
conflicts: undefined,
|
|
432
|
+
...ifDefined('warnings', args.warnings),
|
|
398
433
|
};
|
|
399
|
-
return
|
|
434
|
+
return blindCast<
|
|
435
|
+
DbInitResult | DbUpdateResult,
|
|
436
|
+
'notOk(failure) is shape-compatible with both DbInitResult and DbUpdateResult; the union is the return type of the surrounding function'
|
|
437
|
+
>(notOk(failure));
|
|
400
438
|
}
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
10
10
|
import { notOk } from '@prisma-next/utils/result';
|
|
11
11
|
import type { DbUpdateResult, OnControlProgress } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { executeRun } from './db-run';
|
|
13
13
|
|
|
14
14
|
const DB_UPDATE_POLICY = {
|
|
15
15
|
allowedOperationClasses: ['additive', 'widening', 'destructive'] as const,
|
|
@@ -71,7 +71,7 @@ export async function executeDbUpdate<TFamilyId extends string, TTargetId extend
|
|
|
71
71
|
const gate = await guardDestructiveChanges<TFamilyId, TTargetId>(sharedInputs);
|
|
72
72
|
if (gate !== null) return gate;
|
|
73
73
|
}
|
|
74
|
-
return (await
|
|
74
|
+
return (await executeRun<TFamilyId, TTargetId>({
|
|
75
75
|
...sharedInputs,
|
|
76
76
|
mode: options.mode,
|
|
77
77
|
})) as DbUpdateResult;
|
|
@@ -85,9 +85,9 @@ export async function executeDbUpdate<TFamilyId extends string, TTargetId extend
|
|
|
85
85
|
* run.
|
|
86
86
|
*/
|
|
87
87
|
async function guardDestructiveChanges<TFamilyId extends string, TTargetId extends string>(
|
|
88
|
-
sharedInputs: Omit<Parameters<typeof
|
|
88
|
+
sharedInputs: Omit<Parameters<typeof executeRun<TFamilyId, TTargetId>>[0], 'mode'>,
|
|
89
89
|
): Promise<DbUpdateResult | null> {
|
|
90
|
-
const planResult = (await
|
|
90
|
+
const planResult = (await executeRun<TFamilyId, TTargetId>({
|
|
91
91
|
...sharedInputs,
|
|
92
92
|
mode: 'plan',
|
|
93
93
|
})) as DbUpdateResult;
|
|
@@ -8,11 +8,12 @@ import type {
|
|
|
8
8
|
} from '@prisma-next/framework-components/control';
|
|
9
9
|
import {
|
|
10
10
|
type ContractSpaceMember,
|
|
11
|
+
collectAggregateNamespaces,
|
|
11
12
|
requireHeadRef,
|
|
12
13
|
type VerifierOutput,
|
|
13
14
|
verifyMigration,
|
|
14
15
|
} from '@prisma-next/migration-tools/aggregate';
|
|
15
|
-
import { castAs } from '@prisma-next/utils/casts';
|
|
16
|
+
import { blindCast, castAs } from '@prisma-next/utils/casts';
|
|
16
17
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
17
18
|
import { CliStructuredError } from '../../utils/cli-errors';
|
|
18
19
|
import {
|
|
@@ -101,7 +102,12 @@ export async function executeDbVerify<TFamilyId extends string, TTargetId extend
|
|
|
101
102
|
const markersBySpaceId = await familyInstance.readAllMarkers({ driver });
|
|
102
103
|
const schemaIntrospection = skipSchema
|
|
103
104
|
? null
|
|
104
|
-
: await runIntrospection({
|
|
105
|
+
: await runIntrospection({
|
|
106
|
+
driver,
|
|
107
|
+
familyInstance,
|
|
108
|
+
onProgress,
|
|
109
|
+
contract: collectAggregateNamespaces(aggregate),
|
|
110
|
+
});
|
|
105
111
|
|
|
106
112
|
emitVerifySpan(onProgress, 'spanStart');
|
|
107
113
|
const verifyResult = verifyMigration({
|
|
@@ -130,8 +136,9 @@ async function runIntrospection<TFamilyId extends string, TTargetId extends stri
|
|
|
130
136
|
driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
131
137
|
familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
132
138
|
onProgress: OnControlProgress | undefined;
|
|
139
|
+
contract: unknown;
|
|
133
140
|
}): Promise<unknown> {
|
|
134
|
-
const { driver, familyInstance, onProgress } = args;
|
|
141
|
+
const { driver, familyInstance, onProgress, contract } = args;
|
|
135
142
|
onProgress?.({
|
|
136
143
|
action: 'dbVerify',
|
|
137
144
|
kind: 'spanStart',
|
|
@@ -139,7 +146,7 @@ async function runIntrospection<TFamilyId extends string, TTargetId extends stri
|
|
|
139
146
|
label: 'Introspecting database schema',
|
|
140
147
|
});
|
|
141
148
|
try {
|
|
142
|
-
const result = await familyInstance.introspect({ driver });
|
|
149
|
+
const result = await familyInstance.introspect({ driver, contract });
|
|
143
150
|
onProgress?.({
|
|
144
151
|
action: 'dbVerify',
|
|
145
152
|
kind: 'spanEnd',
|
|
@@ -179,7 +186,10 @@ export function createPerMemberVerifier<TFamilyId extends string, TTargetId exte
|
|
|
179
186
|
// The family's `TSchemaIR` is opaque to migration-tools; the
|
|
180
187
|
// aggregate verifier passes through whatever we hand it. The
|
|
181
188
|
// family expects its own IR shape on the way back.
|
|
182
|
-
schema:
|
|
189
|
+
schema: blindCast<
|
|
190
|
+
never,
|
|
191
|
+
'family TSchemaIR is opaque to migration-tools; projectedSchema is passed straight through'
|
|
192
|
+
>(projectedSchema),
|
|
183
193
|
strict: verifyMode === 'strict',
|
|
184
194
|
frameworkComponents,
|
|
185
195
|
});
|