@prisma/orm-toolchain 8.0.0-rc.12-dev.13 → 8.0.0-rc.12-dev.15

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.
Files changed (80) hide show
  1. package/dist/{aggregate-CZyUi3Gt.mjs → aggregate-BsI5y36e.mjs} +9 -9
  2. package/dist/{aggregate-CZyUi3Gt.mjs.map → aggregate-BsI5y36e.mjs.map} +1 -1
  3. package/dist/{aggregate-DwZNs0oH.d.mts → aggregate-C_e9y2vI.d.mts} +2 -2
  4. package/dist/{aggregate-DwZNs0oH.d.mts.map → aggregate-C_e9y2vI.d.mts.map} +1 -1
  5. package/dist/cli-telemetry.mjs +3 -3
  6. package/dist/cli.d.mts +2 -2
  7. package/dist/cli.mjs +377 -48
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/cli__control-api.d.mts +25 -21
  10. package/dist/cli__control-api.d.mts.map +1 -1
  11. package/dist/cli__control-api.mjs +1 -1
  12. package/dist/cli__control-api__testing.d.mts +2 -2
  13. package/dist/cli__control-api__testing.mjs +1 -1
  14. package/dist/cli__migration-cli.mjs +5 -5
  15. package/dist/cli__migration-cli.mjs.map +1 -1
  16. package/dist/config-loader.d.mts +2 -2
  17. package/dist/config-loader.mjs +2 -2
  18. package/dist/{contract-snapshot-store-1S_6vaGt-mzFobPtq.mjs → contract-snapshot-store-1S_6vaGt-FrXDiBEd.mjs} +4 -4
  19. package/dist/{contract-snapshot-store-1S_6vaGt-mzFobPtq.mjs.map → contract-snapshot-store-1S_6vaGt-FrXDiBEd.mjs.map} +1 -1
  20. package/dist/{db-verify-D4Y9yGyX-Df6oIwYg.d.mts → db-verify-DoVihHM8-QNzdRseL.d.mts} +4 -4
  21. package/dist/{db-verify-D4Y9yGyX-Df6oIwYg.d.mts.map → db-verify-DoVihHM8-QNzdRseL.d.mts.map} +1 -1
  22. package/dist/emitter.mjs +1 -1
  23. package/dist/{errors-DD6iLGXk-B4Q4tIha.mjs → errors-DD6iLGXk-6I9PqjpZ.mjs} +2 -2
  24. package/dist/{errors-DD6iLGXk-B4Q4tIha.mjs.map → errors-DD6iLGXk-6I9PqjpZ.mjs.map} +1 -1
  25. package/dist/{exports-4SvYVqSf.mjs → exports-BB9aU4zk.mjs} +4 -4
  26. package/dist/{exports-4SvYVqSf.mjs.map → exports-BB9aU4zk.mjs.map} +1 -1
  27. package/dist/{exports-DI1kMms6--e9LdT9A.mjs → exports-Bx-2JeW0-BHlN6Av7.mjs} +4 -3
  28. package/dist/exports-Bx-2JeW0-BHlN6Av7.mjs.map +1 -0
  29. package/dist/{exports-BOv2LgXz.mjs → exports-C2kyulLb.mjs} +19 -10
  30. package/dist/exports-C2kyulLb.mjs.map +1 -0
  31. package/dist/{graph-membership-BQ43lP4A-B8rZC7rC.mjs → graph-membership-BQ43lP4A-i4Ov419-.mjs} +2 -2
  32. package/dist/{graph-membership-BQ43lP4A-B8rZC7rC.mjs.map → graph-membership-BQ43lP4A-i4Ov419-.mjs.map} +1 -1
  33. package/dist/{import-roots-CR-pnC1n.mjs → import-roots-BB3GzIi-.mjs} +2 -2
  34. package/dist/{import-roots-CR-pnC1n.mjs.map → import-roots-BB3GzIi-.mjs.map} +1 -1
  35. package/dist/{index-D_KaEMoL.d.mts → index-CQm4jQjG.d.mts} +8 -3
  36. package/dist/index-CQm4jQjG.d.mts.map +1 -0
  37. package/dist/{invariants-C0lpc60l-MH7CqDAw.mjs → invariants-C0lpc60l-CMUCvk4O.mjs} +2 -2
  38. package/dist/{invariants-C0lpc60l-MH7CqDAw.mjs.map → invariants-C0lpc60l-CMUCvk4O.mjs.map} +1 -1
  39. package/dist/{io-xKnQrxIC-D_C_lwGm.mjs → io-xKnQrxIC-BZHUkAeY.mjs} +4 -4
  40. package/dist/{io-xKnQrxIC-D_C_lwGm.mjs.map → io-xKnQrxIC-BZHUkAeY.mjs.map} +1 -1
  41. package/dist/{migration-CkACVhgz.mjs → migration-CTBcGs-o.mjs} +4 -4
  42. package/dist/{migration-CkACVhgz.mjs.map → migration-CTBcGs-o.mjs.map} +1 -1
  43. package/dist/migration-tools.d.mts +1 -1
  44. package/dist/migration-tools.mjs +12 -12
  45. package/dist/migration-tools__aggregate.d.mts +1 -1
  46. package/dist/migration-tools__aggregate.mjs +1 -1
  47. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  48. package/dist/migration-tools__errors.mjs +1 -1
  49. package/dist/migration-tools__invariants.mjs +1 -1
  50. package/dist/migration-tools__io.mjs +1 -1
  51. package/dist/migration-tools__migration-graph.mjs +1 -1
  52. package/dist/migration-tools__migration-ts.mjs +1 -1
  53. package/dist/migration-tools__migration.mjs +1 -1
  54. package/dist/migration-tools__ref-resolution.mjs +1 -1
  55. package/dist/migration-tools__refs.mjs +1 -1
  56. package/dist/migration-tools__spaces.mjs +2 -2
  57. package/dist/{migration-ts-FyF55c4M.mjs → migration-ts-DdVm0rws.mjs} +2 -2
  58. package/dist/{migration-ts-FyF55c4M.mjs.map → migration-ts-DdVm0rws.mjs.map} +1 -1
  59. package/dist/publish-surface.mjs +2 -2
  60. package/dist/publish-surface__import-roots.mjs +1 -1
  61. package/dist/publish-surface__shells.mjs +1 -1
  62. package/dist/{ref-jhp3BGZM-CI91tliC.mjs → ref-DZuzAvuD-BYpisYJp.mjs} +269 -270
  63. package/dist/ref-DZuzAvuD-BYpisYJp.mjs.map +1 -0
  64. package/dist/{ref-resolution-be3JMf5X.mjs → ref-resolution-CyyiVwzz.mjs} +2 -2
  65. package/dist/{ref-resolution-be3JMf5X.mjs.map → ref-resolution-CyyiVwzz.mjs.map} +1 -1
  66. package/dist/{refs-qwvw4_dV-Bk9tl756.mjs → refs-qwvw4_dV-DNg_7WTD.mjs} +2 -2
  67. package/dist/{refs-qwvw4_dV-Bk9tl756.mjs.map → refs-qwvw4_dV-DNg_7WTD.mjs.map} +1 -1
  68. package/dist/{shells-B05MST_L.mjs → shells-nviMkCdc.mjs} +2 -1
  69. package/dist/shells-nviMkCdc.mjs.map +1 -0
  70. package/dist/{spaces-D1-7OKid.mjs → spaces-CcU9rbeZ.mjs} +7 -7
  71. package/dist/{spaces-D1-7OKid.mjs.map → spaces-CcU9rbeZ.mjs.map} +1 -1
  72. package/dist/{verify-contract-spaces-CYjc343k-9_2GpPRg.mjs → verify-contract-spaces-CYjc343k-DHy5xtKR.mjs} +4 -4
  73. package/dist/{verify-contract-spaces-CYjc343k-9_2GpPRg.mjs.map → verify-contract-spaces-CYjc343k-DHy5xtKR.mjs.map} +1 -1
  74. package/dist/vite-plugin-contract-emit.mjs +3 -3
  75. package/package.json +12 -12
  76. package/dist/exports-BOv2LgXz.mjs.map +0 -1
  77. package/dist/exports-DI1kMms6--e9LdT9A.mjs.map +0 -1
  78. package/dist/index-D_KaEMoL.d.mts.map +0 -1
  79. package/dist/ref-jhp3BGZM-CI91tliC.mjs.map +0 -1
  80. package/dist/shells-B05MST_L.mjs.map +0 -1
@@ -1,40 +1,40 @@
1
- import { i as expandContractInputs } from "./exports-BOv2LgXz.mjs";
2
- import { r as getEmittedArtifactPaths, t as emit } from "./exports-DI1kMms6--e9LdT9A.mjs";
3
- import { D as errorNoInvariantPath, M as errorUnknownInvariant, b as errorInvalidRefName, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-DD6iLGXk-B4Q4tIha.mjs";
1
+ import { i as expandContractInputs } from "./exports-C2kyulLb.mjs";
2
+ import { r as getEmittedArtifactPaths, t as emit } from "./exports-Bx-2JeW0-BHlN6Av7.mjs";
3
+ import { D as errorNoInvariantPath, M as errorUnknownInvariant, b as errorInvalidRefName, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-DD6iLGXk-6I9PqjpZ.mjs";
4
4
  import { r as verifyMigrationHash, t as computeMigrationHash } from "./hash-BAZVWU4a-BdynTmar.mjs";
5
- import { a as snapshotsImportPathFrom, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-1S_6vaGt-mzFobPtq.mjs";
6
- import { t as deriveProvidedInvariants } from "./invariants-C0lpc60l-MH7CqDAw.mjs";
7
- import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-xKnQrxIC-D_C_lwGm.mjs";
5
+ import { a as snapshotsImportPathFrom, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-1S_6vaGt-FrXDiBEd.mjs";
6
+ import { t as deriveProvidedInvariants } from "./invariants-C0lpc60l-CMUCvk4O.mjs";
7
+ import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-xKnQrxIC-BZHUkAeY.mjs";
8
8
  import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
9
- import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-BQ43lP4A-B8rZC7rC.mjs";
9
+ import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-BQ43lP4A-i4Ov419-.mjs";
10
10
  import { i as findPathWithDecision, r as findPath } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
11
- 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-qwvw4_dV-Bk9tl756.mjs";
12
- 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-CYjc343k-9_2GpPRg.mjs";
13
- 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-CZyUi3Gt.mjs";
14
- import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-D1-7OKid.mjs";
15
- import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver, t as ImportRootError } from "./import-roots-CR-pnC1n.mjs";
16
- import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-be3JMf5X.mjs";
17
- import { i as writeMigrationTs } from "./migration-ts-FyF55c4M.mjs";
11
+ 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-qwvw4_dV-DNg_7WTD.mjs";
12
+ 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-CYjc343k-DHy5xtKR.mjs";
13
+ 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-BsI5y36e.mjs";
14
+ import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-CcU9rbeZ.mjs";
15
+ import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver, t as ImportRootError } from "./import-roots-BB3GzIi-.mjs";
16
+ import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-CyyiVwzz.mjs";
17
+ import { i as writeMigrationTs } from "./migration-ts-DdVm0rws.mjs";
18
18
  import { createRequire } from "node:module";
19
19
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
20
20
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
21
- import { basename, dirname, isAbsolute, join, relative, resolve } from "pathe";
22
- import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
23
21
  import { isStructuredErrorCode, structuredError } from "@prisma/orm-framework/utils/structured-error";
24
22
  import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
25
23
  import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
26
24
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
27
25
  import { CliStructuredError, CliStructuredError as CliStructuredError$1, errorConfigValidation as errorConfigValidation$1, errorContractConfigMissing, errorContractValidationFailed, errorDatabaseConnectionRequired, errorDriverRequired, errorFileNotFound, errorMigrationPlanningFailed, errorTargetMigrationNotSupported, errorUnexpected } from "@prisma/orm-framework/errors/control";
28
- import { notOk, ok } from "@prisma/orm-framework/utils/result";
29
26
  import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView } from "@prisma/orm-framework/components/control";
27
+ import { notOk, ok } from "@prisma/orm-framework/utils/result";
30
28
  import { mergeCapabilityMatrices } from "@prisma/orm-framework/components/components";
31
29
  import { ERROR_CODE_DESTRUCTIVE_CHANGES, errorConsentPlanMismatch, errorDestructiveChanges, errorHashMismatch, errorMarkerMissing, errorRunnerFailed, errorRuntime, errorTargetMismatch } from "@prisma/orm-framework/errors/execution";
32
30
  import "@prisma/orm-framework/errors/migration";
31
+ import { basename, dirname, isAbsolute, join, relative, resolve } from "pathe";
33
32
  import { createHash } from "node:crypto";
34
33
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
34
+ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
35
35
  import { abortable } from "@prisma/orm-framework/utils/abortable";
36
36
  import { resolve as resolve$1 } from "node:path";
37
- //#region ../../../1-framework/3-tooling/cli/dist/ref-jhp3BGZM.mjs
37
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-DZuzAvuD.mjs
38
38
  /**
39
39
  * The typed remediation the CLI attaches to its own errors and findings.
40
40
  * Constructors live here rather than in any library the CLI calls: naming a
@@ -1770,6 +1770,194 @@ function mapMarkerCheckFailures(appSpaceId, section, migrationsDir) {
1770
1770
  meta: { violations }
1771
1771
  });
1772
1772
  }
1773
+ function isRecord$2(value) {
1774
+ return typeof value === "object" && value !== null;
1775
+ }
1776
+ function failedToResolveContractSource(why, fix, meta, cause, diagnostics) {
1777
+ return errorRuntime("CONTRACT.SOURCE_LOAD_FAILED", "Failed to resolve contract source", {
1778
+ why,
1779
+ fix,
1780
+ ...ifDefined("diagnostics", diagnostics),
1781
+ ...ifDefined("meta", meta),
1782
+ ...ifDefined("cause", cause)
1783
+ });
1784
+ }
1785
+ function diagnosticLocation(diagnostic) {
1786
+ const sourceId = typeof diagnostic["sourceId"] === "string" ? diagnostic["sourceId"] : void 0;
1787
+ const span = isRecord$2(diagnostic["span"]) ? diagnostic["span"] : void 0;
1788
+ const start = span && isRecord$2(span["start"]) ? span["start"] : void 0;
1789
+ return {
1790
+ sourceId,
1791
+ line: start && typeof start["line"] === "number" ? start["line"] : void 0,
1792
+ character: start && typeof start["column"] === "number" ? start["column"] : void 0
1793
+ };
1794
+ }
1795
+ function formatLocation({ sourceId, line, character }) {
1796
+ if (sourceId === void 0) return void 0;
1797
+ return line !== void 0 && character !== void 0 ? `${sourceId}:${line}:${character}` : sourceId;
1798
+ }
1799
+ /** One source diagnostic as a line of text: `<sourceId>:<line>:<column> <code> <message>`. */
1800
+ function formatSourceDiagnostic(raw) {
1801
+ if (!isRecord$2(raw)) return String(raw);
1802
+ const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
1803
+ const message = typeof raw["message"] === "string" ? raw["message"] : "";
1804
+ return [
1805
+ formatLocation(diagnosticLocation(raw)),
1806
+ code,
1807
+ message
1808
+ ].filter((part) => part !== void 0 && part !== "").join(" ");
1809
+ }
1810
+ /**
1811
+ * The finding the CLI prints under the error, one per source diagnostic. The
1812
+ * terminal renderer prints a finding's code and summary and nothing of its
1813
+ * `where`, so the summary starts with the location. A source code that is not
1814
+ * yet dotted is wrapped as `CONTRACT.SOURCE_DIAGNOSTIC` and named in the summary.
1815
+ */
1816
+ function sourceDiagnosticToFinding(raw) {
1817
+ if (!isRecord$2(raw)) return void 0;
1818
+ const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
1819
+ const message = typeof raw["message"] === "string" ? raw["message"] : "";
1820
+ const location = diagnosticLocation(raw);
1821
+ const formatted = formatLocation(location);
1822
+ const locatedSummary = (text) => formatted === void 0 ? text : `${formatted} ${text}`;
1823
+ const finding = {
1824
+ severity: "error",
1825
+ nextActions: [],
1826
+ ...ifDefined("where", location.sourceId === void 0 ? void 0 : {
1827
+ path: location.sourceId,
1828
+ ...ifDefined("line", location.line)
1829
+ })
1830
+ };
1831
+ return isStructuredErrorCode(code) ? {
1832
+ code,
1833
+ summary: locatedSummary(message),
1834
+ ...finding
1835
+ } : {
1836
+ code: "CONTRACT.SOURCE_DIAGNOSTIC",
1837
+ summary: locatedSummary(`${code}: ${message}`),
1838
+ ...finding,
1839
+ meta: { code }
1840
+ };
1841
+ }
1842
+ function sourceDiagnosticsToFindings(diagnostics) {
1843
+ const findings = [];
1844
+ for (const raw of diagnostics) {
1845
+ const finding = sourceDiagnosticToFinding(raw);
1846
+ if (finding !== void 0) findings.push(finding);
1847
+ }
1848
+ return findings;
1849
+ }
1850
+ function diagnosticLocationSuffix(diagnostic) {
1851
+ const formatted = formatLocation(diagnosticLocation(diagnostic));
1852
+ return formatted === void 0 ? "" : ` (${formatted})`;
1853
+ }
1854
+ function mapDiagnosticsToIssues(diagnostics) {
1855
+ const issues = [];
1856
+ for (const raw of diagnostics) {
1857
+ if (!isRecord$2(raw)) continue;
1858
+ const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
1859
+ const message = typeof raw["message"] === "string" ? raw["message"] : "";
1860
+ issues.push({
1861
+ kind: code,
1862
+ message: `${message}${diagnosticLocationSuffix(raw)}`
1863
+ });
1864
+ }
1865
+ return issues;
1866
+ }
1867
+ function failedWith(error) {
1868
+ return notOk({ error });
1869
+ }
1870
+ /**
1871
+ * Checks the shape of what `load` returned. A source may be plain JavaScript,
1872
+ * so its declared type is not trusted.
1873
+ */
1874
+ function validateProviderResult(providerResult) {
1875
+ const raw = providerResult;
1876
+ if (!isRecord$2(raw) || typeof raw["ok"] !== "boolean") return failedWith(failedToResolveContractSource("Contract source provider returned malformed result shape.", "Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics })."));
1877
+ if (providerResult.ok) {
1878
+ const value = providerResult.value;
1879
+ if (value === void 0 || value === null) return failedWith(failedToResolveContractSource("Contract source provider returned malformed success result: missing value.", "Ensure contract.source.load success payload is ok(Contract)."));
1880
+ return ok(providerResult.value);
1881
+ }
1882
+ const failure = providerResult.failure;
1883
+ if (!isRecord$2(failure) || typeof failure["summary"] !== "string" || !Array.isArray(failure["diagnostics"])) return failedWith(failedToResolveContractSource("Contract source provider returned malformed failure result: expected summary and diagnostics.", "Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? })."));
1884
+ if (failure["diagnostics"].some((diagnostic) => !isRecord$2(diagnostic) || typeof diagnostic["sourceId"] !== "string")) return failedWith(failedToResolveContractSource("Contract source provider returned malformed failure result: each diagnostic must include a string sourceId.", "Include the source filename in each diagnostic returned by contract.source.load."));
1885
+ return notOk({
1886
+ error: failedToResolveContractSource(failure["summary"], "Edit the source where each finding points, then run the command again.", {
1887
+ diagnostics: failure["diagnostics"],
1888
+ issues: mapDiagnosticsToIssues(failure["diagnostics"]),
1889
+ ...ifDefined("providerMeta", failure["meta"])
1890
+ }, void 0, sourceDiagnosticsToFindings(failure["diagnostics"])),
1891
+ sourceDiagnostics: providerResult.failure
1892
+ });
1893
+ }
1894
+ /**
1895
+ * Asks the configured contract source for the contract, with a source context
1896
+ * built from `stack`, and turns every failure into `CONTRACT.SOURCE_LOAD_FAILED`.
1897
+ * Every command that loads a contract source goes through here, so each
1898
+ * reports a bad source the same way.
1899
+ *
1900
+ * @throws {DOMException} `AbortError` if cancelled via `signal`
1901
+ */
1902
+ async function loadContractSourceWithStack(inputs) {
1903
+ const { stack, source } = inputs;
1904
+ const signal = inputs.signal ?? new AbortController().signal;
1905
+ const unlessAborted = abortable(signal);
1906
+ const sourceContext = {
1907
+ ...ifDefined("reportWarning", inputs.reportWarning),
1908
+ composedExtensions: stack.extensions.map((p) => p.id),
1909
+ composedExtensionContracts: stack.extensionContracts,
1910
+ authoringContributions: stack.authoringContributions,
1911
+ codecLookup: stack.codecLookup,
1912
+ controlMutationDefaults: stack.controlMutationDefaults,
1913
+ dataTypeLookup: stack.dataTypeLookup,
1914
+ resolvedInputs: await unlessAborted(expandContractInputs(source.inputs)),
1915
+ capabilities: stack.capabilities
1916
+ };
1917
+ let providerResult;
1918
+ try {
1919
+ providerResult = await unlessAborted(source.load(sourceContext));
1920
+ } catch (error) {
1921
+ if (signal.aborted || isRecord$2(error) && error["name"] === "AbortError") throw error;
1922
+ return failedWith(failedToResolveContractSource(error instanceof Error ? error.message : String(error), "Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.", void 0, error));
1923
+ }
1924
+ return validateProviderResult(providerResult);
1925
+ }
1926
+ /** @throws {CliStructuredError} `CONFIG.CONTRACT_MISSING` when the config has no contract section */
1927
+ function requireContractConfig(config) {
1928
+ if (!config.contract) throw errorContractConfigMissing({ why: "Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }" });
1929
+ return config.contract;
1930
+ }
1931
+ /** @throws {CliStructuredError} `CONFIG.CONTRACT_MISSING` when the contract source has no `load` function */
1932
+ function requireSourceProvider(contractConfig) {
1933
+ if (typeof contractConfig.source?.load !== "function") throw errorContractConfigMissing({ why: "Contract config must include a valid source provider object" });
1934
+ }
1935
+ /**
1936
+ * Runs the config's contract source and stops there: nothing is emitted or
1937
+ * written. A source that reports diagnostics is a `notOk` carrying them.
1938
+ *
1939
+ * @throws {CliStructuredError} the error `contract emit` raises, when the
1940
+ * config has no contract source or the source is malformed or throws
1941
+ * @throws {DOMException} `AbortError` if cancelled via `signal`
1942
+ */
1943
+ async function loadContractSource(config, options = {}) {
1944
+ const contractConfig = requireContractConfig(config);
1945
+ requireSourceProvider(contractConfig);
1946
+ const loaded = await loadContractSourceWithStack({
1947
+ stack: createControlStack(config),
1948
+ source: contractConfig.source,
1949
+ ...ifDefined("signal", options.signal),
1950
+ ...ifDefined("reportWarning", options.onWarning)
1951
+ });
1952
+ if (loaded.ok) return loaded;
1953
+ const { error, sourceDiagnostics } = loaded.failure;
1954
+ if (sourceDiagnostics === void 0) throw error;
1955
+ return notOk({
1956
+ summary: sourceDiagnostics.summary,
1957
+ diagnostics: sourceDiagnostics.diagnostics,
1958
+ meta: sourceDiagnostics.meta
1959
+ });
1960
+ }
1773
1961
  /**
1774
1962
  * Apply pending migrations across every contract space (app +
1775
1963
  * extensions). Replay-only: graph-walk against the on-disk graph for
@@ -2542,7 +2730,6 @@ var ControlClientImpl = class {
2542
2730
  const { onProgress, contractConfig } = options;
2543
2731
  this.init();
2544
2732
  if (!this.familyInstance) throw new InternalError("Family instance was not initialized. This is a bug.");
2545
- let contractRaw;
2546
2733
  const sourceWarnings = [];
2547
2734
  onProgress?.({
2548
2735
  action: "emit",
@@ -2550,56 +2737,27 @@ var ControlClientImpl = class {
2550
2737
  spanId: "resolveSource",
2551
2738
  label: "Resolving contract source..."
2552
2739
  });
2553
- try {
2554
- const stack = this.stack;
2555
- const sourceContext = {
2556
- composedExtensions: stack.extensions.map((p) => p.id),
2557
- composedExtensionContracts: stack.extensionContracts,
2558
- authoringContributions: stack.authoringContributions,
2559
- codecLookup: stack.codecLookup,
2560
- controlMutationDefaults: stack.controlMutationDefaults,
2561
- dataTypeLookup: stack.dataTypeLookup,
2562
- resolvedInputs: await expandContractInputs(contractConfig.source.inputs),
2563
- capabilities: stack.capabilities,
2564
- reportWarning: (diagnostic) => {
2565
- sourceWarnings.push(diagnostic);
2566
- }
2567
- };
2568
- const providerResult = await contractConfig.source.load(sourceContext);
2569
- if (!providerResult.ok) {
2570
- onProgress?.({
2571
- action: "emit",
2572
- kind: "spanEnd",
2573
- spanId: "resolveSource",
2574
- outcome: "error"
2575
- });
2576
- return notOk({
2577
- code: "CONTRACT_SOURCE_INVALID",
2578
- summary: providerResult.failure.summary,
2579
- why: providerResult.failure.summary,
2580
- meta: providerResult.failure.meta,
2581
- diagnostics: providerResult.failure
2582
- });
2740
+ const loaded = await loadContractSourceWithStack({
2741
+ stack: this.stack,
2742
+ source: contractConfig.source,
2743
+ reportWarning: (diagnostic) => {
2744
+ sourceWarnings.push(diagnostic);
2583
2745
  }
2584
- contractRaw = providerResult.value;
2585
- onProgress?.({
2586
- action: "emit",
2587
- kind: "spanEnd",
2588
- spanId: "resolveSource",
2589
- outcome: "ok"
2590
- });
2591
- } catch (error) {
2592
- onProgress?.({
2593
- action: "emit",
2594
- kind: "spanEnd",
2595
- spanId: "resolveSource",
2596
- outcome: "error"
2597
- });
2746
+ });
2747
+ onProgress?.({
2748
+ action: "emit",
2749
+ kind: "spanEnd",
2750
+ spanId: "resolveSource",
2751
+ outcome: loaded.ok ? "ok" : "error"
2752
+ });
2753
+ if (!loaded.ok) {
2754
+ const { error, sourceDiagnostics } = loaded.failure;
2598
2755
  return notOk({
2599
2756
  code: "CONTRACT_SOURCE_INVALID",
2600
- summary: "Failed to resolve contract source",
2601
- why: error instanceof Error ? error.message : String(error),
2602
- meta: void 0
2757
+ summary: sourceDiagnostics?.summary ?? error.message,
2758
+ why: error.why,
2759
+ meta: sourceDiagnostics?.meta,
2760
+ ...ifDefined("diagnostics", sourceDiagnostics)
2603
2761
  });
2604
2762
  }
2605
2763
  onProgress?.({
@@ -2609,7 +2767,7 @@ var ControlClientImpl = class {
2609
2767
  label: "Emitting contract..."
2610
2768
  });
2611
2769
  try {
2612
- const enrichedIR = enrichContract(blindCast(contractRaw), this.frameworkComponents ?? []);
2770
+ const enrichedIR = enrichContract(loaded.value, this.frameworkComponents ?? []);
2613
2771
  const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
2614
2772
  let deserializedContract;
2615
2773
  try {
@@ -2730,13 +2888,13 @@ function disposeEmitQueue(outputJsonPath) {
2730
2888
  * configuration that could disagree with what is installed.
2731
2889
  */
2732
2890
  const DEPENDENCY_FIELDS = ["dependencies", "devDependencies"];
2733
- function isRecord$2(value) {
2891
+ function isRecord$1(value) {
2734
2892
  return typeof value === "object" && value !== null && !Array.isArray(value);
2735
2893
  }
2736
2894
  /** The error codes that mean "no manifest here", as opposed to "cannot read it". */
2737
2895
  const MANIFEST_ABSENT_CODES = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
2738
2896
  function errorCode(error) {
2739
- if (!isRecord$2(error)) return void 0;
2897
+ if (!isRecord$1(error)) return void 0;
2740
2898
  const code = error["code"];
2741
2899
  return typeof code === "string" ? code : void 0;
2742
2900
  }
@@ -2780,7 +2938,7 @@ function nearestManifest(from) {
2780
2938
  cause
2781
2939
  });
2782
2940
  }
2783
- if (!isRecord$2(parsed)) throw errorRuntime("CLI.PROJECT_MANIFEST_INVALID", `Failed to read ${path}`, {
2941
+ if (!isRecord$1(parsed)) throw errorRuntime("CLI.PROJECT_MANIFEST_INVALID", `Failed to read ${path}`, {
2784
2942
  why: `\`${path}\` is valid JSON but not a JSON object, so it states no dependencies.`,
2785
2943
  fix: `Make \`${path}\` a JSON object with the usual manifest fields, then re-run the command. Emission reads it to decide which package names generated files should import.`,
2786
2944
  meta: { path }
@@ -2794,7 +2952,7 @@ function nearestManifest(from) {
2794
2952
  function declaredDependencies(manifest) {
2795
2953
  return DEPENDENCY_FIELDS.flatMap((field) => {
2796
2954
  const value = manifest[field];
2797
- return isRecord$2(value) ? Object.keys(value) : [];
2955
+ return isRecord$1(value) ? Object.keys(value) : [];
2798
2956
  });
2799
2957
  }
2800
2958
  /**
@@ -2824,7 +2982,7 @@ function projectImportRoot(projectDir) {
2824
2982
  function createProjectSpecifierResolver(projectDir) {
2825
2983
  return createImportSpecifierResolver(projectImportRoot(projectDir));
2826
2984
  }
2827
- function isRecord$1(value) {
2985
+ function isRecord(value) {
2828
2986
  return typeof value === "object" && value !== null;
2829
2987
  }
2830
2988
  function createTempArtifactPath(path, publicationToken, phase) {
@@ -2834,7 +2992,7 @@ async function readExistingArtifact(path) {
2834
2992
  try {
2835
2993
  return { content: await readFile(path, "utf-8") };
2836
2994
  } catch (error) {
2837
- if (isRecord$1(error) && error["code"] === "ENOENT") return "remove";
2995
+ if (isRecord(error) && error["code"] === "ENOENT") return "remove";
2838
2996
  throw error;
2839
2997
  }
2840
2998
  }
@@ -2928,11 +3086,27 @@ function validateContractDeps(dtsContent, projectRoot) {
2928
3086
  ].join("\n")
2929
3087
  };
2930
3088
  }
3089
+ /**
3090
+ * Validates a contract its source loaded, as `contract emit` and `contract print` both do before
3091
+ * they write anything: the contract is enriched with what the configured components declare,
3092
+ * serialized by the target, and read back through the family instance, which checks its structure.
3093
+ * Returns the contract that comes back.
3094
+ *
3095
+ * @throws {CliStructuredError} when a configured component does not match the family and target
3096
+ * @throws the family instance's error for a contract whose structure it rejects
3097
+ */
3098
+ function validateLoadedContract(input) {
3099
+ const { config } = input;
3100
+ const frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, [
3101
+ config.target,
3102
+ config.adapter,
3103
+ ...config.extensions ?? []
3104
+ ]);
3105
+ const enriched = enrichContract(input.contract, frameworkComponents);
3106
+ return input.familyInstance.deserializeContract(config.target.contractSerializer.serializeContract(enriched));
3107
+ }
2931
3108
  const EMIT_ACTION = "emit";
2932
3109
  const defaultContractEmitDependencies = { emit };
2933
- function isRecord(value) {
2934
- return typeof value === "object" && value !== null;
2935
- }
2936
3110
  function startSpan(onProgress, spanId, label) {
2937
3111
  onProgress?.({
2938
3112
  action: EMIT_ACTION,
@@ -2949,181 +3123,6 @@ function endSpan(onProgress, spanId, outcome) {
2949
3123
  outcome
2950
3124
  });
2951
3125
  }
2952
- function failedToResolveContractSource(why, fix, meta, cause, diagnostics) {
2953
- return errorRuntime("CONTRACT.SOURCE_LOAD_FAILED", "Failed to resolve contract source", {
2954
- why,
2955
- fix,
2956
- ...ifDefined("diagnostics", diagnostics),
2957
- ...ifDefined("meta", meta),
2958
- ...ifDefined("cause", cause)
2959
- });
2960
- }
2961
- function diagnosticLocation(diagnostic) {
2962
- const sourceId = typeof diagnostic["sourceId"] === "string" ? diagnostic["sourceId"] : void 0;
2963
- const span = isRecord(diagnostic["span"]) ? diagnostic["span"] : void 0;
2964
- const start = span && isRecord(span["start"]) ? span["start"] : void 0;
2965
- return {
2966
- sourceId,
2967
- line: start && typeof start["line"] === "number" ? start["line"] : void 0,
2968
- character: start && typeof start["column"] === "number" ? start["column"] : void 0
2969
- };
2970
- }
2971
- function formatLocation({ sourceId, line, character }) {
2972
- if (sourceId === void 0) return void 0;
2973
- return line !== void 0 && character !== void 0 ? `${sourceId}:${line}:${character}` : sourceId;
2974
- }
2975
- /** One source diagnostic as a line of text: `<sourceId>:<line>:<column> <code> <message>`. */
2976
- function formatSourceDiagnostic(raw) {
2977
- if (!isRecord(raw)) return String(raw);
2978
- const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
2979
- const message = typeof raw["message"] === "string" ? raw["message"] : "";
2980
- return [
2981
- formatLocation(diagnosticLocation(raw)),
2982
- code,
2983
- message
2984
- ].filter((part) => part !== void 0 && part !== "").join(" ");
2985
- }
2986
- /**
2987
- * The finding the CLI prints under the error, one per source diagnostic. The
2988
- * terminal renderer prints a finding's code and summary and nothing of its
2989
- * `where`, so the summary starts with the location. A source code that is not
2990
- * yet dotted is wrapped as `CONTRACT.SOURCE_DIAGNOSTIC` and named in the summary.
2991
- */
2992
- function sourceDiagnosticToFinding(raw) {
2993
- if (!isRecord(raw)) return void 0;
2994
- const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
2995
- const message = typeof raw["message"] === "string" ? raw["message"] : "";
2996
- const location = diagnosticLocation(raw);
2997
- const formatted = formatLocation(location);
2998
- const locatedSummary = (text) => formatted === void 0 ? text : `${formatted} ${text}`;
2999
- const finding = {
3000
- severity: "error",
3001
- nextActions: [],
3002
- ...ifDefined("where", location.sourceId === void 0 ? void 0 : {
3003
- path: location.sourceId,
3004
- ...ifDefined("line", location.line)
3005
- })
3006
- };
3007
- return isStructuredErrorCode(code) ? {
3008
- code,
3009
- summary: locatedSummary(message),
3010
- ...finding
3011
- } : {
3012
- code: "CONTRACT.SOURCE_DIAGNOSTIC",
3013
- summary: locatedSummary(`${code}: ${message}`),
3014
- ...finding,
3015
- meta: { code }
3016
- };
3017
- }
3018
- function sourceDiagnosticsToFindings(diagnostics) {
3019
- const findings = [];
3020
- for (const raw of diagnostics) {
3021
- const finding = sourceDiagnosticToFinding(raw);
3022
- if (finding !== void 0) findings.push(finding);
3023
- }
3024
- return findings;
3025
- }
3026
- function diagnosticLocationSuffix(diagnostic) {
3027
- const formatted = formatLocation(diagnosticLocation(diagnostic));
3028
- return formatted === void 0 ? "" : ` (${formatted})`;
3029
- }
3030
- function mapDiagnosticsToIssues(diagnostics) {
3031
- const issues = [];
3032
- for (const raw of diagnostics) {
3033
- if (!isRecord(raw)) continue;
3034
- const code = typeof raw["code"] === "string" ? raw["code"] : "diagnostic";
3035
- const message = typeof raw["message"] === "string" ? raw["message"] : "";
3036
- issues.push({
3037
- kind: code,
3038
- message: `${message}${diagnosticLocationSuffix(raw)}`
3039
- });
3040
- }
3041
- return issues;
3042
- }
3043
- function validateProviderResult(providerResult) {
3044
- if (!isRecord(providerResult) || typeof providerResult["ok"] !== "boolean") return {
3045
- kind: "malformed",
3046
- error: failedToResolveContractSource("Contract source provider returned malformed result shape.", "Ensure contract.source.load resolves to ok(Contract) or notOk({ summary, diagnostics }).")
3047
- };
3048
- if (providerResult["ok"]) {
3049
- if (!("value" in providerResult)) return {
3050
- kind: "malformed",
3051
- error: failedToResolveContractSource("Contract source provider returned malformed success result: missing value.", "Ensure contract.source.load success payload is ok(Contract).")
3052
- };
3053
- return {
3054
- kind: "ok",
3055
- value: providerResult["value"]
3056
- };
3057
- }
3058
- const failure = providerResult["failure"];
3059
- if (!isRecord(failure) || typeof failure["summary"] !== "string" || !Array.isArray(failure["diagnostics"])) return {
3060
- kind: "malformed",
3061
- error: failedToResolveContractSource("Contract source provider returned malformed failure result: expected summary and diagnostics.", "Ensure contract.source.load failure payload is notOk({ summary, diagnostics, meta? }).")
3062
- };
3063
- if (failure["diagnostics"].some((diagnostic) => !isRecord(diagnostic) || typeof diagnostic["sourceId"] !== "string")) return {
3064
- kind: "malformed",
3065
- error: failedToResolveContractSource("Contract source provider returned malformed failure result: each diagnostic must include a string sourceId.", "Include the source filename in each diagnostic returned by contract.source.load.")
3066
- };
3067
- return {
3068
- kind: "failed",
3069
- failure: {
3070
- summary: failure["summary"],
3071
- diagnostics: failure["diagnostics"],
3072
- meta: failure["meta"]
3073
- }
3074
- };
3075
- }
3076
- function sourceFailureError(failure) {
3077
- return failedToResolveContractSource(failure.summary, "Edit the schema where each finding points, then run contract emit again.", {
3078
- diagnostics: failure.diagnostics,
3079
- issues: mapDiagnosticsToIssues(failure.diagnostics),
3080
- ...ifDefined("providerMeta", failure.meta)
3081
- }, void 0, sourceDiagnosticsToFindings(failure.diagnostics));
3082
- }
3083
- function requireContractConfig(config) {
3084
- if (!config.contract) throw errorContractConfigMissing({ why: "Config.contract is required for emit. Define it in your config: contract: { source: ..., output: ... }" });
3085
- return config.contract;
3086
- }
3087
- function requireSourceProvider(contractConfig) {
3088
- if (typeof contractConfig.source?.load !== "function") throw errorContractConfigMissing({ why: "Contract config must include a valid source provider object" });
3089
- }
3090
- async function resolveContractSource(contractConfig, stack, signal, reportWarning) {
3091
- const sourceContext = {
3092
- ...ifDefined("reportWarning", reportWarning),
3093
- composedExtensions: stack.extensions.map((p) => p.id),
3094
- composedExtensionContracts: stack.extensionContracts,
3095
- authoringContributions: stack.authoringContributions,
3096
- codecLookup: stack.codecLookup,
3097
- controlMutationDefaults: stack.controlMutationDefaults,
3098
- dataTypeLookup: stack.dataTypeLookup,
3099
- resolvedInputs: await abortable(signal)(expandContractInputs(contractConfig.source.inputs)),
3100
- capabilities: stack.capabilities
3101
- };
3102
- let providerResult;
3103
- try {
3104
- providerResult = await abortable(signal)(contractConfig.source.load(sourceContext));
3105
- } catch (error) {
3106
- if (signal.aborted || isRecord(error) && error["name"] === "AbortError") throw error;
3107
- throw failedToResolveContractSource(error instanceof Error ? error.message : String(error), "Ensure contract.source.load resolves to ok(Contract) or returns structured diagnostics.", void 0, error);
3108
- }
3109
- const validated = validateProviderResult(providerResult);
3110
- switch (validated.kind) {
3111
- case "malformed": throw validated.error;
3112
- case "failed": return notOk(validated.failure);
3113
- case "ok": return ok(validated.value);
3114
- }
3115
- }
3116
- /**
3117
- * Runs the config's contract source the way `executeContractEmit` does and
3118
- * stops there: nothing is emitted or written. A source that reports
3119
- * diagnostics is a `notOk`; a malformed or throwing source raises the same
3120
- * error emit raises.
3121
- */
3122
- async function loadContractSource(config, options = {}) {
3123
- const contractConfig = requireContractConfig(config);
3124
- requireSourceProvider(contractConfig);
3125
- return resolveContractSource(contractConfig, createControlStack(config), options.signal ?? new AbortController().signal, options.onWarning);
3126
- }
3127
3126
  /**
3128
3127
  * Canonical contract emit operation.
3129
3128
  *
@@ -3159,36 +3158,36 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
3159
3158
  }
3160
3159
  const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;
3161
3160
  return queueEmitByOutput(outputJsonPath, async () => {
3162
- const stack = createControlStack(config);
3163
3161
  startSpan(onProgress, "resolveSource", "Resolving contract source...");
3164
3162
  const sourceWarnings = [];
3165
- let resolved;
3163
+ let stack;
3164
+ let contract;
3166
3165
  try {
3167
- resolved = await resolveContractSource(contractConfig, stack, signal, (diagnostic) => {
3168
- sourceWarnings.push(diagnostic);
3166
+ stack = createControlStack(config);
3167
+ const loaded = await loadContractSourceWithStack({
3168
+ stack,
3169
+ source: contractConfig.source,
3170
+ signal,
3171
+ reportWarning: (diagnostic) => {
3172
+ sourceWarnings.push(diagnostic);
3173
+ }
3169
3174
  });
3175
+ if (!loaded.ok) throw loaded.failure.error;
3176
+ contract = loaded.value;
3170
3177
  } catch (error) {
3171
3178
  endSpan(onProgress, "resolveSource", "error");
3172
3179
  throw error;
3173
3180
  }
3174
- if (!resolved.ok) {
3175
- endSpan(onProgress, "resolveSource", "error");
3176
- throw sourceFailureError(resolved.failure);
3177
- }
3178
3181
  endSpan(onProgress, "resolveSource", "ok");
3179
3182
  startSpan(onProgress, "emit", "Emitting contract...");
3180
3183
  let emitResult;
3181
3184
  try {
3182
3185
  const familyInstance = config.family.create(stack);
3183
- const rawComponents = [
3184
- config.target,
3185
- config.adapter,
3186
- ...config.extensions ?? []
3187
- ];
3188
- const frameworkComponents = assertFrameworkComponentsCompatible(config.family.familyId, config.target.targetId, rawComponents);
3189
- const enrichedIR = enrichContract(blindCast(resolved.value), frameworkComponents);
3190
- const rawContractJson = config.target.contractSerializer.serializeContract(enrichedIR);
3191
- const deserializedContract = familyInstance.deserializeContract(rawContractJson);
3186
+ const deserializedContract = validateLoadedContract({
3187
+ config,
3188
+ familyInstance,
3189
+ contract
3190
+ });
3192
3191
  const { contractSerializer } = config.target;
3193
3192
  const serializeContract = (c) => contractSerializer.serializeContract(c);
3194
3193
  emitResult = await unlessAborted(dependencies.emit(deserializedContract, stack, config.family.emission, {
@@ -5165,6 +5164,6 @@ async function executeRefListCommand(options) {
5165
5164
  }
5166
5165
  }
5167
5166
  //#endregion
5168
- export { formatSourceDiagnostic as $, errorLegendHumanOnly as A, runCommandAction as At, errorUnexpected as B, errorContractArgConflict as C, requireLiveDatabase as Ct, errorDriverRequired as D, resolveFromForPlan as Dt, errorDestructiveChanges as E, resolveContractRefToSnapshot as Et, errorPathUnreachable as F, snapshotVerifierFor as Ft, executeMigrateShowPlan as G, executeDbInit as H, errorRunnerFailed as I, statusForMigrationHash as It, executeRefAdvancement as J, executeMigrationNewCommand as K, errorRuntime as L, targetSupportsMigrations as Lt, errorMigrationPackageNotFound as M, runMigrationCheck as Mt, errorMigrationPlanningFailed as N, runMigrationList as Nt, errorFileNotFound as O, resolveMigrationRef as Ot, errorNoMigrations as P, sanitizeErrorMessage as Pt, findPackageByDirPath as Q, errorTargetMigrationNotSupported as R, toDeclaredExtensionsFromRaw as Rt, errorConsentPlanMismatch as S, refuseUnknownInvariants as St, errorDatabaseConnectionRequired as T, resolveContractRef$1 as Tt, executeDbUpdate as U, executeContractEmit as V, executeDbVerify as W, executeRefListCommand as X, executeRefDeleteCommand as Y, executeRefSetCommand as Z, disposeEmitQueue as _, refuseContractSpaceIntegrity as _t, appContractStandInFromIdentity as a, loadContractSpaceAggregateForCli as at, errorAdvanceRefArgConflict as b, refuseMissingInvariantPath as bt, buildMigrationSpaceGraphEntries as c, mapContractAtError as ct, checkSingleTarget as d, migrationSpaceListEntriesFromAggregate as dt, hasMigrationPath as et, chooseAction as f, originHashForStatus as ft, deriveStatusEdgeAnnotations as g, redactUrlCredentials as gt, createControlClient as h, readMigrationRefs as ht, advanceRefSafely as i, loadContractSource as it, errorMarkerMissing as j, runContractSpaceSeedPhase as jt, errorHashMismatch as k, resolveToForPlan as kt, buildReadAggregate as l, mapIntegrityViolations as lt, computeRefAdvancementName as m, readContractEnvelope as mt, ERROR_CODE_DESTRUCTIVE_CHANGES as n, loadAggregateIntegrityViolations as nt, appliedHashesFromLedger as o, looksLikePath as ot, closeQuietly as p, preflightRefAdvancement as pt, executeMigrationPlanCommand as q, NO_REF_ADVANCEMENT as r, loadContractRawSafely as rt, buildContractSpaceAggregate as s, mapCaughtMigrationError as st, CliStructuredError$1 as t, listRefsByContractHash as tt, buildRefAdvancementFields as u, maskConnectionUrl as ut, enrichContract as v, refuseDeclaredExtensionTargetMismatch as vt, errorContractValidationFailed as w, resolveAppTargetPath as wt, errorConfigValidation$1 as x, refusePackageCorruptionOnAggregate as xt, enumerateCheckSpaces as y, refuseMarkerOutsideGraph as yt, errorTargetMismatch as z };
5167
+ export { findPackageByDirPath as $, errorHashMismatch as A, resolveMigrationRef as At, errorTargetMismatch as B, toDeclaredExtensionsFromRaw as Bt, errorContractArgConflict as C, refusePackageCorruptionOnAggregate as Ct, errorDestructiveChanges as D, resolveContractRef$1 as Dt, errorDatabaseConnectionRequired as E, resolveAppTargetPath as Et, errorNoMigrations as F, runMigrationList as Ft, executeDbVerify as G, executeContractEmit as H, errorPathUnreachable as I, sanitizeErrorMessage as It, executeMigrationPlanCommand as J, executeMigrateShowPlan as K, errorRunnerFailed as L, snapshotVerifierFor as Lt, errorMarkerMissing as M, runCommandAction as Mt, errorMigrationPackageNotFound as N, runContractSpaceSeedPhase as Nt, errorDriverRequired as O, resolveContractRefToSnapshot as Ot, errorMigrationPlanningFailed as P, runMigrationCheck as Pt, executeRefSetCommand as Q, errorRuntime as R, statusForMigrationHash as Rt, errorConsentPlanMismatch as S, refuseMissingInvariantPath as St, errorContractValidationFailed as T, requireLiveDatabase as Tt, executeDbInit as U, errorUnexpected as V, validateLoadedContract as Vt, executeDbUpdate as W, executeRefDeleteCommand as X, executeRefAdvancement as Y, executeRefListCommand as Z, disposeEmitQueue as _, readMigrationRefs as _t, appContractStandInFromIdentity as a, loadContractSource as at, errorAdvanceRefArgConflict as b, refuseDeclaredExtensionTargetMismatch as bt, buildMigrationSpaceGraphEntries as c, looksLikePath as ct, checkSingleTarget as d, mapIntegrityViolations as dt, formatSourceDiagnostic as et, chooseAction as f, maskConnectionUrl as ft, deriveStatusEdgeAnnotations as g, readContractEnvelope as gt, createControlClient as h, preflightRefAdvancement as ht, advanceRefSafely as i, loadContractRawSafely as it, errorLegendHumanOnly as j, resolveToForPlan as jt, errorFileNotFound as k, resolveFromForPlan as kt, buildReadAggregate as l, mapCaughtMigrationError as lt, computeRefAdvancementName as m, originHashForStatus as mt, ERROR_CODE_DESTRUCTIVE_CHANGES as n, listRefsByContractHash as nt, appliedHashesFromLedger as o, loadContractSourceWithStack as ot, closeQuietly as p, migrationSpaceListEntriesFromAggregate as pt, executeMigrationNewCommand as q, NO_REF_ADVANCEMENT as r, loadAggregateIntegrityViolations as rt, buildContractSpaceAggregate as s, loadContractSpaceAggregateForCli as st, CliStructuredError$1 as t, hasMigrationPath as tt, buildRefAdvancementFields as u, mapContractAtError as ut, enrichContract as v, redactUrlCredentials as vt, errorContractConfigMissing as w, refuseUnknownInvariants as wt, errorConfigValidation$1 as x, refuseMarkerOutsideGraph as xt, enumerateCheckSpaces as y, refuseContractSpaceIntegrity as yt, errorTargetMigrationNotSupported as z, targetSupportsMigrations as zt };
5169
5168
 
5170
- //# sourceMappingURL=ref-jhp3BGZM-CI91tliC.mjs.map
5169
+ //# sourceMappingURL=ref-DZuzAvuD-BYpisYJp.mjs.map