@prisma/orm-toolchain 8.0.0-rc.21-dev.5 → 8.0.0-rc.21-dev.6
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/dist/{aggregate-CNSeEdzt.mjs → aggregate-DS_usja4.mjs} +2 -2
- package/dist/{aggregate-CNSeEdzt.mjs.map → aggregate-DS_usja4.mjs.map} +1 -1
- package/dist/{aggregate-L_KguJXL.d.mts → aggregate-DbWK1jSi.d.mts} +2 -2
- package/dist/{aggregate-L_KguJXL.d.mts.map → aggregate-DbWK1jSi.d.mts.map} +1 -1
- package/dist/{caught-errors-BxdRHTkj-C40Qqf4i.mjs → caught-errors-DlLh7HAX-DzRh7ZVr.mjs} +12 -25
- package/dist/caught-errors-DlLh7HAX-DzRh7ZVr.mjs.map +1 -0
- package/dist/cli-telemetry.mjs +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +11 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +8 -4
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__control-api__testing.d.mts +2 -2
- package/dist/cli__migration-cli.mjs +2 -2
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{db-sign-DRaumhgX-DUsGYByK.d.mts → db-sign-wBQmmQn7-Bl6NVm0G.d.mts} +12 -4
- package/dist/db-sign-wBQmmQn7-Bl6NVm0G.d.mts.map +1 -0
- package/dist/{domain-type-generation-B4m774CV-WAjyhZHw.mjs → domain-type-generation-BlYB8GiS-k0HNTf4f.mjs} +38 -26
- package/dist/domain-type-generation-BlYB8GiS-k0HNTf4f.mjs.map +1 -0
- package/dist/{domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts → domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts} +8 -8
- package/dist/{domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map → domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts.map} +1 -1
- package/dist/emitter.d.mts +2 -2
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.d.mts +1 -1
- package/dist/emitter__domain-type-generation.mjs +1 -1
- package/dist/{exports-BCIlMjIW-DkUBVDzl.mjs → exports-CVgs3YWV-BF4rqnxF.mjs} +12 -20
- package/dist/exports-CVgs3YWV-BF4rqnxF.mjs.map +1 -0
- package/dist/{exports-DET_AbNt.mjs → exports-D-eB7CoA.mjs} +2 -2
- package/dist/{exports-DET_AbNt.mjs.map → exports-D-eB7CoA.mjs.map} +1 -1
- package/dist/{exports-BlYTE3-J.mjs → exports-ycSqeIf5.mjs} +2 -2
- package/dist/{exports-BlYTE3-J.mjs.map → exports-ycSqeIf5.mjs.map} +1 -1
- package/dist/{index-tAySVPvZ.d.mts → index-BHYAWGxJ.d.mts} +4 -4
- package/dist/{index-tAySVPvZ.d.mts.map → index-BHYAWGxJ.d.mts.map} +1 -1
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +1 -1
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/{ref-D-HCqZAl-Bbop38S7.mjs → ref-qma7fG-2-TOPNrzuP.mjs} +153 -67
- package/dist/ref-qma7fG-2-TOPNrzuP.mjs.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/caught-errors-BxdRHTkj-C40Qqf4i.mjs.map +0 -1
- package/dist/db-sign-DRaumhgX-DUsGYByK.d.mts.map +0 -1
- package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +0 -1
- package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +0 -1
- package/dist/ref-D-HCqZAl-Bbop38S7.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as expandContractInputs } from "./exports-
|
|
1
|
+
import { a as expandContractInputs } from "./exports-ycSqeIf5.mjs";
|
|
2
2
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
3
|
import { D as errorNoInvariantPath, M as errorUnknownInvariant, b as errorInvalidRefName, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-DXha_4l--relAaiI4.mjs";
|
|
4
4
|
import { r as verifyMigrationHash, t as computeMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
|
|
@@ -8,11 +8,11 @@ import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigratio
|
|
|
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
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-
|
|
12
|
-
import { r as getEmittedArtifactPaths, t as emit } from "./exports-
|
|
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";
|
|
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";
|
|
15
|
-
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, m as verifyMigration, n as buildFabricatedMigrationEdge, p as spacesInApplyOrder, r as collectAggregateNamespaces, t as allStorageElementsExternal, u as planMigration } from "./aggregate-
|
|
15
|
+
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, m as verifyMigration, n as buildFabricatedMigrationEdge, p as spacesInApplyOrder, r as collectAggregateNamespaces, t as allStorageElementsExternal, u as planMigration } from "./aggregate-DS_usja4.mjs";
|
|
16
16
|
import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver, t as ImportRootError } from "./import-roots-A66iGb4c.mjs";
|
|
17
17
|
import { c as parseContractRef, l as parseMigrationRef, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-Eo0QHp4f.mjs";
|
|
18
18
|
import { a as writeMigrationTs } from "./migration-ts-DDgjsR1O.mjs";
|
|
@@ -26,15 +26,16 @@ import { basename, dirname, isAbsolute, join, relative, resolve } from "pathe";
|
|
|
26
26
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
27
27
|
import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
|
|
28
28
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
29
|
+
import { asNamespaceId, valueObjectAt } from "@prisma/orm-framework/contract/types";
|
|
29
30
|
import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
30
|
-
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
31
|
+
import { UNBOUND_NAMESPACE_ID, changedElementCoordinates } from "@prisma/orm-framework/components/ir";
|
|
31
32
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
32
33
|
import { mergeCapabilityMatrices } from "@prisma/orm-framework/components/components";
|
|
33
|
-
import { asNamespaceId } from "@prisma/orm-framework/contract/types";
|
|
34
34
|
import { isDeepStrictEqual } from "node:util";
|
|
35
|
+
import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
|
|
35
36
|
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
36
37
|
import { resolve as resolve$1 } from "node:path";
|
|
37
|
-
//#region ../../../1-framework/3-tooling/cli/dist/ref-
|
|
38
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-qma7fG-2.mjs
|
|
38
39
|
/**
|
|
39
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.
|
|
40
41
|
*/
|
|
@@ -292,6 +293,31 @@ function migrateRowsHoldingValueAdvice(report, failedMigration, invocation) {
|
|
|
292
293
|
text: report.enumValue
|
|
293
294
|
})}\``, `put any code you copied into the migration.ts it writes, ${runWrittenFile(invocation)}`), ...byHand];
|
|
294
295
|
}
|
|
296
|
+
/** Where the operation that updates the rows goes among the operations of a migration.ts that replaces a check. */
|
|
297
|
+
function betweenTheChecks(report, replacedCheck) {
|
|
298
|
+
return `after the operation that drops check "${replacedCheck}" and before the operation that adds check "${report.check}"`;
|
|
299
|
+
}
|
|
300
|
+
function updateOperation(report) {
|
|
301
|
+
return `an operation that updates those rows to fit check "${report.check}"`;
|
|
302
|
+
}
|
|
303
|
+
function fixRowsFirst(report, rerun) {
|
|
304
|
+
return chooseAction(`Update or delete those rows so they fit check "${report.check}", then re-run ${quoted$1(rerun)}`);
|
|
305
|
+
}
|
|
306
|
+
/** The way out when existing rows fail a check `db update` adds: it cannot keep the data while the check it replaces holds. */
|
|
307
|
+
function dbUpdateRowsFailingCheckAdvice(report, databaseStorageHash, invocation) {
|
|
308
|
+
const update = cliCommand(invocation, "db update", invocation.rerunArgs ?? []);
|
|
309
|
+
const { replacedCheck } = report;
|
|
310
|
+
if (replacedCheck === void 0) return [fixRowsFirst(report, update)];
|
|
311
|
+
const cannotKeep = `${quoted$1(cliCommand(invocation, "db update"))} cannot keep this data`;
|
|
312
|
+
if (databaseStorageHash === void 0) return [chooseAction(`${cannotKeep}, and no migration ends at the contract the database is at, so ${quoted$1(cliCommand(invocation, "migration plan"))} cannot plan from it. Drop check "${replacedCheck}" in the database yourself, update those rows to fit check "${report.check}", then re-run ${quoted$1(update)}`)];
|
|
313
|
+
return [chooseAction(`${cannotKeep}. Plan the change with ${quoted$1(printedPlanCommand(invocation, databaseStorageHash, invocation.statementArgs ?? []))}, add ${updateOperation(report)} to the migration.ts it writes, ${betweenTheChecks(report, replacedCheck)}, ${runWrittenFile(invocation)}`)];
|
|
314
|
+
}
|
|
315
|
+
function migrateRowsFailingCheckAdvice(report, failedMigration, invocation) {
|
|
316
|
+
const { replacedCheck } = report;
|
|
317
|
+
if (replacedCheck === void 0) return [fixRowsFirst(report, cliCommand(invocation, "db migrate", invocation.rerunArgs ?? []))];
|
|
318
|
+
const { file, run } = failedMigrationFile(failedMigration);
|
|
319
|
+
return [editFileAction(`To keep the data, add ${updateOperation(report)} to ${file}, ${betweenTheChecks(report, replacedCheck)}, ${run}, and re-run ${dbMigrateCommand(invocation)}`)];
|
|
320
|
+
}
|
|
295
321
|
/**
|
|
296
322
|
* The way out of rows without a value for `db init`: a migration plan needs an origin contract,
|
|
297
323
|
* which a database that `db init` never initialized does not have.
|
|
@@ -412,6 +438,7 @@ function migrateAdvice(failure, facts, failedOnDisk, invocation) {
|
|
|
412
438
|
if (facts.failedTypeChange !== void 0) return migrateFailedTypeChangeAdvice(facts.failedTypeChange, failedMigration, invocation);
|
|
413
439
|
if (facts.rowsWithoutValue !== void 0) return migrateRowsWithoutValueAdvice(facts.rowsWithoutValue, failedMigration, invocation);
|
|
414
440
|
if (facts.rowsHoldingValue !== void 0) return migrateRowsHoldingValueAdvice(facts.rowsHoldingValue, failedMigration, invocation);
|
|
441
|
+
if (facts.rowsFailingCheck !== void 0) return migrateRowsFailingCheckAdvice(facts.rowsFailingCheck, failedMigration, invocation);
|
|
415
442
|
if (schemaCheckIssues(failure) !== void 0) return migrateSchemaCheckAdvice(failedMigration, invocation);
|
|
416
443
|
if (facts.failedPrecheck !== void 0) return migrateFailedPrecheckAdvice(facts.failedPrecheck, invocation);
|
|
417
444
|
return [chooseAction(`Fix the issue and re-run \`${cliCommand(invocation, "db migrate", ["--to", "<contract>"])}\``)];
|
|
@@ -489,7 +516,7 @@ function dbUpdateRunnerFailureError(failure, facts, context) {
|
|
|
489
516
|
const { databaseStorageHash, invocation } = context;
|
|
490
517
|
const update = cliCommand(invocation, "db update");
|
|
491
518
|
const { blockingObjects } = failure.meta;
|
|
492
|
-
return runnerFailureError(failure, blockingObjects !== void 0 ? blockingObjectsAdvice(blockingObjects, cliCommand(invocation, "db update", invocation.rerunArgs ?? [])) : facts.failedTypeChange !== void 0 ? dbUpdateFailedTypeChangeAdvice(facts.failedTypeChange, databaseStorageHash, invocation) : facts.rowsWithoutValue !== void 0 ? dbUpdateRowsWithoutValueAdvice(facts.rowsWithoutValue, databaseStorageHash, invocation) : facts.rowsHoldingValue !== void 0 ? dbUpdateRowsHoldingValueAdvice(facts.rowsHoldingValue, databaseStorageHash, invocation) : schemaCheckIssues(failure) !== void 0 ? [editFileAction(`Change the contract source to resolve the issues listed, re-run \`${cliCommand(invocation, "contract emit")}\`, then re-run \`${update}\``)] : [chooseAction(`Inspect the reported conflict, reconcile schema drift if needed, then re-run \`${update}\``)]);
|
|
519
|
+
return runnerFailureError(failure, blockingObjects !== void 0 ? blockingObjectsAdvice(blockingObjects, cliCommand(invocation, "db update", invocation.rerunArgs ?? [])) : facts.failedTypeChange !== void 0 ? dbUpdateFailedTypeChangeAdvice(facts.failedTypeChange, databaseStorageHash, invocation) : facts.rowsWithoutValue !== void 0 ? dbUpdateRowsWithoutValueAdvice(facts.rowsWithoutValue, databaseStorageHash, invocation) : facts.rowsHoldingValue !== void 0 ? dbUpdateRowsHoldingValueAdvice(facts.rowsHoldingValue, databaseStorageHash, invocation) : facts.rowsFailingCheck !== void 0 ? dbUpdateRowsFailingCheckAdvice(facts.rowsFailingCheck, databaseStorageHash, invocation) : schemaCheckIssues(failure) !== void 0 ? [editFileAction(`Change the contract source to resolve the issues listed, re-run \`${cliCommand(invocation, "contract emit")}\`, then re-run \`${update}\``)] : [chooseAction(`Inspect the reported conflict, reconcile schema drift if needed, then re-run \`${update}\``)]);
|
|
493
520
|
}
|
|
494
521
|
function startText(fromHash) {
|
|
495
522
|
return fromHash === "empty" ? "the empty contract (the space has no marker)" : `the contract its marker names ("${fromHash}")`;
|
|
@@ -794,8 +821,13 @@ function unresolved(statement, refusal) {
|
|
|
794
821
|
function modelIn(namespace, name) {
|
|
795
822
|
return Object.hasOwn(namespace.models, name) ? namespace.models[name] : void 0;
|
|
796
823
|
}
|
|
797
|
-
function hasValueObject(
|
|
798
|
-
return
|
|
824
|
+
function hasValueObject(storage, namespaceId, name) {
|
|
825
|
+
return valueObjectAt(storage, {
|
|
826
|
+
plane: "storage",
|
|
827
|
+
namespaceId,
|
|
828
|
+
entityKind: "valueObject",
|
|
829
|
+
entityName: name
|
|
830
|
+
}) !== void 0;
|
|
799
831
|
}
|
|
800
832
|
function modelAt(contract, coordinate) {
|
|
801
833
|
const namespaces = contract.domain.namespaces;
|
|
@@ -831,7 +863,7 @@ function lookupModelInNamespace(contract, namespaceId, namespace, name) {
|
|
|
831
863
|
},
|
|
832
864
|
model
|
|
833
865
|
};
|
|
834
|
-
if (hasValueObject(
|
|
866
|
+
if (hasValueObject(contract.contract.storage, namespaceId, name)) return {
|
|
835
867
|
kind: "refused",
|
|
836
868
|
...valueObjectRefusal(displayName(namespaceId, name))
|
|
837
869
|
};
|
|
@@ -867,7 +899,7 @@ function lookupModel(contract, namespaceId, name) {
|
|
|
867
899
|
fix: `Name the model with its namespace, for example ${candidates[0]}.`
|
|
868
900
|
};
|
|
869
901
|
}
|
|
870
|
-
if (Object.
|
|
902
|
+
if (Object.keys(contract.contract.storage.namespaces).some((namespaceId) => hasValueObject(contract.contract.storage, namespaceId, name))) return {
|
|
871
903
|
kind: "refused",
|
|
872
904
|
...valueObjectRefusal(name)
|
|
873
905
|
};
|
|
@@ -1316,7 +1348,7 @@ function resolveStatement(state, statement, later) {
|
|
|
1316
1348
|
function typeText(type) {
|
|
1317
1349
|
switch (type.kind) {
|
|
1318
1350
|
case "scalar": return type.typeParams === void 0 ? type.codecId : `${type.codecId}(${JSON.stringify(type.typeParams)})`;
|
|
1319
|
-
case "valueObject": return type.
|
|
1351
|
+
case "valueObject": return type.entityName;
|
|
1320
1352
|
case "union": return type.members.map(typeText).join(" | ");
|
|
1321
1353
|
}
|
|
1322
1354
|
}
|
|
@@ -2094,6 +2126,36 @@ function reportTemporaryValues(values, destination) {
|
|
|
2094
2126
|
value
|
|
2095
2127
|
}] : []);
|
|
2096
2128
|
}
|
|
2129
|
+
/** The storage entities that differ between two contracts, as a result reports them. */
|
|
2130
|
+
function changedStorageEntities(fromContract, toContract) {
|
|
2131
|
+
return changedElementCoordinates(fromContract?.storage ?? null, toContract.storage).map(withoutUnboundNamespaceId);
|
|
2132
|
+
}
|
|
2133
|
+
/** The sentence that names what changed in storage, such as `What changed: value object "public.Home".` */
|
|
2134
|
+
function whatChangedSentence(fromContract, toContract) {
|
|
2135
|
+
const changed = changedElementCoordinates(fromContract?.storage ?? null, toContract.storage);
|
|
2136
|
+
return changed.length === 0 ? `No storage entity changed; what changed is ${changedStorageKeys(fromContract, toContract).join(", ") || "outside the storage entities"}.` : `What changed: ${changed.map(storageEntityText).join(", ")}.`;
|
|
2137
|
+
}
|
|
2138
|
+
function withoutUnboundNamespaceId({ namespaceId, ...rest }) {
|
|
2139
|
+
return namespaceId === UNBOUND_NAMESPACE_ID ? rest : {
|
|
2140
|
+
namespaceId,
|
|
2141
|
+
...rest
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
/** The top-level storage keys whose content differs between two contracts, such as `storage.types`, in key order. */
|
|
2145
|
+
function changedStorageKeys(fromContract, toContract) {
|
|
2146
|
+
const plain = (storage) => typeof storage === "object" && storage !== null ? JSON.parse(JSON.stringify(storage)) : {};
|
|
2147
|
+
const from = plain(fromContract?.storage);
|
|
2148
|
+
const to = plain(toContract.storage);
|
|
2149
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(from), ...Object.keys(to)])].filter((key) => key !== "storageHash").filter((key) => canonicalStringify(from[key]) !== canonicalStringify(to[key])).sort().map((key) => `storage.${key}`);
|
|
2150
|
+
}
|
|
2151
|
+
function storageEntityText(coordinate) {
|
|
2152
|
+
const name = coordinate.namespaceId === UNBOUND_NAMESPACE_ID ? coordinate.entityName : `${coordinate.namespaceId}.${coordinate.entityName}`;
|
|
2153
|
+
return `${kindInWords(coordinate.entityKind)} "${name}"`;
|
|
2154
|
+
}
|
|
2155
|
+
/** An entity kind as words, such as `value object` for `valueObject`. */
|
|
2156
|
+
function kindInWords(entityKind) {
|
|
2157
|
+
return entityKind.replace(/[A-Z]/g, (letter) => ` ${letter.toLowerCase()}`);
|
|
2158
|
+
}
|
|
2097
2159
|
/**
|
|
2098
2160
|
* Project the CLI's `Config.extensions` array into the canonical
|
|
2099
2161
|
* {@link ExtensionPackInput} shape. The single `as ExtensionPackLike`
|
|
@@ -2458,6 +2520,11 @@ function rowsHoldingValueReport(fact, contract) {
|
|
|
2458
2520
|
...ifDefined("keepDataEdit", fact.keepDataEdit)
|
|
2459
2521
|
};
|
|
2460
2522
|
}
|
|
2523
|
+
function rowsFailingCheckReport(fact) {
|
|
2524
|
+
if (fact === void 0) return void 0;
|
|
2525
|
+
const { operationIndex: _operationIndex, ...report } = fact;
|
|
2526
|
+
return report;
|
|
2527
|
+
}
|
|
2461
2528
|
/** What the runner said blocked the failed operation, named as the advice names it. */
|
|
2462
2529
|
function failureReports(failure, resolutions) {
|
|
2463
2530
|
const resolution = resolutions.find(({ spaceId }) => spaceId === failure.meta.failingSpace);
|
|
@@ -2466,8 +2533,8 @@ function failureReports(failure, resolutions) {
|
|
|
2466
2533
|
origin: resolution.entry.destinationContract,
|
|
2467
2534
|
statements: []
|
|
2468
2535
|
});
|
|
2469
|
-
const { failedTypeChange, rowsWithoutValue, rowsHoldingValue } = failure.meta;
|
|
2470
|
-
const operationIndex = failedTypeChange?.operationIndex ?? rowsWithoutValue?.[0]?.operationIndex ?? rowsHoldingValue?.operationIndex;
|
|
2536
|
+
const { failedTypeChange, rowsWithoutValue, rowsHoldingValue, rowsFailingCheck } = failure.meta;
|
|
2537
|
+
const operationIndex = failedTypeChange?.operationIndex ?? rowsWithoutValue?.[0]?.operationIndex ?? rowsHoldingValue?.operationIndex ?? rowsFailingCheck?.operationIndex;
|
|
2471
2538
|
const edge = operationIndex !== void 0 ? edgeOfOperation(resolution.entry.migrationEdges, operationIndex) : schemaCheckIssues(failure) !== void 0 ? resolution.entry.migrationEdges.at(-1) : void 0;
|
|
2472
2539
|
return {
|
|
2473
2540
|
...ifDefined("failedTypeChange", failedTypeChange === void 0 ? void 0 : failedTypeChangeReport(failedTypeChange, fieldText(failedTypeChange.field))),
|
|
@@ -2477,6 +2544,7 @@ function failureReports(failure, resolutions) {
|
|
|
2477
2544
|
rows
|
|
2478
2545
|
}))),
|
|
2479
2546
|
...ifDefined("rowsHoldingValue", rowsHoldingValue === void 0 ? void 0 : rowsHoldingValueReport(rowsHoldingValue, resolution.entry.destinationContract)),
|
|
2547
|
+
...ifDefined("rowsFailingCheck", rowsFailingCheckReport(rowsFailingCheck)),
|
|
2480
2548
|
...ifDefined("failedMigration", edge === void 0 ? void 0 : {
|
|
2481
2549
|
spaceId: resolution.spaceId,
|
|
2482
2550
|
edge
|
|
@@ -2894,7 +2962,8 @@ async function executeRun(options) {
|
|
|
2894
2962
|
}));
|
|
2895
2963
|
}
|
|
2896
2964
|
const aggregateOps = applied.value.orderedResolutions.flatMap((r) => r.entry.displayOps);
|
|
2897
|
-
const
|
|
2965
|
+
const signedWithoutOperations = action === "dbUpdate" && applied.value.totalOpsExecuted === 0 && markerRows.get(aggregate.app.spaceId)?.storageHash !== appPlan.destination.storageHash;
|
|
2966
|
+
const summary = action === "dbInit" ? `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), database signed` : signedWithoutOperations ? `The storage the contract describes changed, but the database needs no operation for it, so none ran and the database was signed with the new contract. ${whatChangedSentence(fromContract, contract)}` : applied.value.totalOpsExecuted === 0 ? `Database already matches contract across ${applied.value.orderedResolutions.length} space(s), signature updated` : `Applied ${applied.value.totalOpsExecuted} operation(s) across ${applied.value.orderedResolutions.length} space(s), signature updated`;
|
|
2898
2967
|
return wrapApplyResult({
|
|
2899
2968
|
operations: aggregateOps,
|
|
2900
2969
|
destination: appPlan.destination,
|
|
@@ -2904,11 +2973,15 @@ async function executeRun(options) {
|
|
|
2904
2973
|
summary,
|
|
2905
2974
|
appliedStatements,
|
|
2906
2975
|
subjects,
|
|
2907
|
-
databaseStorageHash
|
|
2976
|
+
databaseStorageHash,
|
|
2977
|
+
changedStorageEntities: signedWithoutOperations ? changedStorageEntities(fromContract, contract) : void 0
|
|
2908
2978
|
});
|
|
2909
2979
|
}
|
|
2910
2980
|
/** The origin of a database whose marker names no readable contract: no models. */
|
|
2911
|
-
const EMPTY_ORIGIN$1 = {
|
|
2981
|
+
const EMPTY_ORIGIN$1 = {
|
|
2982
|
+
domain: { namespaces: {} },
|
|
2983
|
+
storage: { namespaces: {} }
|
|
2984
|
+
};
|
|
2912
2985
|
/**
|
|
2913
2986
|
* The contract the application space's marker names, from the local snapshot
|
|
2914
2987
|
* store, or where it was looked for and why it could not be used.
|
|
@@ -3075,6 +3148,7 @@ function wrapApplyResult(args) {
|
|
|
3075
3148
|
return ok({
|
|
3076
3149
|
mode: "apply",
|
|
3077
3150
|
...ifDefined("databaseStorageHash", args.databaseStorageHash),
|
|
3151
|
+
...ifDefined("changedStorageEntities", args.changedStorageEntities),
|
|
3078
3152
|
...ifDefined("appliedStatements", args.appliedStatements),
|
|
3079
3153
|
...args.subjects,
|
|
3080
3154
|
plan: { operations: stripOperations(args.operations) },
|
|
@@ -6635,8 +6709,11 @@ function invocationOf(options) {
|
|
|
6635
6709
|
};
|
|
6636
6710
|
}
|
|
6637
6711
|
/** The origin of a plan from an empty database: no models, so no statement resolves. */
|
|
6638
|
-
const EMPTY_ORIGIN = {
|
|
6639
|
-
|
|
6712
|
+
const EMPTY_ORIGIN = {
|
|
6713
|
+
domain: { namespaces: {} },
|
|
6714
|
+
storage: { namespaces: {} }
|
|
6715
|
+
};
|
|
6716
|
+
async function runPlannerLeg(planner, migrations, frameworkComponents, contract, origin, destination, statements, spaceId, ownership, snapshotsImportPath, resolveImportSpecifier, refused = (conflicts) => errorMigrationPlanningFailed({ conflicts: castAs(conflicts) })) {
|
|
6640
6717
|
const fromContract = origin.kind === "contract" ? origin.contract : null;
|
|
6641
6718
|
const fromSchema = migrations.contractToSchema(fromContract, frameworkComponents);
|
|
6642
6719
|
const plannerResult = planner.plan({
|
|
@@ -6656,18 +6733,12 @@ async function runPlannerLeg(planner, migrations, frameworkComponents, contract,
|
|
|
6656
6733
|
ownership,
|
|
6657
6734
|
snapshotsImportPath
|
|
6658
6735
|
});
|
|
6659
|
-
if (plannerResult.kind === "failure") return notOk(
|
|
6660
|
-
reason: "refused",
|
|
6661
|
-
error: refused(plannerResult.conflicts)
|
|
6662
|
-
});
|
|
6736
|
+
if (plannerResult.kind === "failure") return notOk(refused(plannerResult.conflicts));
|
|
6663
6737
|
let resolved = [];
|
|
6664
6738
|
let hasPlaceholders = false;
|
|
6665
6739
|
try {
|
|
6666
6740
|
resolved = await Promise.all(plannerResult.plan.operations);
|
|
6667
|
-
if (resolved.length === 0 &&
|
|
6668
|
-
reason: "noOperations",
|
|
6669
|
-
error: errorPlanProducedNoOperations(origin, destination)
|
|
6670
|
-
});
|
|
6741
|
+
if (resolved.length === 0 && origin.kind === "empty") return notOk(errorPlanProducedNoOperations(destination));
|
|
6671
6742
|
} catch (e) {
|
|
6672
6743
|
if (CliStructuredError$1.is(e) && e.code === "MIGRATION.UNFILLED_PLACEHOLDER") {
|
|
6673
6744
|
hasPlaceholders = true;
|
|
@@ -6877,7 +6948,6 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
6877
6948
|
const resolvedFrom = resolutionResult.value;
|
|
6878
6949
|
const fromOrigin = resolvedFrom.kind === "greenfield" ? { kind: "empty" } : {
|
|
6879
6950
|
kind: "contract",
|
|
6880
|
-
hash: resolvedFrom.fromHash,
|
|
6881
6951
|
contract: resolvedFrom.fromContract
|
|
6882
6952
|
};
|
|
6883
6953
|
if (options.to !== void 0) {
|
|
@@ -6940,6 +7010,7 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
6940
7010
|
...warnings.length > 0 ? { warnings } : {},
|
|
6941
7011
|
appliedStatements: [],
|
|
6942
7012
|
temporaryValues: [],
|
|
7013
|
+
changedStorageEntities: [],
|
|
6943
7014
|
summary: "No changes detected between contracts",
|
|
6944
7015
|
timings: { total: Date.now() - startTime }
|
|
6945
7016
|
});
|
|
@@ -6993,8 +7064,7 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
6993
7064
|
destination: toContract
|
|
6994
7065
|
});
|
|
6995
7066
|
if (!resolved.ok) return resolved;
|
|
6996
|
-
|
|
6997
|
-
return leg.ok ? leg : notOk(leg.failure.error);
|
|
7067
|
+
return planDelta([...consentTexts, ...planned], resolved.value);
|
|
6998
7068
|
}
|
|
6999
7069
|
});
|
|
7000
7070
|
if (isAutoBaseline && fromHash !== null && fromContract !== null && fromContractInStore) {
|
|
@@ -7004,23 +7074,19 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7004
7074
|
const deltaDirName = formatMigrationDirName(deltaTimestamp, options.name ?? "migration");
|
|
7005
7075
|
const baselinePackageDir = join(appMigrationsDir, baselineDirName);
|
|
7006
7076
|
const deltaPackageDir = join(appMigrationsDir, deltaDirName);
|
|
7007
|
-
const baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, {
|
|
7008
|
-
kind: "baseline",
|
|
7009
|
-
hash: fromHash
|
|
7010
|
-
}, {
|
|
7077
|
+
const baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, { kind: "baseline" }, {
|
|
7011
7078
|
hash: fromHash,
|
|
7012
7079
|
isEmitted: false
|
|
7013
|
-
}, [],
|
|
7014
|
-
if (!baselineLeg.ok) return
|
|
7015
|
-
const planBaselineDelta = (texts, resolved) => runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromOrigin, planDestination, resolved,
|
|
7080
|
+
}, [], aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(baselinePackageDir, migrationsDir), resolveImportSpecifier);
|
|
7081
|
+
if (!baselineLeg.ok) return baselineLeg;
|
|
7082
|
+
const planBaselineDelta = (texts, resolved) => runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromOrigin, planDestination, resolved, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(deltaPackageDir, migrationsDir), resolveImportSpecifier, refusedWith(texts, resolved));
|
|
7016
7083
|
const plannedDelta = fromHash === toStorageHash ? void 0 : await planBaselineDelta(statementTexts, statements);
|
|
7017
|
-
if (plannedDelta !== void 0 && !plannedDelta.ok
|
|
7084
|
+
if (plannedDelta !== void 0 && !plannedDelta.ok) return plannedDelta;
|
|
7018
7085
|
const answered = await answerDataLoss(baselineLeg.value, plannedDelta?.ok === true ? plannedDelta.value : void 0, planBaselineDelta);
|
|
7019
7086
|
if (!answered.ok) return notOk(answered.failure);
|
|
7020
|
-
const deltaLeg = plannedDelta === void 0
|
|
7087
|
+
const deltaLeg = plannedDelta === void 0 ? void 0 : answered.value.delta ?? plannedDelta.value;
|
|
7021
7088
|
const deletes = answered.value.deletes;
|
|
7022
7089
|
await writePlannedMigrationPackage(baselinePackageDir, null, fromHash, baselineTimestamp, baselineLeg.value);
|
|
7023
|
-
if (deltaLeg !== void 0 && !deltaLeg.ok) return notOk(deltaLeg.failure.error);
|
|
7024
7090
|
if (deltaLeg === void 0) {
|
|
7025
7091
|
const statementsWithoutOperations = reportAppliedStatements(statements.map((statement) => ({
|
|
7026
7092
|
statement,
|
|
@@ -7043,6 +7109,7 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7043
7109
|
placeholderDirs: [baselineDir],
|
|
7044
7110
|
appliedStatements: [...statementsWithoutOperations, ...deletes],
|
|
7045
7111
|
temporaryValues: baselineLeg.value.temporaryValues,
|
|
7112
|
+
changedStorageEntities: changedStorageEntities(fromContract, toContract),
|
|
7046
7113
|
summary: placeholderSummary("baseline", [baselinePackageDir], invocationOf(options)),
|
|
7047
7114
|
timings: { total: Date.now() - startTime }
|
|
7048
7115
|
});
|
|
@@ -7064,15 +7131,16 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7064
7131
|
...warnings.length > 0 ? { warnings } : {},
|
|
7065
7132
|
appliedStatements: [...statementsWithoutOperations, ...deletes],
|
|
7066
7133
|
temporaryValues: baselineLeg.value.temporaryValues,
|
|
7134
|
+
changedStorageEntities: changedStorageEntities(fromContract, toContract),
|
|
7067
7135
|
summary: buildAutoBaselinePlanSummary(baselineOps.length, 0, emittedExtensionDirs.length),
|
|
7068
7136
|
timings: { total: Date.now() - startTime }
|
|
7069
7137
|
});
|
|
7070
7138
|
}
|
|
7071
|
-
await writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg
|
|
7139
|
+
await writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg);
|
|
7072
7140
|
await writeDestinationSnapshot(toStorageHash);
|
|
7073
7141
|
const baselineOps = baselineLeg.value.hasPlaceholders ? [] : baselineLeg.value.plannedOps;
|
|
7074
|
-
const deltaOps = deltaLeg.
|
|
7075
|
-
if (baselineLeg.value.hasPlaceholders || deltaLeg.
|
|
7142
|
+
const deltaOps = deltaLeg.hasPlaceholders ? [] : deltaLeg.plannedOps;
|
|
7143
|
+
if (baselineLeg.value.hasPlaceholders || deltaLeg.hasPlaceholders) {
|
|
7076
7144
|
const baselineDir = relative(cwd, baselinePackageDir);
|
|
7077
7145
|
const deltaDir = relative(cwd, deltaPackageDir);
|
|
7078
7146
|
return ok({
|
|
@@ -7082,14 +7150,15 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7082
7150
|
to: toStorageHash,
|
|
7083
7151
|
dir: deltaDir,
|
|
7084
7152
|
baselineDir,
|
|
7085
|
-
operations: operationSummaries(deltaLeg.
|
|
7153
|
+
operations: operationSummaries(deltaLeg.plannedOps),
|
|
7086
7154
|
baselineOperations: operationSummaries(baselineLeg.value.plannedOps),
|
|
7087
7155
|
emittedExtensionDirs,
|
|
7088
7156
|
...warnings.length > 0 ? { warnings } : {},
|
|
7089
7157
|
pendingPlaceholders: true,
|
|
7090
|
-
placeholderDirs: [...baselineLeg.value.hasPlaceholders ? [relative(cwd, baselinePackageDir)] : [], ...deltaLeg.
|
|
7091
|
-
appliedStatements: [...deltaLeg.
|
|
7092
|
-
temporaryValues: deltaLeg.
|
|
7158
|
+
placeholderDirs: [...baselineLeg.value.hasPlaceholders ? [relative(cwd, baselinePackageDir)] : [], ...deltaLeg.hasPlaceholders ? [relative(cwd, deltaPackageDir)] : []],
|
|
7159
|
+
appliedStatements: [...deltaLeg.appliedStatements, ...deletes],
|
|
7160
|
+
temporaryValues: deltaLeg.temporaryValues,
|
|
7161
|
+
changedStorageEntities: changedStorageEntities(fromContract, toContract),
|
|
7093
7162
|
summary: placeholderSummary("baseline + migration", [baselinePackageDir, deltaPackageDir], invocationOf(options)),
|
|
7094
7163
|
timings: { total: Date.now() - startTime }
|
|
7095
7164
|
});
|
|
@@ -7115,22 +7184,22 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7115
7184
|
emittedExtensionDirs,
|
|
7116
7185
|
...preview !== void 0 ? { preview } : {},
|
|
7117
7186
|
...warnings.length > 0 ? { warnings } : {},
|
|
7118
|
-
appliedStatements: [...deltaLeg.
|
|
7119
|
-
temporaryValues: deltaLeg.
|
|
7120
|
-
|
|
7187
|
+
appliedStatements: [...deltaLeg.appliedStatements, ...deletes],
|
|
7188
|
+
temporaryValues: deltaLeg.temporaryValues,
|
|
7189
|
+
...withNoOperationsReport(buildAutoBaselinePlanSummary(baselineOps.length, deltaOps.length, emittedExtensionDirs.length), deltaOps.length === 0, fromContract, toContract),
|
|
7121
7190
|
timings: { total: Date.now() - startTime }
|
|
7122
7191
|
});
|
|
7123
7192
|
}
|
|
7124
7193
|
const timestamp = /* @__PURE__ */ new Date();
|
|
7125
7194
|
const packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? "migration"));
|
|
7126
|
-
const planDelta = (texts, resolved) => runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromOrigin, planDestination, resolved,
|
|
7195
|
+
const planDelta = (texts, resolved) => runPlannerLeg(planner, migrations, frameworkComponents, aggregate.app.contract(), fromOrigin, planDestination, resolved, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(packageDir, migrationsDir), resolveImportSpecifier, refusedWith(texts, resolved));
|
|
7127
7196
|
const plannedDelta = await planDelta(statementTexts, statements);
|
|
7128
|
-
if (!plannedDelta.ok) return
|
|
7197
|
+
if (!plannedDelta.ok) return plannedDelta;
|
|
7129
7198
|
const answered = await answerDataLoss(void 0, plannedDelta.value, planDelta);
|
|
7130
7199
|
if (!answered.ok) return notOk(answered.failure);
|
|
7131
|
-
const deltaLeg =
|
|
7200
|
+
const deltaLeg = answered.value.delta ?? plannedDelta.value;
|
|
7132
7201
|
const deletes = answered.value.deletes;
|
|
7133
|
-
if (!deltaLeg.
|
|
7202
|
+
if (!deltaLeg.hasPlaceholders && deltaLeg.plannedOps.length === 0 && fromHash === toStorageHash) return ok({
|
|
7134
7203
|
ok: true,
|
|
7135
7204
|
noOp: true,
|
|
7136
7205
|
from: fromHash,
|
|
@@ -7138,14 +7207,15 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7138
7207
|
operations: [],
|
|
7139
7208
|
emittedExtensionDirs,
|
|
7140
7209
|
...warnings.length > 0 ? { warnings } : {},
|
|
7141
|
-
appliedStatements: [...deltaLeg.
|
|
7142
|
-
temporaryValues: deltaLeg.
|
|
7210
|
+
appliedStatements: [...deltaLeg.appliedStatements, ...deletes],
|
|
7211
|
+
temporaryValues: deltaLeg.temporaryValues,
|
|
7212
|
+
changedStorageEntities: [],
|
|
7143
7213
|
summary: "No changes to plan: the statements need no operations",
|
|
7144
7214
|
timings: { total: Date.now() - startTime }
|
|
7145
7215
|
});
|
|
7146
|
-
await writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg
|
|
7216
|
+
await writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg);
|
|
7147
7217
|
await writeDestinationSnapshot(toStorageHash);
|
|
7148
|
-
if (deltaLeg.
|
|
7218
|
+
if (deltaLeg.hasPlaceholders) {
|
|
7149
7219
|
const dir = relative(cwd, packageDir);
|
|
7150
7220
|
return ok({
|
|
7151
7221
|
ok: true,
|
|
@@ -7153,19 +7223,20 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7153
7223
|
from: fromHash,
|
|
7154
7224
|
to: toStorageHash,
|
|
7155
7225
|
dir,
|
|
7156
|
-
operations: operationSummaries(deltaLeg.
|
|
7226
|
+
operations: operationSummaries(deltaLeg.plannedOps),
|
|
7157
7227
|
emittedExtensionDirs,
|
|
7158
7228
|
...warnings.length > 0 ? { warnings } : {},
|
|
7159
7229
|
pendingPlaceholders: true,
|
|
7160
7230
|
placeholderDirs: [relative(cwd, packageDir)],
|
|
7161
7231
|
...fromDefaulted ? { fromDefaulted } : {},
|
|
7162
|
-
appliedStatements: [...deltaLeg.
|
|
7163
|
-
temporaryValues: deltaLeg.
|
|
7232
|
+
appliedStatements: [...deltaLeg.appliedStatements, ...deletes],
|
|
7233
|
+
temporaryValues: deltaLeg.temporaryValues,
|
|
7234
|
+
changedStorageEntities: changedStorageEntities(fromContract, toContract),
|
|
7164
7235
|
summary: placeholderSummary("migration", [packageDir], invocationOf(options)),
|
|
7165
7236
|
timings: { total: Date.now() - startTime }
|
|
7166
7237
|
});
|
|
7167
7238
|
}
|
|
7168
|
-
const plannedOps = deltaLeg.
|
|
7239
|
+
const plannedOps = deltaLeg.plannedOps;
|
|
7169
7240
|
const preview = hasOperationPreview(familyInstance) ? familyInstance.toOperationPreview(plannedOps) : void 0;
|
|
7170
7241
|
return ok({
|
|
7171
7242
|
ok: true,
|
|
@@ -7182,9 +7253,9 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7182
7253
|
...preview !== void 0 ? { preview } : {},
|
|
7183
7254
|
...fromDefaulted ? { fromDefaulted } : {},
|
|
7184
7255
|
...warnings.length > 0 ? { warnings } : {},
|
|
7185
|
-
appliedStatements: [...deltaLeg.
|
|
7186
|
-
temporaryValues: deltaLeg.
|
|
7187
|
-
|
|
7256
|
+
appliedStatements: [...deltaLeg.appliedStatements, ...deletes],
|
|
7257
|
+
temporaryValues: deltaLeg.temporaryValues,
|
|
7258
|
+
...withNoOperationsReport(buildPlanSummary(plannedOps.length, emittedExtensionDirs.length), plannedOps.length === 0, fromContract, toContract),
|
|
7188
7259
|
timings: { total: Date.now() - startTime }
|
|
7189
7260
|
});
|
|
7190
7261
|
} catch (error) {
|
|
@@ -7192,6 +7263,21 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
7192
7263
|
}
|
|
7193
7264
|
}
|
|
7194
7265
|
/**
|
|
7266
|
+
* The summary of a written migration and, when it has no operations, the storage entities that
|
|
7267
|
+
* changed, with a sentence added to the summary that says the database needs no operation for them.
|
|
7268
|
+
*/
|
|
7269
|
+
function withNoOperationsReport(summary, hasNoOperations, fromContract, toContract) {
|
|
7270
|
+
const reported = { changedStorageEntities: changedStorageEntities(fromContract, toContract) };
|
|
7271
|
+
if (!hasNoOperations) return {
|
|
7272
|
+
...reported,
|
|
7273
|
+
summary
|
|
7274
|
+
};
|
|
7275
|
+
return {
|
|
7276
|
+
...reported,
|
|
7277
|
+
summary: `${summary}. The storage the contract describes changed, but the database needs no operation for it, so the migration has none. ${whatChangedSentence(fromContract, toContract)}`
|
|
7278
|
+
};
|
|
7279
|
+
}
|
|
7280
|
+
/**
|
|
7195
7281
|
* Compose the success-line summary so the cross-space side effect
|
|
7196
7282
|
* (extension-space migration packages materialised on disk during
|
|
7197
7283
|
* this `plan` run) is visible in the top line — not just in the
|
|
@@ -7332,4 +7418,4 @@ async function executeRefListCommand(options) {
|
|
|
7332
7418
|
//#endregion
|
|
7333
7419
|
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 };
|
|
7334
7420
|
|
|
7335
|
-
//# sourceMappingURL=ref-
|
|
7421
|
+
//# sourceMappingURL=ref-qma7fG-2-TOPNrzuP.mjs.map
|