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

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.
@@ -1,2 +1,2 @@
1
- import { At as resolveMigrationRef, Ct as refusePackageCorruptionOnAggregate, Dt as resolveContractRef$1, Ft as runMigrationList, G as executeDbVerify, H as executeContractEmit, J as executeMigrationPlanCommand, K as executeMigrateShowPlan, Nt as runContractSpaceSeedPhase, Ot as resolveContractRefToSnapshot, Pt as runMigrationCheck, Q as executeRefSetCommand, Rt as statusForMigrationHash, St as refuseMissingInvariantPath, U as executeDbInit, W as executeDbUpdate, X as executeRefDeleteCommand, Y as executeRefAdvancement, Z as executeRefListCommand, _ as disposeEmitQueue, _t as readMigrationRefs, a as appContractStandInFromIdentity, at as loadContractSource, bt as refuseDeclaredExtensionTargetMismatch, c as buildMigrationSpaceGraphEntries, d as checkSingleTarget, dt as mapIntegrityViolations, g as deriveStatusEdgeAnnotations, h as createControlClient, ht as preflightRefAdvancement, i as advanceRefSafely, it as loadContractRawSafely, jt as resolveToForPlan, kt as resolveFromForPlan, l as buildReadAggregate, lt as mapCaughtMigrationError, m as computeRefAdvancementName, mt as originHashForStatus, nt as listRefsByContractHash, o as appliedHashesFromLedger, pt as migrationSpaceListEntriesFromAggregate, q as executeMigrationNewCommand, r as NO_REF_ADVANCEMENT, rt as loadAggregateIntegrityViolations, s as buildContractSpaceAggregate, st as loadContractSpaceAggregateForCli, tt as hasMigrationPath, u as buildRefAdvancementFields, ut as mapContractAtError, v as enrichContract, wt as refuseUnknownInvariants, xt as refuseMarkerOutsideGraph, y as enumerateCheckSpaces, yt as refuseContractSpaceIntegrity } from "./ref-DZuzAvuD-RQwSwQwC.mjs";
1
+ import { At as resolveMigrationRef, Ct as refusePackageCorruptionOnAggregate, Dt as resolveContractRef$1, Ft as runMigrationList, G as executeDbVerify, H as executeContractEmit, J as executeMigrationPlanCommand, K as executeMigrateShowPlan, Nt as runContractSpaceSeedPhase, Ot as resolveContractRefToSnapshot, Pt as runMigrationCheck, Q as executeRefSetCommand, Rt as statusForMigrationHash, St as refuseMissingInvariantPath, U as executeDbInit, W as executeDbUpdate, X as executeRefDeleteCommand, Y as executeRefAdvancement, Z as executeRefListCommand, _ as disposeEmitQueue, _t as readMigrationRefs, a as appContractStandInFromIdentity, at as loadContractSource, bt as refuseDeclaredExtensionTargetMismatch, c as buildMigrationSpaceGraphEntries, d as checkSingleTarget, dt as mapIntegrityViolations, g as deriveStatusEdgeAnnotations, h as createControlClient, ht as preflightRefAdvancement, i as advanceRefSafely, it as loadContractRawSafely, jt as resolveToForPlan, kt as resolveFromForPlan, l as buildReadAggregate, lt as mapCaughtMigrationError, m as computeRefAdvancementName, mt as originHashForStatus, nt as listRefsByContractHash, o as appliedHashesFromLedger, pt as migrationSpaceListEntriesFromAggregate, q as executeMigrationNewCommand, r as NO_REF_ADVANCEMENT, rt as loadAggregateIntegrityViolations, s as buildContractSpaceAggregate, st as loadContractSpaceAggregateForCli, tt as hasMigrationPath, u as buildRefAdvancementFields, ut as mapContractAtError, v as enrichContract, wt as refuseUnknownInvariants, xt as refuseMarkerOutsideGraph, y as enumerateCheckSpaces, yt as refuseContractSpaceIntegrity } from "./ref-Qev9k5zj-BMvIT-te.mjs";
2
2
  export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSource, loadContractSpaceAggregateForCli, mapCaughtMigrationError, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, originHashForStatus, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
@@ -18,7 +18,7 @@ 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 { isStructuredErrorCode, structuredError } from "@prisma/orm-framework/utils/structured-error";
21
+ import { isStructuredError, isStructuredErrorCode, structuredError } from "@prisma/orm-framework/utils/structured-error";
22
22
  import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
23
23
  import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
24
24
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -34,7 +34,7 @@ import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
34
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-DZuzAvuD.mjs
37
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-Qev9k5zj.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
@@ -3420,6 +3420,17 @@ function mapCaughtMigrationError(error) {
3420
3420
  if (CliStructuredError$1.is(error)) return error;
3421
3421
  return null;
3422
3422
  }
3423
+ /** A structured error about the contract, such as a default a planner refuses → the same error as a CliStructuredError; anything else → null. */
3424
+ function mapCaughtContractError(error) {
3425
+ if (!isStructuredError(error) || !error.code.startsWith("CONTRACT.")) return null;
3426
+ return new CliStructuredError$1(error.code, error.message, {
3427
+ ...ifDefined("why", error.why),
3428
+ ...ifDefined("fix", error.fix),
3429
+ ...ifDefined("where", error.where),
3430
+ ...ifDefined("meta", error.meta),
3431
+ cause: error
3432
+ });
3433
+ }
3423
3434
  function mapContractAtError(error, options) {
3424
3435
  if (MigrationToolsError.is(error)) switch (error.code) {
3425
3436
  case "MIGRATION.REF_NOT_RESOLVABLE": return notOk(errorSnapshotMissing(typeof error.meta?.["refName"] === "string" ? error.meta["refName"] : typeof error.meta?.["identifier"] === "string" ? error.meta["identifier"] : "unknown", { cause: error }));
@@ -5014,6 +5025,8 @@ async function executeMigrationPlanCommandInner(options, startTime, callbacks) {
5014
5025
  } catch (error) {
5015
5026
  if (CliStructuredError$1.is(error)) return notOk(error);
5016
5027
  if (MigrationToolsError.is(error)) return notOk(error);
5028
+ const contractError = mapCaughtContractError(error);
5029
+ if (contractError !== null) return notOk(contractError);
5017
5030
  const message = error instanceof Error ? error.message : String(error);
5018
5031
  return notOk(errorUnexpected(message, { why: `Unexpected error during migration plan: ${message}` }));
5019
5032
  }
@@ -5166,4 +5179,4 @@ async function executeRefListCommand(options) {
5166
5179
  //#endregion
5167
5180
  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 };
5168
5181
 
5169
- //# sourceMappingURL=ref-DZuzAvuD-RQwSwQwC.mjs.map
5182
+ //# sourceMappingURL=ref-Qev9k5zj-BMvIT-te.mjs.map