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