@prisma/orm-toolchain 8.0.0-rc.20-dev.2 → 8.0.0-rc.20-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +37 -122
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +12 -16
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/{db-sign-gvrl0kFE-D-nTGx88.d.mts → db-sign-D_XlrpfY-BnnlVa7_.d.mts} +4 -2
- package/dist/{db-sign-gvrl0kFE-D-nTGx88.d.mts.map → db-sign-D_XlrpfY-BnnlVa7_.d.mts.map} +1 -1
- package/dist/{exports-CKgwcXbp.mjs → exports-Dc7BjdfY.mjs} +3 -3
- package/dist/exports-Dc7BjdfY.mjs.map +1 -0
- package/dist/{ref-DEiY2Cbd-1ZImpUEN.mjs → ref-lBShHvAG-BwIX69xi.mjs} +61 -28
- package/dist/{ref-DEiY2Cbd-1ZImpUEN.mjs.map → ref-lBShHvAG-BwIX69xi.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/exports-CKgwcXbp.mjs.map +0 -1
|
@@ -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-
|
|
37
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-lBShHvAG.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
|
*/
|
|
@@ -3169,14 +3169,45 @@ function validateProviderResult(providerResult, cwd) {
|
|
|
3169
3169
|
* Every command that loads a contract source goes through here, so each
|
|
3170
3170
|
* reports a bad source the same way.
|
|
3171
3171
|
*
|
|
3172
|
+
* The warnings the source reports come back on both sides of the result, for the caller to report as it reports the rest of its output.
|
|
3173
|
+
*
|
|
3172
3174
|
* @throws {DOMException} `AbortError` if cancelled via `signal`
|
|
3173
3175
|
*/
|
|
3174
3176
|
async function loadContractSourceWithStack(inputs) {
|
|
3177
|
+
const warnings = [];
|
|
3178
|
+
const loaded = await askSource(inputs, (diagnostic) => {
|
|
3179
|
+
warnings.push(diagnostic);
|
|
3180
|
+
});
|
|
3181
|
+
return loaded.ok ? ok({
|
|
3182
|
+
contract: loaded.value,
|
|
3183
|
+
warnings
|
|
3184
|
+
}) : notOk({
|
|
3185
|
+
...loaded.failure,
|
|
3186
|
+
warnings
|
|
3187
|
+
});
|
|
3188
|
+
}
|
|
3189
|
+
/** The error with the source's warnings added after its own findings, as `warn` findings. */
|
|
3190
|
+
function withWarningFindings(error, warnings, cwd) {
|
|
3191
|
+
if (warnings.length === 0) return error;
|
|
3192
|
+
const warningFindings = warnings.flatMap((warning) => sourceWarningDiagnostic(warning, cwd) ?? []);
|
|
3193
|
+
return new CliStructuredError(error.code, error.message, {
|
|
3194
|
+
severity: error.severity,
|
|
3195
|
+
diagnostics: [...error.diagnostics ?? [], ...warningFindings],
|
|
3196
|
+
...ifDefined("why", error.why),
|
|
3197
|
+
...ifDefined("fix", error.fix),
|
|
3198
|
+
...ifDefined("nextActions", error.nextActions),
|
|
3199
|
+
...ifDefined("where", error.where),
|
|
3200
|
+
...ifDefined("meta", error.meta),
|
|
3201
|
+
...ifDefined("docsUrl", error.docsUrl),
|
|
3202
|
+
...ifDefined("cause", error.cause)
|
|
3203
|
+
});
|
|
3204
|
+
}
|
|
3205
|
+
async function askSource(inputs, reportWarning) {
|
|
3175
3206
|
const { stack, source } = inputs;
|
|
3176
3207
|
const signal = inputs.signal ?? new AbortController().signal;
|
|
3177
3208
|
const unlessAborted = abortable(signal);
|
|
3178
3209
|
const sourceContext = {
|
|
3179
|
-
|
|
3210
|
+
reportWarning,
|
|
3180
3211
|
composedExtensions: stack.extensions.map((p) => p.id),
|
|
3181
3212
|
composedExtensionContracts: stack.extensionContracts,
|
|
3182
3213
|
authoringContributions: stack.authoringContributions,
|
|
@@ -3211,9 +3242,11 @@ function requireSourceProvider(contractConfig) {
|
|
|
3211
3242
|
/**
|
|
3212
3243
|
* Runs the config's contract source and stops there: nothing is emitted or
|
|
3213
3244
|
* written. A source that reports diagnostics is a `notOk` carrying them.
|
|
3245
|
+
* Either side carries the warnings the source reported.
|
|
3214
3246
|
*
|
|
3215
3247
|
* @throws {CliStructuredError} the error `contract emit` raises, when the
|
|
3216
|
-
* config has no contract source or the source is malformed or throws
|
|
3248
|
+
* config has no contract source or the source is malformed or throws; the
|
|
3249
|
+
* source's warnings follow its findings as `warn` findings
|
|
3217
3250
|
* @throws {DOMException} `AbortError` if cancelled via `signal`
|
|
3218
3251
|
*/
|
|
3219
3252
|
async function loadContractSource(config, options = {}) {
|
|
@@ -3223,16 +3256,16 @@ async function loadContractSource(config, options = {}) {
|
|
|
3223
3256
|
stack: createControlStack(config),
|
|
3224
3257
|
source: contractConfig.source,
|
|
3225
3258
|
cwd: void 0,
|
|
3226
|
-
...ifDefined("signal", options.signal)
|
|
3227
|
-
...ifDefined("reportWarning", options.onWarning)
|
|
3259
|
+
...ifDefined("signal", options.signal)
|
|
3228
3260
|
});
|
|
3229
3261
|
if (loaded.ok) return loaded;
|
|
3230
|
-
const { error, sourceDiagnostics } = loaded.failure;
|
|
3231
|
-
if (sourceDiagnostics === void 0) throw error;
|
|
3262
|
+
const { error, sourceDiagnostics, warnings } = loaded.failure;
|
|
3263
|
+
if (sourceDiagnostics === void 0) throw withWarningFindings(error, warnings, void 0);
|
|
3232
3264
|
return notOk({
|
|
3233
3265
|
summary: sourceDiagnostics.summary,
|
|
3234
3266
|
diagnostics: sourceDiagnostics.diagnostics,
|
|
3235
|
-
meta: sourceDiagnostics.meta
|
|
3267
|
+
meta: sourceDiagnostics.meta,
|
|
3268
|
+
warnings
|
|
3236
3269
|
});
|
|
3237
3270
|
}
|
|
3238
3271
|
/**
|
|
@@ -3622,6 +3655,9 @@ function failedMigrationOnDisk(failed, migrationsDir) {
|
|
|
3622
3655
|
* @see {@link ControlClient} for the client interface
|
|
3623
3656
|
* @see README.md "Programmatic Control API" section for usage examples
|
|
3624
3657
|
*/
|
|
3658
|
+
function sourceWarningsOf(warnings) {
|
|
3659
|
+
return ifDefined("sourceWarnings", warnings.length > 0 ? warnings : void 0);
|
|
3660
|
+
}
|
|
3625
3661
|
function createControlClient(options) {
|
|
3626
3662
|
return new ControlClientImpl(options);
|
|
3627
3663
|
}
|
|
@@ -4017,7 +4053,6 @@ var ControlClientImpl = class {
|
|
|
4017
4053
|
const { onProgress, contractConfig } = options;
|
|
4018
4054
|
this.init();
|
|
4019
4055
|
if (!this.familyInstance) throw new InternalError("Family instance was not initialized. This is a bug.");
|
|
4020
|
-
const sourceWarnings = [];
|
|
4021
4056
|
onProgress?.({
|
|
4022
4057
|
action: "emit",
|
|
4023
4058
|
kind: "spanStart",
|
|
@@ -4027,10 +4062,7 @@ var ControlClientImpl = class {
|
|
|
4027
4062
|
const loaded = await loadContractSourceWithStack({
|
|
4028
4063
|
stack: this.stack,
|
|
4029
4064
|
source: contractConfig.source,
|
|
4030
|
-
cwd: void 0
|
|
4031
|
-
reportWarning: (diagnostic) => {
|
|
4032
|
-
sourceWarnings.push(diagnostic);
|
|
4033
|
-
}
|
|
4065
|
+
cwd: void 0
|
|
4034
4066
|
});
|
|
4035
4067
|
onProgress?.({
|
|
4036
4068
|
action: "emit",
|
|
@@ -4039,7 +4071,7 @@ var ControlClientImpl = class {
|
|
|
4039
4071
|
outcome: loaded.ok ? "ok" : "error"
|
|
4040
4072
|
});
|
|
4041
4073
|
if (!loaded.ok) {
|
|
4042
|
-
const { error, sourceDiagnostics } = loaded.failure;
|
|
4074
|
+
const { error, sourceDiagnostics, warnings } = loaded.failure;
|
|
4043
4075
|
const thrownBySource = error.code !== "CONTRACT.SOURCE_LOAD_FAILED";
|
|
4044
4076
|
return notOk({
|
|
4045
4077
|
code: "CONTRACT_SOURCE_INVALID",
|
|
@@ -4049,9 +4081,11 @@ var ControlClientImpl = class {
|
|
|
4049
4081
|
code: error.code,
|
|
4050
4082
|
...error.meta
|
|
4051
4083
|
} : sourceDiagnostics?.meta,
|
|
4052
|
-
...ifDefined("diagnostics", sourceDiagnostics)
|
|
4084
|
+
...ifDefined("diagnostics", sourceDiagnostics),
|
|
4085
|
+
...sourceWarningsOf(warnings)
|
|
4053
4086
|
});
|
|
4054
4087
|
}
|
|
4088
|
+
const { contract, warnings } = loaded.value;
|
|
4055
4089
|
onProgress?.({
|
|
4056
4090
|
action: "emit",
|
|
4057
4091
|
kind: "spanStart",
|
|
@@ -4059,7 +4093,7 @@ var ControlClientImpl = class {
|
|
|
4059
4093
|
label: "Emitting contract..."
|
|
4060
4094
|
});
|
|
4061
4095
|
try {
|
|
4062
|
-
const enrichedIR = enrichContract(
|
|
4096
|
+
const enrichedIR = enrichContract(contract, this.frameworkComponents ?? []);
|
|
4063
4097
|
const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
|
|
4064
4098
|
let deserializedContract;
|
|
4065
4099
|
try {
|
|
@@ -4075,7 +4109,8 @@ var ControlClientImpl = class {
|
|
|
4075
4109
|
code: "CONTRACT_VALIDATION_FAILED",
|
|
4076
4110
|
summary: "Contract validation failed",
|
|
4077
4111
|
why: error instanceof Error ? error.message : String(error),
|
|
4078
|
-
meta: void 0
|
|
4112
|
+
meta: void 0,
|
|
4113
|
+
...sourceWarningsOf(warnings)
|
|
4079
4114
|
});
|
|
4080
4115
|
}
|
|
4081
4116
|
const result = await this.emitArtifacts(deserializedContract, keepInternalSpecifiers);
|
|
@@ -4091,7 +4126,7 @@ var ControlClientImpl = class {
|
|
|
4091
4126
|
profileHash: result.profileHash,
|
|
4092
4127
|
contractJson: result.contractJson,
|
|
4093
4128
|
contractDts: result.contractDts,
|
|
4094
|
-
...
|
|
4129
|
+
...sourceWarningsOf(warnings)
|
|
4095
4130
|
});
|
|
4096
4131
|
} catch (error) {
|
|
4097
4132
|
onProgress?.({
|
|
@@ -4104,7 +4139,8 @@ var ControlClientImpl = class {
|
|
|
4104
4139
|
code: "EMIT_FAILED",
|
|
4105
4140
|
summary: "Failed to emit contract",
|
|
4106
4141
|
why: error instanceof Error ? error.message : String(error),
|
|
4107
|
-
meta: void 0
|
|
4142
|
+
meta: void 0,
|
|
4143
|
+
...sourceWarningsOf(warnings)
|
|
4108
4144
|
});
|
|
4109
4145
|
}
|
|
4110
4146
|
}
|
|
@@ -4451,22 +4487,19 @@ async function executeContractEmit(options, dependencies = defaultContractEmitDe
|
|
|
4451
4487
|
const { jsonPath: outputJsonPath, dtsPath: outputDtsPath } = outputPaths;
|
|
4452
4488
|
return queueEmitByOutput(outputJsonPath, async () => {
|
|
4453
4489
|
startSpan(onProgress, "resolveSource", "Resolving contract source...");
|
|
4454
|
-
const sourceWarnings = [];
|
|
4455
4490
|
let stack;
|
|
4456
4491
|
let contract;
|
|
4492
|
+
let sourceWarnings;
|
|
4457
4493
|
try {
|
|
4458
4494
|
stack = createControlStack(config);
|
|
4459
4495
|
const loaded = await loadContractSourceWithStack({
|
|
4460
4496
|
stack,
|
|
4461
4497
|
source: contractConfig.source,
|
|
4462
4498
|
signal,
|
|
4463
|
-
cwd
|
|
4464
|
-
reportWarning: (diagnostic) => {
|
|
4465
|
-
sourceWarnings.push(diagnostic);
|
|
4466
|
-
}
|
|
4499
|
+
cwd
|
|
4467
4500
|
});
|
|
4468
|
-
if (!loaded.ok) throw loaded.failure.error;
|
|
4469
|
-
contract = loaded.value;
|
|
4501
|
+
if (!loaded.ok) throw withWarningFindings(loaded.failure.error, loaded.failure.warnings, cwd);
|
|
4502
|
+
({contract, warnings: sourceWarnings} = loaded.value);
|
|
4470
4503
|
} catch (error) {
|
|
4471
4504
|
endSpan(onProgress, "resolveSource", "error");
|
|
4472
4505
|
throw error;
|
|
@@ -6658,6 +6691,6 @@ async function executeRefListCommand(options) {
|
|
|
6658
6691
|
}
|
|
6659
6692
|
}
|
|
6660
6693
|
//#endregion
|
|
6661
|
-
export { refuseMarkerOutsideGraph 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, migrationSpaceListEntriesFromAggregate as J, mapIntegrityViolations as K, listRefsByContractHash as L, executeRefSetCommand as M, findPackageByDirPath as N, executeMigrationPlanCommand as O, formatSourceDiagnostic as P, refuseDeclaredExtensionTargetMismatch as Q, liveMarkerUse as R, executeDbInit as S, executeDbVerify as T, loadContractSpaceAggregateForCli as U, loadContractSource as V, looksLikePath as W, readMigrationRefs as X, preflightRefAdvancement as Y, refuseContractSpaceIntegrity as Z, deriveStatusEdgeAnnotations as _, statusForMigrationHash as _t, advanceRefSafely as a, resolveContractRef$1 as at, enumerateCheckSpaces as b, buildContractSpaceAggregate as c, resolveMigrationRef as ct, buildRefAdvancementFields as d, retryCommandFor as dt, refuseMissingInvariantPath as et, checkSingleTarget as f, runContractSpaceSeedPhase as ft, createControlClient as g, sourceWarningDiagnostic as gt, convertAndDelete as h, snapshotVerifierFor as ht, RECORDED_OR_EMPTY_CONTRACT_REF_FORMS as i, resolveAppTargetPath as it, executeRefListCommand as j, executeRefAdvancement as k, buildMigrationSpaceGraphEntries as l, resolveStatements as lt, contractValidationMeta as m, runMigrationList as mt, NO_REF_ADVANCEMENT as n, refuseUnknownInvariants as nt, appContractStandInFromIdentity as o, resolveContractRefToSnapshot as ot, computeRefAdvancementName as p, runMigrationCheck as pt, matchConsents as q, RECORDED_CONTRACT_REF_FORMS as r, requireDatabaseForLiveMarkerUse as rt, appliedHashesFromLedger as s, resolveFromForPlan as st, ALL_CONTRACT_REF_FORMS as t, refusePackageCorruptionOnAggregate as tt, buildReadAggregate as u, resolveToForPlan as ut, disposeEmitQueue as v, toDeclaredExtensionsFromRaw as vt, executeDbUpdate as w, executeContractEmit as x, enrichContract as y, validateLoadedContract as yt, loadAggregateIntegrityViolations as z };
|
|
6694
|
+
export { refuseMarkerOutsideGraph 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, migrationSpaceListEntriesFromAggregate as J, mapIntegrityViolations as K, listRefsByContractHash as L, executeRefSetCommand as M, findPackageByDirPath as N, executeMigrationPlanCommand as O, formatSourceDiagnostic as P, refuseDeclaredExtensionTargetMismatch as Q, liveMarkerUse as R, executeDbInit as S, executeDbVerify as T, loadContractSpaceAggregateForCli as U, loadContractSource as V, looksLikePath as W, readMigrationRefs as X, preflightRefAdvancement as Y, refuseContractSpaceIntegrity as Z, deriveStatusEdgeAnnotations as _, statusForMigrationHash as _t, advanceRefSafely as a, resolveContractRef$1 as at, enumerateCheckSpaces as b, withWarningFindings as bt, buildContractSpaceAggregate as c, resolveMigrationRef as ct, buildRefAdvancementFields as d, retryCommandFor as dt, refuseMissingInvariantPath as et, checkSingleTarget as f, runContractSpaceSeedPhase as ft, createControlClient as g, sourceWarningDiagnostic as gt, convertAndDelete as h, snapshotVerifierFor as ht, RECORDED_OR_EMPTY_CONTRACT_REF_FORMS as i, resolveAppTargetPath as it, executeRefListCommand as j, executeRefAdvancement as k, buildMigrationSpaceGraphEntries as l, resolveStatements as lt, contractValidationMeta as m, runMigrationList as mt, NO_REF_ADVANCEMENT as n, refuseUnknownInvariants as nt, appContractStandInFromIdentity as o, resolveContractRefToSnapshot as ot, computeRefAdvancementName as p, runMigrationCheck as pt, matchConsents as q, RECORDED_CONTRACT_REF_FORMS as r, requireDatabaseForLiveMarkerUse as rt, appliedHashesFromLedger as s, resolveFromForPlan as st, ALL_CONTRACT_REF_FORMS as t, refusePackageCorruptionOnAggregate as tt, buildReadAggregate as u, resolveToForPlan as ut, disposeEmitQueue as v, toDeclaredExtensionsFromRaw as vt, executeDbUpdate as w, executeContractEmit as x, enrichContract as y, validateLoadedContract as yt, loadAggregateIntegrityViolations as z };
|
|
6662
6695
|
|
|
6663
|
-
//# sourceMappingURL=ref-
|
|
6696
|
+
//# sourceMappingURL=ref-lBShHvAG-BwIX69xi.mjs.map
|