@prisma/orm-toolchain 8.0.0-rc.11-dev.10 → 8.0.0-rc.11-dev.12
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-B4HKshLQ.mjs → aggregate-DI9VS7yL.mjs} +6 -9
- package/dist/aggregate-DI9VS7yL.mjs.map +1 -0
- package/dist/{aggregate-D_eX4zoo.d.mts → aggregate-DKBycuzO.d.mts} +1 -3
- package/dist/aggregate-DKBycuzO.d.mts.map +1 -0
- package/dist/cli.mjs +135 -115
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +6 -8
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__migration-cli.mjs +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-snapshot-store-CbqynbtE.d.mts → contract-snapshot-store-BqDMcO4r.d.mts} +2 -3
- package/dist/{contract-snapshot-store-CbqynbtE.d.mts.map → contract-snapshot-store-BqDMcO4r.d.mts.map} +1 -1
- package/dist/{contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs → contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs} +3 -12
- package/dist/{contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map → contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs.map} +1 -1
- package/dist/{domain-type-generation-CR9ECUau-DOlKbcaE.mjs → domain-type-generation-BVFTIUm6-BRbRrGYB.mjs} +3 -7
- package/dist/domain-type-generation-BVFTIUm6-BRbRrGYB.mjs.map +1 -0
- package/dist/emitter.d.mts +1 -1
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.mjs +1 -1
- package/dist/{exports-B8peSdx4.mjs → exports-DGC_nDQ0.mjs} +2 -2
- package/dist/{exports-B8peSdx4.mjs.map → exports-DGC_nDQ0.mjs.map} +1 -1
- package/dist/{exports-CE6OD63o-4Qpqr2W7.mjs → exports-DkJil2JJ-6p86L2r4.mjs} +4 -4
- package/dist/{exports-CE6OD63o-4Qpqr2W7.mjs.map → exports-DkJil2JJ-6p86L2r4.mjs.map} +1 -1
- package/dist/{exports-BXXeNWlj.mjs → exports-Do7_pH8Y.mjs} +2 -2
- package/dist/{exports-BXXeNWlj.mjs.map → exports-Do7_pH8Y.mjs.map} +1 -1
- package/dist/{index-D217lbiW.d.mts → index-K9cFK1Ge.d.mts} +9 -2
- package/dist/index-K9cFK1Ge.d.mts.map +1 -0
- package/dist/{io-BmWQNxRP-DQqbcPsS.mjs → io-DSQXOfBH-GRpmFG2F.mjs} +3 -3
- package/dist/{io-BmWQNxRP-DQqbcPsS.mjs.map → io-DSQXOfBH-GRpmFG2F.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +3 -3
- package/dist/migration-tools.mjs +6 -6
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -2
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-uqvZQnnQ-DpAQaLiM.mjs → ref-DSvAirqq-oqBwkhgP.mjs} +87 -86
- package/dist/{ref-uqvZQnnQ-DpAQaLiM.mjs.map → ref-DSvAirqq-oqBwkhgP.mjs.map} +1 -1
- package/dist/{spaces-BCZiAZQn.mjs → spaces-DzFtKEl3.mjs} +4 -4
- package/dist/{spaces-BCZiAZQn.mjs.map → spaces-DzFtKEl3.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs → verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs} +3 -3
- package/dist/{verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map → verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/aggregate-B4HKshLQ.mjs.map +0 -1
- package/dist/aggregate-D_eX4zoo.d.mts.map +0 -1
- package/dist/domain-type-generation-CR9ECUau-DOlKbcaE.mjs.map +0 -1
- package/dist/index-D217lbiW.d.mts.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { r as getEmittedArtifactPaths, t as emit } from "./exports-
|
|
1
|
+
import { r as getEmittedArtifactPaths, t as emit } from "./exports-DkJil2JJ-6p86L2r4.mjs";
|
|
2
2
|
import { O as errorNoInvariantPath, P as errorUnknownInvariant, b as errorInvalidRefName, i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-SoLLYLtw-DMxVbVs9.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as writeContractSnapshot, i as snapshotsImportPathFrom, n as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs";
|
|
4
4
|
import { n as verifyMigrationHash, t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
5
5
|
import { t as deriveProvidedInvariants } from "./invariants-Cww4bv0v-BEiFxmbX.mjs";
|
|
6
|
-
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-
|
|
6
|
+
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-DSQXOfBH-GRpmFG2F.mjs";
|
|
7
7
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
8
8
|
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DY1Onbc3-CwBd6wuB.mjs";
|
|
9
9
|
import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-CW4bMmTz-B5xFtFVB.mjs";
|
|
10
10
|
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-BpSpzdYB-BcDelHGt.mjs";
|
|
11
|
-
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-
|
|
12
|
-
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-
|
|
13
|
-
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-
|
|
11
|
+
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-_vwt5LT0-BQAf8Q4T.mjs";
|
|
12
|
+
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-DI9VS7yL.mjs";
|
|
13
|
+
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-DzFtKEl3.mjs";
|
|
14
14
|
import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver, t as ImportRootError } from "./import-roots-BHOrDJbI.mjs";
|
|
15
15
|
import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-BWpwb8_b.mjs";
|
|
16
16
|
import { i as writeMigrationTs } from "./migration-ts-DdVm0rws.mjs";
|
|
@@ -33,7 +33,7 @@ import { createHash } from "node:crypto";
|
|
|
33
33
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
34
34
|
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
35
35
|
import { resolve as resolve$1 } from "node:path";
|
|
36
|
-
//#region ../../../1-framework/3-tooling/cli/dist/ref-
|
|
36
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-DSvAirqq.mjs
|
|
37
37
|
/**
|
|
38
38
|
* The typed remediation the CLI attaches to its own errors and findings.
|
|
39
39
|
* Constructors live here rather than in any library the CLI calls: naming a
|
|
@@ -2599,9 +2599,15 @@ var ControlClientImpl = class {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
}
|
|
2601
2601
|
emitArtifacts(contract, resolveImportSpecifier) {
|
|
2602
|
+
const familyInstance = this.familyInstance;
|
|
2603
|
+
if (!familyInstance) throw new InternalError("Family instance was not initialized. This is a bug.");
|
|
2604
|
+
const { contractSerializer } = this.options.target;
|
|
2602
2605
|
return emit(contract, this.stack, this.options.family.emission, {
|
|
2603
|
-
serializeContract: (c) =>
|
|
2606
|
+
serializeContract: (c) => contractSerializer.serializeContract(c),
|
|
2607
|
+
deserializeContract: (json) => familyInstance.deserializeContract(json),
|
|
2604
2608
|
resolveImportSpecifier,
|
|
2609
|
+
...ifDefined("shouldPreserveEmpty", contractSerializer.shouldPreserveEmpty),
|
|
2610
|
+
...ifDefined("sortStorage", contractSerializer.sortStorage),
|
|
2605
2611
|
...ifDefined("supportsNamespaces", this.options.target.supportsNamespaces)
|
|
2606
2612
|
});
|
|
2607
2613
|
}
|
|
@@ -2996,6 +3002,7 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
|
|
|
2996
3002
|
emitResult = await unlessAborted(dependencies.emit(deserializedContract, stack, config.family.emission, {
|
|
2997
3003
|
outputJsonPath,
|
|
2998
3004
|
serializeContract,
|
|
3005
|
+
deserializeContract: (json) => familyInstance.deserializeContract(json),
|
|
2999
3006
|
resolveImportSpecifier: createProjectSpecifierResolver(configPath ?? outputJsonPath),
|
|
3000
3007
|
...ifDefined("shouldPreserveEmpty", contractSerializer.shouldPreserveEmpty),
|
|
3001
3008
|
...ifDefined("sortStorage", contractSerializer.sortStorage),
|
|
@@ -3027,15 +3034,6 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
|
|
|
3027
3034
|
};
|
|
3028
3035
|
});
|
|
3029
3036
|
}
|
|
3030
|
-
const NO_REF_ADVANCEMENT = {
|
|
3031
|
-
advancedRef: null,
|
|
3032
|
-
plannedAdvanceRef: null
|
|
3033
|
-
};
|
|
3034
|
-
function computeRefAdvancementName(options) {
|
|
3035
|
-
if (options.advanceRef !== void 0) return options.advanceRef;
|
|
3036
|
-
if (options.db === void 0) return "db";
|
|
3037
|
-
return null;
|
|
3038
|
-
}
|
|
3039
3037
|
function errorContractDtsRenderFailed(contractJsonPath, failure) {
|
|
3040
3038
|
const why = failure.why ?? failure.summary;
|
|
3041
3039
|
if (failure.code === "CONTRACT_VALIDATION_FAILED") return errorContractValidationFailed(`Contract at ${contractJsonPath} failed to deserialize: ${why}`, {
|
|
@@ -3044,12 +3042,35 @@ function errorContractDtsRenderFailed(contractJsonPath, failure) {
|
|
|
3044
3042
|
});
|
|
3045
3043
|
return new CliStructuredError$1("CONTRACT.TYPES_RENDER_FAILED", "Failed to render contract types", {
|
|
3046
3044
|
why: `The types for the contract at ${contractJsonPath} could not be rendered: ${why}`,
|
|
3047
|
-
fix: "Run {bin} contract emit to see why the contract does not emit, fix it, then
|
|
3045
|
+
fix: "Run {bin} contract emit to see why the contract does not emit, fix it, then run the command again.",
|
|
3048
3046
|
where: { path: contractJsonPath },
|
|
3049
3047
|
...ifDefined("cause", failure.cause)
|
|
3050
3048
|
});
|
|
3051
3049
|
}
|
|
3052
3050
|
/**
|
|
3051
|
+
* The `contract.d.ts` half of a snapshot, rendered from the `contract.json`
|
|
3052
|
+
* half through the control client. Every snapshot writer renders before it
|
|
3053
|
+
* writes anything, so a contract that cannot be snapshotted refuses the
|
|
3054
|
+
* command with nothing on disk changed.
|
|
3055
|
+
*/
|
|
3056
|
+
async function renderSnapshotDeclarations(args) {
|
|
3057
|
+
const rendered = await args.client.renderContractDts({
|
|
3058
|
+
contract: args.contractJson,
|
|
3059
|
+
resolveImportSpecifier: args.resolveImportSpecifier
|
|
3060
|
+
});
|
|
3061
|
+
if (!rendered.ok) return notOk(errorContractDtsRenderFailed(args.contractJsonPath, rendered.failure));
|
|
3062
|
+
return ok(rendered.value.contractDts);
|
|
3063
|
+
}
|
|
3064
|
+
const NO_REF_ADVANCEMENT = {
|
|
3065
|
+
advancedRef: null,
|
|
3066
|
+
plannedAdvanceRef: null
|
|
3067
|
+
};
|
|
3068
|
+
function computeRefAdvancementName(options) {
|
|
3069
|
+
if (options.advanceRef !== void 0) return options.advanceRef;
|
|
3070
|
+
if (options.db === void 0) return "db";
|
|
3071
|
+
return null;
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3053
3074
|
* Everything `executeRefAdvancement` needs, produced before a command does the
|
|
3054
3075
|
* work that precedes the ref write: the ref name is validated and the
|
|
3055
3076
|
* declarations of the contract to snapshot are rendered from its JSON, with
|
|
@@ -3066,14 +3087,16 @@ async function preflightRefAdvancement(args) {
|
|
|
3066
3087
|
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
3067
3088
|
throw error;
|
|
3068
3089
|
}
|
|
3069
|
-
const rendered = await
|
|
3070
|
-
|
|
3090
|
+
const rendered = await renderSnapshotDeclarations({
|
|
3091
|
+
client: args.client,
|
|
3092
|
+
contractJson: args.contractJson,
|
|
3093
|
+
contractJsonPath: args.contractJsonPath,
|
|
3071
3094
|
resolveImportSpecifier
|
|
3072
3095
|
});
|
|
3073
|
-
if (!rendered.ok) return
|
|
3096
|
+
if (!rendered.ok) return rendered;
|
|
3074
3097
|
return ok({
|
|
3075
3098
|
contract: args.contractJson,
|
|
3076
|
-
contractDts: rendered.value
|
|
3099
|
+
contractDts: rendered.value
|
|
3077
3100
|
});
|
|
3078
3101
|
}
|
|
3079
3102
|
async function executeRefAdvancement(refsDir, migrationsDir, name, hash, contractIR) {
|
|
@@ -3983,9 +4006,10 @@ async function executeMigrationNewCommand(options) {
|
|
|
3983
4006
|
}));
|
|
3984
4007
|
throw error;
|
|
3985
4008
|
}
|
|
4009
|
+
let parsedContract;
|
|
3986
4010
|
let toContract;
|
|
3987
4011
|
try {
|
|
3988
|
-
|
|
4012
|
+
parsedContract = JSON.parse(contractJsonContent);
|
|
3989
4013
|
toContract = familyInstance.deserializeContract(parsedContract);
|
|
3990
4014
|
} catch (error) {
|
|
3991
4015
|
return notOk(errorRuntime("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract JSON is invalid", {
|
|
@@ -4045,12 +4069,17 @@ async function executeMigrationNewCommand(options) {
|
|
|
4045
4069
|
...config.extensions ?? []
|
|
4046
4070
|
]);
|
|
4047
4071
|
const resolveSpecifier = createProjectSpecifierResolver(options.configPath);
|
|
4072
|
+
const declarations = await renderSnapshotDeclarations({
|
|
4073
|
+
client: options.client,
|
|
4074
|
+
contractJson: parsedContract,
|
|
4075
|
+
contractJsonPath: contractPathAbsolute,
|
|
4076
|
+
resolveImportSpecifier: resolveSpecifier
|
|
4077
|
+
});
|
|
4078
|
+
if (!declarations.ok) return notOk(declarations.failure);
|
|
4048
4079
|
await writeMigrationPackage(packageDir, metadata, []);
|
|
4049
|
-
const destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);
|
|
4050
|
-
const [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, "utf-8"), readFile(destinationArtifacts.dtsPath, "utf-8")]);
|
|
4051
4080
|
await writeContractSnapshot(migrationsDir, toStorageHash, {
|
|
4052
|
-
contractJson:
|
|
4053
|
-
contractDts
|
|
4081
|
+
contractJson: parsedContract,
|
|
4082
|
+
contractDts: declarations.value
|
|
4054
4083
|
});
|
|
4055
4084
|
await writeMigrationTs(packageDir, migrations.createPlanner(controlAdapter).emptyMigration({
|
|
4056
4085
|
packageDir,
|
|
@@ -4190,16 +4219,12 @@ async function resolveContractRef(parsed, space, options) {
|
|
|
4190
4219
|
if (at.provenance === "ref") return ok({
|
|
4191
4220
|
kind: "ref",
|
|
4192
4221
|
hash: at.hash,
|
|
4193
|
-
contract: at.contract
|
|
4194
|
-
contractJson: at.contractJson,
|
|
4195
|
-
contractDts: at.contractDts
|
|
4222
|
+
contract: at.contract
|
|
4196
4223
|
});
|
|
4197
4224
|
return ok({
|
|
4198
4225
|
kind: "graph-node",
|
|
4199
4226
|
hash: at.hash,
|
|
4200
|
-
contract: at.contract
|
|
4201
|
-
contractJson: at.contractJson,
|
|
4202
|
-
contractDts: at.contractDts
|
|
4227
|
+
contract: at.contract
|
|
4203
4228
|
});
|
|
4204
4229
|
} catch (error) {
|
|
4205
4230
|
return mapContractAtError(error, options?.artifactRole !== void 0 ? { artifactRole: options.artifactRole } : void 0);
|
|
@@ -4216,13 +4241,11 @@ async function resolveFromPolicy(parsed, input, refs, explicitFromLabel) {
|
|
|
4216
4241
|
fromHash: resolution.value.hash,
|
|
4217
4242
|
fromContract: resolution.value.contract
|
|
4218
4243
|
});
|
|
4219
|
-
const { hash, contract
|
|
4244
|
+
const { hash, contract } = resolution.value;
|
|
4220
4245
|
if (graphIsEmpty(input.space)) return ok({
|
|
4221
4246
|
kind: "auto-baseline",
|
|
4222
4247
|
fromHash: hash,
|
|
4223
|
-
fromContract: contract
|
|
4224
|
-
contractDts,
|
|
4225
|
-
contractJson
|
|
4248
|
+
fromContract: contract
|
|
4226
4249
|
});
|
|
4227
4250
|
const graph = input.space.graph();
|
|
4228
4251
|
const graphTip = findLatestMigration(graph)?.to ?? null;
|
|
@@ -4235,9 +4258,7 @@ async function resolveFromPolicy(parsed, input, refs, explicitFromLabel) {
|
|
|
4235
4258
|
return ok({
|
|
4236
4259
|
kind: "ref",
|
|
4237
4260
|
fromHash: hash,
|
|
4238
|
-
fromContract: contract
|
|
4239
|
-
contractDts,
|
|
4240
|
-
contractJson
|
|
4261
|
+
fromContract: contract
|
|
4241
4262
|
});
|
|
4242
4263
|
}
|
|
4243
4264
|
async function resolveFromForPlan(input) {
|
|
@@ -4305,12 +4326,10 @@ async function resolveToForPlan(optionsTo, input) {
|
|
|
4305
4326
|
artifactRole: "to"
|
|
4306
4327
|
});
|
|
4307
4328
|
if (!resolution.ok) return resolution;
|
|
4308
|
-
const { hash, contract
|
|
4329
|
+
const { hash, contract } = resolution.value;
|
|
4309
4330
|
return ok({
|
|
4310
4331
|
hash,
|
|
4311
|
-
contract
|
|
4312
|
-
contractJson,
|
|
4313
|
-
contractDts
|
|
4332
|
+
contract
|
|
4314
4333
|
});
|
|
4315
4334
|
}
|
|
4316
4335
|
/**
|
|
@@ -4402,19 +4421,21 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4402
4421
|
const stack = createControlStack(config);
|
|
4403
4422
|
const familyInstance = config.family.create(stack);
|
|
4404
4423
|
const controlAdapter = config.adapter.create(stack);
|
|
4424
|
+
let emittedContractJson;
|
|
4405
4425
|
let toContract;
|
|
4406
4426
|
try {
|
|
4407
|
-
|
|
4427
|
+
emittedContractJson = castAs(JSON.parse(contractJsonContent));
|
|
4428
|
+
toContract = familyInstance.deserializeContract(emittedContractJson);
|
|
4408
4429
|
} catch (error) {
|
|
4409
4430
|
return notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));
|
|
4410
4431
|
}
|
|
4411
4432
|
const rawStorageHash = toContract.storage?.storageHash;
|
|
4412
4433
|
if (typeof rawStorageHash !== "string") return notOk(errorContractValidationFailed("Contract is missing storageHash", { where: { path: contractPathAbsolute } }));
|
|
4413
4434
|
let toStorageHash = rawStorageHash;
|
|
4414
|
-
let
|
|
4435
|
+
let destinationInStore = false;
|
|
4415
4436
|
let fromContract = null;
|
|
4416
4437
|
let fromHash = null;
|
|
4417
|
-
let
|
|
4438
|
+
let fromContractInStore = false;
|
|
4418
4439
|
let isAutoBaseline = false;
|
|
4419
4440
|
let fromDefaulted = false;
|
|
4420
4441
|
const tolerantAggregateResult = await loadContractSpaceAggregateForCli({
|
|
@@ -4442,20 +4463,12 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4442
4463
|
case "ref":
|
|
4443
4464
|
fromHash = resolutionResult.value.fromHash;
|
|
4444
4465
|
fromContract = resolutionResult.value.fromContract;
|
|
4445
|
-
|
|
4446
|
-
fromHash: resolutionResult.value.fromHash,
|
|
4447
|
-
contractJson: resolutionResult.value.contractJson,
|
|
4448
|
-
contractDts: resolutionResult.value.contractDts
|
|
4449
|
-
};
|
|
4466
|
+
fromContractInStore = true;
|
|
4450
4467
|
break;
|
|
4451
4468
|
case "auto-baseline":
|
|
4452
4469
|
fromHash = resolutionResult.value.fromHash;
|
|
4453
4470
|
fromContract = resolutionResult.value.fromContract;
|
|
4454
|
-
|
|
4455
|
-
fromHash: resolutionResult.value.fromHash,
|
|
4456
|
-
contractJson: resolutionResult.value.contractJson,
|
|
4457
|
-
contractDts: resolutionResult.value.contractDts
|
|
4458
|
-
};
|
|
4471
|
+
fromContractInStore = true;
|
|
4459
4472
|
isAutoBaseline = true;
|
|
4460
4473
|
break;
|
|
4461
4474
|
}
|
|
@@ -4464,12 +4477,20 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4464
4477
|
if (!toResolution.ok) return notOk(toResolution.failure);
|
|
4465
4478
|
toContract = toResolution.value.contract;
|
|
4466
4479
|
toStorageHash = toResolution.value.hash;
|
|
4467
|
-
|
|
4468
|
-
contractJson: toResolution.value.contractJson,
|
|
4469
|
-
contractDts: toResolution.value.contractDts
|
|
4470
|
-
};
|
|
4480
|
+
destinationInStore = true;
|
|
4471
4481
|
}
|
|
4472
4482
|
const resolveImportSpecifier = createProjectSpecifierResolver(options.configPath);
|
|
4483
|
+
let destinationDeclarations = null;
|
|
4484
|
+
if (!destinationInStore && fromHash !== toStorageHash) {
|
|
4485
|
+
const rendered = await renderSnapshotDeclarations({
|
|
4486
|
+
client: options.client,
|
|
4487
|
+
contractJson: emittedContractJson,
|
|
4488
|
+
contractJsonPath: contractPathAbsolute,
|
|
4489
|
+
resolveImportSpecifier
|
|
4490
|
+
});
|
|
4491
|
+
if (!rendered.ok) return notOk(rendered.failure);
|
|
4492
|
+
destinationDeclarations = rendered.value;
|
|
4493
|
+
}
|
|
4473
4494
|
const seedResult = await runContractSpaceSeedPhase({
|
|
4474
4495
|
migrationsDir,
|
|
4475
4496
|
extensions: toExtensionInputs(config.extensions ?? [])
|
|
@@ -4506,23 +4527,15 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4506
4527
|
...config.extensions ?? []
|
|
4507
4528
|
]);
|
|
4508
4529
|
async function writeDestinationSnapshot(destHash) {
|
|
4509
|
-
if (
|
|
4510
|
-
await writeContractSnapshot(migrationsDir, destHash, {
|
|
4511
|
-
contractJson: toArtifacts.contractJson,
|
|
4512
|
-
contractDts: toArtifacts.contractDts
|
|
4513
|
-
});
|
|
4514
|
-
return;
|
|
4515
|
-
}
|
|
4516
|
-
const destinationArtifacts = getEmittedArtifactPaths(contractPathAbsolute);
|
|
4517
|
-
const [contractJsonRaw, contractDts] = await Promise.all([readFile(destinationArtifacts.jsonPath, "utf-8"), readFile(destinationArtifacts.dtsPath, "utf-8")]);
|
|
4530
|
+
if (destinationDeclarations === null) return;
|
|
4518
4531
|
await writeContractSnapshot(migrationsDir, destHash, {
|
|
4519
|
-
contractJson:
|
|
4520
|
-
contractDts
|
|
4532
|
+
contractJson: emittedContractJson,
|
|
4533
|
+
contractDts: destinationDeclarations
|
|
4521
4534
|
});
|
|
4522
4535
|
}
|
|
4523
4536
|
try {
|
|
4524
4537
|
const planner = migrations.createPlanner(controlAdapter);
|
|
4525
|
-
if (isAutoBaseline && fromHash !== null && fromContract !== null &&
|
|
4538
|
+
if (isAutoBaseline && fromHash !== null && fromContract !== null && fromContractInStore) {
|
|
4526
4539
|
const baselineTimestamp = /* @__PURE__ */ new Date();
|
|
4527
4540
|
const deltaTimestamp = new Date(baselineTimestamp.getTime() + 6e4);
|
|
4528
4541
|
const baselineDirName = formatMigrationDirName(baselineTimestamp, "baseline");
|
|
@@ -4532,10 +4545,6 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4532
4545
|
const baselineLeg = await runPlannerLeg(planner, migrations, frameworkComponents, fromContract, null, aggregate.app.spaceId, aggregate, snapshotsImportPathFrom(baselinePackageDir, migrationsDir), resolveImportSpecifier);
|
|
4533
4546
|
if (!baselineLeg.ok) return notOk(baselineLeg.failure);
|
|
4534
4547
|
await writePlannedMigrationPackage(baselinePackageDir, null, fromHash, baselineTimestamp, baselineLeg.value);
|
|
4535
|
-
await writeContractSnapshot(migrationsDir, fromHash, {
|
|
4536
|
-
contractJson: snapshotStartContract.contractJson,
|
|
4537
|
-
contractDts: snapshotStartContract.contractDts
|
|
4538
|
-
});
|
|
4539
4548
|
if (fromHash === toStorageHash) {
|
|
4540
4549
|
const baselineOps = baselineLeg.value.hasPlaceholders ? [] : baselineLeg.value.plannedOps;
|
|
4541
4550
|
if (baselineLeg.value.hasPlaceholders) {
|
|
@@ -4576,10 +4585,6 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4576
4585
|
if (!deltaLeg.ok) return notOk(deltaLeg.failure);
|
|
4577
4586
|
await writePlannedMigrationPackage(deltaPackageDir, fromHash, toStorageHash, deltaTimestamp, deltaLeg.value);
|
|
4578
4587
|
await writeDestinationSnapshot(toStorageHash);
|
|
4579
|
-
await writeContractSnapshot(migrationsDir, fromHash, {
|
|
4580
|
-
contractJson: snapshotStartContract.contractJson,
|
|
4581
|
-
contractDts: snapshotStartContract.contractDts
|
|
4582
|
-
});
|
|
4583
4588
|
const deltaOps = deltaLeg.value.hasPlaceholders ? [] : deltaLeg.value.plannedOps;
|
|
4584
4589
|
if (deltaLeg.value.hasPlaceholders) return ok({
|
|
4585
4590
|
ok: true,
|
|
@@ -4619,10 +4624,6 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4619
4624
|
if (!deltaLeg.ok) return notOk(deltaLeg.failure);
|
|
4620
4625
|
await writePlannedMigrationPackage(packageDir, fromHash, toStorageHash, timestamp, deltaLeg.value);
|
|
4621
4626
|
await writeDestinationSnapshot(toStorageHash);
|
|
4622
|
-
if (snapshotStartContract !== null) await writeContractSnapshot(migrationsDir, snapshotStartContract.fromHash, {
|
|
4623
|
-
contractJson: snapshotStartContract.contractJson,
|
|
4624
|
-
contractDts: snapshotStartContract.contractDts
|
|
4625
|
-
});
|
|
4626
4627
|
if (deltaLeg.value.hasPlaceholders) return ok({
|
|
4627
4628
|
ok: true,
|
|
4628
4629
|
noOp: false,
|
|
@@ -4813,4 +4814,4 @@ async function executeRefListCommand(options) {
|
|
|
4813
4814
|
//#endregion
|
|
4814
4815
|
export { listRefsByContractHash as $, errorMarkerMissing as A, sanitizeErrorMessage as At, executeContractEmit as B, errorContractValidationFailed as C, resolveFromForPlan as Ct, errorFileNotFound as D, runContractSpaceSeedPhase as Dt, errorDriverRequired as E, runCommandAction as Et, errorRunnerFailed as F, executeMigrationNewCommand as G, executeDbUpdate as H, errorRuntime as I, executeRefDeleteCommand as J, executeMigrationPlanCommand as K, errorTargetMigrationNotSupported as L, errorMigrationPlanningFailed as M, targetSupportsMigrations as Mt, errorNoMigrations as N, toDeclaredExtensionsFromRaw as Nt, errorHashMismatch as O, runMigrationCheck as Ot, errorPathUnreachable as P, hasMigrationPath as Q, errorTargetMismatch as R, errorContractArgConflict as S, resolveContractRefToSnapshot as St, errorDestructiveChanges as T, resolveToForPlan as Tt, executeDbVerify as U, executeDbInit as V, executeMigrateShowPlan as W, executeRefSetCommand as X, executeRefListCommand as Y, findPackageByDirPath as Z, enrichContract as _, refusePackageCorruptionOnAggregate as _t, appliedHashesFromLedger as a, mapContractAtError as at, errorConfigValidation$1 as b, resolveAppTargetPath as bt, buildReadAggregate as c, migrationSpaceListEntriesFromAggregate as ct, chooseAction as d, readContractEnvelope as dt, loadAggregateIntegrityViolations as et, closeQuietly as f, readMigrationRefs as ft, disposeEmitQueue as g, refuseMissingInvariantPath as gt, deriveStatusEdgeAnnotations as h, refuseMarkerOutsideGraph as ht, appContractStandInFromIdentity as i, mapCaughtMigrationError as it, errorMigrationPackageNotFound as j, statusForMigrationHash as jt, errorLegendHumanOnly as k, runMigrationList as kt, buildRefAdvancementFields as l, originHashForStatus as lt, createControlClient as m, refuseDeclaredExtensionTargetMismatch as mt, NO_REF_ADVANCEMENT as n, loadContractSpaceAggregateForCli as nt, buildContractSpaceAggregate as o, mapIntegrityViolations as ot, computeRefAdvancementName as p, refuseContractSpaceIntegrity as pt, executeRefAdvancement as q, advanceRefSafely as r, looksLikePath as rt, buildMigrationSpaceGraphEntries as s, maskConnectionUrl as st, CliStructuredError$1 as t, loadContractRawSafely as tt, checkSingleTarget as u, preflightRefAdvancement as ut, enumerateCheckSpaces as v, refuseUnknownInvariants as vt, errorDatabaseConnectionRequired as w, resolveMigrationRef as wt, errorConsentPlanMismatch as x, resolveContractRef$1 as xt, errorAdvanceRefArgConflict as y, requireLiveDatabase as yt, errorUnexpected as z };
|
|
4815
4816
|
|
|
4816
|
-
//# sourceMappingURL=ref-
|
|
4817
|
+
//# sourceMappingURL=ref-DSvAirqq-oqBwkhgP.mjs.map
|