@prisma/orm-toolchain 8.0.0-rc.24-dev.22 → 8.0.0-rc.24-dev.24
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-BmhAhXYL.d.mts → aggregate-C6PGBKyb.d.mts} +7 -3
- package/dist/aggregate-C6PGBKyb.d.mts.map +1 -0
- package/dist/{aggregate-BIjV2dM9.mjs → aggregate-CRIdmKmq.mjs} +12 -8
- package/dist/aggregate-CRIdmKmq.mjs.map +1 -0
- package/dist/{caught-errors-Cll-zcA1-MXR0HE1V.mjs → caught-errors-I1l50iPc-D_-F2M3t.mjs} +21 -5
- package/dist/caught-errors-I1l50iPc-D_-F2M3t.mjs.map +1 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +187 -67
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +17 -5
- 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 +1 -1
- package/dist/cli__migration-cli.mjs +3 -3
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{contract-snapshot-store-nWnsWPPQ-rJ94UCcE.mjs → contract-snapshot-store-B0fRbVHB-BN2g8BKh.mjs} +3 -3
- package/dist/{contract-snapshot-store-nWnsWPPQ-rJ94UCcE.mjs.map → contract-snapshot-store-B0fRbVHB-BN2g8BKh.mjs.map} +1 -1
- package/dist/{db-sign-DGSaPRQ--B_9CmDng.d.mts → db-sign-Bv-FZMAD-uQhMNCC7.d.mts} +42 -26
- package/dist/db-sign-Bv-FZMAD-uQhMNCC7.d.mts.map +1 -0
- package/dist/{errors-DXha_4l--relAaiI4.mjs → errors-BMq40nYH-Cg8PBect.mjs} +33 -4
- package/dist/errors-BMq40nYH-Cg8PBect.mjs.map +1 -0
- package/dist/{errors-CLwhWJiz.d.mts → errors-oP9FaWWm.d.mts} +5 -2
- package/dist/errors-oP9FaWWm.d.mts.map +1 -0
- package/dist/{graph-membership-DxpNgxfZ-BfqA-H7V.mjs → graph-membership-D7m41lWA-B68g1CRS.mjs} +3 -3
- package/dist/{graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map → graph-membership-D7m41lWA-B68g1CRS.mjs.map} +1 -1
- package/dist/{invariants-DrF9p5Gd-BF70vGl1.mjs → invariants-DxCj82g2-DhGkStla.mjs} +3 -3
- package/dist/{invariants-DrF9p5Gd-BF70vGl1.mjs.map → invariants-DxCj82g2-DhGkStla.mjs.map} +1 -1
- package/dist/{io-4O31S6Ei-DvsFKW_Y.mjs → io-B39zsxMm-D5Wcf6cf.mjs} +5 -5
- package/dist/{io-4O31S6Ei-DvsFKW_Y.mjs.map → io-B39zsxMm-D5Wcf6cf.mjs.map} +1 -1
- package/dist/{migration-CWyjX9vz.mjs → migration-DTmtOJ0n.mjs} +3 -3
- package/dist/{migration-CWyjX9vz.mjs.map → migration-DTmtOJ0n.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +6 -5
- package/dist/migration-tools.mjs +12 -12
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.d.mts +2 -2
- package/dist/migration-tools__errors.mjs +2 -2
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +1 -1
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.d.mts +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.d.mts +3 -2
- package/dist/migration-tools__refs.mjs +2 -2
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-D4GWEHQU-BOqb4i_E.mjs → ref-DfuqRCA7-CPPoVHY9.mjs} +459 -101
- package/dist/ref-DfuqRCA7-CPPoVHY9.mjs.map +1 -0
- package/dist/{ref-resolution-Eo0QHp4f.mjs → ref-resolution-C9j2SSb6.mjs} +2 -2
- package/dist/{ref-resolution-Eo0QHp4f.mjs.map → ref-resolution-C9j2SSb6.mjs.map} +1 -1
- package/dist/{ref-resolution-BPhR-kta.d.mts → ref-resolution-UwnXbc9M.d.mts} +2 -2
- package/dist/{ref-resolution-BPhR-kta.d.mts.map → ref-resolution-UwnXbc9M.d.mts.map} +1 -1
- package/dist/refs-B5N_vHH7.d.mts +1 -0
- package/dist/{refs-BNCUu58Y-BIso5Jfg.d.mts → refs-CkGjbosE-CLkrSkQ4.d.mts} +18 -3
- package/dist/refs-CkGjbosE-CLkrSkQ4.d.mts.map +1 -0
- package/dist/{refs-DM3q3IZC-BC6H6P0X.mjs → refs-t_JbIjGo-CRpBRRkq.mjs} +79 -20
- package/dist/refs-t_JbIjGo-CRpBRRkq.mjs.map +1 -0
- package/dist/{spaces-BIABdklg.mjs → spaces-OVZ0QzWJ.mjs} +5 -5
- package/dist/{spaces-BIABdklg.mjs.map → spaces-OVZ0QzWJ.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-BmnQiKDj-JwT2fAPh.mjs → verify-contract-spaces-BOnqhfQs-BBq5YOKo.mjs} +11 -7
- package/dist/verify-contract-spaces-BOnqhfQs-BBq5YOKo.mjs.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/aggregate-BIjV2dM9.mjs.map +0 -1
- package/dist/aggregate-BmhAhXYL.d.mts.map +0 -1
- package/dist/caught-errors-Cll-zcA1-MXR0HE1V.mjs.map +0 -1
- package/dist/db-sign-DGSaPRQ--B_9CmDng.d.mts.map +0 -1
- package/dist/errors-CLwhWJiz.d.mts.map +0 -1
- package/dist/errors-DXha_4l--relAaiI4.mjs.map +0 -1
- package/dist/ref-D4GWEHQU-BOqb4i_E.mjs.map +0 -1
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +0 -1
- package/dist/refs-DM3q3IZC-BC6H6P0X.mjs.map +0 -1
- package/dist/verify-contract-spaces-BmnQiKDj-JwT2fAPh.mjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as OnDiskMigrationPackage } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
|
|
2
2
|
import { n as SnapshotContentVerifier } from "./contract-snapshot-store-xDOQSwJh-YNdzKU85.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as Refs, i as RefLoadProblem } from "./refs-CkGjbosE-CLkrSkQ4.mjs";
|
|
4
4
|
import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
5
5
|
import { t as ContractSpaceHeadRecord } from "./verify-contract-spaces-DHD3C7sU-DA28bANE.mjs";
|
|
6
6
|
import { t as PackageLoadProblem } from "./io-BzVNzfsY-DE_ev9K6.mjs";
|
|
7
7
|
import { t as PathDecision } from "./migration-graph-D8IuOkZb-pSI7-k4_.mjs";
|
|
8
|
-
import { AppliedMigrationStatement, ControlAdapterInstance, ControlFamilyInstance, DiffSubjectGranularity, MigrationOperationPolicy, MigrationPlan, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, ResolvedMigrationStatement, SchemaDiffIssue, SchemaEntityCoordinate, SchemaOwnership, TargetMigrationsCapability, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
8
|
+
import { AppliedMigrationStatement, ControlAdapterInstance, ControlFamilyInstance, DeclaredDatabasePoliciesIssue, DiffSubjectGranularity, MigrationOperationPolicy, MigrationPlan, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, ResolvedMigrationStatement, SchemaDiffIssue, SchemaEntityCoordinate, SchemaOwnership, TargetMigrationsCapability, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
9
9
|
import { Contract, StorageNamespace } from "@prisma/orm-framework/contract/types";
|
|
10
10
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
11
11
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
@@ -60,7 +60,11 @@ type IntegrityViolation = {
|
|
|
60
60
|
readonly kind: 'refUnreadable';
|
|
61
61
|
readonly spaceId: string;
|
|
62
62
|
readonly refName: string;
|
|
63
|
+
/** The ref file that could not be read. */
|
|
64
|
+
readonly path: string;
|
|
63
65
|
readonly detail: string;
|
|
66
|
+
/** The invalid keys of the ref's `policies`, when they are what is wrong. */
|
|
67
|
+
readonly policyIssues?: readonly DeclaredDatabasePoliciesIssue[];
|
|
64
68
|
} | {
|
|
65
69
|
readonly kind: 'orphanSpaceDir';
|
|
66
70
|
readonly spaceId: string;
|
|
@@ -847,4 +851,4 @@ type VerifierOutput = Result<VerifierSuccess, VerifierError>;
|
|
|
847
851
|
declare function verifyMigration(input: VerifierInput): VerifierOutput;
|
|
848
852
|
//#endregion
|
|
849
853
|
export { allStorageElementsExternal as A, requireHeadRef as B, ResolveRecordedPathInputs as C, VerifierInput as D, VerifierError as E, createAggregateContractSpace as F, spacesInApplyOrder as H, createContractSpaceAggregate as I, loadContractSpaceAggregate as L, collectAggregateNamespaces as M, computeIntegrityViolations as N, VerifierOutput as O, contractHashAtMarker as P, loadProblemToViolation as R, PlannerSuccess as S, SchemaCheckSection as T, verifyMigration as U, resolveRecordedPath as V, MarkerCheckSection as _, CallerPolicy as a, PlannerInput as b, ContractMarkerRecordLike as c, IntegrityComputationInput as d, IntegrityQueryOptions as f, MarkerCheckResult as g, LoadAggregateInput as h, AppSpacePlanningInputs as i, buildFabricatedMigrationEdge as j, VerifierSuccess as k, ContractSpaceAggregate as l, IntegrityViolation as m, AggregateCurrentDBState as n, ContractAtOptions as o, IntegritySpaceState as p, AggregateMigrationEdgeRef as r, ContractAtResult as s, AggregateContractSpace as t, DeclaredExtensionEntry as u, PerSpacePlan as v, ResolveRecordedPathOutcome as w, PlannerOutput as x, PlannerError as y, planMigration as z };
|
|
850
|
-
//# sourceMappingURL=aggregate-
|
|
854
|
+
//# sourceMappingURL=aggregate-C6PGBKyb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-C6PGBKyb.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BK;WACM;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;;WAEA,wBAAwB;;WAExB;WACA;;WAEA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;;;;;;;;;;;;;;UAcD;WACC;WACA;;;;;;;;;;;UAWD;;;;;;WAMC,8BAA8B;;;;;WAK9B;;;;UAID;WACC;;KAEN;WACM;WACA;WACA;WACA,UAAU;;WAEV;WACA;WACA;WACA,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAyCX;WACC;WACA,mBAAmB;WACnB,MAAM;WACN,SAAS;EAClB,SAAS;EACT,YAAY;EACZ,WAAW,cAAc,OAAO,oBAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAkCpD,+BAA+B;WAC9B;WACA,KAAK;WACL,qBAAqB;EAC9B;EACA,SAAS;EACT,MAAM,aAAa;EACnB,mBAAmB;EACnB,eAAe,YAAY;EAC3B,gBAAgB,YAAY;EAC5B,eAAe,OAAO,iCAAiC;;;;;;;;;;;;iBAYxC,eAAe,OAAO,yBAAyB;;;;;;;;;;;;;;;;iBAgB/C,6BAA6B;WACnC;WACA,mBAAmB;WACnB,MAAM;WACN,SAAS;WACT;WACA;WACA,uBAAuB;WACvB,sBAAsB,iBAAiB;WACvC,wBAAwB;IAC/B;;;;;;;;;;;;;;iBAca,2BAA2B,WAAW,wBAAwB,iBAAiB;WACrF;aACE,YAAY,SAA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OAAO,gBAAgB;;;iBAG3B,6BAA6B;WACnC;WACA;WACA;WACA;IACP;;;;;;;;;;;;;;UAcM;WACC;WACA,sBAAsB,iBAAiB;WACvC,aAAa;;;;;;;;WAQb,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAoBlB,2BAA2B,OAAO,qBAAqB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC/D,cAAc,0BAA0B,0BAA0B,OAAO,aAAa,WAAW,aAAa,QAAQ;;;;;;;;;;;;KAYlI;WACM;WACA,QAAQ;;WAER;;WAEA;WACA;;UAED;WACC;WACA,OAAO;WACP,eAAe;;;;;;;WAOf;;WAEA,gBAAgB,WAAW;;;;;;;;;;;;;;;;;iBAiBrB,oBAAoB,OAAO,4BAA4B;;;;;;;;;;KAUnE,2BAA2B,OAAO,oBAAoB;;;;;;;;KAQtD,8BAA8B,OAAO;;;;;;;;;UAShC;WACC,WAAW;WACX,kBAAkB,oBAAoB;WACtC;WACA;;;;;;;;WAQA,uBAAuB,iBAAiB,OAAO,wBAAwB,+BAA+B;;;;;;;;WAQtG,6BAA6B;;;;;;;;WAQ7B,qBAAqB;;;;;;;;KAQ3B;WACM;;WAEA;;WAEA;WACA;WACA;;WAEA;WACA;;UAED;WACC,UAAU,oBAAoB;WAC9B;aACE;aACA,KAAK;;;UAGR;;;;;;;WAOC,UAAU,oBAAoB;;;;;;;;WAQ9B;;UAED;WACC,aAAa;WACb,aAAa;;KAEnB;WACM;WACA;;KAEN,iBAAiB,OAAO,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;iBAyB7B,gBAAgB,OAAO,gBAAgB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
2
|
-
import { A as errorRefNotResolvable, j as errorSpaceHeadRefMissing, n as errorBundleNotFoundForGraphNode, p as errorHashNotInGraph, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-
|
|
3
|
-
import { i as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
4
|
-
import { s as readMigrationsDir } from "./io-
|
|
2
|
+
import { A as errorRefNotResolvable, j as errorSpaceHeadRefMissing, n as errorBundleNotFoundForGraphNode, p as errorHashNotInGraph, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-BMq40nYH-Cg8PBect.mjs";
|
|
3
|
+
import { i as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-B0fRbVHB-BN2g8BKh.mjs";
|
|
4
|
+
import { s as readMigrationsDir } from "./io-B39zsxMm-D5Wcf6cf.mjs";
|
|
5
5
|
import { i as findPathWithDecision, o as reconstructGraph } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
|
|
6
|
-
import { a as
|
|
7
|
-
import { n as isGraphNode } from "./graph-membership-
|
|
8
|
-
import {
|
|
6
|
+
import { a as contractSpaceHeadRefPath, c as readContractSpaceHeadRef, l as spaceMigrationDirectory, o as isValidSpaceId, s as listContractSpaceDirectories, t as APP_SPACE_ID$1, u as spaceRefsDirectory } from "./verify-contract-spaces-BOnqhfQs-BBq5YOKo.mjs";
|
|
7
|
+
import { n as isGraphNode } from "./graph-membership-D7m41lWA-B68g1CRS.mjs";
|
|
8
|
+
import { i as readRef, o as readRefsTolerant, t as HEAD_REF_NAME } from "./refs-t_JbIjGo-CRpBRRkq.mjs";
|
|
9
9
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
10
|
import { VERIFY_CODE_SCHEMA_FAILURE, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
11
11
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -268,12 +268,15 @@ function computeIntegrityViolations(input, opts) {
|
|
|
268
268
|
kind: "refUnreadable",
|
|
269
269
|
spaceId,
|
|
270
270
|
refName: refProblem.refName,
|
|
271
|
-
|
|
271
|
+
path: refProblem.path,
|
|
272
|
+
detail: refProblem.detail,
|
|
273
|
+
...ifDefined("policyIssues", refProblem.policyIssues)
|
|
272
274
|
});
|
|
273
275
|
if (headRefProblem !== null) violations.push({
|
|
274
276
|
kind: "refUnreadable",
|
|
275
277
|
spaceId,
|
|
276
278
|
refName: headRefProblem.refName,
|
|
279
|
+
path: headRefProblem.path,
|
|
277
280
|
detail: headRefProblem.detail
|
|
278
281
|
});
|
|
279
282
|
for (const pkg of space.packages) {
|
|
@@ -548,6 +551,7 @@ async function readHeadRefTolerant(migrationsDir, spaceId) {
|
|
|
548
551
|
headRef: null,
|
|
549
552
|
problem: {
|
|
550
553
|
refName: HEAD_REF_NAME,
|
|
554
|
+
path: contractSpaceHeadRefPath(migrationsDir, spaceId),
|
|
551
555
|
detail: detailOf(error)
|
|
552
556
|
}
|
|
553
557
|
};
|
|
@@ -1070,4 +1074,4 @@ function runVerifyMigration(input) {
|
|
|
1070
1074
|
//#endregion
|
|
1071
1075
|
export { contractHashAtMarker as a, loadContractSpaceAggregate as c, requireHeadRef as d, resolveRecordedPath as f, computeIntegrityViolations as i, loadProblemToViolation as l, verifyMigration as m, buildFabricatedMigrationEdge as n, createAggregateContractSpace as o, spacesInApplyOrder as p, collectAggregateNamespaces as r, createContractSpaceAggregate as s, allStorageElementsExternal as t, planMigration as u };
|
|
1072
1076
|
|
|
1073
|
-
//# sourceMappingURL=aggregate-
|
|
1077
|
+
//# sourceMappingURL=aggregate-CRIdmKmq.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-CRIdmKmq.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.mjs"],"sourcesContent":["import { A as errorRefNotResolvable, j as errorSpaceHeadRefMissing, n as errorBundleNotFoundForGraphNode, p as errorHashNotInGraph, r as errorContractDeserializationFailed, t as MigrationToolsError } from \"../errors-BMq40nYH.mjs\";\nimport { i as readContractSnapshotJson, t as contractSnapshotDir } from \"../contract-snapshot-store-B0fRbVHB.mjs\";\nimport { s as readMigrationsDir } from \"../io-B39zsxMm.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"../constants-CM-w38DQ.mjs\";\nimport { n as isGraphNode } from \"../graph-membership-D7m41lWA.mjs\";\nimport { i as findPathWithDecision, o as reconstructGraph } from \"../migration-graph-BoiiZAaU.mjs\";\nimport { i as readRef, o as readRefsTolerant, t as HEAD_REF_NAME } from \"../refs-t_JbIjGo.mjs\";\nimport { a as APP_SPACE_ID, d as spaceRefsDirectory, i as readContractSpaceHeadRef, l as isValidSpaceId, r as contractSpaceHeadRefPath, t as listContractSpaceDirectories, u as spaceMigrationDirectory } from \"../verify-contract-spaces-BOnqhfQs.mjs\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, issueOutcome } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { join } from \"pathe\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates, entityAt } from \"@internal/framework-components/ir\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\n//#region src/aggregate/aggregate.ts\nfunction contractAtMemoKey(hash, refName) {\n\treturn JSON.stringify([hash, refName ?? \"\"]);\n}\nfunction deserializeContractAtPath(filePath, contractJson, deserializeContract) {\n\ttry {\n\t\treturn deserializeContract(contractJson);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) throw error;\n\t\tthrow errorContractDeserializationFailed(filePath, error instanceof Error ? error.message : String(error), { cause: error });\n\t}\n}\nasync function readContractSnapshotEntry(migrationsDir, hash, deserializeContract, verifySnapshotContent) {\n\tconst contractJson = await readContractSnapshotJson(migrationsDir, hash, verifySnapshotContent);\n\treturn {\n\t\tcontractJson,\n\t\tcontract: deserializeContractAtPath(join(contractSnapshotDir(migrationsDir, hash), \"contract.json\"), contractJson, deserializeContract)\n\t};\n}\nasync function resolveContractAt(args) {\n\tconst { hash, opts, refsDir, migrationsDir, packages, graph, deserializeContract, verifySnapshotContent } = args;\n\tconst refName = opts?.refName;\n\tif (refName !== void 0) {\n\t\tlet refEntry;\n\t\ttry {\n\t\t\trefEntry = await readRef(refsDir, refName);\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.UNKNOWN_REF\") refEntry = void 0;\n\t\t\telse throw error;\n\t\t}\n\t\tif (refEntry) {\n\t\t\tconst { contractJson, contract } = await readContractSnapshotEntry(migrationsDir, refEntry.hash, deserializeContract, verifySnapshotContent);\n\t\t\treturn {\n\t\t\t\thash: refEntry.hash,\n\t\t\t\tcontractJson,\n\t\t\t\tcontract,\n\t\t\t\tprovenance: \"ref\"\n\t\t\t};\n\t\t}\n\t\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\t\thash,\n\t\t\tmigrationsDir,\n\t\t\tpackages,\n\t\t\tdeserializeContract,\n\t\t\tverifySnapshotContent,\n\t\t\texplicitLabel: refName\n\t\t});\n\t\tthrow errorRefNotResolvable(refName);\n\t}\n\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\thash,\n\t\tmigrationsDir,\n\t\tpackages,\n\t\tdeserializeContract,\n\t\tverifySnapshotContent\n\t});\n\tthrow errorHashNotInGraph(hash, graph);\n}\nasync function resolveGraphNodeContractAt(args) {\n\tconst { hash, migrationsDir, packages, deserializeContract, verifySnapshotContent, explicitLabel } = args;\n\tif (!packages.find((pkg) => pkg.metadata.to === hash)) throw errorBundleNotFoundForGraphNode(hash, explicitLabel);\n\tconst { contractJson, contract } = await readContractSnapshotEntry(migrationsDir, hash, deserializeContract, verifySnapshotContent);\n\treturn {\n\t\thash,\n\t\tcontractJson,\n\t\tcontract,\n\t\tprovenance: \"graph-node\"\n\t};\n}\n/**\n* Resolve a contract space's head ref, asserting it is present. The apply/verify\n* engine only runs after `checkIntegrity` has refused on `headRefMissing`,\n* so a space reaching the planner / verifier without a head ref is a\n* programming error (the integrity gate was skipped), not a user-facing\n* state. The app space's head ref is always synthesised, so this only\n* ever guards an ungated extension space.\n*/\nfunction requireHeadRef(space) {\n\tif (space.headRef === null) throw new InternalError(`Contract space \"${space.spaceId}\" has no head ref; the integrity gate must refuse a missing head ref before planning or verifying.`);\n\treturn space.headRef;\n}\n/**\n* Build a {@link AggregateContractSpace} with lazily-memoised `graph()`,\n* `contract()`, and `contractAt()` facets.\n*\n* `graph()` reconstructs the migration graph from `packages` on first\n* call and caches it. `contract()` calls `resolveContract` on first call\n* and caches the result; a throwing `resolveContract` (e.g. a missing or\n* undeserializable on-disk contract) re-throws on each call rather than\n* caching a value — `checkIntegrity` surfaces that as `contractUnreadable`.\n* `contractAt()` materializes the contract at an arbitrary graph node with\n* the same resolution order as plan-time ref resolution: the ref's pointer\n* plus the store entry keyed by the pointer's hash first (when\n* `opts.refName` is set), else the contract snapshot store entry keyed by\n* the matching package's `to` hash.\n*/\nfunction createAggregateContractSpace(args) {\n\tconst { spaceId, packages, refs, headRef, refsDir, migrationsDir, resolveContract, deserializeContract, verifySnapshotContent } = args;\n\tlet graphMemo;\n\tlet contractMemo;\n\tconst contractAtMemo = /* @__PURE__ */ new Map();\n\tfunction spaceGraph() {\n\t\tgraphMemo ??= reconstructGraph(packages);\n\t\treturn graphMemo;\n\t}\n\treturn {\n\t\tspaceId,\n\t\tpackages,\n\t\trefs,\n\t\theadRef,\n\t\tgraph: spaceGraph,\n\t\tcontract() {\n\t\t\tcontractMemo ??= resolveContract();\n\t\t\treturn contractMemo;\n\t\t},\n\t\tasync contractAt(hash, opts) {\n\t\t\tconst key = contractAtMemoKey(hash, opts?.refName);\n\t\t\tconst cached = contractAtMemo.get(key);\n\t\t\tif (cached) return cached;\n\t\t\tconst result = await resolveContractAt({\n\t\t\t\thash,\n\t\t\t\topts,\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tpackages,\n\t\t\t\tgraph: spaceGraph(),\n\t\t\t\tdeserializeContract,\n\t\t\t\tverifySnapshotContent\n\t\t\t});\n\t\t\tcontractAtMemo.set(key, result);\n\t\t\treturn result;\n\t\t}\n\t};\n}\n/**\n* Collect the union of every namespace declared across all contract spaces of an\n* aggregate (app + extensions), and of the application space's origin contract when given, so a\n* namespace the origin declares and the destination removed is read too, and return a minimal\n* object with the shape\n* `{ storage: { namespaces }, contracts }` suitable for passing to\n* `familyInstance.introspect`. `contracts` holds each space's contract, app first, so\n* introspection reads a table with the contract of the space that declares it.\n*\n* Callers invoke this after the integrity gate (`buildContractSpaceAggregate`\n* with `checkContracts: true`), so every `space.contract()` call is safe —\n* no try/catch is needed here.\n*/\nfunction collectAggregateNamespaces(aggregate, originContract = null) {\n\tconst contracts = [...aggregate.spaces().map((space) => space.contract()), ...originContract === null ? [] : [originContract]];\n\tconst merged = {};\n\tfor (const contract of contracts) for (const [key, ns] of Object.entries(contract.storage.namespaces)) {\n\t\tconst existing = merged[key];\n\t\tmerged[key] = existing === void 0 ? ns : mergeNamespaceEntries(existing, ns);\n\t}\n\treturn {\n\t\tstorage: { namespaces: merged },\n\t\tcontracts\n\t};\n}\n/**\n* The order in which `migrate` applies an aggregate's contract spaces and `db sign` signs them: the extension spaces in the aggregate's order, then the app space, so an extension's tables exist before the app's tables refer to them.\n*/\nfunction spacesInApplyOrder(aggregate) {\n\treturn [...aggregate.extensions, aggregate.app];\n}\n/**\n* Union two contract spaces' declarations for the same namespace id, per\n* entity kind. Two spaces may legitimately share a namespace (e.g. both\n* declaring tables in `public`); element-level disjointness is enforced by\n* `checkIntegrity`, so the kind maps never collide on a name — replacing the\n* whole namespace would silently drop the earlier space's entities.\n*/\nfunction mergeNamespaceEntries(a, b) {\n\tconst entries = { ...a.entries };\n\tfor (const [entityKind, kindMap] of Object.entries(b.entries)) entries[entityKind] = {\n\t\t...entries[entityKind],\n\t\t...kindMap\n\t};\n\treturn {\n\t\t...a,\n\t\tentries\n\t};\n}\n/**\n* Assemble a {@link ContractSpaceAggregate} value from its contract spaces and a\n* `checkIntegrity` implementation. The query methods (`listSpaces` /\n* `hasSpace` / `space` / `spaces`) are derived here so every aggregate —\n* loader-built or test-built — shares one query surface: `app` first,\n* then `extensions` in the order supplied (the loader sorts them\n* lex-ascending by `spaceId`).\n*/\nfunction createContractSpaceAggregate(args) {\n\tconst { targetId, app, extensions, checkIntegrity } = args;\n\tconst ordered = [app, ...extensions];\n\tconst byId = new Map(ordered.map((m) => [m.spaceId, m]));\n\tconst spaceDeclares = (space, coordinate) => {\n\t\tconst key = coordinateKey(coordinate);\n\t\tfor (const coord of elementCoordinates(space.contract().storage)) if (coordinateKey(coord) === key) return true;\n\t\treturn false;\n\t};\n\treturn {\n\t\ttargetId,\n\t\tapp,\n\t\textensions,\n\t\tlistSpaces: () => ordered.map((m) => m.spaceId),\n\t\thasSpace: (id) => byId.has(id),\n\t\tspace: (id) => byId.get(id),\n\t\tspaces: () => ordered,\n\t\tdeclaresEntity: (coordinate) => ordered.some((space) => spaceDeclares(space, coordinate)),\n\t\tdeclaringSpaces: (coordinate) => ordered.filter((space) => spaceDeclares(space, coordinate)).map((s) => s.spaceId),\n\t\tnamespaceDeclaringSpaces: (namespaceId) => ordered.filter((space) => Object.hasOwn(space.contract().storage.namespaces, namespaceId)).map((space) => space.spaceId),\n\t\tcheckIntegrity\n\t};\n}\n//#endregion\n//#region src/aggregate/all-external.ts\nfunction isControlPolicy(value) {\n\treturn value === \"managed\" || value === \"tolerated\" || value === \"external\" || value === \"observed\";\n}\n/**\n* True when every storage element the contract declares resolves to the\n* `external` control policy (ADR 224) — element-level `control` first, the\n* contract's `defaultControlPolicy` otherwise. A contract with no storage\n* elements is vacuously all-external.\n*\n* This is the precondition for advancing a contract space's marker without\n* any migrations (the declared-state resolution the db-init aggregate\n* planner and `migrate` share): only when nothing in the space is\n* Prisma 8-managed can the storage structure be correct without a\n* migration having produced it. Any space that declares a managed element\n* but ships no migration graph is an authoring bug and must fail loudly.\n*/\nfunction allStorageElementsExternal(contract) {\n\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\tconst entity = entityAt(contract.storage, coordinate);\n\t\tconst declared = entity !== null && typeof entity === \"object\" ? blindCast(entity).control : void 0;\n\t\tif (effectiveControlPolicy(isControlPolicy(declared) ? declared : void 0, contract.defaultControlPolicy) !== \"external\") return false;\n\t}\n\treturn true;\n}\n//#endregion\n//#region src/aggregate/check-integrity.ts\n/**\n* Walk the loaded model and return **every** integrity violation — never\n* bailing at the first. Structurally-derivable violations (load-time\n* problems, self-edges, missing / unreachable head refs) are always\n* produced; layout-drift checks require `declaredExtensions`, and\n* contract / target / disjointness checks require `checkContracts`.\n*/\nfunction computeIntegrityViolations(input, opts) {\n\tconst violations = [];\n\tfor (const { space, problems, refProblems, headRefProblem, isApp } of input.spaces) {\n\t\tconst { spaceId } = space;\n\t\tfor (const problem of problems) violations.push(loadProblemToViolation(spaceId, problem));\n\t\tfor (const refProblem of refProblems) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: refProblem.refName,\n\t\t\tpath: refProblem.path,\n\t\t\tdetail: refProblem.detail,\n\t\t\t...ifDefined(\"policyIssues\", refProblem.policyIssues)\n\t\t});\n\t\tif (headRefProblem !== null) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: headRefProblem.refName,\n\t\t\tpath: headRefProblem.path,\n\t\t\tdetail: headRefProblem.detail\n\t\t});\n\t\tfor (const pkg of space.packages) {\n\t\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\t\tconst isSelfEdge = from === pkg.metadata.to;\n\t\t\tconst hasDataOp = pkg.ops.some((op) => op.operationClass === \"data\");\n\t\t\tif (isSelfEdge && !hasDataOp) violations.push({\n\t\t\t\tkind: \"sameSourceAndTarget\",\n\t\t\t\tspaceId,\n\t\t\t\tdirName: pkg.dirName,\n\t\t\t\thash: from\n\t\t\t});\n\t\t}\n\t\tviolations.push(...duplicateMigrationHashViolations(spaceId, space.packages));\n\t\tif (!isApp && headRefProblem === null) {\n\t\t\tif (space.headRef === null) violations.push({\n\t\t\t\tkind: \"headRefMissing\",\n\t\t\t\tspaceId\n\t\t\t});\n\t\t\telse if (space.packages.length > 0 && !headRefPresentInGraph(space, space.headRef.hash)) violations.push({\n\t\t\t\tkind: \"headRefNotInGraph\",\n\t\t\t\tspaceId,\n\t\t\t\thash: space.headRef.hash\n\t\t\t});\n\t\t}\n\t}\n\tif (opts?.declaredExtensions !== void 0) violations.push(...layoutViolations(input.spaces, opts.declaredExtensions));\n\tif (opts?.checkContracts === true) violations.push(...contractViolations(input));\n\treturn violations;\n}\nfunction loadProblemToViolation(spaceId, problem) {\n\tswitch (problem.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tkind: \"hashMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tstored: problem.stored,\n\t\t\tcomputed: problem.computed\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tkind: \"packageUnloadable\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tdetail: problem.detail\n\t\t};\n\t}\n}\nfunction duplicateMigrationHashViolations(spaceId, packages) {\n\tconst dirNamesByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst hash = pkg.metadata.migrationHash;\n\t\tconst dirNames = dirNamesByHash.get(hash);\n\t\tif (dirNames) dirNames.push(pkg.dirName);\n\t\telse dirNamesByHash.set(hash, [pkg.dirName]);\n\t}\n\tconst out = [];\n\tfor (const [migrationHash, dirNames] of dirNamesByHash) if (dirNames.length > 1) out.push({\n\t\tkind: \"duplicateMigrationHash\",\n\t\tspaceId,\n\t\tmigrationHash,\n\t\tdirNames: [...dirNames].sort()\n\t});\n\treturn out;\n}\n/**\n* Whether a space's head-ref hash is present in its reconstructed graph.\n* An empty graph is reachable only by the empty-contract sentinel.\n*/\nfunction headRefPresentInGraph(space, headHash) {\n\tconst graph = space.graph();\n\tif (graph.nodes.size === 0) return headHash === EMPTY_CONTRACT_HASH;\n\treturn graph.nodes.has(headHash);\n}\nfunction layoutViolations(spaces, declaredExtensions) {\n\tconst out = [];\n\tconst extensionSpaceIds = new Set(spaces.filter((s) => !s.isApp).map((s) => s.space.spaceId));\n\tconst declaredIds = new Set(declaredExtensions.map((d) => d.id));\n\tfor (const id of [...extensionSpaceIds].sort()) if (!declaredIds.has(id)) out.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: id\n\t});\n\tfor (const id of [...declaredIds].sort()) if (!extensionSpaceIds.has(id)) out.push({\n\t\tkind: \"declaredButUnmigrated\",\n\t\tspaceId: id\n\t});\n\treturn out;\n}\nfunction contractViolations(input) {\n\tconst out = [];\n\tconst elementClaimedBy = /* @__PURE__ */ new Map();\n\tconst elementLabel = /* @__PURE__ */ new Map();\n\tfor (const { space } of input.spaces) {\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = space.contract();\n\t\t} catch (error) {\n\t\t\tout.push({\n\t\t\t\tkind: \"contractUnreadable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tdetail: detailOf$1(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (contract.target !== input.targetId) out.push({\n\t\t\tkind: \"targetMismatch\",\n\t\t\tspaceId: space.spaceId,\n\t\t\texpected: input.targetId,\n\t\t\tactual: contract.target\n\t\t});\n\t\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\t\tconst key = coordinateKey(coordinate);\n\t\t\tconst claimers = elementClaimedBy.get(key);\n\t\t\tif (claimers) claimers.push(space.spaceId);\n\t\t\telse {\n\t\t\t\telementClaimedBy.set(key, [space.spaceId]);\n\t\t\t\telementLabel.set(key, `${coordinate.namespaceId}.${coordinate.entityName}`);\n\t\t\t}\n\t\t}\n\t}\n\tconst disjointness = [];\n\tfor (const [key, claimedBy] of elementClaimedBy) if (claimedBy.length > 1) {\n\t\tconst element = elementLabel.get(key) ?? key;\n\t\tdisjointness.push({\n\t\t\tkind: \"disjointness\",\n\t\t\telement,\n\t\t\tclaimedBy: [...claimedBy].sort()\n\t\t});\n\t}\n\tdisjointness.sort((a, b) => a.kind === \"disjointness\" && b.kind === \"disjointness\" ? a.element.localeCompare(b.element) : 0);\n\tout.push(...disjointness);\n\treturn out;\n}\nfunction detailOf$1(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n//#endregion\n//#region src/aggregate/fabricated-migration-edge.ts\nfunction buildFabricatedMigrationEdge(args) {\n\treturn {\n\t\tdirName: \"\",\n\t\tmigrationHash: args.destinationStorageHash,\n\t\tfrom: args.currentMarkerStorageHash ?? \"\",\n\t\tto: args.destinationStorageHash,\n\t\toperationCount: args.operationCount,\n\t\t...args.destinationContractJson !== void 0 ? { destinationContractJson: args.destinationContractJson } : {}\n\t};\n}\n//#endregion\n//#region src/aggregate/loader.ts\n/**\n* Build a tolerant, queryable {@link ContractSpaceAggregate} from on-disk\n* migration state plus the caller's live app contract.\n*\n* Building **never throws on disk content**: a hash- or\n* invariants-mismatched package is retained, an unparseable package is\n* omitted, a missing extension head ref leaves `headRef: null`, and an\n* unreadable on-disk contract defers its failure to `space.contract()`.\n* Every such problem is judged by {@link ContractSpaceAggregate.checkIntegrity}\n* rather than aborting the load. The only rejections are catastrophic I/O\n* (a `migrations/` that exists but is unreadable for reasons other than\n* absence).\n*\n* The app space's head ref is synthesised from the live contract's\n* storage hash (the app contract is authored independently of the\n* migration graph), and `app.contract()` returns the supplied contract.\n* Extension spaces read their contract, refs, and head ref from disk.\n*/\nasync function loadContractSpaceAggregate(input) {\n\tconst { migrationsDir, deserializeContract, appContract, verifySnapshotContent } = input;\n\tconst targetId = appContract.target;\n\tconst appState = await loadAppSpace(migrationsDir, appContract, deserializeContract, verifySnapshotContent);\n\tconst extensionStates = await loadExtensionSpaces(migrationsDir, deserializeContract, verifySnapshotContent);\n\tconst spaces = [appState, ...extensionStates];\n\treturn createContractSpaceAggregate({\n\t\ttargetId,\n\t\tapp: appState.space,\n\t\textensions: extensionStates.map((state) => state.space),\n\t\tcheckIntegrity: (opts) => computeIntegrityViolations({\n\t\t\ttargetId,\n\t\t\tspaces\n\t\t}, opts)\n\t});\n}\nasync function loadAppSpace(migrationsDir, appContract, deserializeContract, verifySnapshotContent) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, {\n\t\tmigrationsDir,\n\t\t...ifDefined(\"verifySnapshotContent\", verifySnapshotContent)\n\t});\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId: APP_SPACE_ID,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef: {\n\t\t\t\thash: appContract.storage.storageHash,\n\t\t\t\tinvariants: []\n\t\t\t},\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => appContract,\n\t\t\tdeserializeContract,\n\t\t\t...ifDefined(\"verifySnapshotContent\", verifySnapshotContent)\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem: null,\n\t\tisApp: true\n\t};\n}\nasync function loadExtensionSpaces(migrationsDir, deserializeContract, verifySnapshotContent) {\n\tconst extensionIds = (await listContractSpaceDirectories(migrationsDir)).filter((name) => name !== APP_SPACE_ID).filter(isValidSpaceId).sort();\n\tconst states = [];\n\tfor (const spaceId of extensionIds) states.push(await loadExtensionSpace(migrationsDir, spaceId, deserializeContract, verifySnapshotContent));\n\treturn states;\n}\nasync function loadExtensionSpace(migrationsDir, spaceId, deserializeContract, verifySnapshotContent) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, spaceId);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, {\n\t\tmigrationsDir,\n\t\t...ifDefined(\"verifySnapshotContent\", verifySnapshotContent)\n\t});\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\tconst { headRef, problem: headRefProblem } = await readHeadRefTolerant(migrationsDir, spaceId);\n\tconst rawContract = await readRawContractDeferred(migrationsDir, spaceId, headRef, verifySnapshotContent);\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef,\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => deserializeContract(rawContract()),\n\t\t\tdeserializeContract,\n\t\t\t...ifDefined(\"verifySnapshotContent\", verifySnapshotContent)\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem,\n\t\tisApp: false\n\t};\n}\n/**\n* Read an extension's head ref, distinguishing a *genuinely absent*\n* `head.json` (`headRef: null`, no problem — judged `headRefMissing`)\n* from one that *exists but cannot be parsed* (`headRef: null` plus a\n* problem — judged `refUnreadable`, not `headRefMissing`).\n* `readContractSpaceHeadRef` already returns `null` only for ENOENT and\n* throws for unparseable / schema-invalid content, so the throw is the\n* corruption signal. Construction never throws on disk content.\n*/\nfunction isToleratedRefHeadReadError(error) {\n\tif (MigrationToolsError.is(error)) return true;\n\tif (!(error instanceof Error)) return false;\n\tconst code = error.code;\n\treturn code === \"ENOENT\" || code === \"EISDIR\";\n}\nasync function readHeadRefTolerant(migrationsDir, spaceId) {\n\ttry {\n\t\treturn {\n\t\t\theadRef: await readContractSpaceHeadRef(migrationsDir, spaceId),\n\t\t\tproblem: null\n\t\t};\n\t} catch (error) {\n\t\tif (!isToleratedRefHeadReadError(error)) throw error;\n\t\treturn {\n\t\t\theadRef: null,\n\t\t\tproblem: {\n\t\t\t\trefName: HEAD_REF_NAME,\n\t\t\t\tpath: contractSpaceHeadRefPath(migrationsDir, spaceId),\n\t\t\t\tdetail: detailOf(error)\n\t\t\t}\n\t\t};\n\t}\n}\nfunction detailOf(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\n/**\n* Read the raw contract snapshot-store entry eagerly (cheap I/O) but defer\n* its (throwing) failure to call time, so a missing or unparseable store\n* entry becomes a `contract()` throw — surfaced as `contractUnreadable` —\n* rather than a construction failure. When `headRef` is absent there is no\n* hash to resolve against the store, so the deferred call always throws;\n* `checkIntegrity` already reports that case as `headRefMissing`, and a\n* `checkContracts` pass surfaces the same space as `contractUnreadable`.\n*/\nasync function readRawContractDeferred(migrationsDir, spaceId, headRef, verifySnapshotContent) {\n\tif (headRef === null) return () => {\n\t\tthrow errorSpaceHeadRefMissing(spaceId);\n\t};\n\ttry {\n\t\tconst raw = await readContractSnapshotJson(migrationsDir, headRef.hash, verifySnapshotContent);\n\t\treturn () => raw;\n\t} catch (error) {\n\t\treturn () => {\n\t\t\tthrow error;\n\t\t};\n\t}\n}\n//#endregion\n//#region src/aggregate/marker-types.ts\n/** The contract hash a database is at: its marker's storage hash, or the empty contract when it has no marker. */\nfunction contractHashAtMarker(marker) {\n\treturn marker?.storageHash ?? \"empty\";\n}\n//#endregion\n//#region src/aggregate/strategies/plan-from-diff.ts\n/**\n* Plan a migration for a single contract space from a diff against the full\n* live schema, delegating to the family's `createPlanner(...).plan(...)`.\n*\n* The planner diffs the whole introspected schema, so it sees other contract\n* spaces' tables as \"extras\"; the orchestration hands the planner the\n* aggregate as an ownership oracle so it can ask, per extra, whether any\n* space owns it — a sibling-owned table is left untouched, so the planner\n* never emits a destructive drop for it, and this strategy holds no ownership\n* logic of its own. The schema is never pruned before planning: cross-space\n* foreign keys need every sibling table visible to the diff.\n*\n* The produced plan's `targetId` is set from `aggregateTargetId`\n* (the aggregate's ambient target). The family's planner does not\n* stamp `targetId` on the produced plan; the aggregate planner is\n* the single point that knows the target.\n*\n* Used by:\n*\n* - The app space by default (CLI policy\n* `ignoreGraphFor: { app.spaceId }`).\n* - Any extension space whose `headRef.invariants` is empty and whose\n* graph is non-empty (the all-external, zero-migration-package case is\n* handled directly by the aggregate planner without calling this).\n*/\nasync function planFromDiff(input) {\n\tconst plannerResult = await input.migrations.createPlanner(input.adapter).plan({\n\t\tcontract: input.space.contract(),\n\t\tschema: input.schemaIntrospection,\n\t\tpolicy: input.operationPolicy,\n\t\tfromContract: input.fromContract,\n\t\torigin: null,\n\t\tstatements: input.statements,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tspaceId: input.space.spaceId,\n\t\townership: input.ownership,\n\t\tsnapshotsImportPath: \"\"\n\t});\n\tif (plannerResult.kind === \"failure\") return {\n\t\tkind: \"failure\",\n\t\tconflicts: plannerResult.conflicts\n\t};\n\tconst producedPlan = plannerResult.plan;\n\tconst plan = new Proxy(producedPlan, {\n\t\tget(target, prop) {\n\t\t\tif (prop === \"targetId\") return input.aggregateTargetId;\n\t\t\treturn Reflect.get(target, prop, target);\n\t\t},\n\t\thas(target, prop) {\n\t\t\tif (prop === \"targetId\") return true;\n\t\t\treturn Reflect.has(target, prop);\n\t\t}\n\t});\n\tconst destinationStorageHash = producedPlan.destination.storageHash;\n\tconst producedOps = await Promise.all(producedPlan.operations);\n\tconst destinationContract = input.space.contract();\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan,\n\t\t\tdisplayOps: producedOps,\n\t\t\tdestinationContract,\n\t\t\tstrategy: \"plan-from-diff\",\n\t\t\tappliedStatements: plannerResult.appliedStatements,\n\t\t\tdataLoss: plannerResult.dataLoss,\n\t\t\taccessChanges: plannerResult.accessChanges,\n\t\t\ttemporaryValues: plannerResult.temporaryValues,\n\t\t\t...plannerResult.namespaces === void 0 ? {} : { namespaces: plannerResult.namespaces },\n\t\t\t...plannerResult.warnings && plannerResult.warnings.length > 0 ? { warnings: plannerResult.warnings } : {},\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: input.currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash,\n\t\t\t\toperationCount: producedOps.length,\n\t\t\t\tdestinationContractJson: destinationContract\n\t\t\t})]\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/strategies/resolve-recorded-path.ts\n/**\n* Resolve a contract space's hydrated migration graph to the path from the\n* live marker to `space.headRef.hash`, covering every required invariant.\n*\n* Pure synchronous function — no I/O. The aggregate's loader has\n* already integrity-checked every package and reconstructed the graph;\n* this resolves the path by looking up ops by `migrationHash` and\n* assembles a `MigrationPlan` with `targetId` set from the aggregate (no\n* placeholder cast).\n*\n* Required invariants are computed as `headRef.invariants \\ marker.invariants`\n* — the marker already declares some invariants satisfied; the path\n* only needs to provide the remainder. Mirrors today's\n* `computeExtensionSpaceApplyPath` semantics.\n*/\nfunction resolveRecordedPath(input) {\n\tconst { aggregateTargetId, space, currentMarker, refName } = input;\n\tconst headRef = requireHeadRef(space);\n\tconst graph = space.graph();\n\tconst packagesByMigrationHash = new Map(space.packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst fromHash = currentMarker?.storageHash ?? \"empty\";\n\tconst markerInvariants = new Set(currentMarker?.invariants ?? []);\n\tconst required = new Set(headRef.invariants.filter((id) => !markerInvariants.has(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, headRef.hash, {\n\t\trequired,\n\t\t...refName !== void 0 ? { refName } : {}\n\t});\n\tif (outcome.kind === \"unreachable\") return { kind: \"unreachable\" };\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tmissing: outcome.missing\n\t};\n\tconst pathOps = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tconst edgeRefs = [];\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByMigrationHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${space.spaceId}\". The hydrated migration graph and packagesByMigrationHash map are out of sync — this should be unreachable; report.`);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t\tedgeRefs.push({\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tdirName: edge.dirName,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\t...pkg.endContractJson !== void 0 ? { destinationContractJson: pkg.endContractJson } : {}\n\t\t});\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregateTargetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: pathOps,\n\t\t\t\tprovidedInvariants: [...providedInvariantsSet].sort()\n\t\t\t},\n\t\t\tdisplayOps: pathOps,\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"resolve-recorded-path\",\n\t\t\tappliedStatements: [],\n\t\t\tdataLoss: pathOps.flatMap((operation, operationIndex) => operation.operationClass === \"destructive\" ? [{\n\t\t\t\toperationIndex,\n\t\t\t\tsubject: {\n\t\t\t\t\tkind: \"storage\",\n\t\t\t\t\tname: input.storageNameOf(operation)\n\t\t\t\t},\n\t\t\t\tlabel: operation.label\n\t\t\t}] : []),\n\t\t\taccessChanges: [],\n\t\t\ttemporaryValues: [],\n\t\t\tmigrationEdges: edgeRefs,\n\t\t\tpathDecision: outcome.decision\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/planner.ts\n/**\n* Plan a migration across every contract space of a {@link ContractSpaceAggregate}.\n*\n* Statements in `input.appSpace` apply only to a diff plan, so the planner refuses them with\n* `policyConflict` unless `callerPolicy.ignoreGraphFor` includes the app space.\n*\n* Per-space operation selection, in order; first match wins:\n*\n* 1. If `callerPolicy.ignoreGraphFor.has(space.spaceId)`:\n* - If `space.headRef.invariants` is empty → `planFromDiff`.\n* - Else → `policyConflict` (a diff-fabricated plan cannot satisfy\n* authored invariants).\n* 2. Else if `space.graph()` is non-empty AND `resolveRecordedPath`\n* succeeds → its result.\n* 3. Else if `space.graph()` is non-empty but unresolvable →\n* `extensionPathUnreachable` / `extensionPathUnsatisfiable`.\n* 4. Else (empty graph — the space ships no migration packages at all,\n* e.g. an all-external extension space like Supabase's `auth`/`storage`)\n* if `space.headRef.invariants` is empty → declare the no-op state\n* directly (zero ops, destination = head ref) without invoking the\n* family planner.\n* 5. Else → `extensionPathUnsatisfiable` (an empty graph cannot satisfy\n* non-empty invariants).\n*\n* Output `applyOrder` is {@link spacesInApplyOrder}: extensions alphabetical, then app. This preserves\n* `MigrationRunnerFailure.failingSpace` attribution byte-for-byte.\n*\n* Every emitted `MigrationPlan` has `targetId = aggregate.targetId`.\n* No placeholder cast; no patch step.\n*/\nasync function planMigration(input) {\n\tconst { aggregate, currentDBState, callerPolicy } = input;\n\tconst appSpaceId = aggregate.app.spaceId;\n\tconst statementCount = input.appSpace.statements.length;\n\tif (statementCount > 0 && !callerPolicy.ignoreGraphFor.has(appSpaceId)) return notOk({\n\t\tkind: \"policyConflict\",\n\t\tspaceId: appSpaceId,\n\t\tdetail: `${statementCount} statement${statementCount === 1 ? \" was\" : \"s were\"} given for space \"${appSpaceId}\", but only a plan built from the diff applies statements, and \\`callerPolicy.ignoreGraphFor\\` does not include \"${appSpaceId}\". Add \"${appSpaceId}\" to \\`ignoreGraphFor\\` or give no statements.`\n\t});\n\tconst perSpace = /* @__PURE__ */ new Map();\n\tfor (const space of spacesInApplyOrder(aggregate)) {\n\t\tconst currentMarker = currentDBState.markersBySpaceId.get(space.spaceId) ?? null;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst ignoreGraph = callerPolicy.ignoreGraphFor.has(space.spaceId);\n\t\tconst invariantsRequired = headRef.invariants.length > 0;\n\t\tif (ignoreGraph && invariantsRequired) return notOk({\n\t\t\tkind: \"policyConflict\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tdetail: `\\`callerPolicy.ignoreGraphFor\\` requested for space \"${space.spaceId}\", but the contract space declares non-empty head-ref invariants (${headRef.invariants.join(\", \")}). A plan built directly from the contract IR cannot satisfy authored invariants — the graph must be walked. Either remove \"${space.spaceId}\" from \\`ignoreGraphFor\\` or amend the on-disk head ref to declare zero invariants.`\n\t\t});\n\t\tif (ignoreGraph) {\n\t\t\tconst diffOutcome = await planFromDiff({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tcurrentMarker,\n\t\t\t\tspace,\n\t\t\t\townership: aggregate,\n\t\t\t\tschemaIntrospection: currentDBState.schemaIntrospection,\n\t\t\t\tadapter: input.adapter,\n\t\t\t\tmigrations: input.migrations,\n\t\t\t\tframeworkComponents: input.frameworkComponents,\n\t\t\t\toperationPolicy: input.operationPolicy,\n\t\t\t\t...space.spaceId === appSpaceId ? input.appSpace : {\n\t\t\t\t\tfromContract: null,\n\t\t\t\t\tstatements: []\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (diffOutcome.kind === \"failure\") return notOk({\n\t\t\t\tkind: \"planFromDiffFailed\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tconflicts: diffOutcome.conflicts\n\t\t\t});\n\t\t\tperSpace.set(space.spaceId, diffOutcome.result);\n\t\t\tcontinue;\n\t\t}\n\t\tif (space.graph().nodes.size > 0) {\n\t\t\tconst resolved = resolveRecordedPath({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tspace,\n\t\t\t\tcurrentMarker,\n\t\t\t\tstorageNameOf: input.storageNameOf\n\t\t\t});\n\t\t\tif (resolved.kind === \"ok\") {\n\t\t\t\tperSpace.set(space.spaceId, resolved.result);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (resolved.kind === \"unreachable\") return notOk({\n\t\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\ttarget: headRef.hash\n\t\t\t});\n\t\t\treturn notOk({\n\t\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tmissingInvariants: resolved.missing\n\t\t\t});\n\t\t}\n\t\tif (invariantsRequired) return notOk({\n\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tmissingInvariants: [...headRef.invariants].sort()\n\t\t});\n\t\tif (!allStorageElementsExternal(space.contract())) return notOk({\n\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\ttarget: headRef.hash\n\t\t});\n\t\tperSpace.set(space.spaceId, {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregate.targetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: []\n\t\t\t},\n\t\t\tdisplayOps: [],\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"declared-state\",\n\t\t\tappliedStatements: [],\n\t\t\tdataLoss: [],\n\t\t\taccessChanges: [],\n\t\t\ttemporaryValues: [],\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash: headRef.hash,\n\t\t\t\toperationCount: 0\n\t\t\t})]\n\t\t});\n\t}\n\treturn ok({\n\t\tperSpace,\n\t\tapplyOrder: spacesInApplyOrder(aggregate).map((space) => space.spaceId)\n\t});\n}\nfunction pathIsUnder(path, prefix) {\n\tif (path.length < prefix.length) return false;\n\treturn prefix.every((segment, i) => path[i] === segment);\n}\n/**\n* Whether an issue's subject is a WHOLE top-level entity — as opposed to\n* something nested under one (e.g. a field, an index, or a policy). Calls\n* the injected `classify` capability, which resolves this from the issue's\n* node `nodeKind` (this aggregate never reaches into the node itself).\n* Absent `classify` (or a `classify` that returns nothing for this issue —\n* a family that doesn't classify) falls back to path shape: a\n* top-level entity's path is exactly its own name (one segment), so\n* anything deeper is nested.\n*/\nfunction isWholeEntityIssue(issue, classify) {\n\tconst granularity = classify?.(issue);\n\tif (granularity !== void 0) return granularity === \"entity\";\n\treturn issue.path.length === 1;\n}\n/**\n* A contract space's contract-satisfaction view. Strips the top-level entity\n* extras — the `not-expected` findings on whole-entity nodes (plus the\n* findings the differ's total descent reported under those entities). Those\n* belong to the standalone unclaimed-elements list\n* ({@link collectExtraElementCoordinates}), never a space's own verdict.\n*\n* Nested `not-expected` findings (an extra field on the space's own\n* declared entity…) and structural findings (an undeclared policy) are\n* the space's **own drift** and stay.\n*\n* The verdict recomputes from the surviving list: the per-space result is\n* issue-based (`ok` ⇔ the list is empty), so a space whose only failures\n* were top-level extras passes after the strip.\n*/\nfunction stripExtraFindings(result, classify) {\n\tconst droppedTablePaths = result.schema.issues.filter((issue) => issueOutcome(issue) === \"not-expected\" && isWholeEntityIssue(issue, classify)).map((issue) => issue.path);\n\tconst issues = result.schema.issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tif (classify?.(issue) === \"structural\") return true;\n\t\treturn !droppedTablePaths.some((prefix) => pathIsUnder(issue.path, prefix));\n\t});\n\tif (issues.length === result.schema.issues.length) return result;\n\tconst ok = issues.length === 0;\n\tconst { code: staleCode, ...envelope } = result;\n\treturn {\n\t\t...envelope,\n\t\tok,\n\t\t...ok ? {} : { code: result.code ?? VERIFY_CODE_SCHEMA_FAILURE },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : result.summary,\n\t\tschema: {\n\t\t\tissues,\n\t\t\t...result.schema.warnings !== void 0 ? { warnings: result.schema.warnings } : {}\n\t\t}\n\t};\n}\n/**\n* The schema-IR entity coordinate a `not-expected` `SchemaDiffIssue`\n* addresses, when its subject is a whole top-level entity. A nested leaf\n* (a field, an index, a policy on an undeclared entity) has no entity of\n* its own to report here.\n*\n* The whole-entity's name is the last path segment: the differ builds each\n* path from its nodes' ids, so at a whole-entity finding the last segment is\n* exactly the entity name — for every family, whether or not it stamps a\n* granularity. The namespace segment only exists for namespace-qualified\n* paths (`['database', namespaceId, entityName]`); single-namespace families\n* (a flat `['database', entityName]`, or a bare `[entityName]`) have no\n* separate segment, so every entity they declare implicitly shares one\n* namespace — the same sentinel the aggregate's own coordinate walk uses\n* for those families.\n*\n* `entityKind` is asked from the injected `classifyEntityKind` capability —\n* this module never names a family entity kind itself. Absent a classifier\n* (the classifier-absent path-shape fallback, e.g. a document family) the\n* coordinate carries {@link UNCLASSIFIED_ENTITY_KIND}: no ownership\n* consumer queries `declaresEntity` for a family in that state today, so\n* nothing reads the value as true.\n*/\nfunction schemaDiffIssueCoordinate(issue, classify, classifyEntityKind) {\n\tif (!isWholeEntityIssue(issue, classify)) return void 0;\n\tconst entityName = issue.path[issue.path.length - 1];\n\tif (entityName === void 0) return void 0;\n\treturn {\n\t\tnamespaceId: issue.path.length === 3 ? issue.path[1] ?? UNBOUND_NAMESPACE_ID : UNBOUND_NAMESPACE_ID,\n\t\tentityKind: classifyEntityKind?.(issue) ?? \"unclassified-entity\",\n\t\tentityName\n\t};\n}\n/**\n* The schema-IR entity coordinates of every live element this contract\n* space's diff reports as `not-expected`, deduplicated. The verifier gathers\n* these across all spaces and keeps only the coordinates no contract space\n* declares — the standalone unclaimed-elements list, reported once for the\n* whole database.\n*/\nfunction collectExtraElementCoordinates(result, classify, classifyEntityKind) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const issue of result.schema.issues) {\n\t\tif (issueOutcome(issue) !== \"not-expected\") continue;\n\t\tconst coordinate = schemaDiffIssueCoordinate(issue, classify, classifyEntityKind);\n\t\tif (coordinate === void 0) continue;\n\t\tseen.set(coordinateKey(coordinate), coordinate);\n\t}\n\treturn [...seen.values()];\n}\n//#endregion\n//#region src/aggregate/verifier.ts\n/**\n* Verify a {@link ContractSpaceAggregate} against the live database\n* state. Bundles two checks:\n*\n* - `markerCheck` per contract space: compare the live marker row against the\n* space's `headRef.hash` + `headRef.invariants`. Absence is a\n* distinct kind, not an error (callers — `db verify` strict vs\n* `db init` precondition — choose how to interpret it).\n* - `schemaCheck`: two distinct outputs from the per-space diffs.\n* `perSpace` — each space verified against the **full**\n* introspected schema, then its extras stripped, leaving the space's\n* declared nodes (its contract-satisfaction view; verdict is\n* missing/mismatch only). `unclaimed` — the extras gathered\n* across every space, deduplicated, and filtered to the names no contract\n* space declares (via the passive aggregate's ownership query); reported\n* once for the database. No schema is pruned before verifying.\n*\n* `markerCheck.orphanMarkers` lists every marker row whose `space` is\n* not a contract space of the aggregate. `db verify` callers reject orphans;\n* future tooling may not.\n*\n* Pure synchronous function; no I/O. The caller (CLI) gathers\n* `markersBySpaceId` and `schemaIntrospection` ahead of the call.\n*/\nfunction verifyMigration(input) {\n\ttry {\n\t\treturn runVerifyMigration(input);\n\t} catch (error) {\n\t\treturn notOk({\n\t\t\tkind: \"introspectionFailure\",\n\t\t\tdetail: error instanceof Error ? error.message : String(error)\n\t\t});\n\t}\n}\nfunction runVerifyMigration(input) {\n\tconst { aggregate, markersBySpaceId, schemaIntrospection, mode, verifySchemaForSpace, classifySubjectGranularity, classifyEntityKind } = input;\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tconst aggregateSpaceIds = new Set(allSpaces.map((m) => m.spaceId));\n\tconst markerPerSpace = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst marker = markersBySpaceId.get(space.spaceId) ?? null;\n\t\tif (marker === null) {\n\t\t\tmarkerPerSpace.set(space.spaceId, { kind: \"absent\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst headRef = requireHeadRef(space);\n\t\tif (marker.storageHash !== headRef.hash) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tmarkerHash: marker.storageHash,\n\t\t\t\texpected: headRef.hash\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = headRef.invariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"missingInvariants\",\n\t\t\t\tmissing: [...missing].sort()\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tmarkerPerSpace.set(space.spaceId, { kind: \"ok\" });\n\t}\n\tconst orphanMarkers = [];\n\tfor (const [spaceId, row] of markersBySpaceId) if (row !== null && !aggregateSpaceIds.has(spaceId)) orphanMarkers.push({\n\t\tspaceId,\n\t\trow\n\t});\n\torphanMarkers.sort((a, b) => a.spaceId.localeCompare(b.spaceId));\n\tconst schemaPerSpace = /* @__PURE__ */ new Map();\n\tconst extraCoordinates = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst result = verifySchemaForSpace(schemaIntrospection, space, mode);\n\t\tschemaPerSpace.set(space.spaceId, stripExtraFindings(result, classifySubjectGranularity));\n\t\tfor (const coordinate of collectExtraElementCoordinates(result, classifySubjectGranularity, classifyEntityKind)) extraCoordinates.set(coordinateKey(coordinate), coordinate);\n\t}\n\tconst unclaimed = [...new Set([...extraCoordinates.values()].filter((coordinate) => !aggregate.declaresEntity(coordinate)).map((coordinate) => coordinate.entityName))].sort((a, b) => a.localeCompare(b));\n\treturn ok({\n\t\tmarkerCheck: {\n\t\t\tperSpace: markerPerSpace,\n\t\t\torphanMarkers\n\t\t},\n\t\tschemaCheck: {\n\t\t\tperSpace: schemaPerSpace,\n\t\t\tunclaimed\n\t\t}\n\t});\n}\n//#endregion\nexport { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, contractHashAtMarker, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, spacesInApplyOrder, verifyMigration };\n\n//# sourceMappingURL=aggregate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,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mjs";
|
|
3
3
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
4
|
import { CliStructuredError as CliStructuredError$1, errorConfigValidation as errorConfigValidation$1, errorContractConfigMissing, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFileNotFound, errorMigrationPlanningFailed, errorTargetMigrationNotSupported, errorUnexpected } from "@prisma/orm-framework/errors/control";
|
|
5
5
|
import { APP_SPACE_ID, hasMigrations } from "@prisma/orm-framework/components/control";
|
|
@@ -9,7 +9,7 @@ import { join, relative, resolve } from "pathe";
|
|
|
9
9
|
import { errorHashMismatch, errorMarkerMissing, errorRuntime, errorTargetMismatch } from "@prisma/orm-framework/errors/execution";
|
|
10
10
|
import "@prisma/orm-framework/errors/migration";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
|
-
//#region ../../../1-framework/3-tooling/cli/dist/caught-errors-
|
|
12
|
+
//#region ../../../1-framework/3-tooling/cli/dist/caught-errors-I1l50iPc.mjs
|
|
13
13
|
const SHELL_SAFE = /^[A-Za-z0-9_.:/@%+,-]+$/;
|
|
14
14
|
/** The value as a shell passes it through unchanged, single-quoted when needed. */
|
|
15
15
|
function shellQuoted(value) {
|
|
@@ -58,6 +58,22 @@ function cliInvocation(ctx, db) {
|
|
|
58
58
|
dbGiven: db !== void 0
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/** The flags of `db migrate` or `db update` that a re-run repeats, as the user gave them. */
|
|
62
|
+
function rerunFlags(flags) {
|
|
63
|
+
return [
|
|
64
|
+
...flags.to === void 0 ? [] : ["--to", shellQuoted(flags.to)],
|
|
65
|
+
...flags.advanceRef === void 0 ? [] : ["--advance-ref", shellQuoted(flags.advanceRef)],
|
|
66
|
+
...flags.permitPolicyChange === true ? ["--permit-policy-change"] : []
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
/** The `db migrate` the user ran, with the flags they gave. */
|
|
70
|
+
function dbMigrateRerun(invocation) {
|
|
71
|
+
return cliCommand(invocation, "db migrate", invocation.rerunArgs ?? []);
|
|
72
|
+
}
|
|
73
|
+
/** The `db update` the user ran, with the flags they gave and `statements`, by default the run's own. */
|
|
74
|
+
function dbUpdateRerun(invocation, statements = invocation.statementArgs ?? []) {
|
|
75
|
+
return cliCommand(invocation, "db update", [...invocation.rerunArgs ?? [], ...statements]);
|
|
76
|
+
}
|
|
61
77
|
/** The commands that connect to a database: those whose flags include `dbFlag`, which a test checks. */
|
|
62
78
|
const COMMANDS_TAKING_DB = /* @__PURE__ */ new Set([
|
|
63
79
|
"contract infer",
|
|
@@ -599,7 +615,7 @@ function errorMigrationHasUnfilledPlaceholders(directory, invocation) {
|
|
|
599
615
|
const migrationTs = join(directory, "migration.ts");
|
|
600
616
|
const edit = `Replace each placeholder(...) call in ${printedPath(invocation, migrationTs)} with the value or query it stands for.`;
|
|
601
617
|
const emit = selfEmitCommand(invocation, migrationTs);
|
|
602
|
-
const migrate =
|
|
618
|
+
const migrate = dbMigrateRerun(invocation);
|
|
603
619
|
return new ActionableCliError("MIGRATION.UNFILLED_PLACEHOLDER", "Migration has unfilled placeholders", {
|
|
604
620
|
why: `The migration in ${printedPath(invocation, directory)} still has placeholder(...) calls in its migration.ts, so its ops.json does not hold their operations. Applying it would move the database to its contract without them.`,
|
|
605
621
|
fix: `${edit} Then run ${emit} to write ops.json, and run ${migrate} again.`,
|
|
@@ -1020,6 +1036,6 @@ function diagnosticWithoutConnectionString(diagnostic, connection) {
|
|
|
1020
1036
|
};
|
|
1021
1037
|
}
|
|
1022
1038
|
//#endregion
|
|
1023
|
-
export {
|
|
1039
|
+
export { errorStatementOriginUnknown as $, errorHashMismatch as A, errorPlanOriginUnknown as B, errorContractConfigMissing as C, errorDriverRequired as D, errorDatabaseConnectionRequired as E, errorMigrationPackageNotFound as F, errorRuntime as G, errorRefSetBundleNotFound as H, errorMigrationPlanningFailed as I, errorSpaceNotFound as J, errorSignRefsNotWritten as K, errorNoMigrations as L, errorLegendHumanOnly as M, errorMarkerMissing as N, errorFileNotFound as O, errorMigrationHasUnfilledPlaceholders as P, errorStatementNeedsMigrationFile as Q, errorPathUnreachable as R, errorContractArgConflict as S, writtenMigrationRunCommand as St, errorConvertAndDelete as T, errorRefSetEmptySentinel as U, errorPlanProducedNoOperations as V, errorRefSetHashNotInGraph as W, errorStatementDidNotResolveLoss as X, errorStatementAnswersNoQuestion as Y, errorStatementInvalid as Z, editFileAction as _, selfEmitCommand as _t, appRefsDirFor as a, mapRefResolutionError as at, errorConfigValidation$1 as b, targetSupportsMigrations as bt, cliCommand as c, printedPath as ct, closeQuietly as d, redactUrlCredentials as dt, errorStatementUnresolved as et, collectDeclaredInvariants as f, requireLiveDatabase as ft, displayPath as g, runCommandAction as gt, dbUpdateRerun as h, resolveMigrationPaths as ht, appMigrationsDirFor as i, getTargetMigrations as it, errorInvalidSpaceId as j, errorFromCaught as k, cliErrorFromStructured as l, printedPlanCommand as lt, dbMigrateRerun as m, resolveContractPath as mt, CliStructuredError$1 as n, errorTargetMismatch as nt, baseDirFor as o, maskConnectionUrl as ot, contractPathFor as p, rerunFlags as pt, errorSnapshotMissing as q, STORE_ORIGIN_SNAPSHOT_STEPS as r, errorUnexpected as rt, chooseAction as s, migrationsDirFor as st, ActionableCliError as t, errorTargetMigrationNotSupported as tt, cliInvocation as u, readContractEnvelope as ut, errorAdvanceRefArgConflict as v, shellQuoted as vt, errorContractValidationFailed as w, errorConsentUnused as x, toStructuralEdge as xt, errorAmbiguousMigrationRef as y, statementFlag as yt, errorPlanForgotTheFlag as z };
|
|
1024
1040
|
|
|
1025
|
-
//# sourceMappingURL=caught-errors-
|
|
1041
|
+
//# sourceMappingURL=caught-errors-I1l50iPc-D_-F2M3t.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caught-errors-I1l50iPc-D_-F2M3t.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/caught-errors-I1l50iPc.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { CliStructuredError as CliStructuredError$1, errorConfigValidation, errorContractConfigMissing, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFileNotFound, errorMigrationPlanningFailed, errorTargetMigrationNotSupported, errorUnexpected } from \"@internal/errors/control\";\nimport { APP_SPACE_ID, hasMigrations } from \"@internal/framework-components/control\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { join, relative, resolve } from \"pathe\";\nimport { errorHashMismatch, errorMarkerMissing, errorRuntime, errorTargetMismatch } from \"@internal/errors/execution\";\nimport \"@internal/errors/migration\";\nimport { readFile } from \"node:fs/promises\";\nimport { APP_SPACE_ID as APP_SPACE_ID$1, spaceMigrationDirectory } from \"@internal/migration-tools/spaces\";\n//#region src/control-api/statements/statement-flag.ts\nconst SHELL_SAFE = /^[A-Za-z0-9_.:/@%+,-]+$/;\n/** The value as a shell passes it through unchanged, single-quoted when needed. */\nfunction shellQuoted(value) {\n\treturn SHELL_SAFE.test(value) ? value : `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n/**\n* A statement written as a flag a shell passes through unchanged: the value is single-quoted when\n* it has a character a shell would read, and joined with `=` when it starts with `-`, which a\n* parser would otherwise read as a flag.\n*/\nfunction statementFlag(statement) {\n\tconst value = shellQuoted(statement.text);\n\treturn statement.text.startsWith(\"-\") ? `--${statement.verb}=${value}` : `--${statement.verb} ${value}`;\n}\n//#endregion\n//#region src/utils/next-actions.ts\n/**\n* The typed remediation the CLI attaches to its own errors and findings.\n* Constructors live here rather than in any library the CLI calls: naming a\n* runnable invocation is something only the CLI can do.\n*/\nfunction runCommandAction(label, command) {\n\treturn {\n\t\tkind: \"run-command\",\n\t\tlabel,\n\t\tcommand\n\t};\n}\n/** Advice the user carries out or decides on themselves, such as changing data in the database or choosing between plans; it has no command to run and edits no file. */\nfunction chooseAction(label) {\n\treturn {\n\t\tkind: \"user-choice\",\n\t\tlabel\n\t};\n}\n/** Advice that changes a file before anything runs again. */\nfunction editFileAction(label) {\n\treturn {\n\t\tkind: \"edit-file\",\n\t\tlabel\n\t};\n}\n//#endregion\n//#region src/utils/printed-command.ts\n/** The invocation of a command run with `ctx`, given `--db` when `db` is defined. */\nfunction cliInvocation(ctx, db) {\n\treturn {\n\t\tcwd: ctx.cwd,\n\t\tconfigPath: ctx.configPath,\n\t\tdbGiven: db !== void 0\n\t};\n}\n/** The flags of `db migrate` or `db update` that a re-run repeats, as the user gave them. */\nfunction rerunFlags(flags) {\n\treturn [\n\t\t...flags.to === void 0 ? [] : [\"--to\", shellQuoted(flags.to)],\n\t\t...flags.advanceRef === void 0 ? [] : [\"--advance-ref\", shellQuoted(flags.advanceRef)],\n\t\t...flags.permitPolicyChange === true ? [\"--permit-policy-change\"] : []\n\t];\n}\n/** The `db migrate` the user ran, with the flags they gave. */\nfunction dbMigrateRerun(invocation) {\n\treturn cliCommand(invocation, \"db migrate\", invocation.rerunArgs ?? []);\n}\n/** The `db update` the user ran, with the flags they gave and `statements`, by default the run's own. */\nfunction dbUpdateRerun(invocation, statements = invocation.statementArgs ?? []) {\n\treturn cliCommand(invocation, \"db update\", [...invocation.rerunArgs ?? [], ...statements]);\n}\n/** The commands that connect to a database: those whose flags include `dbFlag`, which a test checks. */\nconst COMMANDS_TAKING_DB = /* @__PURE__ */ new Set([\n\t\"contract infer\",\n\t\"db init\",\n\t\"db migrate\",\n\t\"db schema\",\n\t\"db sign\",\n\t\"db update\",\n\t\"db verify\",\n\t\"migration log\",\n\t\"migration status\"\n]);\nfunction configWords(configPath) {\n\treturn configPath === void 0 ? [] : [\"--config\", shellQuoted(configPath)];\n}\n/**\n* A CLI command as advice prints it: `{bin}`, the command and its arguments, the `--config` the CLI\n* was given, and, for a command that connects to a database, `--db <url>` when the CLI was given\n* `--db`, so it runs as printed from the directory the CLI ran in, against the same database. The\n* URL stays a placeholder because it can hold credentials.\n*/\nfunction cliCommand(invocation, command, args = []) {\n\treturn [\n\t\t\"{bin}\",\n\t\tcommand,\n\t\t...args,\n\t\t...configWords(invocation?.configPath),\n\t\t...invocation?.dbGiven === true && COMMANDS_TAKING_DB.has(command) ? [\"--db\", \"<url>\"] : []\n\t].join(\" \");\n}\n/**\n* The `migration plan` command advice prints: it starts from `from`, the contract the database is\n* at, whenever that is known, because `migration plan` cannot find its origin without it once\n* migrations exist and no `db` ref names one.\n*/\nfunction printedPlanCommand(invocation, from, flags) {\n\treturn cliCommand(invocation, \"migration plan\", [...from === void 0 ? [] : [\"--from\", from], ...flags]);\n}\n/**\n* The command that runs a `migration.ts`, named relative to the directory the CLI ran in, with the\n* `--config` the CLI was given, so it loads the same config.\n*/\nfunction selfEmitCommand(invocation, migrationTs) {\n\treturn [\n\t\t\"node\",\n\t\tshellQuoted(printedPath(invocation, migrationTs)),\n\t\t...configWords(invocation.configPath)\n\t].join(\" \");\n}\n/** The command that runs the `migration.ts` a `migration plan` writes, with its directory a placeholder. */\nfunction writtenMigrationRunCommand(invocation) {\n\treturn [\n\t\t\"node\",\n\t\t\"<migration directory>/migration.ts\",\n\t\t...configWords(invocation.configPath)\n\t].join(\" \");\n}\n/** A path as advice prints it: relative to the directory the CLI ran in. */\nfunction printedPath(invocation, path) {\n\treturn relative(invocation.cwd, path);\n}\n//#endregion\n//#region src/utils/cli-errors.ts\n/**\n* A CLI-raised error that carries the typed remediation as well as the prose.\n* Only the CLI knows which invocation fixes a failure, so only errors raised\n* here spell one; the foundation classes every library also raises keep\n* carrying `code`, `why` and `fix` alone.\n*\n* Both fields are required: the `fix` prose is what the commander shell still\n* renders, and the handler boundary drops it in favour of `nextActions` when it\n* settles the engine's envelope.\n*/\nvar ActionableCliError = class extends CliStructuredError$1 {\n\tnextActions;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.nextActions = options.nextActions;\n\t}\n};\n/**\n* A command that accepts a contract reference both as a positional and as a\n* flag was given both. Structured rather than a bare stderr line, so a script\n* sees the same envelope every other invocation failure produces.\n*/\nfunction errorContractArgConflict(options) {\n\tconst fix = \"Pass the contract reference once — either as the positional argument or as --contract.\";\n\treturn new ActionableCliError(\"CLI.CONTRACT_ARG_CONFLICT\", \"Cannot specify both a positional contract argument and --contract\", {\n\t\twhy: `The positional argument names \"${options.positional}\" and --contract names \"${options.flag}\"; there is no rule for which wins.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tpositional: options.positional,\n\t\t\tflag: options.flag\n\t\t}\n\t});\n}\n/**\n* A command was told both which ref to advance and not to advance any ref.\n* Same envelope as the positional/flag contract conflict, so a script sees\n* every invocation conflict in one shape.\n*/\nfunction errorAdvanceRefArgConflict(options) {\n\tconst fix = \"Pass either --advance-ref <name> or --no-advance-ref, not both.\";\n\treturn new ActionableCliError(\"CLI.ADVANCE_REF_ARG_CONFLICT\", \"Cannot specify both --advance-ref and --no-advance-ref\", {\n\t\twhy: `--advance-ref names \"${options.advanceRef}\" while --no-advance-ref asks for no ref to be written; there is no rule for which wins.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: { advanceRef: options.advanceRef }\n\t});\n}\nfunction quotedSpaces(spaces) {\n\treturn spaces.map((space) => `\"${space}\"`).join(\", \");\n}\nfunction notSignedSentence(spaces, because, becausePlural) {\n\tif (spaces.length === 0) return \"\";\n\treturn spaces.length === 1 ? ` Space ${quotedSpaces(spaces)} was not signed, because ${because}.` : ` Spaces ${quotedSpaces(spaces)} were not signed, because ${becausePlural}.`;\n}\n/**\n* `db sign` wrote the markers, then failed to write one or more refs or their snapshots. The database is signed; running the command again writes the refs. The error also names the spaces it did not sign: those whose schema failed verification, those whose marker changed while it ran, and those whose marker lacks invariants their head ref requires, and it carries each of those spaces' findings.\n*/\nfunction errorSignRefsNotWritten(options) {\n\tconst { signedSpaces, failedSpaces, conflictSpaces, refusedSpaces, unwrittenRefs, rerunCommand } = options;\n\tconst markers = signedSpaces.length === 1 ? `the marker of space ${quotedSpaces(signedSpaces)} holds its contract` : `the markers of spaces ${quotedSpaces(signedSpaces)} hold their contracts`;\n\tconst notSigned = notSignedSentence(failedSpaces, \"its schema does not satisfy its contract\", \"their schemas do not satisfy their contracts\") + notSignedSentence(conflictSpaces, \"its marker changed while db sign ran\", \"their markers changed while db sign ran\") + notSignedSentence(refusedSpaces.map(({ space }) => space), \"its marker does not record invariants its head ref requires\", \"their markers do not record invariants their head refs require\");\n\tconst refs = unwrittenRefs.map((ref) => `ref \"${ref.name}\" of space \"${ref.space}\" (${ref.reason})`).join(\"; \");\n\tconst count = unwrittenRefs.length;\n\treturn new ActionableCliError(\"MIGRATION.SIGN_REFS_NOT_WRITTEN\", `Database signed, but ${count} ${count === 1 ? \"ref was\" : \"refs were\"} not written`, {\n\t\twhy: `The database was signed: ${markers}.${notSigned} These refs were not written: ${refs}.`,\n\t\tfix: `Fix what stopped the write, then run \\`${rerunCommand}\\` again: the markers already hold the contracts, so it writes only the refs.`,\n\t\tnextActions: [runCommandAction(\"Sign again to write the refs that were not written\", rerunCommand), ...refusedSpaces.length === 0 ? [] : [runCommandAction(\"Run the migrations that provide the missing invariants, then sign again\", options.migrateCommand)]],\n\t\tmeta: {\n\t\t\tsignedSpaces,\n\t\t\tfailedSpaces,\n\t\t\tconflictSpaces,\n\t\t\trefusedSpaces,\n\t\t\tunwrittenRefs,\n\t\t\tadvancedRefs: options.advancedRefs\n\t\t},\n\t\tdiagnostics: options.diagnostics,\n\t\tcause: options.cause\n\t});\n}\nfunction errorRefSetHashNotInGraph(resolvedHash, reachableHashes) {\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none — migration graph is empty)\";\n\tconst fix = reachableHashes.length > 0 ? \"Set the ref to the `to` hash of an on-disk migration; `{bin} migration list` shows them.\" : \"Run `{bin} migration plan` first.\";\n\tconst nextActions = reachableHashes.length > 0 ? [runCommandAction(\"List the migrations and their destination hashes\", \"{bin} migration list\"), chooseAction(\"Set the ref to the `to` hash of one of them\")] : [runCommandAction(\"Plan the first migration\", \"{bin} migration plan\")];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved contract hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: reachableHashes.length > 0 ? `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.` : \"The migration graph is empty — no hashes reachable.\",\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableHashes: [...reachableHashes]\n\t\t}\n\t});\n}\nfunction errorRefSetEmptySentinel(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_EMPTY_SENTINEL\", `Cannot set ref to the empty-database sentinel: ${hash}`, {\n\t\twhy: \"The empty-database sentinel is a planner internal; it is not a valid ref target.\",\n\t\tfix: \"Set the ref to a contract hash from the migration graph, or use another ref name.\",\n\t\tnextActions: [chooseAction(\"Set the ref to a contract hash from the migration graph\"), chooseAction(\"Or use another ref name\")],\n\t\tmeta: { hash }\n\t});\n}\n/**\n* `--legend` was combined with a machine-readable or silent output flag.\n* The legend is human-only decoration on stderr.\n*/\nfunction errorLegendHumanOnly(conflictingFlag) {\n\treturn new ActionableCliError(\"MIGRATION.LEGEND_HUMAN_ONLY\", \"`--legend` is only available for human-readable output\", {\n\t\twhy: `\\`--legend\\` prints a glyph key to stderr and cannot be combined with ${conflictingFlag}.`,\n\t\tfix: `Omit ${conflictingFlag} to print the legend alongside the tree, or omit --legend when using ${conflictingFlag}.`,\n\t\tnextActions: [chooseAction(`Omit ${conflictingFlag} to print the legend alongside the tree`), chooseAction(`Or omit --legend when using ${conflictingFlag}`)],\n\t\tmeta: { conflictingFlag }\n\t});\n}\n/**\n* `--space <id>` was given a value that doesn't satisfy the contract-space\n* naming rule (`[a-z][a-z0-9_-]{0,63}` per `isValidSpaceId`). Fires before\n* any fs work — the input is syntactically rejected the same way an on-disk\n* directory with that name would be skipped by the enumerator.\n*/\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new ActionableCliError(\"MIGRATION.INVALID_SPACE_ID\", `Invalid contract space id: ${spaceId}`, {\n\t\twhy: \"Contract space ids must match [a-z][a-z0-9_-]{0,63} (lowercase, starts with a letter, max 64 characters — the rule applied to every on-disk space directory).\",\n\t\tfix: \"Pass a space id that matches the directory naming rule, or omit --space to list every space.\",\n\t\tnextActions: [chooseAction(\"Pass a space id matching [a-z][a-z0-9_-]{0,63}\"), runCommandAction(\"Or list every space\", \"{bin} migration list\")],\n\t\tmeta: { spaceId }\n\t});\n}\n/**\n* `migration list --space <id>` was given a contract-space id that has no\n* directory under `migrations/`. Distinct from \"the space exists but is\n* empty\" — that path renders the empty-state line and exits 0 per the\n* slice spec § Empty-state. This error fires only when `<projectMigrationsDir>/<spaceId>`\n* does not exist on disk.\n*\n* `availableSpaces` lists the contract-space directory names actually\n* present, sorted lex-asc, so the diagnostic can suggest a near match\n* without making the user reach for `ls`.\n*/\nfunction errorSpaceNotFound(spaceId, availableSpaces) {\n\tconst availableList = availableSpaces.length > 0 ? availableSpaces.join(\", \") : \"(none — no contract spaces on disk yet)\";\n\tconst fix = availableSpaces.length > 0 ? `Pick one of: ${availableList}. Run \\`{bin} migration list\\` (no --space) to see every space's migrations.` : \"Author a migration with `{bin} migration new` to create the first contract-space directory.\";\n\tconst nextActions = availableSpaces.length > 0 ? [chooseAction(`Pick one of: ${availableList}`), runCommandAction(\"See every space's migrations\", \"{bin} migration list\")] : [runCommandAction(\"Author the first migration, which creates the contract-space directory\", \"{bin} migration new\")];\n\treturn new ActionableCliError(\"MIGRATION.SPACE_NOT_FOUND\", `Unknown contract space: ${spaceId}`, {\n\t\twhy: `No directory named \"${spaceId}\" exists under the migrations root.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tspaceId,\n\t\t\tavailableSpaces: [...availableSpaces]\n\t\t}\n\t});\n}\n/**\n* A `migration show` target resolved to a directory or a graph node, but no\n* on-disk package was loaded for it.\n*/\nfunction errorMigrationPackageNotFound(why) {\n\treturn new ActionableCliError(\"MIGRATION.PACKAGE_NOT_FOUND\", \"Migration package not found\", {\n\t\twhy,\n\t\tfix: \"Pass a directory name, hash prefix, or path to an on-disk app-space migration package.\",\n\t\tnextActions: [chooseAction(\"Pass a directory name, hash prefix, or path to an on-disk app-space migration package\"), runCommandAction(\"List what is on disk\", \"{bin} migration list\")]\n\t});\n}\n/** The app space has no migration packages at all, so no target can resolve. */\nfunction errorNoMigrations(appMigrationsRelative) {\n\treturn new ActionableCliError(\"MIGRATION.NO_MIGRATIONS\", \"No migrations found\", {\n\t\twhy: `No migration packages found in ${appMigrationsRelative}`,\n\t\tfix: \"Run `{bin} migration plan` to create a migration first.\",\n\t\tnextActions: [runCommandAction(\"Create the first migration\", \"{bin} migration plan\")]\n\t});\n}\nfunction errorRefSetBundleNotFound(hash) {\n\treturn new ActionableCliError(\"MIGRATION.REF_SET_BUNDLE_NOT_FOUND\", `No migration bundle matches graph-node hash ${hash}`, {\n\t\twhy: `The hash is a graph node but no on-disk bundle has metadata.to = ${hash}.`,\n\t\tfix: \"Run `pnpm fixtures:check`, or re-emit the migration that produces this hash so its bundle is restored.\",\n\t\tnextActions: [runCommandAction(\"Restore the checked-in fixtures\", \"pnpm fixtures:check\"), chooseAction(\"Or re-emit the migration that produces this hash\")],\n\t\tmeta: { hash }\n\t});\n}\nfunction errorPlanForgotTheFlag(resolvedHash, reachableRefs, options) {\n\tconst reachableList = reachableRefs.length > 0 ? reachableRefs.map((r) => `${r.name} (${r.hash})`).join(\", \") : \"(none)\";\n\tconst refFix = reachableRefs.length > 0 ? `Run migration plan with ${reachableRefs.map((r) => `--from ${r.name}`).join(\" or \")}.` : \"Pass --from <contract> naming the `to` hash of an on-disk migration (`{bin} migration list` shows them), or point the db ref at one with `{bin} migration ref set db <contract>`.\";\n\tconst nextActions = reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, `{bin} migration plan --from ${ref.name}`)) : [runCommandAction(\"Plan from an explicit origin\", \"{bin} migration plan --from <contract>\"), runCommandAction(\"Point the db ref at a graph node\", \"{bin} migration ref set db <contract>\")];\n\treturn new ActionableCliError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Resolved from-hash is not in the migration graph: ${resolvedHash}`, {\n\t\twhy: `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`,\n\t\tfix: refFix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tresolvedHash,\n\t\t\treachableRefs: reachableRefs.map((r) => r.name)\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\n/**\n* `viaRef: true` (the default) mirrors migration-tools' `errorRefNotResolvable`:\n* a ref name with no pointer file, where the fallback hash isn't a graph\n* node either — there's nothing to materialize a contract from.\n* `viaRef: false` is a distinct, ref-independent case: an explicit `--from\n* <hash>` that doesn't name a ref, on an empty migration graph, so there is\n* no graph node and no ref to resolve a contract through.\n*/\nfunction errorSnapshotMissing(identifier, options) {\n\tconst viaRef = options?.viaRef !== false;\n\tconst fix = viaRef ? `Create the ref with \"{bin} migration ref set ${identifier} <hash>\" (or advance it via \"{bin} db update --advance-ref ${identifier}\"), or pass a hash that is a node in the migration graph.` : `No contract source exists for hash \"${identifier}\" on an empty migration graph. Use --from with a ref name (its contract resolves through the snapshot store), or run db update first.`;\n\tconst nextActions = viaRef ? [\n\t\trunCommandAction(`Create the ref \"${identifier}\"`, `{bin} migration ref set ${identifier} <hash>`),\n\t\trunCommandAction(\"Or advance it from the database\", `{bin} db update --advance-ref ${identifier}`),\n\t\tchooseAction(\"Or pass a hash that is a node in the migration graph\")\n\t] : [chooseAction(\"Pass --from a ref name, whose contract resolves through the snapshot store\"), runCommandAction(\"Or populate the graph first\", \"{bin} db update\")];\n\treturn new ActionableCliError(\"MIGRATION.SNAPSHOT_MISSING\", viaRef ? `Ref \"${identifier}\" is not resolvable` : `No contract source for from-hash \"${identifier}\"`, {\n\t\twhy: viaRef ? `Ref \"${identifier}\" has no pointer file, and the hash being resolved is not a node in the migration graph either.` : `Hash \"${identifier}\" is not a node in the migration graph (the graph is empty), and it does not name a ref either.`,\n\t\tfix,\n\t\tnextActions,\n\t\tmeta: {\n\t\t\tidentifier,\n\t\t\tviaRef\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\n/**\n* Default origin resolution for `migration plan` found nothing (no `--from`,\n* no `db` ref) while migrations already exist on disk. Planning would silently\n* produce an empty-origin migration that ignores the existing history — almost\n* always a mistake — so the command refuses and names the three exits.\n*/\nfunction errorPlanOriginUnknown(reachableRefs) {\n\tconst fromSuggestion = reachableRefs.length > 0 ? reachableRefs.map((r) => `--from ${r.name}`).join(\" or \") : \"--from <contract>\";\n\tconst refSetCommand = \"{bin} migration ref set db <contract>\";\n\treturn new ActionableCliError(\"MIGRATION.PLAN_ORIGIN_UNKNOWN\", \"Cannot determine the plan origin: migrations exist but no origin is named\", {\n\t\twhy: \"Migrations exist on disk, but there is no `db` ref and no --from was given, so the plan origin would silently fall back to an empty database and the resulting migration would recreate everything the existing migrations already create.\",\n\t\tfix: [\n\t\t\t`Set the \\`db\\` ref to the contract your database is at (\\`${refSetCommand}\\`), or, on a database whose migration history does not need to be kept, advance it via \\`{bin} db update\\`.`,\n\t\t\t`Or pass the origin explicitly: \\`{bin} migration plan ${fromSuggestion}\\`.`,\n\t\t\t\"Or pass --from @empty to deliberately plan from an empty database.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\trunCommandAction(\"Point the db ref at the origin contract\", refSetCommand),\n\t\t\t...reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, `{bin} migration plan --from ${ref.name}`)) : [runCommandAction(\"Plan from an explicit origin\", `{bin} migration plan ${fromSuggestion}`)],\n\t\t\trunCommandAction(\"Plan from an empty database deliberately\", \"{bin} migration plan --from @empty\")\n\t\t],\n\t\tmeta: { reachableRefs: reachableRefs.map((r) => r.name) }\n\t});\n}\nfunction errorStatementInvalid(statement, why, fix) {\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_INVALID\", `Invalid statement \"--${statement.verb} ${statement.text}\"`, {\n\t\twhy,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb\n\t\t}\n\t});\n}\n/**\n* A statement is well formed, but its names do not resolve in the\n* origin and destination contracts the way a rename requires.\n*/\nfunction errorStatementUnresolved(statement, why, fix) {\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_UNRESOLVED\", `Cannot resolve statement \"--${statement.verb} ${statement.text}\"`, {\n\t\twhy,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb\n\t\t}\n\t});\n}\n/**\n* A rename or convert typed in answer to a data-loss question was planned, and the plan still loses\n* the subject's data: the statement does not account for the operation the question was about.\n*/\nfunction errorStatementDidNotResolveLoss(statement, subject) {\n\tconst fix = `Answer the question about \"${subject}\" with ${statementFlag({\n\t\tverb: \"delete\",\n\t\ttext: subject\n\t})} if its data may be lost, or give a ${statement.verb} statement that keeps that data.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_DID_NOT_RESOLVE_LOSS\", `\"--${statement.verb} ${statement.text}\" does not keep the data of \"${subject}\"`, {\n\t\twhy: `The plan was made again with the statement, and it still loses the data of \"${subject}\".`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: statement.text,\n\t\t\tverb: statement.verb,\n\t\t\tsubject\n\t\t}\n\t});\n}\n/** `--convert` and `--delete` name the same field, and each answers its type change differently. */\nfunction errorConvertAndDelete(field) {\n\tconst fix = `Give one of them: ${statementFlag({\n\t\tverb: \"convert\",\n\t\ttext: field\n\t})}, or ${statementFlag({\n\t\tverb: \"delete\",\n\t\ttext: field\n\t})}.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_INVALID\", `\"--convert ${field}\" and \"--delete ${field}\" conflict`, {\n\t\twhy: `Both answer the type change of \"${field}\": --convert converts each value with code you write in migration.ts, and --delete lets the database cast each value, losing those it cannot keep.`,\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatement: field,\n\t\t\tverb: \"convert\"\n\t\t}\n\t});\n}\nconst MIGRATION_PLAN_VERBS = [\n\t\"rename\",\n\t\"delete\",\n\t\"convert\",\n\t\"backfill\"\n];\n/**\n* `refused`, `--convert` or `--backfill` statements that ask for code the user writes, were given\n* to `db update`, which applies its plan directly and so has no migration file whose slot the user\n* could fill. `statements` are every statement the user gave, in the order given: the `migration\n* plan` command the error suggests carries each one that command accepts, and starts from\n* `databaseStorageHash`, the contract the database is at, when it is known. Its commands repeat the\n* `--config` of `invocation`.\n*/\nfunction needsMigrationFileReason(refused) {\n\tconst converts = refused.some(({ verb }) => verb === \"convert\");\n\tconst backfills = refused.some(({ verb }) => verb === \"backfill\");\n\tif (converts && backfills) return \"--convert of a field and --backfill ask for a migration file with a slot for the code that converts the values or the value that fills the field\";\n\treturn converts ? \"--convert of a field asks for a migration file with a slot for the code that converts its values\" : \"--backfill asks for a migration file with a slot for the value that fills the field\";\n}\nfunction errorStatementNeedsMigrationFile(statements, refused, invocation, databaseStorageHash) {\n\tconst written = refused.map(({ verb, text }) => `\"--${verb} ${text}\"`);\n\tconst listed = written.length === 1 ? written[0] : `${written.slice(0, -1).join(\", \")} and ${written.at(-1)}`;\n\tconst plan = printedPlanCommand(invocation, databaseStorageHash, statements.filter(({ verb }) => MIGRATION_PLAN_VERBS.includes(verb)).map(statementFlag));\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_NEEDS_MIGRATION_FILE\", `db update cannot carry out ${listed}`, {\n\t\twhy: `${needsMigrationFileReason(refused)}, and db update has no migration file to fill: it applies its plan directly.`,\n\t\tfix: `Plan the change with ${plan}, fill in the migration.ts it writes, run that migration.ts with the \\`node\\` command \\`migration plan\\` prints, and apply it with ${cliCommand(invocation, \"db migrate\")}. Or leave out these statements: db update then asks before it loses any data.`,\n\t\tnextActions: [runCommandAction(\"Plan the change into a migration file to fill in\", plan), chooseAction(\"Or run db update without these statements\")],\n\t\tmeta: { statements: refused.map(({ verb, text }) => ({\n\t\t\tverb,\n\t\t\ttext\n\t\t})) }\n\t});\n}\nfunction unusedConsentSentence({ verb, text, alreadyAnsweredBy: answeredBy }) {\n\tif (answeredBy === void 0) return `--${verb} ${text} was given but nothing in this run asked about ${text}.`;\n\tif (answeredBy.kind === \"namespace\") return `--${verb} ${text} was given, but every question about namespace \"${answeredBy.namespace}\" was already answered by another flag.`;\n\treturn `--${verb} ${text} was given, but the question about ${answeredBy.subject} was already answered by --${answeredBy.flag.verb} ${answeredBy.flag.text}.`;\n}\nfunction errorConsentUnused(unused, asked) {\n\tconst actions = [...unused.some(({ alreadyAnsweredBy }) => alreadyAnsweredBy === void 0) ? [\"Remove the flag, or spell the subject the way the command names it.\"] : [], ...unused.some(({ alreadyAnsweredBy }) => alreadyAnsweredBy !== void 0) ? [\"Give one flag per question.\"] : []];\n\treturn new CliStructuredError$1(\"CLI.CONSENT_UNUSED\", unused.map(unusedConsentSentence).join(\" \"), {\n\t\t...ifDefined(\"why\", asked.length === 0 ? void 0 : `The run asked about ${asked.join(\", \")}.`),\n\t\tnextActions: actions.map((label) => ({\n\t\t\tkind: \"user-choice\",\n\t\t\tlabel\n\t\t})),\n\t\tmeta: {\n\t\t\tunused: unused.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\tvalues: [text]\n\t\t\t})),\n\t\t\t...asked.length === 0 ? {} : { asked }\n\t\t}\n\t});\n}\n/**\n* `delete` or `allow` statements given to a programmatic call match no question the plan asks,\n* so they consent to nothing.\n*/\nfunction errorStatementAnswersNoQuestion(statements, subjects) {\n\tconst written = statements.map(({ verb, text }) => `\"--${verb} ${text}\"`);\n\tconst listed = written.length === 1 ? `Statement ${written[0]} answers` : `Statements ${written.slice(0, -1).join(\", \")} and ${written.at(-1)} answer`;\n\tconst fix = subjects.length === 0 ? \"Leave the statements out: the plan asks no question.\" : `Leave them out, or name a subject the plan asks about: ${subjects.join(\", \")}.`;\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_ANSWERS_NO_QUESTION\", `${listed} no question of the plan`, {\n\t\twhy: \"A delete or allow statement consents to an operation the plan asks about, and these name no subject the plan would lose data from or change access to.\",\n\t\tfix,\n\t\tnextActions: [chooseAction(fix)],\n\t\tmeta: {\n\t\t\tstatements: statements.map(({ verb, text }) => ({\n\t\t\t\tverb,\n\t\t\t\ttext\n\t\t\t})),\n\t\t\tsubjects\n\t\t}\n\t});\n}\n/**\n* Without statements, `db update` drops a renamed table or column and creates it again under the\n* new name, so any advice to run without them says so.\n*/\nconst WITHOUT_STATEMENTS_DROPS = \"A plan made without statements drops the storage of each renamed model or field with its data and creates it again under the new name, and asks for consent before it does.\";\n/** How to store the snapshot of the contract the database is at, so statements can resolve. */\nconst STORE_ORIGIN_SNAPSHOT_STEPS = [\n\t\"1. Put the contract source back to the version the database is at, and run `{bin} contract emit`.\",\n\t\"2. Run `{bin} db update --advance-ref <name> --dry-run`, with the same `--db` as this command if it has one, and check that it plans no operations. Then run it again without `--dry-run`: the database matches that contract, so this changes nothing in it, and it stores the contract snapshot. If the dry run plans operations, the database has drifted from that contract; settle that before you go on.\",\n\t\"3. Put the new contract source back, run `{bin} contract emit`, and run this command again with `--advance-ref <name>`.\"\n];\n/**\n* Statements were given, but there is no origin contract to resolve their old\n* names against.\n*/\nfunction errorStatementOriginUnknown(origin) {\n\tif (origin.hash === null) return new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the database has no marker\", {\n\t\twhy: \"The database has no marker: Prisma has never initialised or updated it, so there is no earlier contract whose names a statement could rename.\",\n\t\tfix: `Leave out the statements. If the database already holds data under the old names, preview the plan with --dry-run first. ${WITHOUT_STATEMENTS_DROPS}`,\n\t\tnextActions: [chooseAction(`Leave out the statements, and preview the plan with --dry-run first. ${WITHOUT_STATEMENTS_DROPS}`)],\n\t\tmeta: {\n\t\t\thash: null,\n\t\t\tsnapshotDirectory: origin.snapshotDirectory\n\t\t}\n\t});\n\tconst meta = {\n\t\thash: origin.hash,\n\t\tsnapshotDirectory: origin.snapshotDirectory,\n\t\t...ifDefined(\"unreadable\", origin.unreadable)\n\t};\n\tif (origin.unreadable !== void 0) return new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the origin contract snapshot cannot be read\", {\n\t\twhy: `The contract snapshot for hash \"${origin.hash}\" in ${origin.snapshotDirectory} could not be read: ${origin.unreadable}`,\n\t\tfix: [\"Restore migrations/snapshots/ from version control. If no good copy exists, store the snapshot again:\", ...STORE_ORIGIN_SNAPSHOT_STEPS].join(\"\\n\"),\n\t\tnextActions: [chooseAction(\"Restore migrations/snapshots/ from version control\"), chooseAction(\"Or store the snapshot again from the contract the database is at\")],\n\t\tmeta\n\t});\n\treturn new ActionableCliError(\"MIGRATION.STATEMENT_ORIGIN_UNKNOWN\", \"Cannot resolve statements: the origin contract is unknown\", {\n\t\twhy: `No contract snapshot for hash \"${origin.hash}\" was found in ${origin.snapshotDirectory}. Statements name things in the contract the database is at, so the command needs that contract. \\`db update\\` stores the snapshot of the contract it applies only when it advances a ref: the \\`db\\` ref by default, or with \\`--db <url>\\` only the ref named by \\`--advance-ref <name>\\`. Most likely the run that brought the database to this contract advanced no ref.`,\n\t\tfix: [\n\t\t\t\"Store the snapshot of the contract the database is at, then run the rename:\",\n\t\t\t...STORE_ORIGIN_SNAPSHOT_STEPS,\n\t\t\t\"Adding --advance-ref to this command alone does not help: it would store the new contract, not the one the database is at. `migration plan --from` does not apply to `db update`.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\tchooseAction(\"Put the contract source back to the version the database is at, and emit it\"),\n\t\t\trunCommandAction(\"Check that it plans no operations (with the same --db as this command, if any)\", \"{bin} db update --advance-ref <name> --dry-run\"),\n\t\t\trunCommandAction(\"Then store its snapshot, which changes nothing in the database\", \"{bin} db update --advance-ref <name>\"),\n\t\t\tchooseAction(\"Put the new contract source back, emit it, and run this command again with --advance-ref <name>\")\n\t\t],\n\t\tmeta\n\t});\n}\n/**\n* `migration plan` refuses a first migration whose planner produced no operations: the contract\n* describes nothing to create.\n*/\nfunction errorPlanProducedNoOperations(destination) {\n\treturn errorMigrationPlanningFailed({ conflicts: [{\n\t\tkind: \"nothingToCreate\",\n\t\tsummary: \"This contract describes nothing migration plan can create, so there is no first migration to plan.\",\n\t\twhy: destination.isEmitted ? \"If the database needs something the contract does not describe, run `prisma migration new`, add its operations to the new `migration.ts`, then run that `migration.ts` with `node` to write `ops.json`.\" : \"`prisma migration new` writes a migration only to the emitted contract. If the database needs something this contract does not describe, emit it, run `prisma migration new`, add its operations to the new `migration.ts`, then run that `migration.ts` with `node` to write `ops.json`.\"\n\t}] });\n}\nconst ROLLBACK_IS_DESTRUCTIVE = \"A rollback (reverse) plan is expected to contain destructive (DROP) operations — review them before applying\";\nconst RENAMES_AND_DATA_NEED_MORE = \"Plan a rename with --rename old:new; re-adding a required field without a safe default, or a type change that needs data, may need you to fill in the planned migration.ts\";\nfunction planThenApply(meta) {\n\tconst planCommand = meta.kind === \"neverPlanned\" ? \"{bin} migration plan --name <slug>\" : meta.fromHash === EMPTY_CONTRACT_HASH ? `{bin} migration plan --to ${meta.targetHash} --name <slug>` : `{bin} migration plan --from ${meta.fromHash} --to ${meta.targetHash} --name <slug>`;\n\tconst applyCommand = meta.kind === \"neverPlanned\" ? \"{bin} db migrate\" : `{bin} db migrate --to ${meta.targetHash}`;\n\treturn {\n\t\tfix: [\n\t\t\t\"Plan the missing edge, then apply it:\",\n\t\t\t` 1. ${planCommand}`,\n\t\t\t` 2. ${applyCommand}`,\n\t\t\t`${ROLLBACK_IS_DESTRUCTIVE}.`,\n\t\t\t`${RENAMES_AND_DATA_NEED_MORE}.`,\n\t\t\t\"Inspect the on-disk graph with `{bin} migration list`, or `{bin} migration show <bundle>` for any bundle in the path you expected.\"\n\t\t].join(\"\\n\"),\n\t\tnextActions: [\n\t\t\trunCommandAction(\"Plan the missing edge\", planCommand),\n\t\t\trunCommandAction(\"Apply it\", applyCommand),\n\t\t\tchooseAction(ROLLBACK_IS_DESTRUCTIVE),\n\t\t\tchooseAction(RENAMES_AND_DATA_NEED_MORE),\n\t\t\trunCommandAction(\"Inspect the on-disk graph\", \"{bin} migration list\"),\n\t\t\trunCommandAction(\"Inspect a bundle in the path you expected\", \"{bin} migration show <bundle>\")\n\t\t]\n\t};\n}\n/** `MIGRATION.UNFILLED_PLACEHOLDER` from `db migrate`: a migration to apply still has `placeholder(...)` calls, so its `ops.json` lacks their operations. */\nfunction errorMigrationHasUnfilledPlaceholders(directory, invocation) {\n\tconst migrationTs = join(directory, \"migration.ts\");\n\tconst edit = `Replace each placeholder(...) call in ${printedPath(invocation, migrationTs)} with the value or query it stands for.`;\n\tconst emit = selfEmitCommand(invocation, migrationTs);\n\tconst migrate = dbMigrateRerun(invocation);\n\treturn new ActionableCliError(\"MIGRATION.UNFILLED_PLACEHOLDER\", \"Migration has unfilled placeholders\", {\n\t\twhy: `The migration in ${printedPath(invocation, directory)} still has placeholder(...) calls in its migration.ts, so its ops.json does not hold their operations. Applying it would move the database to its contract without them.`,\n\t\tfix: `${edit} Then run ${emit} to write ops.json, and run ${migrate} again.`,\n\t\tnextActions: [\n\t\t\teditFileAction(edit),\n\t\t\trunCommandAction(\"Write ops.json\", emit),\n\t\t\trunCommandAction(\"Apply the migration\", migrate)\n\t\t],\n\t\tmeta: { directory }\n\t});\n}\n/** `MIGRATION.PATH_UNREACHABLE`, advising to plan the missing edge and apply it unless `advice` says otherwise. */\nfunction errorPathUnreachable(failure, advice = planThenApply(failure.meta)) {\n\treturn new ActionableCliError(\"MIGRATION.PATH_UNREACHABLE\", failure.summary, {\n\t\twhy: failure.why,\n\t\tfix: advice.fix,\n\t\tnextActions: advice.nextActions,\n\t\tmeta: failure.meta\n\t});\n}\n/**\n* Shared \"needs a live database\" precondition for read verbs that consult the\n* marker/ledger (`migration log`, `migration status`). A command needs both a\n* connection string and a control-plane driver; either missing yields the same\n* `CONFIG.DB_CONNECTION_REQUIRED` envelope with `meta.missingFlags` (canonical long-form flags\n* per CLI Style Guide §Errors) so callers can react programmatically. Returns\n* `null` when both are present.\n*/\nfunction requireLiveDatabase(args) {\n\tif (args.dbConnection && args.hasDriver) return null;\n\tconst missingFlags = args.dbConnection ? [] : [\"--db\"];\n\treturn errorDatabaseConnectionRequired({\n\t\twhy: args.why,\n\t\tmissingFlags,\n\t\t...ifDefined(\"commandName\", args.commandName),\n\t\t...ifDefined(\"retryCommand\", args.retryCommand)\n\t});\n}\n/**\n* Maps a `RefResolutionError` from the contract/migration reference\n* resolver into a CLI structured error envelope.\n*/\n/**\n* A migration ref (dirName or hash-prefix) resolves in more than one contract\n* space. The user must qualify with `--space <id>` to disambiguate.\n*/\nfunction errorAmbiguousMigrationRef(ref, spaceIds) {\n\tconst spaceList = spaceIds.join(\", \");\n\treturn new ActionableCliError(\"MIGRATION.AMBIGUOUS_MIGRATION_REF\", `Ambiguous migration reference: \"${ref}\" resolves in multiple spaces — qualify with --space <id>`, {\n\t\twhy: `\"${ref}\" matches migrations in spaces: ${spaceList}.`,\n\t\tfix: `Qualify with --space <id> to select one space. Available matching spaces: ${spaceList}.`,\n\t\tnextActions: [chooseAction(`Qualify with --space <id>, one of: ${spaceList}`)],\n\t\tmeta: {\n\t\t\tref,\n\t\t\tspaceIds: [...spaceIds]\n\t\t}\n\t});\n}\nfunction mapRefResolutionError(error) {\n\tswitch (error.kind) {\n\t\tcase \"not-found\": {\n\t\t\tconst fix = error.grammar === \"contract\" ? \"Provide a valid contract hash, ref name, or migration directory name.\" : \"Provide a valid migration directory name or migration hash.\";\n\t\t\treturn new ActionableCliError(\"MIGRATION.REF_NOT_FOUND\", `Not a known ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\t\twhy: `No ${error.grammar} matching \"${error.input}\" exists in the migration graph or refs index.`,\n\t\t\t\tfix,\n\t\t\t\tnextActions: [chooseAction(fix)],\n\t\t\t\tmeta: {\n\t\t\t\t\tinput: error.input,\n\t\t\t\t\tgrammar: error.grammar\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tcase \"ambiguous\": return new ActionableCliError(\"MIGRATION.REF_AMBIGUOUS\", `Ambiguous ${error.grammar} reference: \"${error.input}\"`, {\n\t\t\twhy: `\"${error.input}\" matches multiple ${error.grammar}s: ${error.candidates.join(\", \")}`,\n\t\t\tfix: \"Provide a longer prefix or use the full hash to disambiguate.\",\n\t\t\tnextActions: [chooseAction(\"Provide a longer prefix or use the full hash to disambiguate\")],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\tcandidates: error.candidates,\n\t\t\t\tgrammar: error.grammar\n\t\t\t}\n\t\t});\n\t\tcase \"wrong-grammar\": return new ActionableCliError(\"MIGRATION.REF_WRONG_GRAMMAR\", error.message, {\n\t\t\twhy: error.message,\n\t\t\tfix: error.fix,\n\t\t\tnextActions: [chooseAction(error.fix)],\n\t\t\tmeta: {\n\t\t\t\tinput: error.input,\n\t\t\t\texpectedGrammar: error.expectedGrammar\n\t\t\t}\n\t\t});\n\t\tcase \"invalid-format\": return new ActionableCliError(\"MIGRATION.REF_INVALID_FORMAT\", `Invalid reference format: \"${error.input}\"`, {\n\t\t\twhy: error.reason,\n\t\t\tfix: \"Provide a valid contract hash, ref name, or migration directory name.\",\n\t\t\tnextActions: [chooseAction(\"Provide a valid contract hash, ref name, or migration directory name\")],\n\t\t\tmeta: { input: error.input }\n\t\t});\n\t}\n}\n//#endregion\n//#region src/orm/migration/paths.ts\n/**\n* The directory of the config file that wrote the section, recorded when the\n* engine validated it. Every command runs behind that validation, so its\n* absence here is a bug.\n*/\nfunction baseDirFor(config) {\n\tif (config.baseDir === void 0) throw new InternalError(\"the orm config section reached a command without baseDir\");\n\treturn config.baseDir;\n}\n/**\n* Where a config keeps its migrations: `migrations.dir`, default `migrations`, resolved against the config's `baseDir`. `base` stands in for `baseDir` when a config built in memory carries none.\n*/\nfunction migrationsDirFor(config, base) {\n\treturn resolve(config.baseDir ?? base ?? baseDirFor(config), config.migrations?.dir ?? \"migrations\");\n}\n/** The app subspace under {@link migrationsDirFor}. */\nfunction appMigrationsDirFor(config) {\n\treturn spaceMigrationDirectory(migrationsDirFor(config), APP_SPACE_ID);\n}\n/**\n* Where refs live. The framework keeps them under the app subspace rather than\n* at the migrations root.\n*/\nfunction appRefsDirFor(config) {\n\treturn resolve(appMigrationsDirFor(config), \"refs\");\n}\n/** The emitted contract; the validated config carries `contract.output` absolute. */\nfunction contractPathFor(config) {\n\treturn config.contract?.output;\n}\n/**\n* The header's rendering of a path: relative to where the user invoked the\n* CLI, as the commander shell rendered it against the config file.\n*/\nfunction displayPath(path, cwd) {\n\treturn relative(cwd, path);\n}\n//#endregion\n//#region src/utils/url-credentials.ts\nconst MASK = \"****\";\nconst URL_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\//;\nconst LEADING_URL_USERINFO = /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/([^/?#\\s]+)@/;\nconst URL_USERINFO = /([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)([^/?#\\s]+)@/g;\nconst PASSWORD_QUERY_PARAMETER = /([?&][^=&#\\s]*password[^=&#\\s]*=)([^&#\\s]*)/gi;\nfunction hasUrlScheme(text) {\n\treturn URL_SCHEME.test(text);\n}\n/**\n* Reads the userinfo of a URL without parsing its hosts, so it works for URLs `new URL` rejects,\n* such as a seed list of several `host:port` pairs. The userinfo ends at the last `@` before the\n* first `/`, `?` or `#`.\n*/\nfunction urlUserinfo(url) {\n\treturn splitUserinfo(url.match(LEADING_URL_USERINFO)?.[1] ?? \"\");\n}\n/**\n* Reads the values of the query parameters whose key contains `password`, the same ones\n* `redactUrlCredentials` masks, without parsing hosts.\n*/\nfunction passwordQueryValues(url) {\n\treturn [...url.matchAll(PASSWORD_QUERY_PARAMETER)].map((match) => match[2] ?? \"\");\n}\n/**\n* Masks the userinfo and any password query parameter of every URL in `text`, without parsing\n* hosts. The masked form matches what `new URL` gives when its username and password are set to\n* `****`.\n*/\nfunction redactUrlCredentials(text) {\n\treturn text.replace(URL_USERINFO, (_match, scheme, userinfo) => `${scheme}${maskUserinfo(splitUserinfo(userinfo))}@`).replace(PASSWORD_QUERY_PARAMETER, `$1${MASK}`);\n}\nfunction splitUserinfo(userinfo) {\n\tconst colon = userinfo.indexOf(\":\");\n\tif (colon === -1) return {\n\t\tusername: userinfo,\n\t\tpassword: \"\"\n\t};\n\treturn {\n\t\tusername: userinfo.slice(0, colon),\n\t\tpassword: userinfo.slice(colon + 1)\n\t};\n}\nfunction maskUserinfo({ username, password }) {\n\treturn `${username ? MASK : \"\"}${password ? `:${MASK}` : \"\"}`;\n}\n//#endregion\n//#region src/utils/command-helpers.ts\nconst PASSWORD_QUERY_KEY = /password/i;\n/**\n* Resolves the absolute path to contract.json from the config.\n*/\nfunction resolveContractPath(config) {\n\tif (config.contract?.output === void 0) throw errorRuntime(\"CONFIG.VALIDATION_FAILED\", \"config.contract.output is required to resolve the contract path\", {\n\t\twhy: \"CLI commands read the emitted contract from config.contract.output; the config has no value to read.\",\n\t\tfix: \"Ensure your prisma.config.ts goes through `defineConfig()`, which normalises a default output when the provider supplies an input path, or set `contract.output` explicitly.\"\n\t});\n\treturn resolve(config.contract.output);\n}\n/**\n* Resolves the migrations directory and config path from CLI options.\n* Shared by migrate, migration-plan, and migration-status.\n*\n* - `migrationsDir` is the project's top-level `migrations/` directory\n* (the root that the aggregate loader walks for every contract space).\n* - `appMigrationsDir` is the app subspace directory under it\n* (`<migrationsDir>/<APP_SPACE_ID>/`). Every per-app reader / writer\n* (`migration new`, `migration plan`, `migrate`,\n* `migration status`, `migration show`, `migration ref`) operates on\n* this directory. Extensions own their own `migrations/<spaceId>/`.\n* - `refsDir` is the app's refs directory (`<appMigrationsDir>/refs/`).\n* The framework does not maintain refs at the migrations root.\n*\n* `cwd` is the directory the command was invoked from; every relative path in\n* the result is computed against it.\n*/\nfunction resolveMigrationPaths(config, cwd) {\n\tconst configPath = \"prisma.config.ts\";\n\tconst migrationsDir = migrationsDirFor(config, cwd);\n\tconst migrationsRelative = relative(cwd, migrationsDir);\n\tconst appMigrationsDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID$1);\n\treturn {\n\t\tconfigPath,\n\t\tmigrationsDir,\n\t\tmigrationsRelative,\n\t\tappMigrationsDir,\n\t\tappMigrationsRelative: relative(cwd, appMigrationsDir),\n\t\trefsDir: resolve(appMigrationsDir, \"refs\")\n\t};\n}\nfunction collectDeclaredInvariants(graph) {\n\tconst declared = /* @__PURE__ */ new Set();\n\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) for (const inv of edge.invariants) declared.add(inv);\n\treturn declared;\n}\n/**\n* Maps a `MigrationEdge` to the structural-edge shape used in the\n* `MIGRATION.NO_INVARIANT_PATH` error envelope. Shared between\n* `migrate` and `migration status` so both commands surface\n* the same JSON wire shape when an invariant-aware route is unsatisfiable.\n*/\nfunction toStructuralEdge(edge) {\n\treturn {\n\t\tdirName: edge.dirName,\n\t\tmigrationHash: edge.migrationHash,\n\t\tfrom: edge.from,\n\t\tto: edge.to,\n\t\tinvariants: edge.invariants\n\t};\n}\nfunction targetSupportsMigrations(target) {\n\treturn hasMigrations(target);\n}\n/**\n* Hangs up without letting the hang-up decide the command's result. A rejection out of a\n* `finally` replaces the value the `try`/`catch` already returned, so an unguarded close turns a\n* mapped connection error into an unmapped one — and that is the case it hits most, because a\n* `connect()` that failed leaves nothing to close.\n*/\nasync function closeQuietly(client) {\n\ttry {\n\t\tawait client.close();\n\t} catch {}\n}\nfunction getTargetMigrations(target) {\n\treturn hasMigrations(target) ? target.migrations : void 0;\n}\n/**\n* Reads and parses contract.json, validating the framework-level envelope\n* fields (storageHash, schemaVersion, target, targetFamily).\n*\n* Family-specific validation (storage structure, codec mappings, etc.)\n* happens downstream in the control client via the family instance.\n*/\nasync function readContractEnvelope(config) {\n\tconst contractPath = resolveContractPath(config);\n\tconst content = await readFile(contractPath, \"utf-8\");\n\tconst json = JSON.parse(content);\n\tconst { schemaVersion, target, targetFamily, profileHash } = json;\n\tconst storageHash = json[\"storage\"]?.[\"storageHash\"];\n\tif (typeof storageHash !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \\`{bin} contract emit\\` to regenerate.`, { where: { path: contractPath } });\n\tif (typeof schemaVersion !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });\n\tif (typeof target !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });\n\tif (typeof targetFamily !== \"string\") throw new CliStructuredError$1(\"CONTRACT.VALIDATION_FAILED\", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });\n\treturn {\n\t\t...json,\n\t\tstorageHash,\n\t\tschemaVersion,\n\t\ttarget,\n\t\ttargetFamily,\n\t\t...typeof profileHash === \"string\" ? { profileHash } : {}\n\t};\n}\n/**\n* Masks credentials in a database connection URL.\n* Handles standard URLs (username + password + query params), URLs `new URL` rejects (such as\n* multi-host URLs), and libpq-style key=value strings.\n*/\nfunction maskConnectionUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tif (parsed.username) parsed.username = \"****\";\n\t\tif (parsed.password) parsed.password = \"****\";\n\t\tfor (const key of [...parsed.searchParams.keys()]) if (PASSWORD_QUERY_KEY.test(key)) parsed.searchParams.set(key, \"****\");\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn hasUrlScheme(url) ? redactUrlCredentials(url) : maskKeyValueCredentials(url);\n\t}\n}\n/**\n* Strips raw connection URL fragments from an error message to prevent credential leakage.\n* Call this before surfacing driver errors to the user.\n*/\nfunction sanitizeErrorMessage(message, connectionUrl) {\n\tif (!connectionUrl) return message;\n\tconst secrets = connectionUrlSecrets(connectionUrl);\n\tif (secrets === void 0) return maskKeyValueCredentials(message);\n\tlet sanitized = message.replaceAll(connectionUrl, maskConnectionUrl(connectionUrl));\n\tfor (const secret of secrets.filter(Boolean).sort(longestFirst)) sanitized = sanitized.replaceAll(secret, \"****\");\n\treturn sanitized;\n}\n/** A next action with the connection string removed from each of its strings. */\nfunction nextActionWithoutConnectionString(action, connectionUrl) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connectionUrl);\n\treturn {\n\t\tkind: action.kind,\n\t\tlabel: clean(action.label),\n\t\t...ifDefined(\"command\", action.command === void 0 ? void 0 : clean(action.command)),\n\t\t...ifDefined(\"commands\", action.commands?.map(clean)),\n\t\t...ifDefined(\"url\", action.url === void 0 ? void 0 : clean(action.url)),\n\t\t...ifDefined(\"reason\", action.reason === void 0 ? void 0 : clean(action.reason))\n\t};\n}\n/** `meta` with the connection string removed from every string it holds, however deeply nested. */\nfunction metaWithoutConnectionString(meta, connectionUrl) {\n\tconst clean = (value) => {\n\t\tif (typeof value === \"string\") return sanitizeErrorMessage(value, connectionUrl);\n\t\tif (Array.isArray(value)) return value.map(clean);\n\t\tif (typeof value === \"object\" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, clean(entry)]));\n\t\treturn value;\n\t};\n\treturn Object.fromEntries(Object.entries(meta).map(([key, value]) => [key, clean(value)]));\n}\nfunction connectionUrlSecrets(connectionUrl) {\n\ttry {\n\t\tconst { username, password, searchParams } = new URL(connectionUrl);\n\t\treturn [\n\t\t\tusername,\n\t\t\tpassword,\n\t\t\t...[...searchParams].filter(([key]) => PASSWORD_QUERY_KEY.test(key)).map(([, value]) => value)\n\t\t];\n\t} catch {\n\t\tif (!hasUrlScheme(connectionUrl)) return;\n\t\tconst { username, password } = urlUserinfo(connectionUrl);\n\t\treturn [\n\t\t\tusername,\n\t\t\tpassword,\n\t\t\t...passwordQueryValues(connectionUrl)\n\t\t];\n\t}\n}\nfunction longestFirst(a, b) {\n\treturn b.length - a.length;\n}\nfunction maskKeyValueCredentials(text) {\n\treturn text.replace(/password\\s*=\\s*\\S+/gi, \"password=****\").replace(/user\\s*=\\s*\\S+/gi, \"user=****\");\n}\n//#endregion\n//#region src/control-api/operations/caught-errors.ts\n/**\n* The error a command reports for one it caught. A CLI error is reported as it is, and so is any other error a library raised with a structured code, such as `CONTRACT.DEFAULT_INVALID` for a stale contract's default or `CONTRACT.TYPE_PARAMS_INVALID` for its type parameters: the code says what went wrong better than the command can. An `InternalError` is thrown again, so the command boundary, `defineOrmCommand`, lets the engine report it as a bug. Anything else is reported as `CLI.UNEXPECTED` with the `why` the command gives for the error's message, and a `code` it carries that is not a structured one, such as a driver's `ECONNREFUSED` or a SQLSTATE, in `meta.code`.\n*\n* A command that holds a database connection passes its connection string, which is then removed from every string the reported error carries, whichever of those it is.\n*/\nfunction errorFromCaught(error, why, options = {}) {\n\tconst reported = reportedError(error, why);\n\treturn options.connection === void 0 ? reported : withoutConnectionString(reported, options.connection);\n}\n/** A structured error a library raised, reported under its own code, message and fields. */\nfunction cliErrorFromStructured(error) {\n\tif (CliStructuredError$1.is(error)) return error;\n\treturn new CliStructuredError$1(error.code, error.message, {\n\t\t...ifDefined(\"severity\", error.severity),\n\t\t...ifDefined(\"why\", error.why),\n\t\t...ifDefined(\"fix\", error.fix),\n\t\t...ifDefined(\"nextActions\", error.nextActions),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl),\n\t\tcause: error\n\t});\n}\nfunction reportedError(error, why) {\n\tif (isInternalError(error)) throw error;\n\tif (CliStructuredError$1.is(error)) return error;\n\tif (isStructuredError(error)) return cliErrorFromStructured(error);\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst driverCode = error instanceof Error ? Reflect.get(error, \"code\") : void 0;\n\treturn errorUnexpected(message, {\n\t\twhy: why(message),\n\t\t...ifDefined(\"meta\", typeof driverCode === \"string\" ? { code: driverCode } : void 0),\n\t\tcause: error\n\t});\n}\nfunction withoutConnectionString(error, connection) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connection);\n\treturn new CliStructuredError$1(error.code, clean(error.message), {\n\t\tseverity: error.severity,\n\t\t...ifDefined(\"why\", error.why === void 0 ? void 0 : clean(error.why)),\n\t\t...ifDefined(\"fix\", error.fix === void 0 ? void 0 : clean(error.fix)),\n\t\t...ifDefined(\"nextActions\", error.nextActions?.map((action) => nextActionWithoutConnectionString(action, connection))),\n\t\t...ifDefined(\"diagnostics\", error.diagnostics?.map((diagnostic) => diagnosticWithoutConnectionString(diagnostic, connection))),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta === void 0 ? void 0 : metaWithoutConnectionString(error.meta, connection)),\n\t\t...ifDefined(\"docsUrl\", error.docsUrl),\n\t\tcause: error.cause\n\t});\n}\nfunction diagnosticWithoutConnectionString(diagnostic, connection) {\n\tconst clean = (text) => sanitizeErrorMessage(text, connection);\n\treturn {\n\t\t...diagnostic,\n\t\tsummary: clean(diagnostic.summary),\n\t\t...ifDefined(\"why\", diagnostic.why === void 0 ? void 0 : clean(diagnostic.why)),\n\t\tnextActions: diagnostic.nextActions.map((action) => nextActionWithoutConnectionString(action, connection)),\n\t\t...ifDefined(\"meta\", diagnostic.meta === void 0 ? void 0 : metaWithoutConnectionString(diagnostic.meta, connection))\n\t};\n}\n//#endregion\nexport { errorStatementDidNotResolveLoss as $, errorDatabaseConnectionRequired as A, errorNoMigrations as B, errorAmbiguousMigrationRef as C, errorContractConfigMissing as D, errorContractArgConflict as E, errorLegendHumanOnly as F, errorRefSetBundleNotFound as G, errorPlanForgotTheFlag as H, errorMarkerMissing as I, errorRuntime as J, errorRefSetEmptySentinel as K, errorMigrationHasUnfilledPlaceholders as L, errorFileNotFound as M, errorHashMismatch as N, errorContractValidationFailed as O, errorInvalidSpaceId as P, errorStatementAnswersNoQuestion as Q, errorMigrationPackageNotFound as R, errorAdvanceRefArgConflict as S, statementFlag as St, errorConsentUnused as T, errorPlanOriginUnknown as U, errorPathUnreachable as V, errorPlanProducedNoOperations as W, errorSnapshotMissing as X, errorSignRefsNotWritten as Y, errorSpaceNotFound as Z, displayPath as _, writtenMigrationRunCommand as _t, getTargetMigrations as a, errorTargetMismatch as at, CliStructuredError$1 as b, runCommandAction as bt, resolveContractPath as c, requireLiveDatabase as ct, toStructuralEdge as d, dbMigrateRerun as dt, errorStatementInvalid as et, redactUrlCredentials as f, dbUpdateRerun as ft, contractPathFor as g, selfEmitCommand as gt, baseDirFor as h, rerunFlags as ht, collectDeclaredInvariants as i, errorTargetMigrationNotSupported as it, errorDriverRequired as j, errorConvertAndDelete as k, resolveMigrationPaths as l, cliCommand as lt, appRefsDirFor as m, printedPlanCommand as mt, errorFromCaught as n, errorStatementOriginUnknown as nt, maskConnectionUrl as o, errorUnexpected as ot, appMigrationsDirFor as p, printedPath as pt, errorRefSetHashNotInGraph as q, closeQuietly as r, errorStatementUnresolved as rt, readContractEnvelope as s, mapRefResolutionError as st, cliErrorFromStructured as t, errorStatementNeedsMigrationFile as tt, targetSupportsMigrations as u, cliInvocation as ut, migrationsDirFor as v, chooseAction as vt, errorConfigValidation as w, STORE_ORIGIN_SNAPSHOT_STEPS as x, shellQuoted as xt, ActionableCliError as y, editFileAction as yt, errorMigrationPlanningFailed as z };\n\n//# sourceMappingURL=caught-errors-I1l50iPc.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,aAAa;;AAEnB,SAAS,YAAY,OAAO;CAC3B,OAAO,WAAW,KAAK,KAAK,IAAI,QAAQ,IAAI,MAAM,WAAW,KAAK,OAAO,EAAE;AAC5E;;;;;;AAMA,SAAS,cAAc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