@prisma-next/cli 0.14.0-dev.4 → 0.14.0-dev.40
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 +27 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-CJzuo5wX.mjs → client-CWTNqJdj.mjs} +76 -72
- package/dist/client-CWTNqJdj.mjs.map +1 -0
- package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-6cNJZ863.mjs} +3 -3
- package/dist/{command-helpers-DGMvGBeX.mjs.map → command-helpers-6cNJZ863.mjs.map} +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +5 -5
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +35 -35
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +8 -8
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.d.mts +6 -6
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +4 -4
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +4 -4
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-DdxWRjMc.mjs} +2 -2
- package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-DdxWRjMc.mjs.map} +1 -1
- package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-CMwCj7_m.mjs} +8 -6
- package/dist/contract-emit-CMwCj7_m.mjs.map +1 -0
- package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-klH7zzaV.mjs} +6 -6
- package/dist/contract-emit-klH7zzaV.mjs.map +1 -0
- package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-B__56PGb.mjs} +3 -3
- package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-B__56PGb.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-Bu2fjSWV.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs.map → contract-space-aggregate-loader-Bu2fjSWV.mjs.map} +1 -1
- package/dist/{db-verify-C24FKhb7.mjs → db-verify-DlqHvkkA.mjs} +69 -49
- package/dist/db-verify-DlqHvkkA.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +3 -3
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +2 -2
- package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +1 -1
- package/dist/{format-C8yv6mXH.mjs → format-C3XdaDuA.mjs} +3 -3
- package/dist/format-C3XdaDuA.mjs.map +1 -0
- package/dist/{framework-components-YVQHhPH7.mjs → framework-components-5RljWT7Q.mjs} +2 -2
- package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-5RljWT7Q.mjs.map} +1 -1
- package/dist/{init-a3-ljrL3.mjs → init-BF3s9NcB.mjs} +3 -3
- package/dist/{init-a3-ljrL3.mjs.map → init-BF3s9NcB.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-Dd1Ft0dw.mjs} +4 -4
- package/dist/inspect-live-schema-Dd1Ft0dw.mjs.map +1 -0
- package/dist/{migration-check-VwM8xCZV.mjs → migration-check-UoHMvsP3.mjs} +10 -11
- package/dist/migration-check-UoHMvsP3.mjs.map +1 -0
- package/dist/migration-cli.mjs +1 -1
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-DW2BpjZW.mjs} +4 -4
- package/dist/migration-command-scaffold-DW2BpjZW.mjs.map +1 -0
- package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-BOzQzJK4.mjs} +15 -15
- package/dist/migration-list-BOzQzJK4.mjs.map +1 -0
- package/dist/{migration-log-CG0qQAFm.mjs → migration-log-q50rqMiU.mjs} +4 -4
- package/dist/migration-log-q50rqMiU.mjs.map +1 -0
- package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-zK6RG6JY.mjs} +2 -2
- package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-zK6RG6JY.mjs.map} +1 -1
- package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-BwJLPkwV.mjs} +24 -24
- package/dist/migration-plan-BwJLPkwV.mjs.map +1 -0
- package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-27NzO2SC.mjs} +13 -14
- package/dist/migration-status-27NzO2SC.mjs.map +1 -0
- package/dist/{telemetry-BIM4beEO.mjs → telemetry-BckOSUWG.mjs} +2 -2
- package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-BckOSUWG.mjs.map} +1 -1
- package/dist/{types-C_tYiJYx.d.mts → types-CKgJmH02.d.mts} +26 -20
- package/dist/types-CKgJmH02.d.mts.map +1 -0
- package/dist/{verify-DcOYZ1tH.mjs → verify-DC14_nPu.mjs} +29 -6
- package/dist/verify-DC14_nPu.mjs.map +1 -0
- package/package.json +21 -24
- package/src/cli.ts +3 -0
- package/src/commands/contract-emit.ts +1 -1
- package/src/commands/db-sign.ts +1 -1
- package/src/commands/db-verify.ts +32 -20
- package/src/commands/inspect-live-schema.ts +1 -1
- package/src/commands/lsp.ts +32 -0
- package/src/commands/migrate.ts +45 -42
- package/src/commands/migration-check.ts +6 -6
- package/src/commands/migration-graph.ts +5 -5
- package/src/commands/migration-list.ts +13 -13
- package/src/commands/migration-log.ts +1 -1
- package/src/commands/migration-new.ts +1 -1
- package/src/commands/migration-plan.ts +4 -4
- package/src/commands/migration-show.ts +1 -1
- package/src/commands/migration-status.ts +10 -10
- package/src/commands/ref.ts +1 -1
- package/src/control-api/client.ts +5 -3
- package/src/control-api/operations/contract-emit.ts +8 -7
- package/src/control-api/operations/db-init.ts +2 -2
- package/src/control-api/operations/db-run.ts +7 -7
- package/src/control-api/operations/db-verify.ts +38 -33
- package/src/control-api/operations/format.ts +1 -2
- package/src/control-api/operations/migrate.ts +66 -66
- package/src/control-api/operations/run-migration.ts +2 -2
- package/src/control-api/types.ts +7 -7
- package/src/migration-cli.ts +1 -1
- package/src/utils/combine-verify-results.ts +113 -0
- package/src/utils/extension-pack-inputs.ts +1 -1
- package/src/utils/formatters/verify.ts +44 -3
- package/src/utils/migration-command-scaffold.ts +1 -1
- package/src/utils/plan-resolution.ts +18 -18
- package/dist/client-CJzuo5wX.mjs.map +0 -1
- package/dist/config-loader-p9JMrekQ.mjs +0 -88
- package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
- package/dist/config-loader.d.mts +0 -16
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/config-loader.mjs +0 -2
- package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
- package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
- package/dist/db-verify-C24FKhb7.mjs.map +0 -1
- package/dist/format-C8yv6mXH.mjs.map +0 -1
- package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
- package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
- package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
- package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
- package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
- package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
- package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
- package/dist/types-C_tYiJYx.d.mts.map +0 -1
- package/dist/verify-DcOYZ1tH.mjs.map +0 -1
- package/src/config-loader.ts +0 -92
- package/src/config-path-validation.ts +0 -74
- package/src/utils/combine-schema-results.ts +0 -84
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as CliStructuredError } from "./command-helpers-
|
|
1
|
+
import { F as CliStructuredError } from "./command-helpers-6cNJZ863.mjs";
|
|
2
2
|
import { n as toExtensionInputs } from "./extension-pack-inputs-1ySHqxKG.mjs";
|
|
3
|
-
import { t as assertFrameworkComponentsCompatible } from "./framework-components-
|
|
3
|
+
import { t as assertFrameworkComponentsCompatible } from "./framework-components-5RljWT7Q.mjs";
|
|
4
4
|
import { t as enrichContract } from "./contract-enrichment-gn9sWbPw.mjs";
|
|
5
|
-
import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-
|
|
5
|
+
import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-Bu2fjSWV.mjs";
|
|
6
6
|
import { emit } from "@prisma-next/emitter";
|
|
7
7
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
8
8
|
import { notOk, ok } from "@prisma-next/utils/result";
|
|
@@ -144,7 +144,7 @@ function buildPerSpaceBreakdown(orderedResolutions, appSpaceId, options) {
|
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Materialise the `applyOrder` ordering into resolved per-space
|
|
147
|
-
* entries. Throws if the planner output is missing a
|
|
147
|
+
* entries. Throws if the planner output is missing a contract space listed
|
|
148
148
|
* in `applyOrder` — a wiring bug that should never reach runtime.
|
|
149
149
|
*
|
|
150
150
|
* Exported so callers building their own success envelopes after a
|
|
@@ -197,9 +197,9 @@ const SPAN_IDS$1 = {
|
|
|
197
197
|
* 2. **Read DB state**: marker rows (`familyInstance.readAllMarkers`)
|
|
198
198
|
* + introspected schema (`familyInstance.introspect`).
|
|
199
199
|
* 3. **Plan**: {@link planMigration} chooses graph-walk vs synth per
|
|
200
|
-
*
|
|
200
|
+
* space according to `callerPolicy.ignoreGraphFor`. The app space
|
|
201
201
|
* is forced through synth (today's daily-driver behaviour); every
|
|
202
|
-
* extension
|
|
202
|
+
* extension space walks its on-disk graph.
|
|
203
203
|
* 4. **Apply** (when `mode === 'apply'`): every per-space `MigrationPlan`
|
|
204
204
|
* feeds into the runner's `execute` — one outer
|
|
205
205
|
* transaction across every space; failure on any space rolls back
|
|
@@ -273,7 +273,7 @@ async function executeRun(options) {
|
|
|
273
273
|
const orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);
|
|
274
274
|
const plannerWarnings = aggregatePlannerWarnings(orderedResolutions);
|
|
275
275
|
const appResolution = orderedResolutions.find((r) => r.spaceId === aggregate.app.spaceId);
|
|
276
|
-
if (!appResolution) throw new Error("Aggregate planner returned no plan for the app
|
|
276
|
+
if (!appResolution) throw new Error("Aggregate planner returned no plan for the app space — the planner is supposed to always emit one.");
|
|
277
277
|
const appPlan = appResolution.entry.plan;
|
|
278
278
|
if (mode === "plan") {
|
|
279
279
|
const aggregateOps = orderedResolutions.flatMap((r) => r.entry.displayOps);
|
|
@@ -325,22 +325,22 @@ function aggregatePlannerWarnings(orderedResolutions) {
|
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* Compare the live `_prisma_marker` rows against the aggregate's
|
|
328
|
-
* declared
|
|
328
|
+
* declared contract spaces. Any marker row whose `space` is not a space of
|
|
329
329
|
* the aggregate is an "orphan" — typically a marker left behind by
|
|
330
330
|
* an extension that was removed from `extensionPacks` without first
|
|
331
331
|
* cleaning up its on-disk migrations / database tables.
|
|
332
332
|
*
|
|
333
333
|
* Returns a {@link CliStructuredError} envelope (code `5002`,
|
|
334
334
|
* `kind: 'orphanMarker'`) for the first orphan it finds, or `null`
|
|
335
|
-
* when every marker row maps to a declared
|
|
335
|
+
* when every marker row maps to a declared contract space. Mirrors the M2
|
|
336
336
|
* `runContractSpaceVerifierMarkerCheck` envelope so downstream
|
|
337
337
|
* tooling (integration tests, JSON consumers) keeps asserting on the
|
|
338
338
|
* same shape.
|
|
339
339
|
*/
|
|
340
340
|
function detectOrphanMarkers(aggregate, markerRows) {
|
|
341
|
-
const
|
|
341
|
+
const aggregateSpaceIds = new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);
|
|
342
342
|
const orphans = [];
|
|
343
|
-
for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !
|
|
343
|
+
for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !aggregateSpaceIds.has(spaceId)) orphans.push(spaceId);
|
|
344
344
|
if (orphans.length === 0) return null;
|
|
345
345
|
orphans.sort((a, b) => a.localeCompare(b));
|
|
346
346
|
return new CliStructuredError("5002", orphans.length === 1 ? `Orphan contract-space marker detected for "${orphans[0]}"` : `Orphan contract-space markers detected for ${orphans.length} spaces`, {
|
|
@@ -544,11 +544,11 @@ const SPAN_IDS = {
|
|
|
544
544
|
* structured CLI error.
|
|
545
545
|
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
546
546
|
* schema introspection.
|
|
547
|
-
* 3. **Verify**: {@link verifyMigration} returns per-space
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
* callers (CLI command) can render
|
|
551
|
-
* returned to the caller verbatim.
|
|
547
|
+
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
548
|
+
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
549
|
+
* then scoped to its own contract space). Marker mismatches map to
|
|
550
|
+
* `CliStructuredError` (code `5002`) so callers (CLI command) can render
|
|
551
|
+
* and exit. Verify results are returned to the caller verbatim.
|
|
552
552
|
*/
|
|
553
553
|
async function executeDbVerify(options) {
|
|
554
554
|
const { driver, familyInstance, onProgress, skipSchema, skipMarker } = options;
|
|
@@ -569,7 +569,7 @@ async function executeDbVerify(options) {
|
|
|
569
569
|
markersBySpaceId,
|
|
570
570
|
schemaIntrospection,
|
|
571
571
|
mode: options.mode,
|
|
572
|
-
|
|
572
|
+
verifySchemaForSpace: createPerSpaceVerifier(options)
|
|
573
573
|
}),
|
|
574
574
|
aggregate,
|
|
575
575
|
skipMarker,
|
|
@@ -616,18 +616,18 @@ async function runIntrospection(args) {
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
/**
|
|
619
|
-
* Build the per-
|
|
619
|
+
* Build the per-space schema callback handed to the aggregate verifier.
|
|
620
620
|
* When `skipSchema` is true the callback short-circuits with a synthetic
|
|
621
621
|
* `ok` result so the verifier still runs the (cheap) schemaCheck loop
|
|
622
622
|
* without invoking the family's verification path.
|
|
623
623
|
*/
|
|
624
|
-
function
|
|
624
|
+
function createPerSpaceVerifier(options) {
|
|
625
625
|
const { skipSchema, familyInstance, frameworkComponents } = options;
|
|
626
|
-
return (
|
|
627
|
-
if (skipSchema) return buildSkippedSchemaResult(
|
|
626
|
+
return (schema, space, verifyMode) => {
|
|
627
|
+
if (skipSchema) return buildSkippedSchemaResult(space);
|
|
628
628
|
return familyInstance.verifySchema({
|
|
629
|
-
contract:
|
|
630
|
-
schema
|
|
629
|
+
contract: space.contract(),
|
|
630
|
+
schema,
|
|
631
631
|
strict: verifyMode === "strict",
|
|
632
632
|
frameworkComponents
|
|
633
633
|
});
|
|
@@ -674,13 +674,14 @@ function finaliseVerifyResult(args) {
|
|
|
674
674
|
emitVerifySpan(onProgress, "spanEndOk");
|
|
675
675
|
return ok({
|
|
676
676
|
schemaResults: verifyResult.value.schemaCheck.perSpace,
|
|
677
|
-
|
|
677
|
+
unclaimed: verifyResult.value.schemaCheck.unclaimed,
|
|
678
|
+
spaceOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],
|
|
678
679
|
appSpaceId: aggregate.app.spaceId
|
|
679
680
|
});
|
|
680
681
|
}
|
|
681
|
-
function buildSkippedSchemaResult(
|
|
682
|
-
const contract =
|
|
683
|
-
const headRef = requireHeadRef(
|
|
682
|
+
function buildSkippedSchemaResult(space) {
|
|
683
|
+
const contract = space.contract();
|
|
684
|
+
const headRef = requireHeadRef(space);
|
|
684
685
|
const profileHash = castAs(contract).profileHash;
|
|
685
686
|
return {
|
|
686
687
|
ok: true,
|
|
@@ -692,10 +693,11 @@ function buildSkippedSchemaResult(member) {
|
|
|
692
693
|
target: { expected: contract.target },
|
|
693
694
|
schema: {
|
|
694
695
|
issues: [],
|
|
696
|
+
schemaDiffIssues: [],
|
|
695
697
|
root: {
|
|
696
698
|
status: "pass",
|
|
697
699
|
kind: "skipped",
|
|
698
|
-
name:
|
|
700
|
+
name: space.spaceId,
|
|
699
701
|
contractPath: "",
|
|
700
702
|
code: "SKIPPED",
|
|
701
703
|
message: "Schema verification skipped",
|
|
@@ -756,16 +758,16 @@ function mapMarkerCheckFailures(appSpaceId, section) {
|
|
|
756
758
|
/**
|
|
757
759
|
* Apply pending migrations across every contract space (app +
|
|
758
760
|
* extensions). Replay-only: graph-walk against the on-disk graph for
|
|
759
|
-
* every
|
|
761
|
+
* every contract space; no synth, no introspection.
|
|
760
762
|
*
|
|
761
763
|
* Pipeline:
|
|
762
764
|
*
|
|
763
765
|
* 1. Load aggregate from disk (loader hydrates extension graphs;
|
|
764
766
|
* caller provides app-space packages).
|
|
765
767
|
* 2. Read live marker rows per space (`familyInstance.readAllMarkers`).
|
|
766
|
-
* 3. Per
|
|
767
|
-
* marker to `
|
|
768
|
-
*
|
|
768
|
+
* 3. Per space: `graphWalkStrategy` plots the path from the live
|
|
769
|
+
* marker to `space.headRef.hash` (or `refHash` for the app
|
|
770
|
+
* space when provided). Empty-graph spaces fail loudly — a
|
|
769
771
|
* "never planned" space is a user-error condition for replay.
|
|
770
772
|
* 4. Hand off to {@link runMigration} (the runner-driving tail
|
|
771
773
|
* shared with `db init` / `db update`). Marker advancement is
|
|
@@ -786,29 +788,29 @@ async function executeMigrate(options) {
|
|
|
786
788
|
if (!loaded.ok) throw loaded.failure;
|
|
787
789
|
const aggregate = loaded.value;
|
|
788
790
|
const markerRows = await familyInstance.readAllMarkers({ driver });
|
|
789
|
-
const
|
|
791
|
+
const allSpaces = [aggregate.app, ...aggregate.extensions];
|
|
790
792
|
const perSpacePlans = /* @__PURE__ */ new Map();
|
|
791
793
|
const atHeadResolutions = /* @__PURE__ */ new Map();
|
|
792
|
-
for (const
|
|
793
|
-
const
|
|
794
|
-
const headRef = requireHeadRef(
|
|
795
|
-
const
|
|
796
|
-
const outcome =
|
|
797
|
-
|
|
794
|
+
for (const space of allSpaces) {
|
|
795
|
+
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
796
|
+
const headRef = requireHeadRef(space);
|
|
797
|
+
const spaceTargetHash = isAppSpace && refHash !== void 0 ? refHash : headRef.hash;
|
|
798
|
+
const outcome = planSpacePath({
|
|
799
|
+
space,
|
|
798
800
|
aggregate,
|
|
799
|
-
targetHash:
|
|
800
|
-
refInvariants:
|
|
801
|
-
liveMarker: markerRows.get(
|
|
802
|
-
...
|
|
801
|
+
targetHash: spaceTargetHash,
|
|
802
|
+
refInvariants: isAppSpace && refHash !== void 0 ? refInvariants : void 0,
|
|
803
|
+
liveMarker: markerRows.get(space.spaceId) ?? null,
|
|
804
|
+
...isAppSpace ? { refName } : {}
|
|
803
805
|
});
|
|
804
806
|
if (outcome.kind === "at-head") {
|
|
805
|
-
atHeadResolutions.set(
|
|
807
|
+
atHeadResolutions.set(space.spaceId, outcome.plan);
|
|
806
808
|
continue;
|
|
807
809
|
}
|
|
808
810
|
if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));
|
|
809
811
|
if (outcome.kind === "unreachable") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));
|
|
810
812
|
if (outcome.kind === "unsatisfiable") {
|
|
811
|
-
const structural = findPathWithDecision(outcome.
|
|
813
|
+
const structural = findPathWithDecision(outcome.targetSpace.graph(), outcome.liveHash, spaceTargetHash, { required: /* @__PURE__ */ new Set() });
|
|
812
814
|
const structuralPath = structural.kind === "ok" ? structural.decision.selectedPath.map((edge) => ({
|
|
813
815
|
dirName: edge.dirName,
|
|
814
816
|
migrationHash: edge.migrationHash,
|
|
@@ -823,7 +825,7 @@ async function executeMigrate(options) {
|
|
|
823
825
|
structuralPath
|
|
824
826
|
});
|
|
825
827
|
}
|
|
826
|
-
perSpacePlans.set(
|
|
828
|
+
perSpacePlans.set(space.spaceId, outcome.plan);
|
|
827
829
|
}
|
|
828
830
|
const canonicalOrder = [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId];
|
|
829
831
|
const applyOrder = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId));
|
|
@@ -892,7 +894,7 @@ async function executeMigrate(options) {
|
|
|
892
894
|
}));
|
|
893
895
|
}
|
|
894
896
|
/**
|
|
895
|
-
* Compute the graph-walk path for one contract
|
|
897
|
+
* Compute the graph-walk path for one contract space.
|
|
896
898
|
*
|
|
897
899
|
* Encapsulates the invariant-correct input assembly that both
|
|
898
900
|
* `executeMigrate` and `executeMigrateShowCommand` must use:
|
|
@@ -901,34 +903,34 @@ async function executeMigrate(options) {
|
|
|
901
903
|
* - `targetInvariants` uses the caller-supplied `refInvariants` when a
|
|
902
904
|
* `--to` ref was resolved (not always the file head ref's invariants).
|
|
903
905
|
*
|
|
904
|
-
* Both callers map the returned `
|
|
906
|
+
* Both callers map the returned `SpacePathOutcome` to their own error
|
|
905
907
|
* representation; the path-compute logic is shared and identical.
|
|
906
908
|
*
|
|
907
909
|
* @internal Exported for `executeMigrateShowCommand`.
|
|
908
910
|
*/
|
|
909
|
-
function
|
|
910
|
-
const
|
|
911
|
-
const headRef = requireHeadRef(
|
|
912
|
-
if (
|
|
911
|
+
function planSpacePath({ space, aggregate, targetHash, refInvariants, liveMarker, refName }) {
|
|
912
|
+
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
913
|
+
const headRef = requireHeadRef(space);
|
|
914
|
+
if (space.graph().nodes.size === 0) {
|
|
913
915
|
const liveHash = liveMarker?.storageHash;
|
|
914
916
|
if (targetHash === liveHash || liveHash === void 0 && targetHash === EMPTY_CONTRACT_HASH) return {
|
|
915
917
|
kind: "at-head",
|
|
916
918
|
plan: buildAtHeadResolution({
|
|
917
919
|
aggregateTargetId: aggregate.targetId,
|
|
918
|
-
|
|
920
|
+
space,
|
|
919
921
|
targetHash,
|
|
920
922
|
liveMarker
|
|
921
923
|
})
|
|
922
924
|
};
|
|
923
925
|
return {
|
|
924
926
|
kind: "never-planned",
|
|
925
|
-
spaceId:
|
|
927
|
+
spaceId: space.spaceId,
|
|
926
928
|
targetHash
|
|
927
929
|
};
|
|
928
930
|
}
|
|
929
|
-
const targetInvariants =
|
|
930
|
-
const
|
|
931
|
-
...
|
|
931
|
+
const targetInvariants = isAppSpace && refInvariants !== void 0 ? refInvariants : headRef.invariants;
|
|
932
|
+
const targetSpace = targetHash === headRef.hash && targetInvariants === headRef.invariants ? space : {
|
|
933
|
+
...space,
|
|
932
934
|
headRef: {
|
|
933
935
|
hash: targetHash,
|
|
934
936
|
invariants: targetInvariants
|
|
@@ -936,13 +938,13 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
|
|
|
936
938
|
};
|
|
937
939
|
const walked = graphWalkStrategy({
|
|
938
940
|
aggregateTargetId: aggregate.targetId,
|
|
939
|
-
|
|
941
|
+
space: targetSpace,
|
|
940
942
|
currentMarker: liveMarker,
|
|
941
|
-
...
|
|
943
|
+
...isAppSpace && refName !== void 0 ? { refName } : {}
|
|
942
944
|
});
|
|
943
945
|
if (walked.kind === "unreachable") return {
|
|
944
946
|
kind: "unreachable",
|
|
945
|
-
spaceId:
|
|
947
|
+
spaceId: space.spaceId,
|
|
946
948
|
liveMarker,
|
|
947
949
|
targetHash
|
|
948
950
|
};
|
|
@@ -950,11 +952,11 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
|
|
|
950
952
|
const liveHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;
|
|
951
953
|
return {
|
|
952
954
|
kind: "unsatisfiable",
|
|
953
|
-
spaceId:
|
|
954
|
-
|
|
955
|
+
spaceId: space.spaceId,
|
|
956
|
+
isAppSpace,
|
|
955
957
|
missing: walked.missing,
|
|
956
958
|
targetInvariants,
|
|
957
|
-
|
|
959
|
+
targetSpace,
|
|
958
960
|
liveHash,
|
|
959
961
|
refName
|
|
960
962
|
};
|
|
@@ -966,24 +968,24 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
|
|
|
966
968
|
}
|
|
967
969
|
/**
|
|
968
970
|
* Build a zero-op {@link PerSpacePlan} for an empty-graph
|
|
969
|
-
*
|
|
970
|
-
* pipeline thread the
|
|
971
|
+
* space whose live marker already matches the target. Lets the apply
|
|
972
|
+
* pipeline thread the space through `perSpacePlans` -> `applyOrder`
|
|
971
973
|
* -> the success envelope's `perSpace[]` block so the result reflects
|
|
972
974
|
* every loaded space, even when there is nothing to execute.
|
|
973
975
|
*/
|
|
974
976
|
function buildAtHeadResolution(args) {
|
|
975
|
-
const { aggregateTargetId,
|
|
977
|
+
const { aggregateTargetId, space, targetHash, liveMarker } = args;
|
|
976
978
|
return {
|
|
977
979
|
plan: {
|
|
978
980
|
targetId: aggregateTargetId,
|
|
979
|
-
spaceId:
|
|
981
|
+
spaceId: space.spaceId,
|
|
980
982
|
origin: liveMarker === null ? null : { storageHash: liveMarker.storageHash },
|
|
981
983
|
destination: { storageHash: targetHash },
|
|
982
984
|
operations: [],
|
|
983
985
|
providedInvariants: []
|
|
984
986
|
},
|
|
985
987
|
displayOps: [],
|
|
986
|
-
destinationContract:
|
|
988
|
+
destinationContract: space.contract(),
|
|
987
989
|
strategy: "graph-walk",
|
|
988
990
|
migrationEdges: [buildSynthMigrationEdge({
|
|
989
991
|
currentMarkerStorageHash: liveMarker?.storageHash,
|
|
@@ -1503,7 +1505,8 @@ var ControlClientImpl = class {
|
|
|
1503
1505
|
authoringContributions: stack.authoringContributions,
|
|
1504
1506
|
codecLookup: stack.codecLookup,
|
|
1505
1507
|
controlMutationDefaults: stack.controlMutationDefaults,
|
|
1506
|
-
resolvedInputs: contractConfig.source.inputs ?? []
|
|
1508
|
+
resolvedInputs: contractConfig.source.inputs ?? [],
|
|
1509
|
+
capabilities: stack.capabilities
|
|
1507
1510
|
};
|
|
1508
1511
|
const providerResult = await contractConfig.source.load(sourceContext);
|
|
1509
1512
|
if (!providerResult.ok) {
|
|
@@ -1558,9 +1561,10 @@ var ControlClientImpl = class {
|
|
|
1558
1561
|
});
|
|
1559
1562
|
try {
|
|
1560
1563
|
const enrichedIR = enrichContract(contractRaw, this.frameworkComponents ?? []);
|
|
1564
|
+
const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
|
|
1561
1565
|
let deserializedContract;
|
|
1562
1566
|
try {
|
|
1563
|
-
deserializedContract = this.familyInstance.deserializeContract(
|
|
1567
|
+
deserializedContract = this.familyInstance.deserializeContract(rawContractJson);
|
|
1564
1568
|
} catch (error) {
|
|
1565
1569
|
onProgress?.({
|
|
1566
1570
|
action: "emit",
|
|
@@ -1606,6 +1610,6 @@ var ControlClientImpl = class {
|
|
|
1606
1610
|
}
|
|
1607
1611
|
};
|
|
1608
1612
|
//#endregion
|
|
1609
|
-
export { executeDbInit as a, executeDbUpdate as i,
|
|
1613
|
+
export { executeDbInit as a, executeDbUpdate as i, planSpacePath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
|
|
1610
1614
|
|
|
1611
|
-
//# sourceMappingURL=client-
|
|
1615
|
+
//# sourceMappingURL=client-CWTNqJdj.mjs.map
|