@prisma-next/cli 0.14.0 → 0.15.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.mjs +33 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-CJzuo5wX.mjs → client-DwOyZz0a.mjs} +141 -123
- package/dist/client-DwOyZz0a.mjs.map +1 -0
- package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-CNwURRf9.mjs} +30 -11
- package/dist/command-helpers-CNwURRf9.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +5 -5
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.d.mts.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +37 -38
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +9 -9
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.d.mts +6 -6
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +4 -4
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +4 -4
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-BHbY04pl.mjs} +2 -2
- package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-BHbY04pl.mjs.map} +1 -1
- package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-BeidkyUC.mjs} +9 -11
- package/dist/contract-emit-BeidkyUC.mjs.map +1 -0
- package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-IQBYv351.mjs} +6 -6
- package/dist/contract-emit-IQBYv351.mjs.map +1 -0
- package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-B3Wq2cu1.mjs} +3 -3
- package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-B3Wq2cu1.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-BirzMmW1.mjs} +63 -5
- package/dist/contract-space-aggregate-loader-BirzMmW1.mjs.map +1 -0
- package/dist/{db-verify-C24FKhb7.mjs → db-verify-DpRrecs7.mjs} +57 -61
- package/dist/db-verify-DpRrecs7.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +3 -3
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.d.mts +5 -1
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +4 -3
- package/dist/exports/index.mjs.map +1 -1
- package/dist/format-CaCF63ld.mjs +102 -0
- package/dist/format-CaCF63ld.mjs.map +1 -0
- package/dist/{framework-components-YVQHhPH7.mjs → framework-components-CnBcJDmF.mjs} +2 -2
- package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-CnBcJDmF.mjs.map} +1 -1
- package/dist/{init-0HwB-Vh8.mjs → init-Boa0LzeJ.mjs} +27 -19
- package/dist/init-Boa0LzeJ.mjs.map +1 -0
- package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-CldSQjVI.mjs} +4 -4
- package/dist/inspect-live-schema-CldSQjVI.mjs.map +1 -0
- package/dist/{migration-check-VwM8xCZV.mjs → migration-check-CGtYnR9k.mjs} +10 -11
- package/dist/migration-check-CGtYnR9k.mjs.map +1 -0
- package/dist/migration-cli.mjs +1 -1
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-B3m-MMAx.mjs} +4 -4
- package/dist/migration-command-scaffold-B3m-MMAx.mjs.map +1 -0
- package/dist/{migration-graph-command-render-CEez7YUK.mjs → migration-graph-command-render-B83xrnNy.mjs} +24 -24
- package/dist/{migration-graph-command-render-CEez7YUK.mjs.map → migration-graph-command-render-B83xrnNy.mjs.map} +1 -1
- package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-DBU6Pneg.mjs} +16 -16
- package/dist/migration-list-DBU6Pneg.mjs.map +1 -0
- package/dist/{migration-log-CG0qQAFm.mjs → migration-log-BYngyvXa.mjs} +5 -5
- package/dist/migration-log-BYngyvXa.mjs.map +1 -0
- package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-DQa4Caoc.mjs} +2 -2
- package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-DQa4Caoc.mjs.map} +1 -1
- package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-D6bHpCzE.mjs} +30 -30
- package/dist/migration-plan-D6bHpCzE.mjs.map +1 -0
- package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-CpQ5UhcU.mjs} +14 -14
- package/dist/migration-status-CpQ5UhcU.mjs.map +1 -0
- package/dist/{telemetry-BIM4beEO.mjs → telemetry-BQJ_XHa9.mjs} +2 -2
- package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-BQJ_XHa9.mjs.map} +1 -1
- package/dist/{types-C_tYiJYx.d.mts → types-DFoqNIcQ.d.mts} +27 -21
- package/dist/types-DFoqNIcQ.d.mts.map +1 -0
- package/dist/{verify-DcOYZ1tH.mjs → verify-CInGyt4U.mjs} +58 -159
- package/dist/verify-CInGyt4U.mjs.map +1 -0
- package/package.json +28 -30
- package/src/cli.ts +7 -0
- package/src/commands/contract-emit.ts +1 -1
- package/src/commands/db-sign.ts +1 -1
- package/src/commands/db-verify.ts +34 -20
- package/src/commands/format.ts +75 -0
- package/src/commands/init/detect-package-manager.ts +8 -4
- package/src/commands/init/hygiene-package-scripts.ts +16 -3
- package/src/commands/inspect-live-schema.ts +1 -1
- package/src/commands/lsp.ts +32 -0
- package/src/commands/migrate.ts +47 -44
- package/src/commands/migration-check.ts +6 -6
- package/src/commands/migration-graph.ts +5 -5
- package/src/commands/migration-list.ts +13 -13
- package/src/commands/migration-log.ts +1 -1
- package/src/commands/migration-new.ts +1 -1
- package/src/commands/migration-plan.ts +15 -4
- package/src/commands/migration-show.ts +1 -1
- package/src/commands/migration-status.ts +10 -10
- package/src/commands/ref.ts +1 -1
- package/src/control-api/client.ts +8 -23
- package/src/control-api/operations/contract-emit.ts +9 -27
- package/src/control-api/operations/db-init.ts +2 -2
- package/src/control-api/operations/db-run.ts +18 -17
- package/src/control-api/operations/db-verify.ts +52 -44
- package/src/control-api/operations/format.ts +98 -0
- package/src/control-api/operations/migrate.ts +139 -95
- package/src/control-api/operations/run-migration.ts +6 -5
- package/src/control-api/types.ts +8 -8
- package/src/exports/index.ts +1 -0
- package/src/migration-cli.ts +1 -1
- package/src/utils/cli-errors.ts +14 -1
- package/src/utils/combine-verify-results.ts +94 -0
- package/src/utils/extension-pack-inputs.ts +1 -1
- package/src/utils/formatters/errors.ts +34 -5
- package/src/utils/formatters/verify.ts +89 -227
- package/src/utils/migration-command-scaffold.ts +1 -1
- package/src/utils/plan-resolution.ts +18 -18
- package/dist/client-CJzuo5wX.mjs.map +0 -1
- package/dist/command-helpers-DGMvGBeX.mjs.map +0 -1
- package/dist/config-loader-p9JMrekQ.mjs +0 -88
- package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
- package/dist/config-loader.d.mts +0 -16
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/config-loader.mjs +0 -2
- package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
- package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
- package/dist/contract-space-aggregate-loader-ClI1KN6d.mjs.map +0 -1
- package/dist/db-verify-C24FKhb7.mjs.map +0 -1
- package/dist/extension-pack-inputs-1ySHqxKG.mjs +0 -62
- package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +0 -1
- package/dist/init-0HwB-Vh8.mjs.map +0 -1
- package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
- package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
- package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
- package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
- package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
- package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
- package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
- package/dist/types-C_tYiJYx.d.mts.map +0 -1
- package/dist/verify-DcOYZ1tH.mjs.map +0 -1
- package/src/config-loader.ts +0 -92
- package/src/config-path-validation.ts +0 -74
- package/src/utils/combine-schema-results.ts +0 -84
package/src/commands/migrate.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
4
|
import { createControlStack } from '@prisma-next/framework-components/control';
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type AggregateContractSpace,
|
|
7
|
+
requireHeadRef,
|
|
8
|
+
} from '@prisma-next/migration-tools/aggregate';
|
|
5
9
|
import { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';
|
|
6
10
|
import { errorUnknownInvariant, MigrationToolsError } from '@prisma-next/migration-tools/errors';
|
|
7
11
|
import { findLatestMigration, isGraphNode } from '@prisma-next/migration-tools/migration-graph';
|
|
@@ -11,9 +15,8 @@ import { readRefs } from '@prisma-next/migration-tools/refs';
|
|
|
11
15
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
12
16
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
13
17
|
import { Command } from 'commander';
|
|
14
|
-
import { loadConfig } from '../config-loader';
|
|
15
18
|
import { createControlClient } from '../control-api/client';
|
|
16
|
-
import {
|
|
19
|
+
import { planSpacePath } from '../control-api/operations/migrate';
|
|
17
20
|
import type {
|
|
18
21
|
MigrateFailure,
|
|
19
22
|
MigratePathDecision,
|
|
@@ -149,8 +152,8 @@ export interface MigrateResult {
|
|
|
149
152
|
* Computes the path through the SAME seam as `executeMigrate`:
|
|
150
153
|
* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving
|
|
151
154
|
* the full marker including `invariants` (not just `storageHash`).
|
|
152
|
-
* - `
|
|
153
|
-
* which feeds `
|
|
155
|
+
* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,
|
|
156
|
+
* which feeds `resolveRecordedPath()` with the same target hash, target invariants,
|
|
154
157
|
* and current marker as the real apply path uses.
|
|
155
158
|
*
|
|
156
159
|
* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No
|
|
@@ -203,7 +206,7 @@ async function executeMigrateShowCommand(
|
|
|
203
206
|
const appGraph = aggregate.app.graph();
|
|
204
207
|
|
|
205
208
|
// Resolve the --to target (defaults to the on-disk contract, same as migrate).
|
|
206
|
-
// Also capture the ref's invariants so
|
|
209
|
+
// Also capture the ref's invariants so planSpacePath feeds resolveRecordedPath the
|
|
207
210
|
// same target invariants that real migrate would use (refInvariants ?? headRef.invariants).
|
|
208
211
|
let targetHash: string = contractHash;
|
|
209
212
|
let refInvariants: readonly string[] | undefined;
|
|
@@ -258,13 +261,13 @@ async function executeMigrateShowCommand(
|
|
|
258
261
|
// - Explicit --from: parse it offline (no connection).
|
|
259
262
|
// - Omitted: read the live DB marker via readAllMarkers() — the same source migrate uses.
|
|
260
263
|
//
|
|
261
|
-
// Full marker records (storageHash + invariants) are preserved so
|
|
262
|
-
// can feed
|
|
264
|
+
// Full marker records (storageHash + invariants) are preserved so planSpacePath
|
|
265
|
+
// can feed resolveRecordedPath the complete currentMarker — exactly as executeMigrate
|
|
263
266
|
// does via familyInstance.readAllMarkers(). A stripped { storageHash, invariants: [] }
|
|
264
267
|
// marker would produce a different `required` set and a different (incorrect) path.
|
|
265
268
|
type LiveMarker = { readonly storageHash: string; readonly invariants: readonly string[] };
|
|
266
269
|
const markerBySpace = new Map<string, LiveMarker | null>();
|
|
267
|
-
const
|
|
270
|
+
const allSpaces: ReadonlyArray<AggregateContractSpace> = [aggregate.app, ...aggregate.extensions];
|
|
268
271
|
|
|
269
272
|
if (hasExplicitFrom) {
|
|
270
273
|
// @db with explicit --from requires a connection
|
|
@@ -301,7 +304,7 @@ async function executeMigrateShowCommand(
|
|
|
301
304
|
} else {
|
|
302
305
|
// Offline hypothetical: the --from ref only carries a hash (no live invariants).
|
|
303
306
|
// Apply the from-hash marker to the APP space only. Extension spaces are left
|
|
304
|
-
// absent from markerBySpace (treated as null / greenfield by
|
|
307
|
+
// absent from markerBySpace (treated as null / greenfield by planSpacePath),
|
|
305
308
|
// so they plan from their own marker → own head — exactly as executeMigrate does.
|
|
306
309
|
const fromHash = fromResult.value.hash;
|
|
307
310
|
const offlineMarker: LiveMarker | null =
|
|
@@ -334,9 +337,9 @@ async function executeMigrateShowCommand(
|
|
|
334
337
|
const allMarkers = await client.readAllMarkers();
|
|
335
338
|
// Store the full marker record (storageHash + invariants) per space.
|
|
336
339
|
// This is the same data executeMigrate uses via familyInstance.readAllMarkers().
|
|
337
|
-
for (const
|
|
338
|
-
const marker = allMarkers.get(
|
|
339
|
-
markerBySpace.set(
|
|
340
|
+
for (const space of allSpaces) {
|
|
341
|
+
const marker = allMarkers.get(space.spaceId);
|
|
342
|
+
markerBySpace.set(space.spaceId, marker ?? null);
|
|
340
343
|
}
|
|
341
344
|
} catch (error) {
|
|
342
345
|
if (CliStructuredError.is(error)) {
|
|
@@ -355,35 +358,35 @@ async function executeMigrateShowCommand(
|
|
|
355
358
|
}
|
|
356
359
|
}
|
|
357
360
|
|
|
358
|
-
// Walk the path via
|
|
359
|
-
//
|
|
361
|
+
// Walk the path via planSpacePath — the same helper executeMigrate uses.
|
|
362
|
+
// planSpacePath feeds resolveRecordedPath identical inputs (targetHash, targetInvariants,
|
|
360
363
|
// currentMarker with full invariants), so the preview path is always the path migrate runs.
|
|
361
364
|
//
|
|
362
365
|
// Canonical schedule order: extensions alphabetically first, then app — mirroring the
|
|
363
366
|
// runner's `applyOrder` in operations/migrate.ts so the "Will run, in order:" list
|
|
364
367
|
// reflects the actual execution sequence (extensions install first, app last).
|
|
365
|
-
const
|
|
368
|
+
const canonicalOrderSpaces: ReadonlyArray<AggregateContractSpace> = [
|
|
366
369
|
...aggregate.extensions,
|
|
367
370
|
aggregate.app,
|
|
368
371
|
];
|
|
369
372
|
const orderedMigrations: MigrateShowMigration[] = [];
|
|
370
|
-
for (const
|
|
371
|
-
const
|
|
372
|
-
const headRef = requireHeadRef(
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
const liveMarker = markerBySpace.get(
|
|
376
|
-
|
|
377
|
-
const outcome =
|
|
378
|
-
|
|
373
|
+
for (const space of canonicalOrderSpaces) {
|
|
374
|
+
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
375
|
+
const headRef = requireHeadRef(space);
|
|
376
|
+
const spaceTargetHash = isAppSpace ? targetHash : headRef.hash;
|
|
377
|
+
const spaceRefInvariants = isAppSpace ? refInvariants : undefined;
|
|
378
|
+
const liveMarker = markerBySpace.get(space.spaceId) ?? null;
|
|
379
|
+
|
|
380
|
+
const outcome = planSpacePath({
|
|
381
|
+
space,
|
|
379
382
|
aggregate,
|
|
380
|
-
targetHash:
|
|
381
|
-
refInvariants:
|
|
383
|
+
targetHash: spaceTargetHash,
|
|
384
|
+
refInvariants: spaceRefInvariants,
|
|
382
385
|
liveMarker,
|
|
383
386
|
});
|
|
384
387
|
|
|
385
388
|
if (outcome.kind === 'at-head') {
|
|
386
|
-
// Empty-graph
|
|
389
|
+
// Empty-graph space already at target — nothing to run for this space.
|
|
387
390
|
continue;
|
|
388
391
|
}
|
|
389
392
|
if (outcome.kind === 'never-planned') {
|
|
@@ -417,7 +420,7 @@ async function executeMigrateShowCommand(
|
|
|
417
420
|
|
|
418
421
|
for (const edge of outcome.plan.migrationEdges) {
|
|
419
422
|
orderedMigrations.push({
|
|
420
|
-
spaceId:
|
|
423
|
+
spaceId: space.spaceId,
|
|
421
424
|
dirName: edge.dirName,
|
|
422
425
|
migrationHash: edge.migrationHash,
|
|
423
426
|
from: edge.from,
|
|
@@ -445,12 +448,12 @@ async function executeMigrateShowCommand(
|
|
|
445
448
|
// before rendering. This ensures the name column, hash column, and ops column
|
|
446
449
|
// start at the same horizontal offset across every space section AND the
|
|
447
450
|
// "Will run, in order:" list below.
|
|
448
|
-
const
|
|
449
|
-
const isApp =
|
|
450
|
-
const
|
|
451
|
-
const rowModel = buildMigrationGraphRows(
|
|
451
|
+
const spaceLayouts = allSpaces.map((space) => {
|
|
452
|
+
const isApp = space.spaceId === aggregate.app.spaceId;
|
|
453
|
+
const spaceGraph = space.graph();
|
|
454
|
+
const rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});
|
|
452
455
|
const edgeAnnotations = new Map<string, MigrationEdgeAnnotation>();
|
|
453
|
-
for (const edge of
|
|
456
|
+
for (const edge of spaceGraph.migrationByHash.values()) {
|
|
454
457
|
edgeAnnotations.set(edge.migrationHash, {
|
|
455
458
|
pathHighlight: onPathHashes.has(edge.migrationHash) ? 'on-path' : 'off-path',
|
|
456
459
|
});
|
|
@@ -459,17 +462,17 @@ async function executeMigrateShowCommand(
|
|
|
459
462
|
// green/continuous; off-path lanes dim. Rows, gutter, and labels all come
|
|
460
463
|
// from this one grid.
|
|
461
464
|
const grid = buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations));
|
|
462
|
-
return {
|
|
465
|
+
return { space, isApp, spaceGraph, rowModel, grid, edgeAnnotations };
|
|
463
466
|
});
|
|
464
467
|
|
|
465
468
|
// Global max across all space grids so every section's labels share columns.
|
|
466
469
|
const globalLabelColumn =
|
|
467
|
-
|
|
468
|
-
? Math.max(...
|
|
470
|
+
spaceLayouts.length > 1
|
|
471
|
+
? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, 'unicode')))
|
|
469
472
|
: undefined;
|
|
470
473
|
const globalMaxDirNameWidthFromLayouts =
|
|
471
|
-
|
|
472
|
-
? Math.max(...
|
|
474
|
+
spaceLayouts.length > 1
|
|
475
|
+
? Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel)))
|
|
473
476
|
: undefined;
|
|
474
477
|
// The run-list name column width must be at least as wide as the global tree dirName
|
|
475
478
|
// width so that tree sections and the list align at the hash column.
|
|
@@ -485,10 +488,10 @@ async function executeMigrateShowCommand(
|
|
|
485
488
|
runListLeftPad = globalLabelColumn;
|
|
486
489
|
|
|
487
490
|
// Render each space section with globally computed widths.
|
|
488
|
-
const showSpaceHeadings =
|
|
491
|
+
const showSpaceHeadings = allSpaces.length > 1;
|
|
489
492
|
const sections: string[] = [];
|
|
490
|
-
for (const {
|
|
491
|
-
const liveMarker = markerBySpace.get(
|
|
493
|
+
for (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {
|
|
494
|
+
const liveMarker = markerBySpace.get(space.spaceId) ?? null;
|
|
492
495
|
const liveMarkerHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;
|
|
493
496
|
const tree = renderMigrationGraphCommand({
|
|
494
497
|
grid,
|
|
@@ -496,7 +499,7 @@ async function executeMigrateShowCommand(
|
|
|
496
499
|
contractHash,
|
|
497
500
|
isAppSpace: isApp,
|
|
498
501
|
...(needsLiveMarker ? { dbHash: liveMarkerHash } : {}),
|
|
499
|
-
refsByHash: listRefsByContractHash(
|
|
502
|
+
refsByHash: listRefsByContractHash(space),
|
|
500
503
|
edgeAnnotationsByHash: edgeAnnotations,
|
|
501
504
|
colorize,
|
|
502
505
|
glyphMode: 'unicode',
|
|
@@ -505,7 +508,7 @@ async function executeMigrateShowCommand(
|
|
|
505
508
|
});
|
|
506
509
|
if (tree.length === 0) continue;
|
|
507
510
|
if (showSpaceHeadings) {
|
|
508
|
-
sections.push(`${
|
|
511
|
+
sections.push(`${space.spaceId}:\n${indentMigrationGraphTreeBlock(tree, ' ')}`);
|
|
509
512
|
} else {
|
|
510
513
|
sections.push(tree);
|
|
511
514
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
3
4
|
import { createControlStack } from '@prisma-next/framework-components/control';
|
|
4
5
|
import type {
|
|
5
6
|
ContractSpaceAggregate,
|
|
@@ -25,7 +26,6 @@ import { ifDefined } from '@prisma-next/utils/defined';
|
|
|
25
26
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
26
27
|
import { Command } from 'commander';
|
|
27
28
|
import { join, relative } from 'pathe';
|
|
28
|
-
import { loadConfig } from '../config-loader';
|
|
29
29
|
import {
|
|
30
30
|
type CliStructuredError,
|
|
31
31
|
errorAmbiguousMigrationRef,
|
|
@@ -156,16 +156,16 @@ export async function enumerateCheckSpaces(
|
|
|
156
156
|
candidateDirs.filter((name) => !RESERVED_SPACE_SUBDIR_NAMES.has(name)).filter(isValidSpaceId),
|
|
157
157
|
);
|
|
158
158
|
const spaces: CheckSpace[] = [];
|
|
159
|
-
for (const
|
|
160
|
-
const spaceId =
|
|
159
|
+
for (const space of aggregate.spaces()) {
|
|
160
|
+
const spaceId = space.spaceId;
|
|
161
161
|
if (!isValidSpaceId(spaceId)) continue;
|
|
162
162
|
if (!onDiskSpaceIds.has(spaceId)) continue;
|
|
163
163
|
const migrationsDir = spaceMigrationDirectory(projectMigrationsDir, spaceId);
|
|
164
164
|
spaces.push({
|
|
165
165
|
spaceId,
|
|
166
|
-
packages:
|
|
167
|
-
refs:
|
|
168
|
-
graph:
|
|
166
|
+
packages: space.packages,
|
|
167
|
+
refs: space.refs,
|
|
168
|
+
graph: space.graph(),
|
|
169
169
|
migrationsDir,
|
|
170
170
|
refsDir: spaceRefsDirectory(migrationsDir),
|
|
171
171
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';
|
|
2
3
|
import type { MigrationGraph } from '@prisma-next/migration-tools/graph';
|
|
3
4
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
4
5
|
import { ok, type Result } from '@prisma-next/utils/result';
|
|
5
6
|
import { Command } from 'commander';
|
|
6
|
-
import { loadConfig } from '../config-loader';
|
|
7
7
|
import type { CliStructuredError } from '../utils/cli-errors';
|
|
8
8
|
import {
|
|
9
9
|
addGlobalOptions,
|
|
@@ -154,13 +154,13 @@ export async function executeMigrationGraphCommand(
|
|
|
154
154
|
const treeSections: MigrationGraphTreeSection[] = [];
|
|
155
155
|
const spaces: MigrationSpaceGraphEntry[] = [];
|
|
156
156
|
for (const spaceEntry of scopedSpaces) {
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
157
|
+
const space = aggregate.space(spaceEntry.space);
|
|
158
|
+
if (space === undefined) {
|
|
159
159
|
continue;
|
|
160
160
|
}
|
|
161
|
-
const graph =
|
|
161
|
+
const graph = space.graph();
|
|
162
162
|
const isAppSpace = spaceEntry.space === aggregate.app.spaceId;
|
|
163
|
-
const refsByHash = listRefsByContractHash(
|
|
163
|
+
const refsByHash = listRefsByContractHash(space);
|
|
164
164
|
const tree =
|
|
165
165
|
spaceEntry.migrations.length === 0
|
|
166
166
|
? ''
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import type {
|
|
3
|
+
AggregateContractSpace,
|
|
2
4
|
ContractSpaceAggregate,
|
|
3
|
-
ContractSpaceMember,
|
|
4
5
|
} from '@prisma-next/migration-tools/aggregate';
|
|
5
6
|
import type { MigrationGraph } from '@prisma-next/migration-tools/graph';
|
|
6
7
|
import { HEAD_REF_NAME, refsByContractHash } from '@prisma-next/migration-tools/refs';
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
14
15
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
15
16
|
import { Command } from 'commander';
|
|
16
|
-
import { loadConfig } from '../config-loader';
|
|
17
17
|
import {
|
|
18
18
|
type CliStructuredError,
|
|
19
19
|
errorInvalidSpaceId,
|
|
@@ -59,18 +59,18 @@ function compareDirNamesDescending(a: MigrationListEntry, b: MigrationListEntry)
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Ref names decorating a space's destination contract hashes. The
|
|
62
|
-
* tolerant `
|
|
62
|
+
* tolerant `space.refs` deliberately omits the structural `head.json`;
|
|
63
63
|
* for extension spaces the old enumerator surfaced it as a `head`
|
|
64
|
-
* decoration on the tip migration, so fold `
|
|
64
|
+
* decoration on the tip migration, so fold `space.headRef` back in to
|
|
65
65
|
* keep that output. The app space synthesises its head, so it carries
|
|
66
66
|
* no on-disk `head` ref to restore.
|
|
67
67
|
*/
|
|
68
68
|
export function listRefsByContractHash(
|
|
69
|
-
|
|
69
|
+
space: AggregateContractSpace,
|
|
70
70
|
): ReadonlyMap<string, readonly string[]> {
|
|
71
|
-
const byHash = new Map(refsByContractHash(
|
|
72
|
-
if (
|
|
73
|
-
const hash =
|
|
71
|
+
const byHash = new Map(refsByContractHash(space.refs));
|
|
72
|
+
if (space.spaceId !== APP_SPACE_ID && space.headRef !== null) {
|
|
73
|
+
const hash = space.headRef.hash;
|
|
74
74
|
const bucket = byHash.get(hash) ?? [];
|
|
75
75
|
if (!bucket.includes(HEAD_REF_NAME)) {
|
|
76
76
|
byHash.set(hash, [...bucket, HEAD_REF_NAME].sort());
|
|
@@ -92,7 +92,7 @@ async function orderedOnDiskSpaceIds(projectMigrationsDir: string): Promise<read
|
|
|
92
92
|
* {@link MigrationSpaceListEntry} rows `migration list` displays.
|
|
93
93
|
*
|
|
94
94
|
* Space membership matches the on-disk contract-space directories (not the
|
|
95
|
-
* aggregate's always-present synthesized app
|
|
95
|
+
* aggregate's always-present synthesized app space when `migrations/app/`
|
|
96
96
|
* is absent); package and ref data come from `aggregate.space(id)`.
|
|
97
97
|
*/
|
|
98
98
|
export async function migrationSpaceListEntriesFromAggregate(
|
|
@@ -103,12 +103,12 @@ export async function migrationSpaceListEntriesFromAggregate(
|
|
|
103
103
|
const spaces: MigrationSpaceListEntry[] = [];
|
|
104
104
|
|
|
105
105
|
for (const spaceId of spaceIds) {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
106
|
+
const space = aggregate.space(spaceId);
|
|
107
|
+
if (space === undefined) {
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
|
-
const refsByHash = listRefsByContractHash(
|
|
111
|
-
const migrations: MigrationListEntry[] =
|
|
110
|
+
const refsByHash = listRefsByContractHash(space);
|
|
111
|
+
const migrations: MigrationListEntry[] = space.packages
|
|
112
112
|
.map((pkg) => ({
|
|
113
113
|
name: pkg.dirName,
|
|
114
114
|
hash: pkg.metadata.migrationHash,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import type { LedgerEntryRecord } from '@prisma-next/contract/types';
|
|
2
3
|
import { MigrationToolsError } from '@prisma-next/migration-tools/errors';
|
|
3
4
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
4
5
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
5
6
|
import { Command } from 'commander';
|
|
6
|
-
import { loadConfig } from '../config-loader';
|
|
7
7
|
import { createControlClient } from '../control-api/client';
|
|
8
8
|
import {
|
|
9
9
|
CliStructuredError,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { readFile } from 'node:fs/promises';
|
|
12
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
12
13
|
import type { Contract } from '@prisma-next/contract/types';
|
|
13
14
|
import { getEmittedArtifactPaths } from '@prisma-next/emitter';
|
|
14
15
|
import { APP_SPACE_ID, createControlStack } from '@prisma-next/framework-components/control';
|
|
@@ -25,7 +26,6 @@ import { writeMigrationTs } from '@prisma-next/migration-tools/migration-ts';
|
|
|
25
26
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
26
27
|
import { Command } from 'commander';
|
|
27
28
|
import { join, relative } from 'pathe';
|
|
28
|
-
import { loadConfig } from '../config-loader';
|
|
29
29
|
import {
|
|
30
30
|
CliStructuredError,
|
|
31
31
|
errorFileNotFound,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
4
|
import { getEmittedArtifactPaths } from '@prisma-next/emitter';
|
|
4
5
|
import {
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
hasOperationPreview,
|
|
7
8
|
type MigrationPlanOperation,
|
|
8
9
|
type OperationPreview,
|
|
10
|
+
type SchemaOwnership,
|
|
9
11
|
} from '@prisma-next/framework-components/control';
|
|
10
12
|
import { canonicalizeJson } from '@prisma-next/framework-components/utils';
|
|
11
13
|
import { MigrationToolsError } from '@prisma-next/migration-tools/errors';
|
|
@@ -21,7 +23,6 @@ import { writeMigrationTs } from '@prisma-next/migration-tools/migration-ts';
|
|
|
21
23
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
22
24
|
import { Command } from 'commander';
|
|
23
25
|
import { join, relative } from 'pathe';
|
|
24
|
-
import { loadConfig } from '../config-loader';
|
|
25
26
|
import {
|
|
26
27
|
type CliErrorConflict,
|
|
27
28
|
CliStructuredError,
|
|
@@ -97,6 +98,7 @@ async function runPlannerLeg(
|
|
|
97
98
|
contract: Contract,
|
|
98
99
|
fromContract: Contract | null,
|
|
99
100
|
spaceId: string,
|
|
101
|
+
ownership: SchemaOwnership,
|
|
100
102
|
): Promise<Result<PlannerSuccess, CliStructuredError>> {
|
|
101
103
|
const fromSchema = migrations.contractToSchema(fromContract, frameworkComponents);
|
|
102
104
|
const plannerResult = planner.plan({
|
|
@@ -106,6 +108,12 @@ async function runPlannerLeg(
|
|
|
106
108
|
fromContract,
|
|
107
109
|
frameworkComponents,
|
|
108
110
|
spaceId,
|
|
111
|
+
// Offline `migration plan` is the aggregate-of-(possibly one) degenerate
|
|
112
|
+
// case: the same ownership consultation the live aggregate flow uses. A
|
|
113
|
+
// from→to extra (a table removed from the contract) is not declared by any
|
|
114
|
+
// space in the aggregate, so it stays a genuine drop; a table another
|
|
115
|
+
// space owns is never dropped.
|
|
116
|
+
ownership,
|
|
109
117
|
});
|
|
110
118
|
if (plannerResult.kind === 'failure') {
|
|
111
119
|
return notOk(
|
|
@@ -321,11 +329,11 @@ async function executeMigrationPlanCommand(
|
|
|
321
329
|
if (!tolerantAggregateResult.ok) {
|
|
322
330
|
return notOk(tolerantAggregateResult.failure);
|
|
323
331
|
}
|
|
324
|
-
const
|
|
332
|
+
const resolutionSpace = tolerantAggregateResult.value.app;
|
|
325
333
|
|
|
326
334
|
const resolutionResult = await resolveFromForPlan({
|
|
327
335
|
optionsFrom: options.from,
|
|
328
|
-
|
|
336
|
+
space: resolutionSpace,
|
|
329
337
|
});
|
|
330
338
|
|
|
331
339
|
if (!resolutionResult.ok) {
|
|
@@ -365,7 +373,7 @@ async function executeMigrationPlanCommand(
|
|
|
365
373
|
// change.
|
|
366
374
|
if (options.to !== undefined) {
|
|
367
375
|
const toResolution = await resolveToForPlan(options.to, {
|
|
368
|
-
|
|
376
|
+
space: resolutionSpace,
|
|
369
377
|
});
|
|
370
378
|
if (!toResolution.ok) {
|
|
371
379
|
return notOk(toResolution.failure);
|
|
@@ -498,6 +506,7 @@ async function executeMigrationPlanCommand(
|
|
|
498
506
|
fromContract,
|
|
499
507
|
null,
|
|
500
508
|
aggregate.app.spaceId,
|
|
509
|
+
aggregate,
|
|
501
510
|
);
|
|
502
511
|
if (!baselineLeg.ok) {
|
|
503
512
|
return notOk(baselineLeg.failure);
|
|
@@ -567,6 +576,7 @@ async function executeMigrationPlanCommand(
|
|
|
567
576
|
aggregate.app.contract(),
|
|
568
577
|
fromContract,
|
|
569
578
|
aggregate.app.spaceId,
|
|
579
|
+
aggregate,
|
|
570
580
|
);
|
|
571
581
|
if (!deltaLeg.ok) {
|
|
572
582
|
return notOk(deltaLeg.failure);
|
|
@@ -640,6 +650,7 @@ async function executeMigrationPlanCommand(
|
|
|
640
650
|
aggregate.app.contract(),
|
|
641
651
|
fromContract,
|
|
642
652
|
aggregate.app.spaceId,
|
|
653
|
+
aggregate,
|
|
643
654
|
);
|
|
644
655
|
if (!deltaLeg.ok) {
|
|
645
656
|
return notOk(deltaLeg.failure);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
4
|
import {
|
|
4
5
|
APP_SPACE_ID,
|
|
@@ -13,7 +14,6 @@ import { ifDefined } from '@prisma-next/utils/defined';
|
|
|
13
14
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
14
15
|
import { Command } from 'commander';
|
|
15
16
|
import { relative } from 'pathe';
|
|
16
|
-
import { loadConfig } from '../config-loader';
|
|
17
17
|
import { createControlClient } from '../control-api/client';
|
|
18
18
|
import {
|
|
19
19
|
type CliStructuredError,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import type { LedgerEntryRecord } from '@prisma-next/contract/types';
|
|
2
3
|
import type {
|
|
4
|
+
AggregateContractSpace,
|
|
3
5
|
ContractMarkerRecordLike,
|
|
4
|
-
ContractSpaceMember,
|
|
5
6
|
} from '@prisma-next/migration-tools/aggregate';
|
|
6
7
|
import { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';
|
|
7
8
|
import {
|
|
@@ -17,7 +18,6 @@ import { ifDefined } from '@prisma-next/utils/defined';
|
|
|
17
18
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
18
19
|
import { dim, yellow } from 'colorette';
|
|
19
20
|
import { Command } from 'commander';
|
|
20
|
-
import { loadConfig } from '../config-loader';
|
|
21
21
|
import { createControlClient } from '../control-api/client';
|
|
22
22
|
import {
|
|
23
23
|
CliStructuredError,
|
|
@@ -130,7 +130,7 @@ function buildStatusMigrations(
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function renderSpaceTree(args: {
|
|
133
|
-
readonly
|
|
133
|
+
readonly space: AggregateContractSpace;
|
|
134
134
|
readonly liveContractHash: string;
|
|
135
135
|
readonly migrations: readonly MigrationListEntry[];
|
|
136
136
|
readonly markerHash: string | undefined;
|
|
@@ -142,7 +142,7 @@ function renderSpaceTree(args: {
|
|
|
142
142
|
readonly globalMaxEdgeTreePrefixWidth?: number;
|
|
143
143
|
readonly globalMaxDirNameWidth?: number;
|
|
144
144
|
}): string {
|
|
145
|
-
const graph = args.
|
|
145
|
+
const graph = args.space.graph();
|
|
146
146
|
if (graph.nodes.size === 0) {
|
|
147
147
|
return '';
|
|
148
148
|
}
|
|
@@ -150,7 +150,7 @@ function renderSpaceTree(args: {
|
|
|
150
150
|
graph,
|
|
151
151
|
migrations: args.migrations,
|
|
152
152
|
liveContractHash: args.liveContractHash,
|
|
153
|
-
refsByHash: listRefsByContractHash(args.
|
|
153
|
+
refsByHash: listRefsByContractHash(args.space),
|
|
154
154
|
statusOverlayByHash: args.statusOverlay,
|
|
155
155
|
colorize: args.colorize,
|
|
156
156
|
glyphMode: args.glyphMode,
|
|
@@ -493,12 +493,12 @@ export async function executeMigrationStatusCommand(
|
|
|
493
493
|
globalLayoutInputs.length > 0 ? computeGlobalMaxDirNameWidth(globalLayoutInputs) : undefined;
|
|
494
494
|
|
|
495
495
|
for (const spaceEntry of scopedSpaces) {
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
496
|
+
const space = aggregate.space(spaceEntry.space);
|
|
497
|
+
if (space === undefined) {
|
|
498
498
|
continue;
|
|
499
499
|
}
|
|
500
|
-
const graph =
|
|
501
|
-
const spaceContractHash =
|
|
500
|
+
const graph = space.graph();
|
|
501
|
+
const spaceContractHash = space.contract().storage.storageHash;
|
|
502
502
|
const targetHash = resolveTarget(spaceContractHash, activeRefHash);
|
|
503
503
|
if (spaceEntry.space === aggregate.app.spaceId) {
|
|
504
504
|
headlineTargetHash = targetHash;
|
|
@@ -547,7 +547,7 @@ export async function executeMigrationStatusCommand(
|
|
|
547
547
|
});
|
|
548
548
|
const isAppSpace = spaceEntry.space === aggregate.app.spaceId;
|
|
549
549
|
const tree = renderSpaceTree({
|
|
550
|
-
|
|
550
|
+
space,
|
|
551
551
|
liveContractHash: contractHash,
|
|
552
552
|
migrations: spaceEntry.migrations,
|
|
553
553
|
markerHash,
|
package/src/commands/ref.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import { EMPTY_CONTRACT_HASH } from '@prisma-next/migration-tools/constants';
|
|
3
4
|
import { MigrationToolsError } from '@prisma-next/migration-tools/errors';
|
|
4
5
|
import { findLatestMigration, isGraphNode } from '@prisma-next/migration-tools/migration-graph';
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
15
16
|
import { Command } from 'commander';
|
|
16
17
|
import { join } from 'pathe';
|
|
17
|
-
import { loadConfig } from '../config-loader';
|
|
18
18
|
import {
|
|
19
19
|
CliStructuredError,
|
|
20
20
|
errorFileNotFound,
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
hasSchemaView,
|
|
28
28
|
} from '@prisma-next/framework-components/control';
|
|
29
29
|
import type { PslDocumentAst } from '@prisma-next/framework-components/psl-ast';
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
32
32
|
import { notOk, ok } from '@prisma-next/utils/result';
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
import { assertFrameworkComponentsCompatible } from '../utils/framework-components';
|
|
35
35
|
import { enrichContract } from './contract-enrichment';
|
|
36
36
|
import { ContractValidationError } from './errors';
|
|
@@ -606,31 +606,15 @@ class ControlClientImpl implements ControlClient {
|
|
|
606
606
|
|
|
607
607
|
try {
|
|
608
608
|
const stack = this.stack!;
|
|
609
|
-
const extensionInputs = toExtensionInputs(
|
|
610
|
-
blindCast<
|
|
611
|
-
readonly unknown[],
|
|
612
|
-
'toExtensionInputs accepts readonly unknown[] per its documented structural cast boundary'
|
|
613
|
-
>(stack.extensionPacks),
|
|
614
|
-
);
|
|
615
|
-
const composedExtensionContracts = new Map<string, Contract>(
|
|
616
|
-
extensionInputs
|
|
617
|
-
.filter((p) => p.contractSpace !== undefined)
|
|
618
|
-
.map((p) => [
|
|
619
|
-
p.id,
|
|
620
|
-
blindCast<
|
|
621
|
-
Contract,
|
|
622
|
-
'contractSpace.contractJson is the typed contract for this extension space'
|
|
623
|
-
>(p.contractSpace!.contractJson),
|
|
624
|
-
]),
|
|
625
|
-
);
|
|
626
609
|
const sourceContext = {
|
|
627
610
|
composedExtensionPacks: stack.extensionPacks.map((p) => p.id),
|
|
628
|
-
composedExtensionContracts,
|
|
611
|
+
composedExtensionContracts: stack.extensionContracts,
|
|
629
612
|
scalarTypeDescriptors: stack.scalarTypeDescriptors,
|
|
630
613
|
authoringContributions: stack.authoringContributions,
|
|
631
614
|
codecLookup: stack.codecLookup,
|
|
632
615
|
controlMutationDefaults: stack.controlMutationDefaults,
|
|
633
616
|
resolvedInputs: contractConfig.source.inputs ?? [],
|
|
617
|
+
capabilities: stack.capabilities,
|
|
634
618
|
};
|
|
635
619
|
const providerResult = await contractConfig.source.load(sourceContext);
|
|
636
620
|
if (!providerResult.ok) {
|
|
@@ -696,17 +680,18 @@ class ControlClientImpl implements ControlClient {
|
|
|
696
680
|
// payload — `enrichContract` only adds capability + extension
|
|
697
681
|
// metadata onto whatever shape it receives. The structural
|
|
698
682
|
// check happens immediately afterwards via
|
|
699
|
-
// `familyInstance.deserializeContract
|
|
700
|
-
//
|
|
683
|
+
// `familyInstance.deserializeContract`, which is the
|
|
684
|
+
// seam-of-record and the only thing that may surface
|
|
701
685
|
// structural errors to the caller.
|
|
702
686
|
const enrichedIR = enrichContract(
|
|
703
687
|
contractRaw as unknown as Contract,
|
|
704
688
|
this.frameworkComponents ?? [],
|
|
705
689
|
);
|
|
690
|
+
const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
|
|
706
691
|
|
|
707
692
|
let deserializedContract: Contract;
|
|
708
693
|
try {
|
|
709
|
-
deserializedContract = this.familyInstance.deserializeContract(
|
|
694
|
+
deserializedContract = this.familyInstance.deserializeContract(rawContractJson);
|
|
710
695
|
} catch (error) {
|
|
711
696
|
onProgress?.({
|
|
712
697
|
action: 'emit',
|