@prisma/orm-toolchain 8.0.0-rc.21-dev.13 → 8.0.0-rc.21-dev.14

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.
Files changed (29) hide show
  1. package/dist/{caught-errors-DlLh7HAX-DzRh7ZVr.mjs → caught-errors-DRiDJHfQ-Du9rLuFa.mjs} +8 -6
  2. package/dist/caught-errors-DRiDJHfQ-Du9rLuFa.mjs.map +1 -0
  3. package/dist/cli.d.mts +1 -1
  4. package/dist/cli.mjs +84 -28
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/cli__control-api.d.mts +12 -15
  7. package/dist/cli__control-api.d.mts.map +1 -1
  8. package/dist/cli__control-api.mjs +2 -2
  9. package/dist/cli__control-api__testing.d.mts +1 -1
  10. package/dist/cli__migration-cli.mjs +1 -1
  11. package/dist/cli__migration-cli.mjs.map +1 -1
  12. package/dist/{db-sign-wBQmmQn7-Bl6NVm0G.d.mts → db-sign-D8CcCI0v-Cda_1dSK.d.mts} +17 -4
  13. package/dist/{db-sign-wBQmmQn7-Bl6NVm0G.d.mts.map → db-sign-D8CcCI0v-Cda_1dSK.d.mts.map} +1 -1
  14. package/dist/migration-tools.d.mts +1 -1
  15. package/dist/migration-tools.mjs +1 -1
  16. package/dist/migration-tools__spaces.d.mts +1 -1
  17. package/dist/migration-tools__spaces.mjs +1 -1
  18. package/dist/{ref-qma7fG-2-TOPNrzuP.mjs → ref-CKUrXPT8-DOwCuN0q.mjs} +149 -104
  19. package/dist/ref-CKUrXPT8-DOwCuN0q.mjs.map +1 -0
  20. package/dist/{spaces-B0zxbzdl.mjs → spaces-CW5yVjgx.mjs} +28 -8
  21. package/dist/spaces-CW5yVjgx.mjs.map +1 -0
  22. package/dist/{spaces-VChSCSMQ.d.mts → spaces-Dsp9mRpJ.d.mts} +9 -6
  23. package/dist/{spaces-VChSCSMQ.d.mts.map → spaces-Dsp9mRpJ.d.mts.map} +1 -1
  24. package/dist/vite-plugin-contract-emit.mjs +2 -1
  25. package/dist/vite-plugin-contract-emit.mjs.map +1 -1
  26. package/package.json +12 -12
  27. package/dist/caught-errors-DlLh7HAX-DzRh7ZVr.mjs.map +0 -1
  28. package/dist/ref-qma7fG-2-TOPNrzuP.mjs.map +0 -1
  29. package/dist/spaces-B0zxbzdl.mjs.map +0 -1
@@ -7,8 +7,8 @@ import { t as deriveProvidedInvariants } from "./invariants-DrF9p5Gd-BF70vGl1.mj
7
7
  import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-BNxFm3eg-DYD82QeZ.mjs";
8
8
  import { i as findPathWithDecision, r as findPath } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
9
9
  import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID$1 } from "./verify-contract-spaces-B12R3P5U-CfBKlBjj.mjs";
10
- import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-B0zxbzdl.mjs";
11
- import { B as errorRefSetEmptySentinel, D as errorFromCaught, E as errorFileNotFound, F as errorPathUnreachable, G as errorSpaceNotFound, H as errorRuntime, I as errorPlanForgotTheFlag, J as errorStatementInvalid, K as errorStatementAnswersNoQuestion, L as errorPlanOriginUnknown, N as errorMigrationPlanningFailed, Q as errorTargetMigrationNotSupported, R as errorPlanProducedNoOperations, S as errorContractValidationFailed, V as errorRefSetHashNotInGraph, W as errorSnapshotMissing, X as errorStatementOriginUnknown, Y as errorStatementNeedsMigrationFile, Z as errorStatementUnresolved, _ as errorAmbiguousMigrationRef, _t as toStructuralEdge, at as printedPath, c as cliCommand, d as closeQuietly, dt as resolveMigrationPaths, et as errorUnexpected, f as collectDeclaredInvariants, ft as runCommandAction, h as editFileAction, ht as statementFlag, k as errorInvalidSpaceId, l as cliErrorFromStructured, lt as requireLiveDatabase, n as CliStructuredError$1, nt as mapRefResolutionError, ot as printedPlanCommand, pt as selfEmitCommand, q as errorStatementDidNotResolveLoss, r as STORE_ORIGIN_SNAPSHOT_STEPS, s as chooseAction, st as readContractEnvelope, t as ActionableCliError, tt as getTargetMigrations, ut as resolveContractPath, v as errorConfigValidation$1, vt as writtenMigrationRunCommand, x as errorContractConfigMissing, y as errorConsentUnused, z as errorRefSetBundleNotFound } from "./caught-errors-DlLh7HAX-DzRh7ZVr.mjs";
10
+ import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-CW5yVjgx.mjs";
11
+ import { B as errorRefSetEmptySentinel, D as errorFromCaught, E as errorFileNotFound, F as errorPathUnreachable, G as errorSpaceNotFound, H as errorRuntime, I as errorPlanForgotTheFlag, J as errorStatementInvalid, K as errorStatementAnswersNoQuestion, L as errorPlanOriginUnknown, N as errorMigrationPlanningFailed, Q as errorTargetMigrationNotSupported, R as errorPlanProducedNoOperations, S as errorContractValidationFailed, V as errorRefSetHashNotInGraph, W as errorSnapshotMissing, X as errorStatementOriginUnknown, Y as errorStatementNeedsMigrationFile, Z as errorStatementUnresolved, _ as errorAmbiguousMigrationRef, _t as toStructuralEdge, at as printedPath, c as cliCommand, d as closeQuietly, dt as resolveMigrationPaths, et as errorUnexpected, f as collectDeclaredInvariants, ft as runCommandAction, h as editFileAction, ht as statementFlag, it as migrationsDirFor, k as errorInvalidSpaceId, l as cliErrorFromStructured, lt as requireLiveDatabase, n as CliStructuredError$1, nt as mapRefResolutionError, ot as printedPlanCommand, pt as selfEmitCommand, q as errorStatementDidNotResolveLoss, r as STORE_ORIGIN_SNAPSHOT_STEPS, s as chooseAction, st as readContractEnvelope, t as ActionableCliError, tt as getTargetMigrations, ut as resolveContractPath, v as errorConfigValidation$1, vt as writtenMigrationRunCommand, x as errorContractConfigMissing, y as errorConsentUnused, z as errorRefSetBundleNotFound } from "./caught-errors-DRiDJHfQ-Du9rLuFa.mjs";
12
12
  import { r as getEmittedArtifactPaths, t as emit } from "./exports-CVgs3YWV-BF4rqnxF.mjs";
13
13
  import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DxpNgxfZ-BfqA-H7V.mjs";
14
14
  import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-DM3q3IZC-BC6H6P0X.mjs";
@@ -35,7 +35,7 @@ import { isDeepStrictEqual } from "node:util";
35
35
  import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
36
36
  import { abortable } from "@prisma/orm-framework/utils/abortable";
37
37
  import { resolve as resolve$1 } from "node:path";
38
- //#region ../../../1-framework/3-tooling/cli/dist/ref-qma7fG-2.mjs
38
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-CKUrXPT8.mjs
39
39
  /**
40
40
  * The meta of a contract that failed to load because the family refused it, such as the columns whose defaults it refused, for the command to report: the refusal's own meta, or the `refusedDefaults` a migration-tools error kept from it.
41
41
  */
@@ -2275,6 +2275,10 @@ function describeIntegrityViolation(violation) {
2275
2275
  * target mismatch, then disjointness, then a contract-validation
2276
2276
  * failure, then any remaining structural integrity violation.
2277
2277
  */
2278
+ function layoutFix(layout, migrationsDir) {
2279
+ const spaceDir = `\`${migrationsDir}/<space>/\``;
2280
+ return [layout.some((v) => v.kind === "declaredButUnmigrated") ? `Run \`prisma contract emit\` or \`prisma migration plan\` to write the pinned files of each declared extension pack under ${spaceDir}.` : [], layout.some((v) => v.kind === "orphanSpaceDir") ? `For a directory no extension declares, declare its extension in \`extensions\` or remove ${spaceDir}.` : []].flat().join(" ");
2281
+ }
2278
2282
  function mapIntegrityViolations(violations, migrationsDir) {
2279
2283
  if (violations.length === 0) return null;
2280
2284
  const layout = violations.filter((v) => v.kind === "orphanSpaceDir" || v.kind === "declaredButUnmigrated");
@@ -2282,7 +2286,7 @@ function mapIntegrityViolations(violations, migrationsDir) {
2282
2286
  const lines = layout.map((v) => `- [${v.kind}] ${v.spaceId}`);
2283
2287
  return new CliStructuredError$1("MIGRATION.CONTRACT_SPACE_LAYOUT_VIOLATION", layout.length === 1 ? "Contract-space layout violation detected" : `Contract-space layout violations detected (${layout.length})`, {
2284
2288
  why: `The on-disk \`${migrationsDir}/\` directory and your \`extensions\` declaration are not in agreement.\n${lines.join("\n")}`,
2285
- fix: `Declare the extension in \`extensions\` and re-emit its contract-space artefacts, or remove the orphan \`${migrationsDir}/<space>\` directory.`,
2289
+ fix: layoutFix(layout, migrationsDir),
2286
2290
  docsUrl: CONTRACT_SPACES_DOCS_URL,
2287
2291
  meta: { violations: layout }
2288
2292
  });
@@ -3443,8 +3447,21 @@ function markerHashes(marker) {
3443
3447
  profileHash: marker.profileHash
3444
3448
  };
3445
3449
  }
3450
+ function missingInvariants(space, marker) {
3451
+ const recorded = new Set(marker?.invariants ?? []);
3452
+ return requireHeadRef(space).invariants.filter((id) => !recorded.has(id)).sort();
3453
+ }
3454
+ function contractHashes(space) {
3455
+ const contract = space.contract();
3456
+ return {
3457
+ storageHash: contract.storage.storageHash,
3458
+ profileHash: contract.profileHash
3459
+ };
3460
+ }
3446
3461
  /**
3447
3462
  * Reads every space's marker, verifies every contract space of the aggregate against the live schema without strict mode, then writes the marker of every space that verified in one call to the family, each only while it still holds the hashes read here. A space that fails verification is reported with its schema result and keeps its marker; a space whose marker another process wrote in the meantime is reported as a conflict and keeps that marker. The family gets the spaces in the order `migrate` applies them ({@link spacesInApplyOrder}).
3463
+ *
3464
+ * A space whose head ref requires invariants its marker does not record is refused and keeps its marker, since only running the migrations that provide them can record them.
3448
3465
  */
3449
3466
  async function signContractSpaces(options) {
3450
3467
  const { driver, familyInstance, aggregate, frameworkComponents, onProgress } = options;
@@ -3477,7 +3494,9 @@ async function signContractSpaces(options) {
3477
3494
  if (schema === void 0) throw new InternalError(`the aggregate verifier returned no schema result for contract space "${space.spaceId}"`);
3478
3495
  return schema;
3479
3496
  };
3480
- const toSign = spacesInApplyOrder(aggregate).filter((space) => schemaOf(space).ok).map((space) => ({
3497
+ const allSpaces = [aggregate.app, ...aggregate.extensions];
3498
+ const missingBySpace = new Map(allSpaces.map((space) => [space.spaceId, missingInvariants(space, markers.get(space.spaceId))]).filter(([, missing]) => missing.length > 0));
3499
+ const toSign = spacesInApplyOrder(aggregate).filter((space) => schemaOf(space).ok && !missingBySpace.has(space.spaceId)).map((space) => ({
3481
3500
  space: space.spaceId,
3482
3501
  contract: space.contract(),
3483
3502
  expected: markerHashes(markers.get(space.spaceId))
@@ -3499,16 +3518,22 @@ async function signContractSpaces(options) {
3499
3518
  outcome: "ok"
3500
3519
  });
3501
3520
  const signatureOf = new Map(signatures.map((signature) => [signature.space, signature]));
3502
- return ok({ spaces: [aggregate.app, ...aggregate.extensions].map((space) => {
3503
- const contract = space.contract();
3504
- return signatureOf.get(space.spaceId) ?? {
3521
+ return ok({ spaces: allSpaces.map((space) => {
3522
+ const signature = signatureOf.get(space.spaceId);
3523
+ if (signature !== void 0) return signature;
3524
+ const missing = missingBySpace.get(space.spaceId);
3525
+ const schema = schemaOf(space);
3526
+ return missing === void 0 ? {
3505
3527
  space: space.spaceId,
3506
3528
  status: "failed",
3507
- contract: {
3508
- storageHash: contract.storage.storageHash,
3509
- profileHash: contract.profileHash
3510
- },
3511
- schema: schemaOf(space)
3529
+ contract: contractHashes(space),
3530
+ schema
3531
+ } : {
3532
+ space: space.spaceId,
3533
+ status: "missing-invariants",
3534
+ contract: contractHashes(space),
3535
+ missingInvariants: missing,
3536
+ ...schema.ok ? {} : { schema }
3512
3537
  };
3513
3538
  }) });
3514
3539
  }
@@ -5119,6 +5144,100 @@ function validateContractDeps(dtsContent, projectRoot) {
5119
5144
  };
5120
5145
  }
5121
5146
  /**
5147
+ * Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4), and the
5148
+ * step of `contract emit` that writes each pack's pinned files.
5149
+ *
5150
+ * For every extension that exposes a `contractSpace`:
5151
+ *
5152
+ * 1. Read the on-disk head ref (returns `null` on first emit).
5153
+ * 2. Write the head contract into the migrations-root snapshot store
5154
+ * (write-if-absent, keyed by hash) and unconditionally re-emit
5155
+ * `refs/head.json`, via {@link emitContractSpaceArtifacts}. The
5156
+ * framework owns `refs/head.json`; re-emit is the contract for that
5157
+ * file. The snapshot itself is only written once per distinct hash.
5158
+ * 3. Materialise any descriptor-shipped migration packages not yet on
5159
+ * disk via {@link materialiseExtensionMigrationPackageIfMissing}.
5160
+ * Existing packages are left untouched (by-existence skip).
5161
+ *
5162
+ * The return value lets the caller render a per-space status line and
5163
+ * lets the phase-2 aggregate loader run on a now-consistent disk state
5164
+ * (every loaded extension is guaranteed to have its head ref pinned
5165
+ * to the descriptor's hash and to ship every package the descriptor
5166
+ * declares).
5167
+ *
5168
+ * Output ordering is deterministic and alphabetical by spaceId (via
5169
+ * {@link planAllSpaces}, which also detects duplicate spaceIds). This
5170
+ * matches the canonical sort order used by every other aggregate
5171
+ * surface (`migrate`, `migration status`, the runner).
5172
+ */
5173
+ async function runContractSpaceSeedPhase(inputs) {
5174
+ const planned = planAllSpaces(inputs.extensions.filter((pack) => pack.contractSpace !== void 0).map((pack) => ({
5175
+ spaceId: pack.id,
5176
+ priorContract: null,
5177
+ newContract: pack.contractSpace.contractJson,
5178
+ __pack: pack.contractSpace
5179
+ })), (input) => input.__pack.migrations);
5180
+ const descriptorBySpace = /* @__PURE__ */ new Map();
5181
+ for (const pack of inputs.extensions) if (pack.contractSpace !== void 0) descriptorBySpace.set(pack.id, pack.contractSpace);
5182
+ const seeded = [];
5183
+ for (const space of planned) {
5184
+ const descriptor = descriptorBySpace.get(space.spaceId);
5185
+ if (descriptor === void 0) continue;
5186
+ inputs.signal?.throwIfAborted();
5187
+ const priorHash = (await readContractSpaceHeadRef(inputs.migrationsDir, space.spaceId))?.hash ?? null;
5188
+ const artifacts = await emitContractSpaceArtifacts(inputs.migrationsDir, space.spaceId, {
5189
+ contract: descriptor.contractJson,
5190
+ contractDts: buildPlaceholderContractDts(space.spaceId),
5191
+ headRef: {
5192
+ hash: descriptor.headRef.hash,
5193
+ invariants: descriptor.headRef.invariants
5194
+ }
5195
+ });
5196
+ const spaceDir = spaceMigrationDirectory(inputs.migrationsDir, space.spaceId);
5197
+ const newMigrationDirs = [];
5198
+ for (const pkg of space.migrationPackages) {
5199
+ inputs.signal?.throwIfAborted();
5200
+ const { written } = await materialiseExtensionMigrationPackageIfMissing(spaceDir, pkg);
5201
+ if (written) newMigrationDirs.push(pkg.dirName);
5202
+ }
5203
+ const action = priorHash !== descriptor.headRef.hash || newMigrationDirs.length > 0 ? "updated" : "unchanged";
5204
+ seeded.push({
5205
+ spaceId: space.spaceId,
5206
+ action,
5207
+ priorHash,
5208
+ newHash: descriptor.headRef.hash,
5209
+ newMigrationDirs,
5210
+ writtenPaths: [...artifacts.writtenPaths, ...newMigrationDirs.map((dirName) => join(spaceDir, dirName))]
5211
+ });
5212
+ }
5213
+ return { seeded };
5214
+ }
5215
+ /**
5216
+ * Placeholder `.d.ts` content for an extension space's on-disk mirror.
5217
+ *
5218
+ * Rendering a fully-typed `.d.ts` for an extension contract requires
5219
+ * the SQL-family renderer with the codec / typemap registry threaded
5220
+ * through; until that integration ships, the on-disk `.d.ts` is a
5221
+ * stub `export {};` module that documents how consumers should
5222
+ * validate the sibling `contract.json`. The stub typechecks on its
5223
+ * own and does not need any TypeScript suppressions.
5224
+ */
5225
+ function buildPlaceholderContractDts(spaceId) {
5226
+ return [
5227
+ "/**",
5228
+ ` * Placeholder \`.d.ts\` for extension space "${spaceId}".`,
5229
+ " *",
5230
+ " * The framework re-emits this file on every `migration plan` run",
5231
+ " * alongside `contract.json` and `refs/head.json`. A typed `.d.ts`",
5232
+ " * rendering pass for extension contracts is tracked separately;",
5233
+ " * until that ships, consumers should import `contract.json`",
5234
+ " * and pass it through the target descriptor’s `contractSerializer`.",
5235
+ " */",
5236
+ "export {};",
5237
+ ""
5238
+ ].join("\n");
5239
+ }
5240
+ /**
5122
5241
  * Validates a contract its source loaded, as `contract emit` and `contract print` both do before
5123
5242
  * they write anything: the contract is enriched with what the configured components declare,
5124
5243
  * serialized by the target, and read back through the family instance, which checks its structure.
@@ -5163,6 +5282,12 @@ function endSpan(onProgress, spanId, outcome) {
5163
5282
  * (`@internal/vite-plugin-contract-emit`). New callers must go through this
5164
5283
  * function rather than re-implementing load → emit → publish.
5165
5284
  *
5285
+ * Before publishing, it writes each composed extension pack's pinned files
5286
+ * under `migrations/<space-id>/`, as `migration plan` does, so a project
5287
+ * that never plans a migration can still sign its database, and returns
5288
+ * each path it wrote there. An `outputPath` writes the contract somewhere
5289
+ * other than the project, so it writes no pinned files.
5290
+ *
5166
5291
  * The whole flow (load config → resolve source → emit bytes → atomic publish)
5167
5292
  * is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls
5168
5293
  * for the same output line up FIFO; the user-visible outcome is "last
@@ -5234,6 +5359,15 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
5234
5359
  throw error;
5235
5360
  }
5236
5361
  endSpan(onProgress, "emit", "ok");
5362
+ signal.throwIfAborted();
5363
+ const pinnedFiles = outputPath === void 0 ? (await unlessAborted(runContractSpaceSeedPhase({
5364
+ migrationsDir: migrationsDirFor(config, cwd),
5365
+ extensions: toExtensionInputs(config.extensions ?? []),
5366
+ signal
5367
+ }))).seeded.flatMap(({ spaceId, writtenPaths }) => writtenPaths.map((path) => ({
5368
+ spaceId,
5369
+ path
5370
+ }))) : [];
5237
5371
  await unlessAborted(mkdir(dirname(outputJsonPath), { recursive: true }));
5238
5372
  await publishContractArtifactPair({
5239
5373
  outputJsonPath,
@@ -5251,6 +5385,7 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
5251
5385
  json: outputJsonPath,
5252
5386
  dts: outputDtsPath
5253
5387
  },
5388
+ pinnedFiles,
5254
5389
  ...ifDefined("validationWarning", validationWarning),
5255
5390
  ...ifDefined("sourceWarnings", sourceWarnings.length > 0 ? sourceWarnings : void 0)
5256
5391
  };
@@ -6602,96 +6737,6 @@ async function executeMigrationNewCommand(options) {
6602
6737
  }
6603
6738
  }
6604
6739
  /**
6605
- * Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4).
6606
- *
6607
- * For every extension that exposes a `contractSpace`:
6608
- *
6609
- * 1. Read the on-disk head ref (returns `null` on first emit).
6610
- * 2. Write the head contract into the migrations-root snapshot store
6611
- * (write-if-absent, keyed by hash) and unconditionally re-emit
6612
- * `refs/head.json`, via {@link emitContractSpaceArtifacts}. The
6613
- * framework owns `refs/head.json`; re-emit is the contract for that
6614
- * file. The snapshot itself is only written once per distinct hash.
6615
- * 3. Materialise any descriptor-shipped migration packages not yet on
6616
- * disk via {@link materialiseExtensionMigrationPackageIfMissing}.
6617
- * Existing packages are left untouched (by-existence skip).
6618
- *
6619
- * The return value lets the caller render a per-space status line and
6620
- * lets the phase-2 aggregate loader run on a now-consistent disk state
6621
- * (every loaded extension is guaranteed to have its head ref pinned
6622
- * to the descriptor's hash and to ship every package the descriptor
6623
- * declares).
6624
- *
6625
- * Output ordering is deterministic and alphabetical by spaceId (via
6626
- * {@link planAllSpaces}, which also detects duplicate spaceIds). This
6627
- * matches the canonical sort order used by every other aggregate
6628
- * surface (`migrate`, `migration status`, the runner).
6629
- */
6630
- async function runContractSpaceSeedPhase(inputs) {
6631
- const planned = planAllSpaces(inputs.extensions.filter((pack) => pack.contractSpace !== void 0).map((pack) => ({
6632
- spaceId: pack.id,
6633
- priorContract: null,
6634
- newContract: pack.contractSpace.contractJson,
6635
- __pack: pack.contractSpace
6636
- })), (input) => input.__pack.migrations);
6637
- const descriptorBySpace = /* @__PURE__ */ new Map();
6638
- for (const pack of inputs.extensions) if (pack.contractSpace !== void 0) descriptorBySpace.set(pack.id, pack.contractSpace);
6639
- const seeded = [];
6640
- for (const space of planned) {
6641
- const descriptor = descriptorBySpace.get(space.spaceId);
6642
- if (descriptor === void 0) continue;
6643
- const priorHash = (await readContractSpaceHeadRef(inputs.migrationsDir, space.spaceId))?.hash ?? null;
6644
- await emitContractSpaceArtifacts(inputs.migrationsDir, space.spaceId, {
6645
- contract: descriptor.contractJson,
6646
- contractDts: buildPlaceholderContractDts(space.spaceId),
6647
- headRef: {
6648
- hash: descriptor.headRef.hash,
6649
- invariants: descriptor.headRef.invariants
6650
- }
6651
- });
6652
- const spaceDir = spaceMigrationDirectory(inputs.migrationsDir, space.spaceId);
6653
- const newMigrationDirs = [];
6654
- for (const pkg of space.migrationPackages) {
6655
- const { written } = await materialiseExtensionMigrationPackageIfMissing(spaceDir, pkg);
6656
- if (written) newMigrationDirs.push(pkg.dirName);
6657
- }
6658
- const action = priorHash !== descriptor.headRef.hash || newMigrationDirs.length > 0 ? "updated" : "unchanged";
6659
- seeded.push({
6660
- spaceId: space.spaceId,
6661
- action,
6662
- priorHash,
6663
- newHash: descriptor.headRef.hash,
6664
- newMigrationDirs
6665
- });
6666
- }
6667
- return { seeded };
6668
- }
6669
- /**
6670
- * Placeholder `.d.ts` content for an extension space's on-disk mirror.
6671
- *
6672
- * Rendering a fully-typed `.d.ts` for an extension contract requires
6673
- * the SQL-family renderer with the codec / typemap registry threaded
6674
- * through; until that integration ships, the on-disk `.d.ts` is a
6675
- * stub `export {};` module that documents how consumers should
6676
- * validate the sibling `contract.json`. The stub typechecks on its
6677
- * own and does not need any TypeScript suppressions.
6678
- */
6679
- function buildPlaceholderContractDts(spaceId) {
6680
- return [
6681
- "/**",
6682
- ` * Placeholder \`.d.ts\` for extension space "${spaceId}".`,
6683
- " *",
6684
- " * The framework re-emits this file on every `migration plan` run",
6685
- " * alongside `contract.json` and `refs/head.json`. A typed `.d.ts`",
6686
- " * rendering pass for extension contracts is tracked separately;",
6687
- " * until that ships, consumers should import `contract.json`",
6688
- " * and pass it through the target descriptor’s `contractSerializer`.",
6689
- " */",
6690
- "export {};",
6691
- ""
6692
- ].join("\n");
6693
- }
6694
- /**
6695
6740
  * Policy core of `migration plan`: resolves from/to contracts, runs the planner legs, and writes the planned migration packages.
6696
6741
  */
6697
6742
  function isEnoent(error) {
@@ -7418,4 +7463,4 @@ async function executeRefListCommand(options) {
7418
7463
  //#endregion
7419
7464
  export { refuseContractSpaceIntegrity as $, executeRefDeleteCommand as A, loadAggregateIntegrityViolations as B, executeDbSign as C, executeMigrationNewCommand as D, executeMigrateShowPlan as E, hasMigrationPath as F, looksLikePath as G, loadContractSource as H, isStatementVerb as I, matchConsents as J, mapContractAtError as K, labelsText as L, executeRefSetCommand as M, findPackageByDirPath as N, executeMigrationPlanCommand as O, formatSourceDiagnostic as P, readMigrationRefs as Q, listRefsByContractHash as R, executeDbInit as S, withWarningFindings as St, executeDbVerify as T, loadContractSourceWithStack as U, loadContractRawSafely as V, loadContractSpaceAggregateForCli as W, planEverySpace as X, migrationSpaceListEntriesFromAggregate as Y, preflightRefAdvancement as Z, deriveStatusEdgeAnnotations as _, snapshotVerifierFor as _t, advanceRefSafely as a, requireDatabaseForLiveMarkerUse as at, enumerateCheckSpaces as b, toDeclaredExtensionsFromRaw as bt, buildContractSpaceAggregate as c, resolveContractRefToSnapshot as ct, buildRefAdvancementFields as d, resolveStatements as dt, refuseDeclaredExtensionTargetMismatch as et, checkSingleTarget as f, resolveToForPlan as ft, createControlClient as g, runMigrationList as gt, convertAndDelete as h, runMigrationCheck as ht, RECORDED_OR_EMPTY_CONTRACT_REF_FORMS as i, renamedAndDeleted as it, executeRefListCommand as j, executeRefAdvancement as k, buildMigrationSpaceGraphEntries as l, resolveFromForPlan as lt, contractValidationMeta as m, runContractSpaceSeedPhase as mt, NO_REF_ADVANCEMENT as n, refusePackageCorruptionOnAggregate as nt, appContractStandInFromIdentity as o, resolveAppTargetPath as ot, computeRefAdvancementName as p, retryCommandFor as pt, mapIntegrityViolations as q, RECORDED_CONTRACT_REF_FORMS as r, refuseUnknownInvariants as rt, appliedHashesFromLedger as s, resolveContractRef$1 as st, ALL_CONTRACT_REF_FORMS as t, refuseMissingInvariantPath as tt, buildReadAggregate as u, resolveMigrationRef as ut, disposeEmitQueue as v, sourceWarningDiagnostic as vt, executeDbUpdate as w, executeContractEmit as x, validateLoadedContract as xt, enrichContract as y, statusForMigrationHash as yt, liveMarkerUse as z };
7420
7465
 
7421
- //# sourceMappingURL=ref-qma7fG-2-TOPNrzuP.mjs.map
7466
+ //# sourceMappingURL=ref-CKUrXPT8-DOwCuN0q.mjs.map