@prisma/orm-toolchain 8.0.0-rc.4-dev.15 → 8.0.0-rc.4-dev.17
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-BOlLu7k7.mjs → aggregate-EMuVN6hq.mjs} +8 -8
- package/dist/{aggregate-BOlLu7k7.mjs.map → aggregate-EMuVN6hq.mjs.map} +1 -1
- package/dist/cli.mjs +60 -65
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__migration-cli.mjs +3 -3
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs} +3 -3
- package/dist/{contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs.map → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map} +1 -1
- package/dist/{errors-CcEpbfnE-CsSXrttT.mjs → errors-SoLLYLtw-DMxVbVs9.mjs} +9 -9
- package/dist/errors-SoLLYLtw-DMxVbVs9.mjs.map +1 -0
- package/dist/{graph-membership-BoITerZB-C2-x1Qp6.mjs → graph-membership-DY1Onbc3-CwBd6wuB.mjs} +3 -3
- package/dist/{graph-membership-BoITerZB-C2-x1Qp6.mjs.map → graph-membership-DY1Onbc3-CwBd6wuB.mjs.map} +1 -1
- package/dist/{invariants-DcFfhJMZ-BHDWZP9k.mjs → invariants-Cww4bv0v-BEiFxmbX.mjs} +3 -3
- package/dist/{invariants-DcFfhJMZ-BHDWZP9k.mjs.map → invariants-Cww4bv0v-BEiFxmbX.mjs.map} +1 -1
- package/dist/{io-DsViRB_O-Ci1kJGBg.mjs → io-BmWQNxRP-DQqbcPsS.mjs} +5 -5
- package/dist/{io-DsViRB_O-Ci1kJGBg.mjs.map → io-BmWQNxRP-DQqbcPsS.mjs.map} +1 -1
- package/dist/{migration-CWSj4pMr.mjs → migration-B9w-7dKe.mjs} +3 -3
- package/dist/{migration-CWSj4pMr.mjs.map → migration-B9w-7dKe.mjs.map} +1 -1
- package/dist/{migration-graph-DwXAHP6T-NgmP2DNz.mjs → migration-graph-CW4bMmTz-B5xFtFVB.mjs} +3 -3
- package/dist/{migration-graph-DwXAHP6T-NgmP2DNz.mjs.map → migration-graph-CW4bMmTz-B5xFtFVB.mjs.map} +1 -1
- package/dist/migration-tools.mjs +12 -12
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-DJkSkzAt-DCYlpVrB.mjs → ref-XdaDN3GF-Io-mSVS6.mjs} +51 -51
- package/dist/ref-XdaDN3GF-Io-mSVS6.mjs.map +1 -0
- package/dist/{ref-resolution-Cbdejrwt.mjs → ref-resolution-D77jPigU.mjs} +2 -2
- package/dist/{ref-resolution-Cbdejrwt.mjs.map → ref-resolution-D77jPigU.mjs.map} +1 -1
- package/dist/{refs-KVVlm3lE-BcqdpdYD.mjs → refs-BpSpzdYB-BcDelHGt.mjs} +9 -9
- package/dist/refs-BpSpzdYB-BcDelHGt.mjs.map +1 -0
- package/dist/{spaces-CHrjWRoZ.mjs → spaces-BCZiAZQn.mjs} +6 -6
- package/dist/{spaces-CHrjWRoZ.mjs.map → spaces-BCZiAZQn.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs} +7 -7
- package/dist/{verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs.map → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/errors-CcEpbfnE-CsSXrttT.mjs.map +0 -1
- package/dist/ref-DJkSkzAt-DCYlpVrB.mjs.map +0 -1
- package/dist/refs-KVVlm3lE-BcqdpdYD.mjs.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { r as getEmittedArtifactPaths, t as emit } from "./exports-Dw2WIX63-CQgI2e_L.mjs";
|
|
2
|
-
import { O as errorNoInvariantPath, P as errorUnknownInvariant, b as errorInvalidRefName, i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-
|
|
3
|
-
import { a as snapshotsImportPathFrom, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
2
|
+
import { O as errorNoInvariantPath, P as errorUnknownInvariant, b as errorInvalidRefName, i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-SoLLYLtw-DMxVbVs9.mjs";
|
|
3
|
+
import { a as snapshotsImportPathFrom, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs";
|
|
4
4
|
import { n as verifyMigrationHash, t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
5
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
6
|
-
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-
|
|
5
|
+
import { t as deriveProvidedInvariants } from "./invariants-Cww4bv0v-BEiFxmbX.mjs";
|
|
6
|
+
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-BmWQNxRP-DQqbcPsS.mjs";
|
|
7
7
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
8
|
-
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-
|
|
9
|
-
import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-
|
|
10
|
-
import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-
|
|
11
|
-
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID$1 } from "./verify-contract-spaces-
|
|
12
|
-
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-
|
|
13
|
-
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-
|
|
8
|
+
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-DY1Onbc3-CwBd6wuB.mjs";
|
|
9
|
+
import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-CW4bMmTz-B5xFtFVB.mjs";
|
|
10
|
+
import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-BpSpzdYB-BcDelHGt.mjs";
|
|
11
|
+
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID$1 } from "./verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs";
|
|
12
|
+
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-EMuVN6hq.mjs";
|
|
13
|
+
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-BCZiAZQn.mjs";
|
|
14
14
|
import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver } from "./import-roots-kw_vAdpJ.mjs";
|
|
15
|
-
import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-
|
|
15
|
+
import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-D77jPigU.mjs";
|
|
16
16
|
import { i as writeMigrationTs } from "./migration-ts-DdVm0rws.mjs";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
18
18
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
@@ -32,7 +32,7 @@ import { createHash } from "node:crypto";
|
|
|
32
32
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
33
33
|
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
34
34
|
import { resolve as resolve$1 } from "node:path";
|
|
35
|
-
//#region ../../../1-framework/3-tooling/cli/dist/ref-
|
|
35
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-XdaDN3GF.mjs
|
|
36
36
|
/**
|
|
37
37
|
* The typed remediation the CLI attaches to its own errors and findings.
|
|
38
38
|
* Constructors live here rather than in any library the CLI calls: naming a
|
|
@@ -88,8 +88,8 @@ function errorContractArgConflict(options) {
|
|
|
88
88
|
}
|
|
89
89
|
function errorRefSetHashNotInGraph(resolvedHash, reachableHashes, graphTipHash) {
|
|
90
90
|
const reachableList = reachableHashes.length > 0 ? reachableHashes.join(", ") : "(none — migration graph is empty)";
|
|
91
|
-
const fix = reachableHashes.length > 0 ? graphTipHash !== null ? `Set the ref to a graph-node hash such as ${graphTipHash}, or run \`
|
|
92
|
-
const nextActions = reachableHashes.length > 0 ? graphTipHash !== null ? [chooseAction(`Set the ref to a graph-node hash such as ${graphTipHash}`), runCommandAction("Extend the migration graph", "
|
|
91
|
+
const fix = reachableHashes.length > 0 ? graphTipHash !== null ? `Set the ref to a graph-node hash such as ${graphTipHash}, or run \`{bin} migration plan\` to extend the graph.` : "Set the ref to a hash that appears in the migration graph." : "Run `{bin} migration plan` first.";
|
|
92
|
+
const nextActions = reachableHashes.length > 0 ? graphTipHash !== null ? [chooseAction(`Set the ref to a graph-node hash such as ${graphTipHash}`), runCommandAction("Extend the migration graph", "{bin} migration plan")] : [chooseAction("Set the ref to a hash that appears in the migration graph")] : [runCommandAction("Plan the first migration", "{bin} migration plan")];
|
|
93
93
|
return new ActionableCliError("MIGRATION.HASH_NOT_IN_GRAPH", `Resolved contract hash is not in the migration graph: ${resolvedHash}`, {
|
|
94
94
|
why: reachableHashes.length > 0 ? `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.` : "The migration graph is empty — no hashes reachable.",
|
|
95
95
|
fix,
|
|
@@ -131,7 +131,7 @@ function errorInvalidSpaceId(spaceId) {
|
|
|
131
131
|
return new ActionableCliError("MIGRATION.INVALID_SPACE_ID", `Invalid contract space id: ${spaceId}`, {
|
|
132
132
|
why: "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).",
|
|
133
133
|
fix: "Pass a space id that matches the directory naming rule, or omit --space to list every space.",
|
|
134
|
-
nextActions: [chooseAction("Pass a space id matching [a-z][a-z0-9_-]{0,63}"), runCommandAction("Or list every space", "
|
|
134
|
+
nextActions: [chooseAction("Pass a space id matching [a-z][a-z0-9_-]{0,63}"), runCommandAction("Or list every space", "{bin} migration list")],
|
|
135
135
|
meta: { spaceId }
|
|
136
136
|
});
|
|
137
137
|
}
|
|
@@ -148,8 +148,8 @@ function errorInvalidSpaceId(spaceId) {
|
|
|
148
148
|
*/
|
|
149
149
|
function errorSpaceNotFound(spaceId, availableSpaces) {
|
|
150
150
|
const availableList = availableSpaces.length > 0 ? availableSpaces.join(", ") : "(none — no contract spaces on disk yet)";
|
|
151
|
-
const fix = availableSpaces.length > 0 ? `Pick one of: ${availableList}. Run \`
|
|
152
|
-
const nextActions = availableSpaces.length > 0 ? [chooseAction(`Pick one of: ${availableList}`), runCommandAction("See every space's migrations", "
|
|
151
|
+
const 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.";
|
|
152
|
+
const 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")];
|
|
153
153
|
return new ActionableCliError("MIGRATION.SPACE_NOT_FOUND", `Unknown contract space: ${spaceId}`, {
|
|
154
154
|
why: `No directory named "${spaceId}" exists under the migrations root.`,
|
|
155
155
|
fix,
|
|
@@ -168,15 +168,15 @@ function errorMigrationPackageNotFound(why) {
|
|
|
168
168
|
return new ActionableCliError("MIGRATION.PACKAGE_NOT_FOUND", "Migration package not found", {
|
|
169
169
|
why,
|
|
170
170
|
fix: "Pass a directory name, hash prefix, or path to an on-disk app-space migration package.",
|
|
171
|
-
nextActions: [chooseAction("Pass a directory name, hash prefix, or path to an on-disk app-space migration package"), runCommandAction("List what is on disk", "
|
|
171
|
+
nextActions: [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")]
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
/** The app space has no migration packages at all, so no target can resolve. */
|
|
175
175
|
function errorNoMigrations(appMigrationsRelative) {
|
|
176
176
|
return new ActionableCliError("MIGRATION.NO_MIGRATIONS", "No migrations found", {
|
|
177
177
|
why: `No migration packages found in ${appMigrationsRelative}`,
|
|
178
|
-
fix: "Run `
|
|
179
|
-
nextActions: [runCommandAction("Create the first migration", "
|
|
178
|
+
fix: "Run `{bin} migration plan` to create a migration first.",
|
|
179
|
+
nextActions: [runCommandAction("Create the first migration", "{bin} migration plan")]
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
function errorRefSetBundleNotFound(hash) {
|
|
@@ -190,7 +190,7 @@ function errorRefSetBundleNotFound(hash) {
|
|
|
190
190
|
function errorPlanForgotTheFlag(resolvedHash, reachableRefs, graphTipHash, options) {
|
|
191
191
|
const reachableList = reachableRefs.length > 0 ? reachableRefs.map((r) => `${r.name} (${r.hash})`).join(", ") : "(none)";
|
|
192
192
|
const refFix = reachableRefs.length > 0 ? `Run migration plan with ${reachableRefs.map((r) => `--from ${r.name}`).join(" or ")}.` : graphTipHash !== null ? `Run migration plan --from ${graphTipHash}.` : "Commit pending migrations first, then run migration plan.";
|
|
193
|
-
const nextActions = reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, `
|
|
193
|
+
const nextActions = reachableRefs.length > 0 ? reachableRefs.map((ref) => runCommandAction(`Plan from ${ref.name}`, `{bin} migration plan --from ${ref.name}`)) : graphTipHash !== null ? [runCommandAction("Plan from the graph tip", `{bin} migration plan --from ${graphTipHash}`)] : [chooseAction("Commit pending migrations first, then run migration plan")];
|
|
194
194
|
return new ActionableCliError("MIGRATION.HASH_NOT_IN_GRAPH", `Resolved from-hash is not in the migration graph: ${resolvedHash}`, {
|
|
195
195
|
why: `The migration graph reaches ${reachableList}; resolved ${resolvedHash} isn't a graph node.`,
|
|
196
196
|
fix: refFix,
|
|
@@ -213,12 +213,12 @@ function errorPlanForgotTheFlag(resolvedHash, reachableRefs, graphTipHash, optio
|
|
|
213
213
|
*/
|
|
214
214
|
function errorSnapshotMissing(identifier, options) {
|
|
215
215
|
const viaRef = options?.viaRef !== false;
|
|
216
|
-
const fix = viaRef ? `Create the ref with "
|
|
216
|
+
const 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.`;
|
|
217
217
|
const nextActions = viaRef ? [
|
|
218
|
-
runCommandAction(`Create the ref "${identifier}"`, `
|
|
219
|
-
runCommandAction("Or advance it from the database", `
|
|
218
|
+
runCommandAction(`Create the ref "${identifier}"`, `{bin} migration ref set ${identifier} <hash>`),
|
|
219
|
+
runCommandAction("Or advance it from the database", `{bin} db update --advance-ref ${identifier}`),
|
|
220
220
|
chooseAction("Or pass a hash that is a node in the migration graph")
|
|
221
|
-
] : [chooseAction("Pass --from a ref name, whose contract resolves through the snapshot store"), runCommandAction("Or populate the graph first", "
|
|
221
|
+
] : [chooseAction("Pass --from a ref name, whose contract resolves through the snapshot store"), runCommandAction("Or populate the graph first", "{bin} db update")];
|
|
222
222
|
return new ActionableCliError("MIGRATION.SNAPSHOT_MISSING", viaRef ? `Ref "${identifier}" is not resolvable` : `No contract source for from-hash "${identifier}"`, {
|
|
223
223
|
why: 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.`,
|
|
224
224
|
fix,
|
|
@@ -232,18 +232,18 @@ function errorSnapshotMissing(identifier, options) {
|
|
|
232
232
|
}
|
|
233
233
|
function errorMarkerMismatch(markerHash, reachableHashes, graphTip) {
|
|
234
234
|
const reachableList = reachableHashes.length > 0 ? reachableHashes.join(", ") : "(none — migration graph is empty)";
|
|
235
|
-
const planFromFix = graphTip !== null ? `Run \`
|
|
236
|
-
const planCommand = graphTip !== null ? `
|
|
235
|
+
const planFromFix = graphTip !== null ? `Run \`{bin} migration plan --from ${graphTip}\` if the live marker is canonical and the on-disk graph needs catching up.` : "Run `{bin} migration plan` if the live marker is canonical and the on-disk graph needs catching up.";
|
|
236
|
+
const planCommand = graphTip !== null ? `{bin} migration plan --from ${graphTip}` : "{bin} migration plan";
|
|
237
237
|
return new ActionableCliError("MIGRATION.MARKER_MISMATCH", "Database marker is not reachable in the on-disk migration graph", {
|
|
238
238
|
why: `DB marker is ${markerHash}, but the on-disk migration graph reaches: ${reachableList}.`,
|
|
239
239
|
fix: [
|
|
240
240
|
planFromFix,
|
|
241
|
-
`Run \`
|
|
241
|
+
`Run \`{bin} migration ref set db ${markerHash}\` if the on-disk graph is canonical and the local \`db\` ref drifted.`,
|
|
242
242
|
"Investigate whether the database was migrated by an out-of-band process."
|
|
243
243
|
].join("\n"),
|
|
244
244
|
nextActions: [
|
|
245
245
|
runCommandAction("Catch the on-disk graph up to the live marker", planCommand),
|
|
246
|
-
runCommandAction("Point the local db ref at the live marker", `
|
|
246
|
+
runCommandAction("Point the local db ref at the live marker", `{bin} migration ref set db ${markerHash}`),
|
|
247
247
|
chooseAction("Investigate whether the database was migrated by an out-of-band process")
|
|
248
248
|
],
|
|
249
249
|
meta: {
|
|
@@ -264,13 +264,13 @@ function errorPathUnreachable(failure) {
|
|
|
264
264
|
const deadEndsSuffix = Array.isArray(deadEnds) && deadEnds.length > 0 ? ` Dead-ends: ${deadEnds.map(String).join(", ")}.` : "";
|
|
265
265
|
const neverPlanned = meta["kind"] === "neverPlanned";
|
|
266
266
|
const planCommand = (() => {
|
|
267
|
-
if (neverPlanned) return "
|
|
268
|
-
if (planFromHash !== null && targetHash !== null) return `
|
|
269
|
-
if (targetHash !== null) return `
|
|
270
|
-
if (planFromHash !== null) return `
|
|
271
|
-
return "
|
|
267
|
+
if (neverPlanned) return "{bin} migration plan --name <slug>";
|
|
268
|
+
if (planFromHash !== null && targetHash !== null) return `{bin} migration plan --from ${planFromHash} --to ${targetHash} --name <slug>`;
|
|
269
|
+
if (targetHash !== null) return `{bin} migration plan --to ${targetHash} --name <slug>`;
|
|
270
|
+
if (planFromHash !== null) return `{bin} migration plan --from ${planFromHash} --name <slug>`;
|
|
271
|
+
return "{bin} migration plan";
|
|
272
272
|
})();
|
|
273
|
-
const applyCommand = targetHash !== null && !neverPlanned ? `
|
|
273
|
+
const applyCommand = targetHash !== null && !neverPlanned ? `{bin} db migrate --to ${targetHash}` : "{bin} db migrate";
|
|
274
274
|
return new ActionableCliError("MIGRATION.PATH_UNREACHABLE", failure.summary, {
|
|
275
275
|
why: failure.why ?? `Cannot reach target "${targetHash ?? "<unknown>"}" from current marker "${fromHashMeta ?? "<unknown>"}".${deadEndsSuffix}`,
|
|
276
276
|
fix: [
|
|
@@ -279,15 +279,15 @@ function errorPathUnreachable(failure) {
|
|
|
279
279
|
` 2. ${applyCommand}`,
|
|
280
280
|
`${ROLLBACK_IS_DESTRUCTIVE}.`,
|
|
281
281
|
`${NARROWER_CASES_NEED_A_HINT}.`,
|
|
282
|
-
"Inspect the on-disk graph with `
|
|
282
|
+
"Inspect the on-disk graph with `{bin} migration list`, or `{bin} migration show <bundle>` for any bundle in the path you expected."
|
|
283
283
|
].join("\n"),
|
|
284
284
|
nextActions: [
|
|
285
285
|
runCommandAction("Plan the missing edge", planCommand),
|
|
286
286
|
runCommandAction("Apply it", applyCommand),
|
|
287
287
|
chooseAction(ROLLBACK_IS_DESTRUCTIVE),
|
|
288
288
|
chooseAction(NARROWER_CASES_NEED_A_HINT),
|
|
289
|
-
runCommandAction("Inspect the on-disk graph", "
|
|
290
|
-
runCommandAction("Inspect a bundle in the path you expected", "
|
|
289
|
+
runCommandAction("Inspect the on-disk graph", "{bin} migration list"),
|
|
290
|
+
runCommandAction("Inspect a bundle in the path you expected", "{bin} migration show <bundle>")
|
|
291
291
|
],
|
|
292
292
|
meta: { ...meta }
|
|
293
293
|
});
|
|
@@ -566,7 +566,7 @@ async function readContractEnvelope(config) {
|
|
|
566
566
|
const json = JSON.parse(content);
|
|
567
567
|
const { schemaVersion, target, targetFamily, profileHash } = json;
|
|
568
568
|
const storageHash = json["storage"]?.["storageHash"];
|
|
569
|
-
if (typeof storageHash !== "string") throw new CliStructuredError$1("CONTRACT.VALIDATION_FAILED", `Contract at ${relative(process.cwd(), contractPath)} is missing a valid storage.storageHash. Run \`
|
|
569
|
+
if (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 } });
|
|
570
570
|
if (typeof schemaVersion !== "string") throw new CliStructuredError$1("CONTRACT.VALIDATION_FAILED", `Contract at ${relative(process.cwd(), contractPath)} is missing schemaVersion.`, { where: { path: contractPath } });
|
|
571
571
|
if (typeof target !== "string") throw new CliStructuredError$1("CONTRACT.VALIDATION_FAILED", `Contract at ${relative(process.cwd(), contractPath)} is missing target.`, { where: { path: contractPath } });
|
|
572
572
|
if (typeof targetFamily !== "string") throw new CliStructuredError$1("CONTRACT.VALIDATION_FAILED", `Contract at ${relative(process.cwd(), contractPath)} is missing targetFamily.`, { where: { path: contractPath } });
|
|
@@ -753,7 +753,7 @@ function mapIntegrityViolations(violations, migrationsDir) {
|
|
|
753
753
|
const contractUnreadable = violations.find((v) => v.kind === "contractUnreadable");
|
|
754
754
|
if (contractUnreadable && contractUnreadable.kind === "contractUnreadable") return contractSpaceViolationError(`Contract-space contract validation failed for "${contractUnreadable.spaceId}"`, {
|
|
755
755
|
why: contractUnreadable.detail,
|
|
756
|
-
fix: "Re-emit the extension contract with `
|
|
756
|
+
fix: "Re-emit the extension contract with `{bin} contract emit`, or fix the extension pack descriptor producing the invalid contract.",
|
|
757
757
|
violations: [contractUnreadable]
|
|
758
758
|
});
|
|
759
759
|
const structural = violations[0];
|
|
@@ -1624,7 +1624,7 @@ function mapMarkerCheckFailures(appSpaceId, section, migrationsDir) {
|
|
|
1624
1624
|
violations.push({
|
|
1625
1625
|
kind: "hashMismatch",
|
|
1626
1626
|
spaceId,
|
|
1627
|
-
remediation: spaceId === appSpaceId ? "Run `
|
|
1627
|
+
remediation: spaceId === appSpaceId ? "Run `{bin} db update` to advance the marker, or roll the database back to the recorded hash." : `Apply on-disk migrations under \`${migrationsDir}/${spaceId}/\` to advance the marker, or remove the conflicting marker row.`
|
|
1628
1628
|
});
|
|
1629
1629
|
continue;
|
|
1630
1630
|
}
|
|
@@ -3058,7 +3058,7 @@ async function resolveContractRefToSnapshot(options) {
|
|
|
3058
3058
|
} catch (error) {
|
|
3059
3059
|
if (isEnoent$1(error)) return notOk(errorFileNotFound(options.contractPathAbsolute, {
|
|
3060
3060
|
why: `Contract file not found at ${options.contractPathAbsolute}`,
|
|
3061
|
-
fix: "Run `
|
|
3061
|
+
fix: "Run `{bin} contract emit` first to generate the contract",
|
|
3062
3062
|
cause: error
|
|
3063
3063
|
}));
|
|
3064
3064
|
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), {
|
|
@@ -3199,7 +3199,7 @@ async function executeMigrateShowPlan(options) {
|
|
|
3199
3199
|
dbConnection,
|
|
3200
3200
|
hasDriver,
|
|
3201
3201
|
why: "migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)",
|
|
3202
|
-
retryCommand: "
|
|
3202
|
+
retryCommand: "{bin} db migrate --show --from <contract>"
|
|
3203
3203
|
});
|
|
3204
3204
|
if (missingDb) return notOk(missingDb);
|
|
3205
3205
|
}
|
|
@@ -3246,7 +3246,7 @@ async function executeMigrateShowPlan(options) {
|
|
|
3246
3246
|
dbConnection,
|
|
3247
3247
|
hasDriver,
|
|
3248
3248
|
why: "@db resolves to the live database marker and requires a --db connection",
|
|
3249
|
-
retryCommand: "
|
|
3249
|
+
retryCommand: "{bin} db migrate --show --from @db --db $DATABASE_URL"
|
|
3250
3250
|
});
|
|
3251
3251
|
if (missingDb) return notOk(missingDb);
|
|
3252
3252
|
} else {
|
|
@@ -3630,7 +3630,7 @@ function checkDanglingRefs(space) {
|
|
|
3630
3630
|
code: "MIGRATION.CHECK_DANGLING_REF",
|
|
3631
3631
|
where: relative(space.cwd, join(space.refsDir, `${name}.json`)),
|
|
3632
3632
|
why: `Ref "${name}" points at ${entry.hash} which does not exist in the migration graph`,
|
|
3633
|
-
nextActions: [runCommandAction("Point the ref at a graph node", `
|
|
3633
|
+
nextActions: [runCommandAction("Point the ref at a graph node", `{bin} migration ref set ${name} <valid-hash>`), chooseAction("Or delete the ref")]
|
|
3634
3634
|
});
|
|
3635
3635
|
return failures;
|
|
3636
3636
|
}
|
|
@@ -3873,7 +3873,7 @@ async function executeMigrationNewCommand(options) {
|
|
|
3873
3873
|
} catch (error) {
|
|
3874
3874
|
if (error instanceof Error && error.code === "ENOENT") return notOk(errorRuntime("CLI.FILE_NOT_FOUND", `Contract file not found at ${contractPathAbsolute}`, {
|
|
3875
3875
|
why: `Contract file not found at ${contractPathAbsolute}`,
|
|
3876
|
-
fix: "Run `
|
|
3876
|
+
fix: "Run `{bin} contract emit` first to generate the contract"
|
|
3877
3877
|
}));
|
|
3878
3878
|
throw error;
|
|
3879
3879
|
}
|
|
@@ -3884,14 +3884,14 @@ async function executeMigrationNewCommand(options) {
|
|
|
3884
3884
|
} catch (error) {
|
|
3885
3885
|
return notOk(errorRuntime("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract JSON is invalid", {
|
|
3886
3886
|
why: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,
|
|
3887
|
-
fix: "Run `
|
|
3887
|
+
fix: "Run `{bin} contract emit` to regenerate the contract",
|
|
3888
3888
|
cause: error
|
|
3889
3889
|
}));
|
|
3890
3890
|
}
|
|
3891
3891
|
const toStorageHash = toContract.storage?.storageHash;
|
|
3892
3892
|
if (typeof toStorageHash !== "string") return notOk(errorRuntime("CONTRACT.VALIDATION_FAILED", "Contract is missing storageHash", {
|
|
3893
3893
|
why: `Contract at ${contractPathAbsolute} has no storageHash`,
|
|
3894
|
-
fix: "Run `
|
|
3894
|
+
fix: "Run `{bin} contract emit` to regenerate the contract"
|
|
3895
3895
|
}));
|
|
3896
3896
|
const aggregate = await loadContractSpaceAggregate({
|
|
3897
3897
|
migrationsDir,
|
|
@@ -3916,7 +3916,7 @@ async function executeMigrationNewCommand(options) {
|
|
|
3916
3916
|
}
|
|
3917
3917
|
if (fromHash === toStorageHash && !options.from) return notOk(errorRuntime("MIGRATION.NO_CHANGES", "No changes detected", {
|
|
3918
3918
|
why: "The from and to contract hashes are identical — there is nothing to migrate.",
|
|
3919
|
-
fix: "Change the contract and run `
|
|
3919
|
+
fix: "Change the contract and run `{bin} contract emit` before creating a new migration. To author a data-only migration on the current contract hash, pass `--from <hash>` explicitly."
|
|
3920
3920
|
}));
|
|
3921
3921
|
const timestamp = /* @__PURE__ */ new Date();
|
|
3922
3922
|
const packageDir = join(appMigrationsDir, formatMigrationDirName(timestamp, options.name ?? "migration"));
|
|
@@ -4272,7 +4272,7 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
|
|
|
4272
4272
|
} catch (error) {
|
|
4273
4273
|
if (isEnoent(error)) return notOk(errorFileNotFound(contractPathAbsolute, {
|
|
4274
4274
|
why: `Contract file not found at ${contractPathAbsolute}`,
|
|
4275
|
-
fix: `Run \`
|
|
4275
|
+
fix: `Run \`{bin} contract emit\` to generate ${contractPath}, or update \`config.contract.output\` in ${configPath}`
|
|
4276
4276
|
}));
|
|
4277
4277
|
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read contract file: ${error instanceof Error ? error.message : String(error)}` }));
|
|
4278
4278
|
}
|
|
@@ -4685,4 +4685,4 @@ async function executeRefListCommand(options) {
|
|
|
4685
4685
|
//#endregion
|
|
4686
4686
|
export { loadContractRawSafely as $, errorMigrationPlanningFailed as A, statusForMigrationHash as At, executeDbUpdate as B, errorDestructiveChanges as C, resolveRefAdvancementFields as Ct, errorLegendHumanOnly as D, runMigrationCheck as Dt, errorHashMismatch as E, runContractSpaceSeedPhase as Et, errorTargetMigrationNotSupported as F, executeRefAdvancement as G, executeMigrateShowPlan as H, errorTargetMismatch as I, executeRefSetCommand as J, executeRefDeleteCommand as K, errorUnexpected as L, errorPathUnreachable as M, toDeclaredExtensionsFromRaw as Mt, errorRunnerFailed as N, errorMarkerMissing as O, runMigrationList as Ot, errorRuntime as P, loadAggregateIntegrityViolations as Q, executeContractEmit as R, errorDatabaseConnectionRequired as S, resolveMigrationRef as St, errorFileNotFound as T, runCommandAction as Tt, executeMigrationNewCommand as U, executeDbVerify as V, executeMigrationPlanCommand as W, hasMigrationPath as X, findPackageByDirPath as Y, listRefsByContractHash as Z, enumerateCheckSpaces as _, requireLiveDatabase as _t, buildContractSpaceAggregate as a, maskConnectionUrl as at, errorContractArgConflict as b, resolveContractRefToSnapshot as bt, buildRefAdvancementFields as c, readContractEnvelope as ct, closeQuietly as d, refuseContractSpaceIntegrity as dt, loadContractSpaceAggregateForCli as et, computeRefAdvancementName as f, refuseDeclaredExtensionTargetMismatch as ft, enrichContract as g, refuseUnknownInvariants as gt, disposeEmitQueue as h, refusePackageCorruptionOnAggregate as ht, appliedHashesFromLedger as i, mapIntegrityViolations as it, errorNoMigrations as j, targetSupportsMigrations as jt, errorMigrationPackageNotFound as k, sanitizeErrorMessage as kt, checkSingleTarget as l, readContractIR as lt, deriveStatusEdgeAnnotations as m, refuseMissingInvariantPath as mt, advanceRefSafely as n, mapCaughtMigrationError as nt, buildMigrationSpaceGraphEntries as o, migrationSpaceListEntriesFromAggregate as ot, createControlClient as p, refuseMarkerOutsideGraph as pt, executeRefListCommand as q, appContractStandInFromIdentity as r, mapContractAtError as rt, buildReadAggregate as s, originHashForStatus as st, CliStructuredError$1 as t, looksLikePath as tt, chooseAction as u, readMigrationRefs as ut, errorConfigValidation$1 as v, resolveAppTargetPath as vt, errorDriverRequired as w, resolveToForPlan as wt, errorContractValidationFailed as x, resolveFromForPlan as xt, errorConsentPlanMismatch as y, resolveContractRef$1 as yt, executeDbInit as z };
|
|
4687
4687
|
|
|
4688
|
-
//# sourceMappingURL=ref-
|
|
4688
|
+
//# sourceMappingURL=ref-XdaDN3GF-Io-mSVS6.mjs.map
|