@prisma/orm-toolchain 8.0.0-rc.18-dev.16 → 8.0.0-rc.18-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.
Files changed (78) hide show
  1. package/dist/{aggregate-CJjYCgNP.mjs → aggregate-C0qscKli.mjs} +15 -11
  2. package/dist/aggregate-C0qscKli.mjs.map +1 -0
  3. package/dist/{aggregate-MAVa_CD0.d.mts → aggregate-Da8PGnzg.d.mts} +5 -3
  4. package/dist/aggregate-Da8PGnzg.d.mts.map +1 -0
  5. package/dist/{caught-errors-olsx_RBn-Cg0ilJtv.mjs → caught-errors-olsx_RBn-BC8azlie.mjs} +2 -2
  6. package/dist/{caught-errors-olsx_RBn-Cg0ilJtv.mjs.map → caught-errors-olsx_RBn-BC8azlie.mjs.map} +1 -1
  7. package/dist/cli-telemetry.mjs +1 -1
  8. package/dist/cli.mjs +46 -31
  9. package/dist/cli.mjs.map +1 -1
  10. package/dist/cli__control-api.d.mts +7 -4
  11. package/dist/cli__control-api.d.mts.map +1 -1
  12. package/dist/cli__control-api.mjs +2 -2
  13. package/dist/cli__control-api__testing.d.mts +1 -1
  14. package/dist/cli__control-api__testing.mjs +1 -1
  15. package/dist/cli__control-api__testing.mjs.map +1 -1
  16. package/dist/cli__migration-cli.mjs +4 -4
  17. package/dist/config-loader.mjs +1 -1
  18. package/dist/{contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs → contract-snapshot-store-DwEs5EOp-3qAvnEf3.mjs} +3 -3
  19. package/dist/{contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs.map → contract-snapshot-store-DwEs5EOp-3qAvnEf3.mjs.map} +1 -1
  20. package/dist/{db-sign-JgxFUHAx-BnA61Q5l.d.mts → db-sign-C3GY7-1h-C0whdey8.d.mts} +3 -3
  21. package/dist/{db-sign-JgxFUHAx-BnA61Q5l.d.mts.map → db-sign-C3GY7-1h-C0whdey8.d.mts.map} +1 -1
  22. package/dist/{domain-type-generation-B_tgVA9W-DdPq_876.d.mts → domain-type-generation-CINeP3Ed-D05XzCGK.d.mts} +3 -3
  23. package/dist/{domain-type-generation-B_tgVA9W-DdPq_876.d.mts.map → domain-type-generation-CINeP3Ed-D05XzCGK.d.mts.map} +1 -1
  24. package/dist/emitter.d.mts +2 -2
  25. package/dist/emitter.mjs +1 -1
  26. package/dist/emitter__domain-type-generation.d.mts +1 -1
  27. package/dist/{errors-KWM8yBAL.d.mts → errors-GnmirXRU.d.mts} +4 -1
  28. package/dist/{errors-KWM8yBAL.d.mts.map → errors-GnmirXRU.d.mts.map} +1 -1
  29. package/dist/{errors-B1xJ5JTo-CrQL55Qf.mjs → errors-nnIQQvmN-oeANP4Yi.mjs} +10 -2
  30. package/dist/errors-nnIQQvmN-oeANP4Yi.mjs.map +1 -0
  31. package/dist/{exports-D1qqHTu1.mjs → exports-DH1C-t5Q.mjs} +2 -2
  32. package/dist/{exports-D1qqHTu1.mjs.map → exports-DH1C-t5Q.mjs.map} +1 -1
  33. package/dist/{exports-DsqGwQ1B.mjs → exports-R5Bj59KS.mjs} +6 -4
  34. package/dist/exports-R5Bj59KS.mjs.map +1 -0
  35. package/dist/{exports-CBaM-1YD-CJuFjV3_.mjs → exports-o91c4INl-_M3b_rty.mjs} +4 -3
  36. package/dist/exports-o91c4INl-_M3b_rty.mjs.map +1 -0
  37. package/dist/{graph-membership-C-5WMh1R-BUtW54H2.mjs → graph-membership-ul46Kb0W-B8HahKEu.mjs} +3 -3
  38. package/dist/{graph-membership-C-5WMh1R-BUtW54H2.mjs.map → graph-membership-ul46Kb0W-B8HahKEu.mjs.map} +1 -1
  39. package/dist/{index-Co6ho75S.d.mts → index-DbIFi6KU.d.mts} +4 -4
  40. package/dist/{index-Co6ho75S.d.mts.map → index-DbIFi6KU.d.mts.map} +1 -1
  41. package/dist/{invariants-1xSrwDkH-BoUuNrf4.mjs → invariants-Jgsl_-rJ-0ieZ1n7L.mjs} +3 -3
  42. package/dist/{invariants-1xSrwDkH-BoUuNrf4.mjs.map → invariants-Jgsl_-rJ-0ieZ1n7L.mjs.map} +1 -1
  43. package/dist/{io-CUFeeOVP-CEgOEVwW.mjs → io-QeCr3NPS-Bk-Rfef2.mjs} +5 -5
  44. package/dist/{io-CUFeeOVP-CEgOEVwW.mjs.map → io-QeCr3NPS-Bk-Rfef2.mjs.map} +1 -1
  45. package/dist/{migration-CZrQ_3zY.mjs → migration-Cp6vkFMP.mjs} +3 -3
  46. package/dist/{migration-CZrQ_3zY.mjs.map → migration-Cp6vkFMP.mjs.map} +1 -1
  47. package/dist/migration-tools.d.mts +2 -2
  48. package/dist/migration-tools.mjs +11 -11
  49. package/dist/migration-tools__aggregate.d.mts +1 -1
  50. package/dist/migration-tools__aggregate.mjs +1 -1
  51. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  52. package/dist/migration-tools__errors.d.mts +1 -1
  53. package/dist/migration-tools__errors.mjs +1 -1
  54. package/dist/migration-tools__invariants.mjs +1 -1
  55. package/dist/migration-tools__io.mjs +1 -1
  56. package/dist/migration-tools__migration-graph.mjs +1 -1
  57. package/dist/migration-tools__migration.mjs +1 -1
  58. package/dist/migration-tools__ref-resolution.mjs +1 -1
  59. package/dist/migration-tools__refs.mjs +1 -1
  60. package/dist/migration-tools__spaces.mjs +2 -2
  61. package/dist/{ref-CPPMhLAs-Bxf2BJcA.mjs → ref-UzwhFoEX-BdXkOZFM.mjs} +72 -32
  62. package/dist/ref-UzwhFoEX-BdXkOZFM.mjs.map +1 -0
  63. package/dist/{ref-resolution-kNMjYJ26.mjs → ref-resolution-CCIgrFwK.mjs} +2 -2
  64. package/dist/{ref-resolution-kNMjYJ26.mjs.map → ref-resolution-CCIgrFwK.mjs.map} +1 -1
  65. package/dist/{refs-CS997f-J-BxkRLuCE.mjs → refs-BIzM-guE-qMvITMOL.mjs} +3 -3
  66. package/dist/{refs-CS997f-J-BxkRLuCE.mjs.map → refs-BIzM-guE-qMvITMOL.mjs.map} +1 -1
  67. package/dist/{spaces-CtxjvIS0.mjs → spaces-BoFEHLeH.mjs} +5 -5
  68. package/dist/{spaces-CtxjvIS0.mjs.map → spaces-BoFEHLeH.mjs.map} +1 -1
  69. package/dist/{verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs → verify-contract-spaces-BFH2o5RL-CI6uhB5B.mjs} +4 -4
  70. package/dist/{verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs.map → verify-contract-spaces-BFH2o5RL-CI6uhB5B.mjs.map} +1 -1
  71. package/dist/vite-plugin-contract-emit.mjs +3 -3
  72. package/package.json +12 -12
  73. package/dist/aggregate-CJjYCgNP.mjs.map +0 -1
  74. package/dist/aggregate-MAVa_CD0.d.mts.map +0 -1
  75. package/dist/errors-B1xJ5JTo-CrQL55Qf.mjs.map +0 -1
  76. package/dist/exports-CBaM-1YD-CJuFjV3_.mjs.map +0 -1
  77. package/dist/exports-DsqGwQ1B.mjs.map +0 -1
  78. package/dist/ref-CPPMhLAs-Bxf2BJcA.mjs.map +0 -1
@@ -1,27 +1,27 @@
1
- import { a as expandContractInputs } from "./exports-D1qqHTu1.mjs";
2
- import { D as errorNoInvariantPath, M as errorUnknownInvariant, b as errorInvalidRefName, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
1
+ import { a as expandContractInputs } from "./exports-DH1C-t5Q.mjs";
2
+ import { D as errorNoInvariantPath, M as errorUnknownInvariant, b as errorInvalidRefName, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-nnIQQvmN-oeANP4Yi.mjs";
3
3
  import { r as verifyMigrationHash, t as computeMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
4
- import { a as snapshotsImportPathFrom, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs";
5
- import { t as deriveProvidedInvariants } from "./invariants-1xSrwDkH-BoUuNrf4.mjs";
6
- import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-CUFeeOVP-CEgOEVwW.mjs";
4
+ import { a as snapshotsImportPathFrom, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-DwEs5EOp-3qAvnEf3.mjs";
5
+ import { t as deriveProvidedInvariants } from "./invariants-Jgsl_-rJ-0ieZ1n7L.mjs";
6
+ import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-QeCr3NPS-Bk-Rfef2.mjs";
7
7
  import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
8
8
  import { i as findPathWithDecision, r as findPath } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
9
- 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-sL5mlmCX-K2P69KDp.mjs";
10
- import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-CtxjvIS0.mjs";
11
- import { $ as errorUnexpected, C as errorFileNotFound, E as errorInvalidSpaceId, F as errorPlanOriginUnknown, G as errorStatementAnswersNoQuestion, I as errorPlanProducedNoOperations, J as errorStatementNeedsMigrationFile, K as errorStatementDidNotResolveLoss, L as errorRefSetBundleNotFound, N as errorPathUnreachable, O as errorMarkerMismatch, P as errorPlanForgotTheFlag, R as errorRefSetEmptySentinel, U as errorSnapshotMissing, V as errorRuntime, W as errorSpaceNotFound, X as errorStatementUnresolved, Y as errorStatementOriginUnknown, Z as errorTargetMigrationNotSupported, ct as requireLiveDatabase, d as collectDeclaredInvariants, dt as runCommandAction, et as getTargetMigrations, ft as selfEmitCommand, g as errorConfigValidation$1, gt as toStructuralEdge, h as errorAmbiguousMigrationRef, j as errorMigrationPlanningFailed, lt as resolveContractPath, mt as statementFlag, n as CliStructuredError$1, ot as readContractEnvelope, q as errorStatementInvalid, r as STORE_ORIGIN_SNAPSHOT_STEPS, s as chooseAction, tt as mapRefResolutionError, u as closeQuietly, ut as resolveMigrationPaths, v as errorContractConfigMissing, w as errorFromCaught, y as errorContractValidationFailed, z as errorRefSetHashNotInGraph } from "./caught-errors-olsx_RBn-Cg0ilJtv.mjs";
12
- import { r as getEmittedArtifactPaths, t as emit } from "./exports-CBaM-1YD-CJuFjV3_.mjs";
13
- import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-C-5WMh1R-BUtW54H2.mjs";
14
- 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-CS997f-J-BxkRLuCE.mjs";
15
- import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, m as verifyMigration, n as buildFabricatedMigrationEdge, p as spacesInApplyOrder, r as collectAggregateNamespaces, t as allStorageElementsExternal, u as planMigration } from "./aggregate-CJjYCgNP.mjs";
9
+ 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-BFH2o5RL-CI6uhB5B.mjs";
10
+ import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-BoFEHLeH.mjs";
11
+ import { $ as errorUnexpected, C as errorFileNotFound, E as errorInvalidSpaceId, F as errorPlanOriginUnknown, G as errorStatementAnswersNoQuestion, I as errorPlanProducedNoOperations, J as errorStatementNeedsMigrationFile, K as errorStatementDidNotResolveLoss, L as errorRefSetBundleNotFound, N as errorPathUnreachable, O as errorMarkerMismatch, P as errorPlanForgotTheFlag, R as errorRefSetEmptySentinel, U as errorSnapshotMissing, V as errorRuntime, W as errorSpaceNotFound, X as errorStatementUnresolved, Y as errorStatementOriginUnknown, Z as errorTargetMigrationNotSupported, ct as requireLiveDatabase, d as collectDeclaredInvariants, dt as runCommandAction, et as getTargetMigrations, ft as selfEmitCommand, g as errorConfigValidation$1, gt as toStructuralEdge, h as errorAmbiguousMigrationRef, j as errorMigrationPlanningFailed, lt as resolveContractPath, mt as statementFlag, n as CliStructuredError$1, ot as readContractEnvelope, q as errorStatementInvalid, r as STORE_ORIGIN_SNAPSHOT_STEPS, s as chooseAction, tt as mapRefResolutionError, u as closeQuietly, ut as resolveMigrationPaths, v as errorContractConfigMissing, w as errorFromCaught, y as errorContractValidationFailed, z as errorRefSetHashNotInGraph } from "./caught-errors-olsx_RBn-BC8azlie.mjs";
12
+ import { r as getEmittedArtifactPaths, t as emit } from "./exports-o91c4INl-_M3b_rty.mjs";
13
+ import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-ul46Kb0W-B8HahKEu.mjs";
14
+ 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-BIzM-guE-qMvITMOL.mjs";
15
+ import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, m as verifyMigration, n as buildFabricatedMigrationEdge, p as spacesInApplyOrder, r as collectAggregateNamespaces, t as allStorageElementsExternal, u as planMigration } from "./aggregate-C0qscKli.mjs";
16
16
  import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver, t as ImportRootError } from "./import-roots-DXD7fung.mjs";
17
- import { c as parseContractRef, l as parseMigrationRef, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-kNMjYJ26.mjs";
17
+ import { c as parseContractRef, l as parseMigrationRef, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-CCIgrFwK.mjs";
18
18
  import { a as writeMigrationTs } from "./migration-ts-DDgjsR1O.mjs";
19
19
  import { createRequire } from "node:module";
20
20
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
21
21
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
22
22
  import { APP_SPACE_ID, CONTRACT_SNAPSHOTS_DIRNAME, createControlStack, describeMigrationStatement, fieldStatementText, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView, isStorageHashHex, migrationStatementJson, migrationSubjectJson, migrationSubjectKey, modelDisplayName, modelStatementText, planOriginOf } from "@prisma/orm-framework/components/control";
23
23
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
24
- import { isStructuredErrorCode, structuredError } from "@prisma/orm-framework/utils/structured-error";
24
+ import { isStructuredError, isStructuredErrorCode, structuredError } from "@prisma/orm-framework/utils/structured-error";
25
25
  import { basename, dirname, isAbsolute, join, relative, resolve } from "pathe";
26
26
  import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
27
27
  import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
@@ -34,7 +34,16 @@ import { asNamespaceId } from "@prisma/orm-framework/contract/types";
34
34
  import { isDeepStrictEqual } from "node:util";
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-CPPMhLAs.mjs
37
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-UzwhFoEX.mjs
38
+ /**
39
+ * The meta of a contract that failed to load because the family refused it, such as the columns whose defaults it refused, for the command to report: the refusal's own meta, or the `refusedDefaults` a migration-tools error kept from it.
40
+ */
41
+ function contractValidationMeta(error) {
42
+ if (!isStructuredError(error)) return void 0;
43
+ if (error.code === "CONTRACT.VALIDATION_FAILED") return error.meta;
44
+ const refusedDefaults = error.meta?.["refusedDefaults"];
45
+ return refusedDefaults === void 0 ? void 0 : { refusedDefaults };
46
+ }
38
47
  /**
39
48
  * Asserts that all framework components are compatible with the expected family and target.
40
49
  *
@@ -3189,7 +3198,10 @@ var ControlClientImpl = class {
3189
3198
  try {
3190
3199
  contract = familyInstance.deserializeContract(options.contract);
3191
3200
  } catch (error) {
3192
- throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
3201
+ throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), {
3202
+ cause: error,
3203
+ ...ifDefined("meta", contractValidationMeta(error))
3204
+ });
3193
3205
  }
3194
3206
  onProgress?.({
3195
3207
  action: "verify",
@@ -3229,7 +3241,10 @@ var ControlClientImpl = class {
3229
3241
  try {
3230
3242
  contract = familyInstance.deserializeContract(options.contract);
3231
3243
  } catch (error) {
3232
- throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
3244
+ throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), {
3245
+ cause: error,
3246
+ ...ifDefined("meta", contractValidationMeta(error))
3247
+ });
3233
3248
  }
3234
3249
  onProgress?.({
3235
3250
  action: "schemaVerify",
@@ -3275,7 +3290,10 @@ var ControlClientImpl = class {
3275
3290
  try {
3276
3291
  contract = familyInstance.deserializeContract(options.contract);
3277
3292
  } catch (error) {
3278
- throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
3293
+ throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), {
3294
+ cause: error,
3295
+ ...ifDefined("meta", contractValidationMeta(error))
3296
+ });
3279
3297
  }
3280
3298
  return executeDbInit({
3281
3299
  driver,
@@ -3302,7 +3320,10 @@ var ControlClientImpl = class {
3302
3320
  try {
3303
3321
  contract = familyInstance.deserializeContract(options.contract);
3304
3322
  } catch (error) {
3305
- throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
3323
+ throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), {
3324
+ cause: error,
3325
+ ...ifDefined("meta", contractValidationMeta(error))
3326
+ });
3306
3327
  }
3307
3328
  return executeDbUpdate({
3308
3329
  driver,
@@ -3386,7 +3407,10 @@ var ControlClientImpl = class {
3386
3407
  try {
3387
3408
  contract = familyInstance.deserializeContract(options.contract);
3388
3409
  } catch (error) {
3389
- throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), { cause: error });
3410
+ throw structuredError("CONTRACT.VALIDATION_FAILED", error instanceof Error ? error.message : String(error), {
3411
+ cause: error,
3412
+ ...ifDefined("meta", contractValidationMeta(error))
3413
+ });
3390
3414
  }
3391
3415
  return executeMigrate({
3392
3416
  driver,
@@ -3438,7 +3462,7 @@ var ControlClientImpl = class {
3438
3462
  this.init();
3439
3463
  if (this.familyInstance && hasSchemaView(this.familyInstance)) return this.familyInstance.toSchemaView(schemaIR);
3440
3464
  }
3441
- inferPslContract(schemaIR) {
3465
+ async inferPslContract(schemaIR) {
3442
3466
  this.init();
3443
3467
  if (this.familyInstance && hasPslContractInfer(this.familyInstance)) return this.familyInstance.inferPslContract(schemaIR);
3444
3468
  }
@@ -3956,7 +3980,8 @@ function errorContractDtsRenderFailed(contractJsonPath, failure) {
3956
3980
  const why = failure.why ?? failure.summary;
3957
3981
  if (failure.code === "CONTRACT_VALIDATION_FAILED") return errorContractValidationFailed(`Contract at ${contractJsonPath} failed to deserialize: ${why}`, {
3958
3982
  where: { path: contractJsonPath },
3959
- ...ifDefined("cause", failure.cause)
3983
+ ...ifDefined("cause", failure.cause),
3984
+ meta: contractValidationMeta(failure.cause)
3960
3985
  });
3961
3986
  return new CliStructuredError$1("CONTRACT.TYPES_RENDER_FAILED", "Failed to render contract types", {
3962
3987
  why: `The types for the contract at ${contractJsonPath} could not be rendered: ${why}`,
@@ -4219,7 +4244,8 @@ function mapContractAtError(error, options) {
4219
4244
  const filePath = typeof error.meta?.["filePath"] === "string" ? error.meta["filePath"] : "unknown";
4220
4245
  return notOk(errorContractValidationFailed(`Predecessor contract at ${filePath} failed to deserialize: ${typeof error.meta?.["message"] === "string" ? error.meta["message"] : error.message}`, {
4221
4246
  where: { path: filePath },
4222
- cause: error
4247
+ cause: error,
4248
+ meta: contractValidationMeta(error)
4223
4249
  }));
4224
4250
  }
4225
4251
  case "MIGRATION.INVALID_JSON": {
@@ -4780,13 +4806,17 @@ async function runMigrationCheck(inputs) {
4780
4806
  summary: `${failures.length} integrity failure(s)`
4781
4807
  });
4782
4808
  }
4809
+ /**
4810
+ * The integrity violations of the project's contract spaces. A contract the family refuses to load, the app's or a snapshot's, such as one holding a default its column type does not hold, is the error, with the refusal's meta; any other failure to load the aggregate leaves the violations to the other checks.
4811
+ */
4783
4812
  async function loadAggregateIntegrityViolations(config, migrationsDir, verifySnapshotContent) {
4813
+ const contractPath = resolveContractPath(config);
4784
4814
  try {
4785
- const contractJsonContent = await readFile(resolveContractPath(config), "utf-8");
4815
+ const contractJsonContent = await readFile(contractPath, "utf-8");
4786
4816
  const familyInstance = config.family.create(createControlStack(config));
4787
4817
  const declaredExtensions = toDeclaredExtensionsFromRaw(config.extensions ?? []);
4788
4818
  const parsedAppContract = JSON.parse(contractJsonContent);
4789
- return (await loadContractSpaceAggregate({
4819
+ return ok((await loadContractSpaceAggregate({
4790
4820
  migrationsDir,
4791
4821
  deserializeContract: (json) => familyInstance.deserializeContract(json),
4792
4822
  appContract: familyInstance.deserializeContract(parsedAppContract),
@@ -4794,9 +4824,15 @@ async function loadAggregateIntegrityViolations(config, migrationsDir, verifySna
4794
4824
  })).checkIntegrity({
4795
4825
  declaredExtensions,
4796
4826
  checkContracts: true
4797
- });
4798
- } catch {
4799
- return [];
4827
+ }));
4828
+ } catch (error) {
4829
+ if (MigrationToolsError.is(error) && error.code === "MIGRATION.CONTRACT_DESERIALIZATION_FAILED") return mapContractAtError(error);
4830
+ if (isStructuredError(error) && error.code === "CONTRACT.VALIDATION_FAILED") return notOk(errorContractValidationFailed(`Contract at ${contractPath} failed to deserialize: ${error.message}`, {
4831
+ where: { path: contractPath },
4832
+ cause: error,
4833
+ meta: contractValidationMeta(error)
4834
+ }));
4835
+ return ok([]);
4800
4836
  }
4801
4837
  }
4802
4838
  /**
@@ -5185,7 +5221,8 @@ async function executeMigrationNewCommand(options) {
5185
5221
  return notOk(errorRuntime("MIGRATION.CONTRACT_DESERIALIZATION_FAILED", "Contract JSON is invalid", {
5186
5222
  why: `Failed to deserialize ${contractPathAbsolute}: ${error instanceof Error ? error.message : String(error)}`,
5187
5223
  fix: "Run `{bin} contract emit` to regenerate the contract",
5188
- cause: error
5224
+ cause: error,
5225
+ ...ifDefined("meta", contractValidationMeta(error))
5189
5226
  }));
5190
5227
  }
5191
5228
  const toStorageHash = toContract.storage?.storageHash;
@@ -5578,7 +5615,10 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
5578
5615
  emittedContractJson = castAs(JSON.parse(contractJsonContent));
5579
5616
  toContract = familyInstance.deserializeContract(emittedContractJson);
5580
5617
  } catch (error) {
5581
- return notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));
5618
+ return notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, {
5619
+ where: { path: contractPathAbsolute },
5620
+ meta: contractValidationMeta(error)
5621
+ }));
5582
5622
  }
5583
5623
  const rawStorageHash = toContract.storage?.storageHash;
5584
5624
  if (typeof rawStorageHash !== "string") return notOk(errorContractValidationFailed("Contract is missing storageHash", { where: { path: contractPathAbsolute } }));
@@ -6074,6 +6114,6 @@ async function executeRefListCommand(options) {
6074
6114
  }
6075
6115
  }
6076
6116
  //#endregion
6077
- export { refuseMissingInvariantPath as $, executeRefDeleteCommand as A, loadContractRawSafely as B, executeDbSign as C, executeMigrationNewCommand as D, executeMigrateShowPlan as E, hasMigrationPath as F, mapContractAtError as G, loadContractSourceWithStack as H, isStatementVerb as I, preflightRefAdvancement as J, mapIntegrityViolations as K, listRefsByContractHash as L, executeRefSetCommand as M, findPackageByDirPath as N, executeMigrationPlanCommand as O, formatSourceDiagnostic as P, refuseMarkerOutsideGraph as Q, liveMarkerUse as R, executeDbInit as S, executeDbVerify as T, loadContractSpaceAggregateForCli as U, loadContractSource as V, looksLikePath as W, refuseContractSpaceIntegrity as X, readMigrationRefs as Y, refuseDeclaredExtensionTargetMismatch as Z, deriveStatusEdgeAnnotations as _, toDeclaredExtensionsFromRaw as _t, RECORDED_OR_EMPTY_CONTRACT_REF_FORMS as a, resolveContractRefToSnapshot as at, enumerateCheckSpaces as b, appliedHashesFromLedger as c, resolveStatements as ct, buildReadAggregate as d, runContractSpaceSeedPhase as dt, refusePackageCorruptionOnAggregate as et, buildRefAdvancementFields as f, runMigrationCheck as ft, createControlClient as g, statusForMigrationHash as gt, convertAndDelete as h, sourceWarningDiagnostic as ht, RECORDED_CONTRACT_REF_FORMS as i, resolveContractRef$1 as it, executeRefListCommand as j, executeRefAdvancement as k, buildContractSpaceAggregate as l, resolveToForPlan as lt, computeRefAdvancementName as m, snapshotVerifierFor as mt, DB_UPDATE_POLICY as n, requireDatabaseForLiveMarkerUse as nt, advanceRefSafely as o, resolveFromForPlan as ot, checkSingleTarget as p, runMigrationList as pt, migrationSpaceListEntriesFromAggregate as q, NO_REF_ADVANCEMENT as r, resolveAppTargetPath as rt, appContractStandInFromIdentity as s, resolveMigrationRef as st, ALL_CONTRACT_REF_FORMS as t, refuseUnknownInvariants as tt, buildMigrationSpaceGraphEntries as u, retryCommandFor as ut, disposeEmitQueue as v, validateLoadedContract as vt, executeDbUpdate as w, executeContractEmit as x, enrichContract as y, loadAggregateIntegrityViolations as z };
6117
+ export { refuseMarkerOutsideGraph as $, executeRefAdvancement as A, loadAggregateIntegrityViolations as B, executeDbInit as C, executeMigrateShowPlan as D, executeDbVerify as E, formatSourceDiagnostic as F, looksLikePath as G, loadContractSource as H, hasMigrationPath as I, migrationSpaceListEntriesFromAggregate as J, mapContractAtError as K, isStatementVerb as L, executeRefListCommand as M, executeRefSetCommand as N, executeMigrationNewCommand as O, findPackageByDirPath as P, refuseDeclaredExtensionTargetMismatch as Q, listRefsByContractHash as R, executeContractEmit as S, executeDbUpdate as T, loadContractSourceWithStack as U, loadContractRawSafely as V, loadContractSpaceAggregateForCli as W, readMigrationRefs as X, preflightRefAdvancement as Y, refuseContractSpaceIntegrity as Z, createControlClient as _, statusForMigrationHash as _t, RECORDED_OR_EMPTY_CONTRACT_REF_FORMS as a, resolveContractRef$1 as at, enrichContract as b, appliedHashesFromLedger as c, resolveMigrationRef as ct, buildReadAggregate as d, retryCommandFor as dt, refuseMissingInvariantPath as et, buildRefAdvancementFields as f, runContractSpaceSeedPhase as ft, convertAndDelete as g, sourceWarningDiagnostic as gt, contractValidationMeta as h, snapshotVerifierFor as ht, RECORDED_CONTRACT_REF_FORMS as i, resolveAppTargetPath as it, executeRefDeleteCommand as j, executeMigrationPlanCommand as k, buildContractSpaceAggregate as l, resolveStatements as lt, computeRefAdvancementName as m, runMigrationList as mt, DB_UPDATE_POLICY as n, refuseUnknownInvariants as nt, advanceRefSafely as o, resolveContractRefToSnapshot as ot, checkSingleTarget as p, runMigrationCheck as pt, mapIntegrityViolations as q, NO_REF_ADVANCEMENT as r, requireDatabaseForLiveMarkerUse as rt, appContractStandInFromIdentity as s, resolveFromForPlan as st, ALL_CONTRACT_REF_FORMS as t, refusePackageCorruptionOnAggregate as tt, buildMigrationSpaceGraphEntries as u, resolveToForPlan as ut, deriveStatusEdgeAnnotations as v, toDeclaredExtensionsFromRaw as vt, executeDbSign as w, enumerateCheckSpaces as x, disposeEmitQueue as y, validateLoadedContract as yt, liveMarkerUse as z };
6078
6118
 
6079
- //# sourceMappingURL=ref-CPPMhLAs-Bxf2BJcA.mjs.map
6119
+ //# sourceMappingURL=ref-UzwhFoEX-BdXkOZFM.mjs.map