@prisma/orm-toolchain 8.0.0-rc.18-dev.29 → 8.0.0-rc.18-dev.30

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.
@@ -8,7 +8,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
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
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";
11
+ import { B as errorRefSetHashNotInGraph, D as errorInvalidSpaceId, F as errorPlanForgotTheFlag, G as errorSpaceNotFound, H as errorRuntime, I as errorPlanOriginUnknown, J as errorStatementInvalid, K as errorStatementAnswersNoQuestion, L as errorPlanProducedNoOperations, M as errorMigrationPlanningFailed, P as errorPathUnreachable, Q as errorTargetMigrationNotSupported, R as errorRefSetBundleNotFound, T as errorFromCaught, W as errorSnapshotMissing, X as errorStatementOriginUnknown, Y as errorStatementNeedsMigrationFile, Z as errorStatementUnresolved, _ as errorConfigValidation$1, _t as toStructuralEdge, b as errorContractValidationFailed, d as closeQuietly, dt as resolveMigrationPaths, et as errorUnexpected, f as collectDeclaredInvariants, ft as runCommandAction, g as errorAmbiguousMigrationRef, ht as statementFlag, k as errorMarkerMismatch, l as cliErrorFromStructured, lt as requireLiveDatabase, n as CliStructuredError$1, nt as mapRefResolutionError, pt as selfEmitCommand, q as errorStatementDidNotResolveLoss, r as STORE_ORIGIN_SNAPSHOT_STEPS, s as chooseAction, st as readContractEnvelope, tt as getTargetMigrations, ut as resolveContractPath, w as errorFileNotFound, y as errorContractConfigMissing, z as errorRefSetEmptySentinel } from "./caught-errors-BJYT1ZZW-CJZWDvwc.mjs";
12
12
  import { r as getEmittedArtifactPaths, t as emit } from "./exports-BLyT8ULG-C_kH8_9c.mjs";
13
13
  import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-ul46Kb0W-B8HahKEu.mjs";
14
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";
@@ -34,7 +34,7 @@ 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-CMuiuRq8.mjs
37
+ //#region ../../../1-framework/3-tooling/cli/dist/ref-Bn3SzQ9Z.mjs
38
38
  /**
39
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
40
  */
@@ -2632,7 +2632,9 @@ function validateProviderResult(providerResult, cwd) {
2632
2632
  }
2633
2633
  /**
2634
2634
  * Asks the configured contract source for the contract, with a source context
2635
- * built from `stack`, and turns every failure into `CONTRACT.SOURCE_LOAD_FAILED`.
2635
+ * built from `stack`. A structured error the source throws, such as
2636
+ * `CONTRACT.DEFAULT_INVALID` from a TypeScript builder, is reported under its
2637
+ * own code; every other failure becomes `CONTRACT.SOURCE_LOAD_FAILED`.
2636
2638
  * Every command that loads a contract source goes through here, so each
2637
2639
  * reports a bad source the same way.
2638
2640
  *
@@ -2650,6 +2652,7 @@ async function loadContractSourceWithStack(inputs) {
2650
2652
  ...ifDefined("pslDiagnostics", stack.family?.pslDiagnostics),
2651
2653
  codecLookup: stack.codecLookup,
2652
2654
  controlMutationDefaults: stack.controlMutationDefaults,
2655
+ generatorFunctions: stack.generatorFunctions,
2653
2656
  dataTypes: stack.dataTypes,
2654
2657
  resolvedInputs: await unlessAborted(expandContractInputs(source.inputs)),
2655
2658
  capabilities: stack.capabilities,
@@ -2660,6 +2663,7 @@ async function loadContractSourceWithStack(inputs) {
2660
2663
  providerResult = await unlessAborted(source.load(sourceContext));
2661
2664
  } catch (error) {
2662
2665
  if (signal.aborted || isRecord$2(error) && error["name"] === "AbortError") throw error;
2666
+ if (isStructuredError(error)) return failedWith(cliErrorFromStructured(error));
2663
2667
  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));
2664
2668
  }
2665
2669
  return validateProviderResult(providerResult, inputs.cwd);
@@ -3510,11 +3514,15 @@ var ControlClientImpl = class {
3510
3514
  });
3511
3515
  if (!loaded.ok) {
3512
3516
  const { error, sourceDiagnostics } = loaded.failure;
3517
+ const thrownBySource = error.code !== "CONTRACT.SOURCE_LOAD_FAILED";
3513
3518
  return notOk({
3514
3519
  code: "CONTRACT_SOURCE_INVALID",
3515
3520
  summary: sourceDiagnostics?.summary ?? error.message,
3516
3521
  why: error.why,
3517
- meta: sourceDiagnostics?.meta,
3522
+ meta: thrownBySource ? {
3523
+ code: error.code,
3524
+ ...error.meta
3525
+ } : sourceDiagnostics?.meta,
3518
3526
  ...ifDefined("diagnostics", sourceDiagnostics)
3519
3527
  });
3520
3528
  }
@@ -6125,4 +6133,4 @@ async function executeRefListCommand(options) {
6125
6133
  //#endregion
6126
6134
  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 };
6127
6135
 
6128
- //# sourceMappingURL=ref-CMuiuRq8-DQRCjbrc.mjs.map
6136
+ //# sourceMappingURL=ref-Bn3SzQ9Z-Cy3ftpv6.mjs.map