@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
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as assertFrameworkComponentsCompatible } from "./framework-components-
|
|
3
|
-
import { t as enrichContract } from "./contract-enrichment-
|
|
4
|
-
import {
|
|
1
|
+
import { F as CliStructuredError } from "./command-helpers-CxHSiwEg.mjs";
|
|
2
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-CmBpbvzV.mjs";
|
|
3
|
+
import { t as enrichContract } from "./contract-enrichment-gn9sWbPw.mjs";
|
|
4
|
+
import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-Bup14UkI.mjs";
|
|
5
5
|
import { emit } from "@prisma-next/emitter";
|
|
6
6
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
7
7
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
8
8
|
import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaView } from "@prisma-next/framework-components/control";
|
|
9
|
-
import {
|
|
9
|
+
import { blindCast, castAs } from "@prisma-next/utils/casts";
|
|
10
|
+
import { buildSynthMigrationEdge, collectAggregateNamespaces, graphWalkStrategy, planMigration, requireHeadRef, verifyMigration } from "@prisma-next/migration-tools/aggregate";
|
|
10
11
|
import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
|
|
11
12
|
import { errorNoInvariantPath } from "@prisma-next/migration-tools/errors";
|
|
12
|
-
import { castAs } from "@prisma-next/utils/casts";
|
|
13
13
|
import { findPathWithDecision } from "@prisma-next/migration-tools/migration-graph";
|
|
14
14
|
//#region src/control-api/errors.ts
|
|
15
15
|
var ContractValidationError = class extends Error {
|
|
@@ -21,14 +21,27 @@ var ContractValidationError = class extends Error {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region src/control-api/operations/
|
|
24
|
+
//#region src/control-api/operations/migration-helpers.ts
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Strips operation objects to their public shape (id, label, operationClass).
|
|
27
|
+
* Used at the API boundary to avoid leaking internal fields (precheck, execute, postcheck, etc.).
|
|
28
|
+
*/
|
|
29
|
+
function stripOperations(operations) {
|
|
30
|
+
return operations.map((op) => ({
|
|
31
|
+
id: op.id,
|
|
32
|
+
label: op.label,
|
|
33
|
+
operationClass: op.operationClass
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/control-api/operations/run-migration.ts
|
|
38
|
+
/**
|
|
39
|
+
* Span id emitted via `onProgress` for the run phase. Stable
|
|
27
40
|
* identifier consumed by the structured-output renderer and by tests.
|
|
28
41
|
*/
|
|
29
|
-
const
|
|
42
|
+
const RUN_SPAN_ID = "apply";
|
|
30
43
|
/**
|
|
31
|
-
* Runner-driving tail shared by every
|
|
44
|
+
* Runner-driving tail shared by every run caller — `db init`,
|
|
32
45
|
* `db update`, and `migrate`. Consumes already-resolved per-space
|
|
33
46
|
* plans (the planner-vs-replay distinction is owned by the caller) and
|
|
34
47
|
* dispatches them to the runner in canonical order.
|
|
@@ -43,14 +56,14 @@ const APPLY_SPAN_ID = "apply";
|
|
|
43
56
|
* so callers don't have to duplicate it; the `action` field on each
|
|
44
57
|
* progress event is taken from the caller's `action` argument.
|
|
45
58
|
*/
|
|
46
|
-
async function
|
|
59
|
+
async function runMigration(inputs) {
|
|
47
60
|
const { aggregate, perSpacePlans, applyOrder, driver, familyInstance, migrations, frameworkComponents, policy, action, onProgress } = inputs;
|
|
48
61
|
const orderedResolutions = collectOrdered(applyOrder, perSpacePlans);
|
|
49
62
|
const runner = migrations.createRunner(familyInstance);
|
|
50
63
|
onProgress?.({
|
|
51
64
|
action,
|
|
52
65
|
kind: "spanStart",
|
|
53
|
-
spanId:
|
|
66
|
+
spanId: RUN_SPAN_ID,
|
|
54
67
|
label: progressLabelForAction(action)
|
|
55
68
|
});
|
|
56
69
|
const perSpaceOptions = orderedResolutions.map((r) => ({
|
|
@@ -60,6 +73,7 @@ async function applyMigration(inputs) {
|
|
|
60
73
|
destinationContract: r.entry.destinationContract,
|
|
61
74
|
policy,
|
|
62
75
|
frameworkComponents,
|
|
76
|
+
migrationEdges: r.entry.migrationEdges,
|
|
63
77
|
strictVerification: false
|
|
64
78
|
}));
|
|
65
79
|
const runnerResult = await runner.execute({
|
|
@@ -70,7 +84,7 @@ async function applyMigration(inputs) {
|
|
|
70
84
|
onProgress?.({
|
|
71
85
|
action,
|
|
72
86
|
kind: "spanEnd",
|
|
73
|
-
spanId:
|
|
87
|
+
spanId: RUN_SPAN_ID,
|
|
74
88
|
outcome: "error"
|
|
75
89
|
});
|
|
76
90
|
return notOk({
|
|
@@ -86,7 +100,7 @@ async function applyMigration(inputs) {
|
|
|
86
100
|
onProgress?.({
|
|
87
101
|
action,
|
|
88
102
|
kind: "spanEnd",
|
|
89
|
-
spanId:
|
|
103
|
+
spanId: RUN_SPAN_ID,
|
|
90
104
|
outcome: "ok"
|
|
91
105
|
});
|
|
92
106
|
return ok({
|
|
@@ -105,7 +119,7 @@ async function applyMigration(inputs) {
|
|
|
105
119
|
* advances as the last step of each space's transaction) and `false`
|
|
106
120
|
* for plan-mode (no marker has been written yet).
|
|
107
121
|
*
|
|
108
|
-
* Exported alongside {@link
|
|
122
|
+
* Exported alongside {@link runMigration} so plan-mode callers can
|
|
109
123
|
* assemble the same per-space block without going through the runner.
|
|
110
124
|
*/
|
|
111
125
|
function buildPerSpaceBreakdown(orderedResolutions, appSpaceId, options) {
|
|
@@ -146,8 +160,8 @@ function collectOrdered(applyOrder, perSpace) {
|
|
|
146
160
|
});
|
|
147
161
|
}
|
|
148
162
|
/**
|
|
149
|
-
* Action-appropriate label for the `spanStart` event the
|
|
150
|
-
* primitive emits. `
|
|
163
|
+
* Action-appropriate label for the `spanStart` event the run
|
|
164
|
+
* primitive emits. `runMigration` is shared by `db init`, `db update`,
|
|
151
165
|
* and `migrate`; the span label tracks the user-visible action
|
|
152
166
|
* so structured-progress output reads naturally for each surface.
|
|
153
167
|
*/
|
|
@@ -155,29 +169,16 @@ function progressLabelForAction(action) {
|
|
|
155
169
|
switch (action) {
|
|
156
170
|
case "dbInit": return "Initialising database across spaces";
|
|
157
171
|
case "dbUpdate": return "Updating database across spaces";
|
|
158
|
-
case "
|
|
172
|
+
case "migrate": return "Running migration plan across spaces";
|
|
159
173
|
}
|
|
160
174
|
}
|
|
161
175
|
//#endregion
|
|
162
|
-
//#region src/control-api/operations/
|
|
163
|
-
/**
|
|
164
|
-
* Strips operation objects to their public shape (id, label, operationClass).
|
|
165
|
-
* Used at the API boundary to avoid leaking internal fields (precheck, execute, postcheck, etc.).
|
|
166
|
-
*/
|
|
167
|
-
function stripOperations(operations) {
|
|
168
|
-
return operations.map((op) => ({
|
|
169
|
-
id: op.id,
|
|
170
|
-
label: op.label,
|
|
171
|
-
operationClass: op.operationClass
|
|
172
|
-
}));
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/control-api/operations/db-apply.ts
|
|
176
|
+
//#region src/control-api/operations/db-run.ts
|
|
176
177
|
/**
|
|
177
|
-
* Span IDs emitted via `onProgress` during the
|
|
178
|
+
* Span IDs emitted via `onProgress` during the run flow.
|
|
178
179
|
* Stable identifiers consumed by the structured-output renderer and by
|
|
179
180
|
* tests asserting on span ids. The `apply` span itself is owned by
|
|
180
|
-
* the {@link
|
|
181
|
+
* the {@link runMigration} primitive — only the introspect / plan
|
|
181
182
|
* spans are emitted directly here.
|
|
182
183
|
*/
|
|
183
184
|
const SPAN_IDS$1 = {
|
|
@@ -203,7 +204,7 @@ const SPAN_IDS$1 = {
|
|
|
203
204
|
* transaction across every space; failure on any space rolls back
|
|
204
205
|
* every space's writes.
|
|
205
206
|
*/
|
|
206
|
-
async function
|
|
207
|
+
async function executeRun(options) {
|
|
207
208
|
const { driver, familyInstance, contract, mode, migrations, frameworkComponents, migrationsDir, extensionPacks, targetId, policy, action, onProgress } = options;
|
|
208
209
|
const loaded = await buildContractSpaceAggregate({
|
|
209
210
|
targetId,
|
|
@@ -225,7 +226,10 @@ async function executeApply(options) {
|
|
|
225
226
|
spanId: SPAN_IDS$1.introspect,
|
|
226
227
|
label: "Introspecting database schema"
|
|
227
228
|
});
|
|
228
|
-
const schemaIR = await familyInstance.introspect({
|
|
229
|
+
const schemaIR = await familyInstance.introspect({
|
|
230
|
+
driver,
|
|
231
|
+
contract: collectAggregateNamespaces(aggregate)
|
|
232
|
+
});
|
|
229
233
|
onProgress?.({
|
|
230
234
|
action,
|
|
231
235
|
kind: "spanEnd",
|
|
@@ -266,6 +270,7 @@ async function executeApply(options) {
|
|
|
266
270
|
outcome: "ok"
|
|
267
271
|
});
|
|
268
272
|
const orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);
|
|
273
|
+
const plannerWarnings = aggregatePlannerWarnings(orderedResolutions);
|
|
269
274
|
const appResolution = orderedResolutions.find((r) => r.spaceId === aggregate.app.spaceId);
|
|
270
275
|
if (!appResolution) throw new Error("Aggregate planner returned no plan for the app member — the planner is supposed to always emit one.");
|
|
271
276
|
const appPlan = appResolution.entry.plan;
|
|
@@ -279,10 +284,11 @@ async function executeApply(options) {
|
|
|
279
284
|
destination: appPlan.destination,
|
|
280
285
|
preview,
|
|
281
286
|
perSpace,
|
|
282
|
-
summary
|
|
287
|
+
summary,
|
|
288
|
+
...ifDefined("warnings", plannerWarnings)
|
|
283
289
|
});
|
|
284
290
|
}
|
|
285
|
-
const applied = await
|
|
291
|
+
const applied = await runMigration({
|
|
286
292
|
aggregate,
|
|
287
293
|
perSpacePlans: planResult.value.perSpace,
|
|
288
294
|
applyOrder: planResult.value.applyOrder,
|
|
@@ -297,7 +303,8 @@ async function executeApply(options) {
|
|
|
297
303
|
if (!applied.ok) return buildRunnerFailure({
|
|
298
304
|
summary: applied.failure.summary,
|
|
299
305
|
...ifDefined("why", applied.failure.why),
|
|
300
|
-
meta: applied.failure.meta
|
|
306
|
+
meta: applied.failure.meta,
|
|
307
|
+
...ifDefined("warnings", plannerWarnings)
|
|
301
308
|
});
|
|
302
309
|
const aggregateOps = applied.value.orderedResolutions.flatMap((r) => r.entry.displayOps);
|
|
303
310
|
const summary = action === "dbInit" ? `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), database signed` : applied.value.totalOpsExecuted === 0 ? `Database already matches contract across ${applied.value.orderedResolutions.length} space(s), signature updated` : `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), signature updated`;
|
|
@@ -307,9 +314,14 @@ async function executeApply(options) {
|
|
|
307
314
|
operationsPlanned: applied.value.totalOpsPlanned,
|
|
308
315
|
operationsExecuted: applied.value.totalOpsExecuted,
|
|
309
316
|
perSpace: applied.value.perSpace,
|
|
310
|
-
summary
|
|
317
|
+
summary,
|
|
318
|
+
...ifDefined("warnings", plannerWarnings)
|
|
311
319
|
});
|
|
312
320
|
}
|
|
321
|
+
function aggregatePlannerWarnings(orderedResolutions) {
|
|
322
|
+
const warnings = orderedResolutions.flatMap((r) => r.entry.warnings ?? []);
|
|
323
|
+
return warnings.length > 0 ? warnings : void 0;
|
|
324
|
+
}
|
|
313
325
|
/**
|
|
314
326
|
* Compare the live `_prisma_marker` rows against the aggregate's
|
|
315
327
|
* declared members. Any marker row whose `space` is not a member of
|
|
@@ -342,13 +354,13 @@ function detectOrphanMarkers(aggregate, markerRows) {
|
|
|
342
354
|
});
|
|
343
355
|
}
|
|
344
356
|
function mapPlannerError(error) {
|
|
345
|
-
if (error.kind === "appSynthFailure") return notOk({
|
|
357
|
+
if (error.kind === "appSynthFailure") return blindCast(notOk({
|
|
346
358
|
code: "PLANNING_FAILED",
|
|
347
359
|
summary: "Migration planning failed due to conflicts",
|
|
348
360
|
conflicts: error.conflicts,
|
|
349
361
|
why: void 0,
|
|
350
362
|
meta: void 0
|
|
351
|
-
});
|
|
363
|
+
}));
|
|
352
364
|
if (error.kind === "extensionPathUnreachable") return buildRunnerFailure({
|
|
353
365
|
summary: `Cannot resolve apply path for extension space "${error.spaceId}"`,
|
|
354
366
|
why: `No path in the on-disk migration graph for extension space "${error.spaceId}" reaches the on-disk head ref hash "${error.target}".`,
|
|
@@ -383,7 +395,8 @@ function wrapPlanResult(args) {
|
|
|
383
395
|
...ifDefined("profileHash", args.destination.profileHash)
|
|
384
396
|
},
|
|
385
397
|
perSpace: args.perSpace,
|
|
386
|
-
summary: args.summary
|
|
398
|
+
summary: args.summary,
|
|
399
|
+
...ifDefined("warnings", args.warnings)
|
|
387
400
|
});
|
|
388
401
|
}
|
|
389
402
|
function wrapApplyResult(args) {
|
|
@@ -403,17 +416,19 @@ function wrapApplyResult(args) {
|
|
|
403
416
|
profileHash: args.destination.profileHash
|
|
404
417
|
} : { storageHash: args.destination.storageHash },
|
|
405
418
|
perSpace: args.perSpace,
|
|
406
|
-
summary: args.summary
|
|
419
|
+
summary: args.summary,
|
|
420
|
+
...ifDefined("warnings", args.warnings)
|
|
407
421
|
});
|
|
408
422
|
}
|
|
409
423
|
function buildRunnerFailure(args) {
|
|
410
|
-
return notOk({
|
|
424
|
+
return blindCast(notOk({
|
|
411
425
|
code: "RUNNER_FAILED",
|
|
412
426
|
summary: args.summary,
|
|
413
427
|
why: args.why,
|
|
414
428
|
meta: args.meta,
|
|
415
|
-
conflicts: void 0
|
|
416
|
-
|
|
429
|
+
conflicts: void 0,
|
|
430
|
+
...ifDefined("warnings", args.warnings)
|
|
431
|
+
}));
|
|
417
432
|
}
|
|
418
433
|
//#endregion
|
|
419
434
|
//#region src/control-api/operations/db-init.ts
|
|
@@ -425,7 +440,7 @@ function buildRunnerFailure(args) {
|
|
|
425
440
|
* changes belong to `db update`.
|
|
426
441
|
*/
|
|
427
442
|
async function executeDbInit(options) {
|
|
428
|
-
return await
|
|
443
|
+
return await executeRun({
|
|
429
444
|
driver: options.driver,
|
|
430
445
|
familyInstance: options.familyInstance,
|
|
431
446
|
contract: options.contract,
|
|
@@ -474,7 +489,7 @@ async function executeDbUpdate(options) {
|
|
|
474
489
|
const gate = await guardDestructiveChanges(sharedInputs);
|
|
475
490
|
if (gate !== null) return gate;
|
|
476
491
|
}
|
|
477
|
-
return await
|
|
492
|
+
return await executeRun({
|
|
478
493
|
...sharedInputs,
|
|
479
494
|
mode: options.mode
|
|
480
495
|
});
|
|
@@ -487,7 +502,7 @@ async function executeDbUpdate(options) {
|
|
|
487
502
|
* run.
|
|
488
503
|
*/
|
|
489
504
|
async function guardDestructiveChanges(sharedInputs) {
|
|
490
|
-
const planResult = await
|
|
505
|
+
const planResult = await executeRun({
|
|
491
506
|
...sharedInputs,
|
|
492
507
|
mode: "plan"
|
|
493
508
|
});
|
|
@@ -541,7 +556,8 @@ async function executeDbVerify(options) {
|
|
|
541
556
|
const schemaIntrospection = skipSchema ? null : await runIntrospection({
|
|
542
557
|
driver,
|
|
543
558
|
familyInstance,
|
|
544
|
-
onProgress
|
|
559
|
+
onProgress,
|
|
560
|
+
contract: collectAggregateNamespaces(aggregate)
|
|
545
561
|
});
|
|
546
562
|
emitVerifySpan(onProgress, "spanStart");
|
|
547
563
|
return finaliseVerifyResult({
|
|
@@ -567,7 +583,7 @@ function buildLoadInputs(options) {
|
|
|
567
583
|
};
|
|
568
584
|
}
|
|
569
585
|
async function runIntrospection(args) {
|
|
570
|
-
const { driver, familyInstance, onProgress } = args;
|
|
586
|
+
const { driver, familyInstance, onProgress, contract } = args;
|
|
571
587
|
onProgress?.({
|
|
572
588
|
action: "dbVerify",
|
|
573
589
|
kind: "spanStart",
|
|
@@ -575,7 +591,10 @@ async function runIntrospection(args) {
|
|
|
575
591
|
label: "Introspecting database schema"
|
|
576
592
|
});
|
|
577
593
|
try {
|
|
578
|
-
const result = await familyInstance.introspect({
|
|
594
|
+
const result = await familyInstance.introspect({
|
|
595
|
+
driver,
|
|
596
|
+
contract
|
|
597
|
+
});
|
|
579
598
|
onProgress?.({
|
|
580
599
|
action: "dbVerify",
|
|
581
600
|
kind: "spanEnd",
|
|
@@ -605,7 +624,7 @@ function createPerMemberVerifier(options) {
|
|
|
605
624
|
if (skipSchema) return buildSkippedSchemaResult(member);
|
|
606
625
|
return familyInstance.verifySchema({
|
|
607
626
|
contract: member.contract(),
|
|
608
|
-
schema: projectedSchema,
|
|
627
|
+
schema: blindCast(projectedSchema),
|
|
609
628
|
strict: verifyMode === "strict",
|
|
610
629
|
frameworkComponents
|
|
611
630
|
});
|
|
@@ -730,7 +749,7 @@ function mapMarkerCheckFailures(appSpaceId, section) {
|
|
|
730
749
|
});
|
|
731
750
|
}
|
|
732
751
|
//#endregion
|
|
733
|
-
//#region src/control-api/operations/
|
|
752
|
+
//#region src/control-api/operations/migrate.ts
|
|
734
753
|
/**
|
|
735
754
|
* Apply pending migrations across every contract space (app +
|
|
736
755
|
* extensions). Replay-only: graph-walk against the on-disk graph for
|
|
@@ -745,14 +764,14 @@ function mapMarkerCheckFailures(appSpaceId, section) {
|
|
|
745
764
|
* marker to `member.headRef.hash` (or `refHash` for the app
|
|
746
765
|
* member when provided). Empty-graph members fail loudly — a
|
|
747
766
|
* "never planned" space is a user-error condition for replay.
|
|
748
|
-
* 4. Hand off to {@link
|
|
767
|
+
* 4. Hand off to {@link runMigration} (the runner-driving tail
|
|
749
768
|
* shared with `db init` / `db update`). Marker advancement is
|
|
750
769
|
* inside the per-space transaction.
|
|
751
770
|
*
|
|
752
771
|
* Encodes the replay-only contract: every contract space must have an
|
|
753
772
|
* authored migration graph on disk before this operation can advance it.
|
|
754
773
|
*/
|
|
755
|
-
async function
|
|
774
|
+
async function executeMigrate(options) {
|
|
756
775
|
const { driver, familyInstance, contract, migrations, frameworkComponents, migrationsDir, extensionPacks, targetId, refHash, refInvariants, refName, onProgress } = options;
|
|
757
776
|
const loaded = await buildContractSpaceAggregate({
|
|
758
777
|
targetId,
|
|
@@ -770,39 +789,23 @@ async function executeMigrationApply(options) {
|
|
|
770
789
|
for (const member of allMembers) {
|
|
771
790
|
const isAppMember = member.spaceId === aggregate.app.spaceId;
|
|
772
791
|
const headRef = requireHeadRef(member);
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
targetHash,
|
|
782
|
-
liveMarker
|
|
783
|
-
}));
|
|
784
|
-
continue;
|
|
785
|
-
}
|
|
786
|
-
return notOk(buildNeverPlannedFailure(member.spaceId, targetHash));
|
|
787
|
-
}
|
|
788
|
-
const targetInvariants = isAppMember && refHash !== void 0 && refInvariants !== void 0 ? refInvariants : headRef.invariants;
|
|
789
|
-
const targetMember = targetHash === headRef.hash && targetInvariants === headRef.invariants ? member : {
|
|
790
|
-
...member,
|
|
791
|
-
headRef: {
|
|
792
|
-
hash: targetHash,
|
|
793
|
-
invariants: targetInvariants
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
const walked = graphWalkStrategy({
|
|
797
|
-
aggregateTargetId: aggregate.targetId,
|
|
798
|
-
member: targetMember,
|
|
799
|
-
currentMarker: liveMarker,
|
|
800
|
-
...isAppMember && refName !== void 0 ? { refName } : {}
|
|
792
|
+
const memberTargetHash = isAppMember && refHash !== void 0 ? refHash : headRef.hash;
|
|
793
|
+
const outcome = planMemberPath({
|
|
794
|
+
member,
|
|
795
|
+
aggregate,
|
|
796
|
+
targetHash: memberTargetHash,
|
|
797
|
+
refInvariants: isAppMember && refHash !== void 0 ? refInvariants : void 0,
|
|
798
|
+
liveMarker: markerRows.get(member.spaceId) ?? null,
|
|
799
|
+
...isAppMember ? { refName } : {}
|
|
801
800
|
});
|
|
802
|
-
if (
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
801
|
+
if (outcome.kind === "at-head") {
|
|
802
|
+
atHeadResolutions.set(member.spaceId, outcome.plan);
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));
|
|
806
|
+
if (outcome.kind === "unreachable") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));
|
|
807
|
+
if (outcome.kind === "unsatisfiable") {
|
|
808
|
+
const structural = findPathWithDecision(outcome.targetMember.graph(), outcome.liveHash, memberTargetHash, { required: /* @__PURE__ */ new Set() });
|
|
806
809
|
const structuralPath = structural.kind === "ok" ? structural.decision.selectedPath.map((edge) => ({
|
|
807
810
|
dirName: edge.dirName,
|
|
808
811
|
migrationHash: edge.migrationHash,
|
|
@@ -811,13 +814,13 @@ async function executeMigrationApply(options) {
|
|
|
811
814
|
invariants: edge.invariants
|
|
812
815
|
})) : [];
|
|
813
816
|
throw errorNoInvariantPath({
|
|
814
|
-
...
|
|
815
|
-
required: targetInvariants,
|
|
816
|
-
missing:
|
|
817
|
+
...outcome.refName !== void 0 ? { refName: outcome.refName } : {},
|
|
818
|
+
required: outcome.targetInvariants,
|
|
819
|
+
missing: outcome.missing,
|
|
817
820
|
structuralPath
|
|
818
821
|
});
|
|
819
822
|
}
|
|
820
|
-
perSpacePlans.set(member.spaceId,
|
|
823
|
+
perSpacePlans.set(member.spaceId, outcome.plan);
|
|
821
824
|
}
|
|
822
825
|
const canonicalOrder = [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId];
|
|
823
826
|
const applyOrder = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId));
|
|
@@ -840,7 +843,7 @@ async function executeMigrationApply(options) {
|
|
|
840
843
|
summary: totalSpaces === 0 ? "Already up to date — no contract spaces are loaded" : totalSpaces === 1 ? "Already up to date" : `Already up to date across ${totalSpaces} space(s)`
|
|
841
844
|
}));
|
|
842
845
|
}
|
|
843
|
-
const applied = await
|
|
846
|
+
const applied = await runMigration({
|
|
844
847
|
aggregate,
|
|
845
848
|
perSpacePlans,
|
|
846
849
|
applyOrder,
|
|
@@ -854,7 +857,7 @@ async function executeMigrationApply(options) {
|
|
|
854
857
|
"destructive",
|
|
855
858
|
"data"
|
|
856
859
|
] },
|
|
857
|
-
action: "
|
|
860
|
+
action: "migrate",
|
|
858
861
|
...ifDefined("onProgress", onProgress)
|
|
859
862
|
});
|
|
860
863
|
if (!applied.ok) return notOk({
|
|
@@ -876,7 +879,7 @@ async function executeMigrationApply(options) {
|
|
|
876
879
|
};
|
|
877
880
|
});
|
|
878
881
|
const perSpaceAll = buildPerSpaceBreakdown(orderedAll, aggregate.app.spaceId, { includeMarkers: true });
|
|
879
|
-
const summary = `Applied ${applied.value.orderedResolutions.reduce((sum, r) => sum +
|
|
882
|
+
const summary = `Applied ${applied.value.orderedResolutions.reduce((sum, r) => sum + r.entry.migrationEdges.length, 0)} migration(s) (${applied.value.totalOpsExecuted} operation(s)) across ${orderedAll.length} contract space(s)`;
|
|
880
883
|
return ok(buildSuccess({
|
|
881
884
|
aggregate,
|
|
882
885
|
orderedResolutions: orderedAll,
|
|
@@ -886,6 +889,79 @@ async function executeMigrationApply(options) {
|
|
|
886
889
|
}));
|
|
887
890
|
}
|
|
888
891
|
/**
|
|
892
|
+
* Compute the graph-walk path for one contract-space member.
|
|
893
|
+
*
|
|
894
|
+
* Encapsulates the invariant-correct input assembly that both
|
|
895
|
+
* `executeMigrate` and `executeMigrateShowCommand` must use:
|
|
896
|
+
* - `currentMarker` carries the full live marker including `invariants`
|
|
897
|
+
* (not a stripped `{ storageHash, invariants: [] }` shell).
|
|
898
|
+
* - `targetInvariants` uses the caller-supplied `refInvariants` when a
|
|
899
|
+
* `--to` ref was resolved (not always the file head ref's invariants).
|
|
900
|
+
*
|
|
901
|
+
* Both callers map the returned `MemberPathOutcome` to their own error
|
|
902
|
+
* representation; the path-compute logic is shared and identical.
|
|
903
|
+
*
|
|
904
|
+
* @internal Exported for `executeMigrateShowCommand`.
|
|
905
|
+
*/
|
|
906
|
+
function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMarker, refName }) {
|
|
907
|
+
const isAppMember = member.spaceId === aggregate.app.spaceId;
|
|
908
|
+
const headRef = requireHeadRef(member);
|
|
909
|
+
if (member.graph().nodes.size === 0) {
|
|
910
|
+
const liveHash = liveMarker?.storageHash;
|
|
911
|
+
if (targetHash === liveHash || liveHash === void 0 && targetHash === EMPTY_CONTRACT_HASH) return {
|
|
912
|
+
kind: "at-head",
|
|
913
|
+
plan: buildAtHeadResolution({
|
|
914
|
+
aggregateTargetId: aggregate.targetId,
|
|
915
|
+
member,
|
|
916
|
+
targetHash,
|
|
917
|
+
liveMarker
|
|
918
|
+
})
|
|
919
|
+
};
|
|
920
|
+
return {
|
|
921
|
+
kind: "never-planned",
|
|
922
|
+
spaceId: member.spaceId,
|
|
923
|
+
targetHash
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
const targetInvariants = isAppMember && refInvariants !== void 0 ? refInvariants : headRef.invariants;
|
|
927
|
+
const targetMember = targetHash === headRef.hash && targetInvariants === headRef.invariants ? member : {
|
|
928
|
+
...member,
|
|
929
|
+
headRef: {
|
|
930
|
+
hash: targetHash,
|
|
931
|
+
invariants: targetInvariants
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
const walked = graphWalkStrategy({
|
|
935
|
+
aggregateTargetId: aggregate.targetId,
|
|
936
|
+
member: targetMember,
|
|
937
|
+
currentMarker: liveMarker,
|
|
938
|
+
...isAppMember && refName !== void 0 ? { refName } : {}
|
|
939
|
+
});
|
|
940
|
+
if (walked.kind === "unreachable") return {
|
|
941
|
+
kind: "unreachable",
|
|
942
|
+
spaceId: member.spaceId,
|
|
943
|
+
liveMarker,
|
|
944
|
+
targetHash
|
|
945
|
+
};
|
|
946
|
+
if (walked.kind === "unsatisfiable") {
|
|
947
|
+
const liveHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;
|
|
948
|
+
return {
|
|
949
|
+
kind: "unsatisfiable",
|
|
950
|
+
spaceId: member.spaceId,
|
|
951
|
+
isAppMember,
|
|
952
|
+
missing: walked.missing,
|
|
953
|
+
targetInvariants,
|
|
954
|
+
targetMember,
|
|
955
|
+
liveHash,
|
|
956
|
+
refName
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
return {
|
|
960
|
+
kind: "ok",
|
|
961
|
+
plan: walked.result
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
889
965
|
* Build a zero-op {@link PerSpacePlan} for an empty-graph
|
|
890
966
|
* member whose live marker already matches the target. Lets the apply
|
|
891
967
|
* pipeline thread the member through `perSpacePlans` -> `applyOrder`
|
|
@@ -906,7 +982,11 @@ function buildAtHeadResolution(args) {
|
|
|
906
982
|
displayOps: [],
|
|
907
983
|
destinationContract: member.contract(),
|
|
908
984
|
strategy: "graph-walk",
|
|
909
|
-
migrationEdges: [
|
|
985
|
+
migrationEdges: [buildSynthMigrationEdge({
|
|
986
|
+
currentMarkerStorageHash: liveMarker?.storageHash,
|
|
987
|
+
destinationStorageHash: targetHash,
|
|
988
|
+
operationCount: 0
|
|
989
|
+
})]
|
|
910
990
|
};
|
|
911
991
|
}
|
|
912
992
|
function sumPlannedOps(applyOrder, perSpacePlans) {
|
|
@@ -922,7 +1002,7 @@ function buildSuccess(args) {
|
|
|
922
1002
|
const appResolution = args.orderedResolutions.find((r) => r.spaceId === args.aggregate.app.spaceId);
|
|
923
1003
|
const appMarkerHash = appResolution?.entry.plan.destination.storageHash ?? requireHeadRef(args.aggregate.app).hash;
|
|
924
1004
|
const applied = args.orderedResolutions.flatMap((r) => {
|
|
925
|
-
return
|
|
1005
|
+
return r.entry.migrationEdges.map((edge) => ({
|
|
926
1006
|
spaceId: r.spaceId,
|
|
927
1007
|
dirName: edge.dirName,
|
|
928
1008
|
migrationHash: edge.migrationHash,
|
|
@@ -1302,9 +1382,17 @@ var ControlClientImpl = class {
|
|
|
1302
1382
|
const { driver, familyInstance } = await this.ensureConnected();
|
|
1303
1383
|
return familyInstance.readAllMarkers({ driver });
|
|
1304
1384
|
}
|
|
1305
|
-
|
|
1385
|
+
/** Reads the per-migration journal; omit `space` to return every space. */
|
|
1386
|
+
async readLedger(space) {
|
|
1387
|
+
const { driver, familyInstance } = await this.ensureConnected();
|
|
1388
|
+
return familyInstance.readLedger({
|
|
1389
|
+
driver,
|
|
1390
|
+
...ifDefined("space", space)
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
async migrate(options) {
|
|
1306
1394
|
const { onProgress } = options;
|
|
1307
|
-
await this.connectWithProgress(options.connection, "
|
|
1395
|
+
await this.connectWithProgress(options.connection, "migrate", onProgress);
|
|
1308
1396
|
const { driver, familyInstance, frameworkComponents } = await this.ensureConnected();
|
|
1309
1397
|
if (!hasMigrations(this.options.target)) throw new Error(`Target "${this.options.target.targetId}" does not support migrations`);
|
|
1310
1398
|
let contract;
|
|
@@ -1313,7 +1401,7 @@ var ControlClientImpl = class {
|
|
|
1313
1401
|
} catch (error) {
|
|
1314
1402
|
throw new ContractValidationError(error instanceof Error ? error.message : String(error), error);
|
|
1315
1403
|
}
|
|
1316
|
-
return
|
|
1404
|
+
return executeMigrate({
|
|
1317
1405
|
driver,
|
|
1318
1406
|
familyInstance,
|
|
1319
1407
|
contract,
|
|
@@ -1444,8 +1532,9 @@ var ControlClientImpl = class {
|
|
|
1444
1532
|
});
|
|
1445
1533
|
try {
|
|
1446
1534
|
const enrichedIR = enrichContract(contractRaw, this.frameworkComponents ?? []);
|
|
1535
|
+
let deserializedContract;
|
|
1447
1536
|
try {
|
|
1448
|
-
this.familyInstance.deserializeContract(enrichedIR);
|
|
1537
|
+
deserializedContract = this.familyInstance.deserializeContract(enrichedIR);
|
|
1449
1538
|
} catch (error) {
|
|
1450
1539
|
onProgress?.({
|
|
1451
1540
|
action: "emit",
|
|
@@ -1460,7 +1549,7 @@ var ControlClientImpl = class {
|
|
|
1460
1549
|
meta: void 0
|
|
1461
1550
|
});
|
|
1462
1551
|
}
|
|
1463
|
-
const result = await emit(
|
|
1552
|
+
const result = await emit(deserializedContract, this.stack, this.options.family.emission, { serializeContract: (contract) => this.options.target.contractSerializer.serializeContract(contract) });
|
|
1464
1553
|
onProgress?.({
|
|
1465
1554
|
action: "emit",
|
|
1466
1555
|
kind: "spanEnd",
|
|
@@ -1491,6 +1580,6 @@ var ControlClientImpl = class {
|
|
|
1491
1580
|
}
|
|
1492
1581
|
};
|
|
1493
1582
|
//#endregion
|
|
1494
|
-
export {
|
|
1583
|
+
export { executeDbInit as a, executeDbUpdate as i, planMemberPath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
|
|
1495
1584
|
|
|
1496
|
-
//# sourceMappingURL=client-
|
|
1585
|
+
//# sourceMappingURL=client-DQvxtihf.mjs.map
|