@prisma/orm-toolchain 8.0.0-rc.4-dev.1 → 8.0.0-rc.4-dev.2
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/cli.mjs +5 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +3 -3
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/{ref-dWFulULw-TMeX1ZM1.mjs → ref-DJkSkzAt-a9gIu2Gt.mjs} +23 -22
- package/dist/ref-DJkSkzAt-a9gIu2Gt.mjs.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/ref-dWFulULw-TMeX1ZM1.mjs.map +0 -1
|
@@ -116,7 +116,7 @@ declare function resolveContractRefToSnapshot(options: ResolveContractRefToSnaps
|
|
|
116
116
|
* target mismatch, then disjointness, then a contract-validation
|
|
117
117
|
* failure, then any remaining structural integrity violation.
|
|
118
118
|
*/
|
|
119
|
-
declare function mapIntegrityViolations(violations: readonly IntegrityViolation[]): CliStructuredError$2 | null;
|
|
119
|
+
declare function mapIntegrityViolations(violations: readonly IntegrityViolation[], migrationsDir: string): CliStructuredError$2 | null;
|
|
120
120
|
/**
|
|
121
121
|
* Inputs needed to compose the aggregate loader at the CLI surface.
|
|
122
122
|
*
|
|
@@ -148,13 +148,13 @@ declare function loadContractSpaceAggregateForCli<TFamilyId extends string, TTar
|
|
|
148
148
|
* the contract-space refusal envelope, or return `null` when the model
|
|
149
149
|
* is acceptable for the requested check scope.
|
|
150
150
|
*/
|
|
151
|
-
declare function refuseContractSpaceIntegrity(aggregate: ContractSpaceAggregate, options: IntegrityQueryOptions): CliStructuredError$2 | null;
|
|
151
|
+
declare function refuseContractSpaceIntegrity(aggregate: ContractSpaceAggregate, options: IntegrityQueryOptions, migrationsDir: string): CliStructuredError$2 | null;
|
|
152
152
|
/**
|
|
153
153
|
* Reader-subset integrity refusal for `migration status`: package
|
|
154
154
|
* corruptions only (`hashMismatch`, `providedInvariantsMismatch`,
|
|
155
155
|
* `packageUnloadable`).
|
|
156
156
|
*/
|
|
157
|
-
declare function refusePackageCorruptionOnAggregate(aggregate: ContractSpaceAggregate): CliStructuredError$2 | null;
|
|
157
|
+
declare function refusePackageCorruptionOnAggregate(aggregate: ContractSpaceAggregate, migrationsDir: string): CliStructuredError$2 | null;
|
|
158
158
|
/**
|
|
159
159
|
* Construct the tolerant {@link ContractSpaceAggregate} at the CLI
|
|
160
160
|
* surface and apply the explicit integrity refusal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBiB,oBAAoB,SAAS,uBAAuB;;;;;;iBAMpD,eAAe,IAAI,UAAU,YAAY,cAAc,kDAAkD;;;;iBAIzG,wBAAwB,iBAAiB;;;iBAGzC,mBAAmB,gBAAgB;WACzC;IACP,cAAc;;;KAGb;WACM,aAAa;;;;;;;;;;;;;;;;;;;;;;iBAsBP,oBAAoB,SAAS,qBAAqB,eAAe,2BAA2B,QAAQ;;;UAG3G;WACC,QAAQ;WACR;;WAEA;;WAEA;;;;;;;;;;KAUN,sCAAsC;WAChC;WACA;;WAEA;WACA;;UAED;WACC;WACA,cAAc;;WAEd;WACA;;iBAEM,6BAA6B,SAAS,sCAAsC,QAAQ,OAAO,qCAAqC;;;;;;;;;;;;;;;;iBAgBhI,uBAAuB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBiB,oBAAoB,SAAS,uBAAuB;;;;;;iBAMpD,eAAe,IAAI,UAAU,YAAY,cAAc,kDAAkD;;;;iBAIzG,wBAAwB,iBAAiB;;;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Q;iBACzF,sBAAsB,iBAAiB,uBAAuB,cAAc,cAAc,YAAY,aAAa;EAClI;EACA;;iBAEe,0BAA0B;WAChC;WACA;WACA;WACA;WACA,YAAY;WACZ;WACA;IACP,QAAQ;UACF;WACC;WACA;WACA;WACA;WACA,cAAc;;WAEd;WACA;WACA;;;;;;;iBAOM,4BAA4B,SAAS,qCAAqC,QAAQ,OAAO,sBAAsB;;iBAE/G,iBAAiB;WACvB;WACA;WACA;WACA;WACA,YAAY;IACnB,QAAQ;WACD;WACA;GACR;;;UAGO;WACC,OAAO;WACP,MAAM;WACN;;iBAEM,mBAAmB,eAAe,SAAS,uBAAuB,OAAO,aAAa;iBACtF,oBAAoB,eAAe;WACzC,OAAO;WACP,MAAM;IACb,OAAO,cAAc;;;;iBAIR,kBAAkB,kBAAkB,QAAQ,OAAO,MAAM;;;iBAGzD,iBAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as loadContractRawSafely, At as statusForMigrationHash, B as executeDbUpdate, Ct as resolveRefAdvancementFields, Dt as runMigrationCheck, Et as runContractSpaceSeedPhase, G as executeRefAdvancement, H as executeMigrateShowPlan, J as executeRefSetCommand, K as executeRefDeleteCommand, Ot as runMigrationList, Q as loadAggregateIntegrityViolations, R as executeContractEmit, St as resolveMigrationRef, U as executeMigrationNewCommand, V as executeDbVerify, W as executeMigrationPlanCommand, X as hasMigrationPath, Z as listRefsByContractHash, _ as enumerateCheckSpaces, a as buildContractSpaceAggregate, bt as resolveContractRefToSnapshot, c as buildRefAdvancementFields, dt as refuseContractSpaceIntegrity, et as loadContractSpaceAggregateForCli, f as computeRefAdvancementName, ft as refuseDeclaredExtensionTargetMismatch, g as enrichContract, gt as refuseUnknownInvariants, h as disposeEmitQueue, ht as refusePackageCorruptionOnAggregate, i as appliedHashesFromLedger, it as mapIntegrityViolations, l as checkSingleTarget, lt as readContractIR, m as deriveStatusEdgeAnnotations, mt as refuseMissingInvariantPath, n as advanceRefSafely, nt as mapCaughtMigrationError, o as buildMigrationSpaceGraphEntries, ot as migrationSpaceListEntriesFromAggregate, p as createControlClient, pt as refuseMarkerOutsideGraph, q as executeRefListCommand, r as appContractStandInFromIdentity, rt as mapContractAtError, s as buildReadAggregate, st as originHashForStatus, ut as readMigrationRefs, wt as resolveToForPlan, xt as resolveFromForPlan, yt as resolveContractRef$1, z as executeDbInit } from "./ref-
|
|
1
|
+
import { $ as loadContractRawSafely, At as statusForMigrationHash, B as executeDbUpdate, Ct as resolveRefAdvancementFields, Dt as runMigrationCheck, Et as runContractSpaceSeedPhase, G as executeRefAdvancement, H as executeMigrateShowPlan, J as executeRefSetCommand, K as executeRefDeleteCommand, Ot as runMigrationList, Q as loadAggregateIntegrityViolations, R as executeContractEmit, St as resolveMigrationRef, U as executeMigrationNewCommand, V as executeDbVerify, W as executeMigrationPlanCommand, X as hasMigrationPath, Z as listRefsByContractHash, _ as enumerateCheckSpaces, a as buildContractSpaceAggregate, bt as resolveContractRefToSnapshot, c as buildRefAdvancementFields, dt as refuseContractSpaceIntegrity, et as loadContractSpaceAggregateForCli, f as computeRefAdvancementName, ft as refuseDeclaredExtensionTargetMismatch, g as enrichContract, gt as refuseUnknownInvariants, h as disposeEmitQueue, ht as refusePackageCorruptionOnAggregate, i as appliedHashesFromLedger, it as mapIntegrityViolations, l as checkSingleTarget, lt as readContractIR, m as deriveStatusEdgeAnnotations, mt as refuseMissingInvariantPath, n as advanceRefSafely, nt as mapCaughtMigrationError, o as buildMigrationSpaceGraphEntries, ot as migrationSpaceListEntriesFromAggregate, p as createControlClient, pt as refuseMarkerOutsideGraph, q as executeRefListCommand, r as appContractStandInFromIdentity, rt as mapContractAtError, s as buildReadAggregate, st as originHashForStatus, ut as readMigrationRefs, wt as resolveToForPlan, xt as resolveFromForPlan, yt as resolveContractRef$1, z as executeDbInit } from "./ref-DJkSkzAt-a9gIu2Gt.mjs";
|
|
2
2
|
export { advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSpaceAggregateForCli, mapCaughtMigrationError, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, originHashForStatus, readContractIR, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveRefAdvancementFields, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
|
|
@@ -32,7 +32,7 @@ import { createHash } from "node:crypto";
|
|
|
32
32
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
33
33
|
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
34
34
|
import { resolve as resolve$1 } from "node:path";
|
|
35
|
-
//#region ../../../1-framework/3-tooling/cli/dist/ref-
|
|
35
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-DJkSkzAt.mjs
|
|
36
36
|
/**
|
|
37
37
|
* The typed remediation the CLI attaches to its own errors and findings.
|
|
38
38
|
* Constructors live here rather than in any library the CLI calls: naming a
|
|
@@ -730,14 +730,14 @@ function describeIntegrityViolation(violation) {
|
|
|
730
730
|
* target mismatch, then disjointness, then a contract-validation
|
|
731
731
|
* failure, then any remaining structural integrity violation.
|
|
732
732
|
*/
|
|
733
|
-
function mapIntegrityViolations(violations) {
|
|
733
|
+
function mapIntegrityViolations(violations, migrationsDir) {
|
|
734
734
|
if (violations.length === 0) return null;
|
|
735
735
|
const layout = violations.filter((v) => v.kind === "orphanSpaceDir" || v.kind === "declaredButUnmigrated");
|
|
736
736
|
if (layout.length > 0) {
|
|
737
737
|
const lines = layout.map((v) => `- [${v.kind}] ${v.spaceId}`);
|
|
738
738
|
return new CliStructuredError$1("MIGRATION.CONTRACT_SPACE_LAYOUT_VIOLATION", layout.length === 1 ? "Contract-space layout violation detected" : `Contract-space layout violations detected (${layout.length})`, {
|
|
739
|
-
why: `The on-disk
|
|
740
|
-
fix:
|
|
739
|
+
why: `The on-disk \`${migrationsDir}/\` directory and your \`extensions\` declaration are not in agreement.\n${lines.join("\n")}`,
|
|
740
|
+
fix: `Declare the extension in \`extensions\` and re-emit its contract-space artefacts, or remove the orphan \`${migrationsDir}/<space>\` directory.`,
|
|
741
741
|
docsUrl: CONTRACT_SPACES_DOCS_URL,
|
|
742
742
|
meta: { violations: layout }
|
|
743
743
|
});
|
|
@@ -759,7 +759,7 @@ function mapIntegrityViolations(violations) {
|
|
|
759
759
|
const structural = violations[0];
|
|
760
760
|
return contractSpaceViolationError(`Contract-space integrity failure for "${"spaceId" in structural ? structural.spaceId : "*"}"`, {
|
|
761
761
|
why: describeIntegrityViolation(structural),
|
|
762
|
-
fix:
|
|
762
|
+
fix: `Re-emit the affected migration package(s) or restore the on-disk \`${migrationsDir}\` directory from version control.`,
|
|
763
763
|
violations: [structural]
|
|
764
764
|
});
|
|
765
765
|
}
|
|
@@ -794,8 +794,8 @@ async function loadContractSpaceAggregateForCli(inputs) {
|
|
|
794
794
|
* the contract-space refusal envelope, or return `null` when the model
|
|
795
795
|
* is acceptable for the requested check scope.
|
|
796
796
|
*/
|
|
797
|
-
function refuseContractSpaceIntegrity(aggregate, options) {
|
|
798
|
-
return mapIntegrityViolations(aggregate.checkIntegrity(options));
|
|
797
|
+
function refuseContractSpaceIntegrity(aggregate, options, migrationsDir) {
|
|
798
|
+
return mapIntegrityViolations(aggregate.checkIntegrity(options), migrationsDir);
|
|
799
799
|
}
|
|
800
800
|
const PACKAGE_CORRUPTION_KINDS = /* @__PURE__ */ new Set([
|
|
801
801
|
"hashMismatch",
|
|
@@ -807,8 +807,8 @@ const PACKAGE_CORRUPTION_KINDS = /* @__PURE__ */ new Set([
|
|
|
807
807
|
* corruptions only (`hashMismatch`, `providedInvariantsMismatch`,
|
|
808
808
|
* `packageUnloadable`).
|
|
809
809
|
*/
|
|
810
|
-
function refusePackageCorruptionOnAggregate(aggregate) {
|
|
811
|
-
return mapIntegrityViolations(aggregate.checkIntegrity().filter((v) => PACKAGE_CORRUPTION_KINDS.has(v.kind)));
|
|
810
|
+
function refusePackageCorruptionOnAggregate(aggregate, migrationsDir) {
|
|
811
|
+
return mapIntegrityViolations(aggregate.checkIntegrity().filter((v) => PACKAGE_CORRUPTION_KINDS.has(v.kind)), migrationsDir);
|
|
812
812
|
}
|
|
813
813
|
/**
|
|
814
814
|
* Construct the tolerant {@link ContractSpaceAggregate} at the CLI
|
|
@@ -824,7 +824,7 @@ async function buildContractSpaceAggregate(inputs) {
|
|
|
824
824
|
const failure = refuseContractSpaceIntegrity(loaded.value, {
|
|
825
825
|
declaredExtensions,
|
|
826
826
|
checkContracts: true
|
|
827
|
-
});
|
|
827
|
+
}, inputs.migrationsDir);
|
|
828
828
|
if (failure) return notOk(failure);
|
|
829
829
|
return ok(loaded.value);
|
|
830
830
|
}
|
|
@@ -1491,7 +1491,8 @@ async function executeDbVerify(options) {
|
|
|
1491
1491
|
}),
|
|
1492
1492
|
aggregate,
|
|
1493
1493
|
skipMarker,
|
|
1494
|
-
onProgress
|
|
1494
|
+
onProgress,
|
|
1495
|
+
migrationsDir: options.migrationsDir
|
|
1495
1496
|
});
|
|
1496
1497
|
}
|
|
1497
1498
|
function buildLoadInputs(options) {
|
|
@@ -1574,7 +1575,7 @@ function emitVerifySpan(onProgress, kind) {
|
|
|
1574
1575
|
* by the CLI's `--schema-only` mode.
|
|
1575
1576
|
*/
|
|
1576
1577
|
function finaliseVerifyResult(args) {
|
|
1577
|
-
const { verifyResult, aggregate, skipMarker, onProgress } = args;
|
|
1578
|
+
const { verifyResult, aggregate, skipMarker, onProgress, migrationsDir } = args;
|
|
1578
1579
|
if (!verifyResult.ok) {
|
|
1579
1580
|
emitVerifySpan(onProgress, "spanEndError");
|
|
1580
1581
|
return notOk(new CliStructuredError$1("MIGRATION.CONTRACT_SPACE_VIOLATION", "Aggregate verifier introspection failed", {
|
|
@@ -1583,7 +1584,7 @@ function finaliseVerifyResult(args) {
|
|
|
1583
1584
|
docsUrl: "https://pris.ly/contract-spaces"
|
|
1584
1585
|
}));
|
|
1585
1586
|
}
|
|
1586
|
-
const markerDrift = skipMarker ? null : mapMarkerCheckFailures(aggregate.app.spaceId, verifyResult.value.markerCheck);
|
|
1587
|
+
const markerDrift = skipMarker ? null : mapMarkerCheckFailures(aggregate.app.spaceId, verifyResult.value.markerCheck, migrationsDir);
|
|
1587
1588
|
emitVerifySpan(onProgress, markerDrift === null ? "spanEndOk" : "spanEndError");
|
|
1588
1589
|
return ok({
|
|
1589
1590
|
schemaResults: verifyResult.value.schemaCheck.perSpace,
|
|
@@ -1615,7 +1616,7 @@ function buildSkippedSchemaResult(space) {
|
|
|
1615
1616
|
* `MIGRATION.CONTRACT_SPACE_VIOLATION` (was emitted by
|
|
1616
1617
|
* `runContractSpaceVerifierMarkerCheck`).
|
|
1617
1618
|
*/
|
|
1618
|
-
function mapMarkerCheckFailures(appSpaceId, section) {
|
|
1619
|
+
function mapMarkerCheckFailures(appSpaceId, section, migrationsDir) {
|
|
1619
1620
|
const violations = [];
|
|
1620
1621
|
for (const [spaceId, result] of section.perSpace) {
|
|
1621
1622
|
if (result.kind === "ok" || result.kind === "absent") continue;
|
|
@@ -1623,14 +1624,14 @@ function mapMarkerCheckFailures(appSpaceId, section) {
|
|
|
1623
1624
|
violations.push({
|
|
1624
1625
|
kind: "hashMismatch",
|
|
1625
1626
|
spaceId,
|
|
1626
|
-
remediation: spaceId === appSpaceId ? "Run `prisma-cli db update` to advance the marker, or roll the database back to the recorded hash." : `Apply on-disk migrations under
|
|
1627
|
+
remediation: spaceId === appSpaceId ? "Run `prisma-cli db update` to advance the marker, or roll the database back to the recorded hash." : `Apply on-disk migrations under \`${migrationsDir}/${spaceId}/\` to advance the marker, or remove the conflicting marker row.`
|
|
1627
1628
|
});
|
|
1628
1629
|
continue;
|
|
1629
1630
|
}
|
|
1630
1631
|
if (result.kind === "missingInvariants") violations.push({
|
|
1631
1632
|
kind: "invariantsMismatch",
|
|
1632
1633
|
spaceId,
|
|
1633
|
-
remediation: `Re-apply the migrations under
|
|
1634
|
+
remediation: `Re-apply the migrations under \`${migrationsDir}/${spaceId}/\` so the marker carries invariants: ${result.missing.join(", ")}.`
|
|
1634
1635
|
});
|
|
1635
1636
|
}
|
|
1636
1637
|
for (const orphan of section.orphanMarkers) violations.push({
|
|
@@ -1641,7 +1642,7 @@ function mapMarkerCheckFailures(appSpaceId, section) {
|
|
|
1641
1642
|
if (violations.length === 0) return null;
|
|
1642
1643
|
const lines = violations.map((v) => `- [${v.kind}] ${v.spaceId}: ${v.remediation}`);
|
|
1643
1644
|
return new CliStructuredError$1("MIGRATION.CONTRACT_SPACE_VIOLATION", violations.length === 1 ? "Contract-space verifier found a violation" : `Contract-space verifier found violations (${violations.length})`, {
|
|
1644
|
-
why: `The on-disk
|
|
1645
|
+
why: `The on-disk \`${migrationsDir}/\` directory, the \`extensions\` declaration, and the live database marker rows are not in agreement.\n${lines.join("\n")}`,
|
|
1645
1646
|
fix: violations[0]?.remediation ?? "Review and reconcile the violations listed above.",
|
|
1646
1647
|
docsUrl: "https://pris.ly/contract-spaces",
|
|
1647
1648
|
meta: { violations }
|
|
@@ -1703,7 +1704,7 @@ async function executeMigrate(options) {
|
|
|
1703
1704
|
atHeadResolutions.set(space.spaceId, outcome.plan);
|
|
1704
1705
|
continue;
|
|
1705
1706
|
}
|
|
1706
|
-
if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));
|
|
1707
|
+
if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash, migrationsDir));
|
|
1707
1708
|
if (outcome.kind === "unreachable") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));
|
|
1708
1709
|
if (outcome.kind === "unsatisfiable") {
|
|
1709
1710
|
const structural = findPathWithDecision(outcome.targetSpace.graph(), outcome.liveHash, spaceTargetHash, { required: /* @__PURE__ */ new Set() });
|
|
@@ -1975,11 +1976,11 @@ function buildSuccess(args) {
|
|
|
1975
1976
|
*
|
|
1976
1977
|
* @internal Exported for testing only.
|
|
1977
1978
|
*/
|
|
1978
|
-
function buildNeverPlannedFailure(spaceId, targetHash) {
|
|
1979
|
+
function buildNeverPlannedFailure(spaceId, targetHash, migrationsDir) {
|
|
1979
1980
|
return {
|
|
1980
1981
|
code: "MIGRATION_PATH_NOT_FOUND",
|
|
1981
1982
|
summary: `No on-disk migrations for contract space "${spaceId}"`,
|
|
1982
|
-
why: `migrate is replay-only: a contract space that declares managed storage elements must have an authored migration graph on disk. Space "${spaceId}" has no migrations under
|
|
1983
|
+
why: `migrate is replay-only: a contract space that declares managed storage elements must have an authored migration graph on disk. Space "${spaceId}" has no migrations under \`${migrationsDir}/${spaceId}/\` but its head ref targets "${targetHash}".`,
|
|
1983
1984
|
meta: {
|
|
1984
1985
|
spaceId,
|
|
1985
1986
|
target: targetHash,
|
|
@@ -3897,7 +3898,7 @@ async function executeMigrationNewCommand(options) {
|
|
|
3897
3898
|
deserializeContract: (json) => familyInstance.deserializeContract(json),
|
|
3898
3899
|
appContract: toContract
|
|
3899
3900
|
});
|
|
3900
|
-
const packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate);
|
|
3901
|
+
const packageCorruptionFailure = refusePackageCorruptionOnAggregate(aggregate, migrationsDir);
|
|
3901
3902
|
if (packageCorruptionFailure) return notOk(packageCorruptionFailure);
|
|
3902
3903
|
const packages = aggregate.app.packages;
|
|
3903
3904
|
const graph = aggregate.app.graph();
|
|
@@ -4684,4 +4685,4 @@ async function executeRefListCommand(options) {
|
|
|
4684
4685
|
//#endregion
|
|
4685
4686
|
export { loadContractRawSafely as $, errorMigrationPlanningFailed as A, statusForMigrationHash as At, executeDbUpdate as B, errorDestructiveChanges as C, resolveRefAdvancementFields as Ct, errorLegendHumanOnly as D, runMigrationCheck as Dt, errorHashMismatch as E, runContractSpaceSeedPhase as Et, errorTargetMigrationNotSupported as F, executeRefAdvancement as G, executeMigrateShowPlan as H, errorTargetMismatch as I, executeRefSetCommand as J, executeRefDeleteCommand as K, errorUnexpected as L, errorPathUnreachable as M, toDeclaredExtensionsFromRaw as Mt, errorRunnerFailed as N, errorMarkerMissing as O, runMigrationList as Ot, errorRuntime as P, loadAggregateIntegrityViolations as Q, executeContractEmit as R, errorDatabaseConnectionRequired as S, resolveMigrationRef as St, errorFileNotFound as T, runCommandAction as Tt, executeMigrationNewCommand as U, executeDbVerify as V, executeMigrationPlanCommand as W, hasMigrationPath as X, findPackageByDirPath as Y, listRefsByContractHash as Z, enumerateCheckSpaces as _, requireLiveDatabase as _t, buildContractSpaceAggregate as a, maskConnectionUrl as at, errorContractArgConflict as b, resolveContractRefToSnapshot as bt, buildRefAdvancementFields as c, readContractEnvelope as ct, closeQuietly as d, refuseContractSpaceIntegrity as dt, loadContractSpaceAggregateForCli as et, computeRefAdvancementName as f, refuseDeclaredExtensionTargetMismatch as ft, enrichContract as g, refuseUnknownInvariants as gt, disposeEmitQueue as h, refusePackageCorruptionOnAggregate as ht, appliedHashesFromLedger as i, mapIntegrityViolations as it, errorNoMigrations as j, targetSupportsMigrations as jt, errorMigrationPackageNotFound as k, sanitizeErrorMessage as kt, checkSingleTarget as l, readContractIR as lt, deriveStatusEdgeAnnotations as m, refuseMissingInvariantPath as mt, advanceRefSafely as n, mapCaughtMigrationError as nt, buildMigrationSpaceGraphEntries as o, migrationSpaceListEntriesFromAggregate as ot, createControlClient as p, refuseMarkerOutsideGraph as pt, executeRefListCommand as q, appContractStandInFromIdentity as r, mapContractAtError as rt, buildReadAggregate as s, originHashForStatus as st, CliStructuredError$1 as t, looksLikePath as tt, chooseAction as u, readMigrationRefs as ut, errorConfigValidation$1 as v, resolveAppTargetPath as vt, errorDriverRequired as w, resolveToForPlan as wt, errorContractValidationFailed as x, resolveFromForPlan as xt, errorConsentPlanMismatch as y, resolveContractRef$1 as yt, executeDbInit as z };
|
|
4686
4687
|
|
|
4687
|
-
//# sourceMappingURL=ref-
|
|
4688
|
+
//# sourceMappingURL=ref-DJkSkzAt-a9gIu2Gt.mjs.map
|