@prisma/composer-cli 0.38.0 → 0.39.0-dev.2
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/{app-configuration-file-CeJvBAti-Dk65W3Az.mjs → app-configuration-file-Cw9autUL-CPnePaG6.mjs} +17 -20
- package/dist/app-configuration-file-Cw9autUL-CPnePaG6.mjs.map +1 -0
- package/dist/{dev-current-D-Qb6Yem-CvaY4xsk.mjs → dev-current-D8GwJQex-D4xWpddG.mjs} +6 -6
- package/dist/{dev-current-D-Qb6Yem-CvaY4xsk.mjs.map → dev-current-D8GwJQex-D4xWpddG.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-DpdGjmTb.mjs → dev-environment-name-6eEr5PW8-DuiDkcM6.mjs} +2 -2
- package/dist/dev-environment-name-6eEr5PW8-DuiDkcM6.mjs.map +1 -0
- package/dist/{dist-BH6HQ6zZ.mjs → dist-qqNor5kl.mjs} +3 -3
- package/dist/{dist-BH6HQ6zZ.mjs.map → dist-qqNor5kl.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs → execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs} +26 -14
- package/dist/execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs.map +1 -0
- package/dist/{execute-dev-current-tBKmDAjV-DOOMGrl5.mjs → execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs} +6 -6
- package/dist/{execute-dev-current-tBKmDAjV-DOOMGrl5.mjs.map → execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs.map} +1 -1
- package/dist/{execute-dev-gjIKYybU-hRndPEgC.mjs → execute-dev-xPaS5SAl-Pf5LvC3G.mjs} +84 -15
- package/dist/{execute-dev-gjIKYybU-hRndPEgC.mjs.map → execute-dev-xPaS5SAl-Pf5LvC3G.mjs.map} +1 -1
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +114 -8
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-BV_n-X9n-BDBjgphH.mjs → generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs} +5 -5
- package/dist/generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs.map +1 -0
- package/dist/{list-deployed-IL0MgmTX.mjs → list-deployed-B_HjWxgs.mjs} +4 -4
- package/dist/list-deployed-B_HjWxgs.mjs.map +1 -0
- package/dist/{config-DiZaanS3.mjs → preflight-transport-DJjTWvyH-C98XN-K2.mjs} +18 -6
- package/dist/preflight-transport-DJjTWvyH-C98XN-K2.mjs.map +1 -0
- package/dist/{redaction-HnbkSFrK-CCKJNRwi.mjs → redaction-C-NnlVUh-xg-a8RGt.mjs} +27 -6
- package/dist/redaction-C-NnlVUh-xg-a8RGt.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-D0dXGsO8.d.mts → redaction-CqdeMBKw-aZd7lPFP.d.mts} +143 -73
- package/dist/redaction-CqdeMBKw-aZd7lPFP.d.mts.map +1 -0
- package/dist/{result-sR7PBi61.mjs → result-DlBttLS8.mjs} +7 -2
- package/dist/{result-sR7PBi61.mjs.map → result-DlBttLS8.mjs.map} +1 -1
- package/dist/{run-alchemy-OS_ix5g0-DSlHsv2p.mjs → run-alchemy-CyciV8i0-Djfa6x3a.mjs} +4 -4
- package/dist/{run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map → run-alchemy-CyciV8i0-Djfa6x3a.mjs.map} +1 -1
- package/dist/testing.d.mts +5 -10
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +5 -5
- package/dist/testing.mjs.map +1 -1
- package/dist/{validate-environment-CpQLC3CA-Ct-PXoKN.mjs → validate-environment-DyW59rJ7-B1PoUO20.mjs} +150 -88
- package/dist/validate-environment-DyW59rJ7-B1PoUO20.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map +0 -1
- package/dist/config-DiZaanS3.mjs.map +0 -1
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs.map +0 -1
- package/dist/execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs.map +0 -1
- package/dist/generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map +0 -1
- package/dist/list-deployed-IL0MgmTX.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-D0dXGsO8.d.mts.map +0 -1
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +0 -1
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import {
|
|
1
|
+
import { d as checkComposerConfig, f as configFileMissing, i as credentialLookingValues, n as SecretRedaction, p as entryMissing, u as valuesUnderSecretsKeys } from "./redaction-C-NnlVUh-xg-a8RGt.mjs";
|
|
2
|
+
import { i as CliStructuredError, o as InternalError, s as blindCast } from "./result-DlBttLS8.mjs";
|
|
3
3
|
import * as mod from "node:module";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as fs from "node:fs";
|
|
@@ -783,8 +783,8 @@ async function assembleServices(graph, config, cwd, run, onEvent, options = {})
|
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
785
|
//#endregion
|
|
786
|
-
//#region ../../0-framework/0-foundation/foundation/dist/pointer-
|
|
787
|
-
/** A pointer: what a value known only at boot holds at deploy. It names the platform
|
|
786
|
+
//#region ../../0-framework/0-foundation/foundation/dist/pointer-BLedpQgL.mjs
|
|
787
|
+
/** A pointer: what a value known only at boot holds at deploy. It names the variable on the platform that the service reads at boot, and records whether that variable holds a secret. */
|
|
788
788
|
const POINTER = blindCast(Symbol.for("prisma:pointer"));
|
|
789
789
|
function kindOf(value) {
|
|
790
790
|
if (typeof value !== "object" || value === null) return void 0;
|
|
@@ -806,7 +806,7 @@ function isSecretString(value) {
|
|
|
806
806
|
return typeof value === "object" && value !== null && blindCast(value)[SECRET_BOX] === true;
|
|
807
807
|
}
|
|
808
808
|
//#endregion
|
|
809
|
-
//#region ../../0-framework/1-core/core/dist/graph-
|
|
809
|
+
//#region ../../0-framework/1-core/core/dist/graph-K7VOpCAj.mjs
|
|
810
810
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
811
811
|
const RESOURCE_OUT_PORT = "$out";
|
|
812
812
|
/**
|
|
@@ -820,6 +820,12 @@ var LoadError = class extends CliStructuredError {
|
|
|
820
820
|
super("COMPOSE.GRAPH_INVALID", message, options);
|
|
821
821
|
}
|
|
822
822
|
};
|
|
823
|
+
/** What an extension's `checkGraph` throws to refuse a graph it cannot deploy. Any other throw from the hook is a bug (ADR-0044). The CLI adds the refusing extension's id as `meta.extension`. */
|
|
824
|
+
var GraphCheckError = class extends CliStructuredError {
|
|
825
|
+
constructor(message, options) {
|
|
826
|
+
super("COMPOSE.GRAPH_INVALID", message, options?.extension === void 0 ? void 0 : { meta: { extension: options.extension } });
|
|
827
|
+
}
|
|
828
|
+
};
|
|
823
829
|
/** The declared style of an untrusted contract value, or `undefined` when it declares none. */
|
|
824
830
|
function contractStyleOf(contract) {
|
|
825
831
|
if (typeof contract !== "object" || contract === null || !("style" in contract)) return void 0;
|
|
@@ -827,6 +833,7 @@ function contractStyleOf(contract) {
|
|
|
827
833
|
}
|
|
828
834
|
const VALUE = blindCast(Symbol.for("prisma:value"));
|
|
829
835
|
const VALUE_ORIGIN = blindCast(Symbol.for("prisma:value-origin"));
|
|
836
|
+
const VALUE_RESOURCE = blindCast(Symbol.for("prisma:value-resource"));
|
|
830
837
|
/** True if `value` is a `Value`, a source included (checks the brand only, never a prototype). */
|
|
831
838
|
function isValue(value) {
|
|
832
839
|
return typeof value === "object" && value !== null && blindCast(value)[VALUE] === true;
|
|
@@ -947,13 +954,47 @@ function buildModuleInput(moduleAddress) {
|
|
|
947
954
|
*/
|
|
948
955
|
const NODE = Symbol.for("prisma:node");
|
|
949
956
|
const SECRET_SOURCE = blindCast(Symbol.for("prisma:secret-source"));
|
|
950
|
-
/** True if `value` is a secret source
|
|
957
|
+
/** True if `value` is a secret source. */
|
|
951
958
|
function isSecretSource(value) {
|
|
952
959
|
return typeof value === "object" && value !== null && blindCast(value)[SECRET_SOURCE] === true;
|
|
953
960
|
}
|
|
954
961
|
blindCast(Symbol.for("prisma:provision-need"));
|
|
955
962
|
const PARAM_SOURCE = blindCast(Symbol.for("prisma:param-source"));
|
|
963
|
+
function buildSource(brand, payload, origin, kind, hidden = {}) {
|
|
964
|
+
const source = {
|
|
965
|
+
[VALUE]: true,
|
|
966
|
+
[VALUE_ORIGIN]: origin,
|
|
967
|
+
[brand]: true,
|
|
968
|
+
[POINTER]: kind,
|
|
969
|
+
payload
|
|
970
|
+
};
|
|
971
|
+
Object.defineProperty(origin, "source", { value: source });
|
|
972
|
+
Object.defineProperties(source, {
|
|
973
|
+
...coercions(origin),
|
|
974
|
+
...hidden
|
|
975
|
+
});
|
|
976
|
+
Object.freeze(origin);
|
|
977
|
+
return Object.freeze(source);
|
|
978
|
+
}
|
|
979
|
+
function coercions(origin) {
|
|
980
|
+
const thrower = (what) => () => {
|
|
981
|
+
throw sourceMisuse(origin, what);
|
|
982
|
+
};
|
|
983
|
+
return {
|
|
984
|
+
toString: { value: thrower("its toString() was called") },
|
|
985
|
+
valueOf: { value: thrower("its valueOf() was called") },
|
|
986
|
+
[Symbol.toPrimitive]: { value: (hint) => {
|
|
987
|
+
throw sourceMisuse(origin, primitiveMisuse(hint));
|
|
988
|
+
} }
|
|
989
|
+
};
|
|
990
|
+
}
|
|
956
991
|
const sourceMisuses = /* @__PURE__ */ new WeakSet();
|
|
992
|
+
function sourceMisuse(origin, what) {
|
|
993
|
+
const { label } = origin;
|
|
994
|
+
const error = new LoadError(`${label} is known only at boot: the deploy holds a pointer to it, never its value, and ${what}. A module body can only pass it on, into a provision() binding; to compute with the value, do it in the service that reads it.`);
|
|
995
|
+
sourceMisuses.add(error);
|
|
996
|
+
return error;
|
|
997
|
+
}
|
|
957
998
|
/** True for the error a source throws when code turns it into text or a number. Internal to core. */
|
|
958
999
|
function isSourceMisuse(error) {
|
|
959
1000
|
return error instanceof LoadError && sourceMisuses.has(error);
|
|
@@ -964,7 +1005,7 @@ function sourceOriginOf(source) {
|
|
|
964
1005
|
const origin = originOf(source);
|
|
965
1006
|
return origin.kind === "source" ? origin : void 0;
|
|
966
1007
|
}
|
|
967
|
-
/** True if `value` is a param source
|
|
1008
|
+
/** True if `value` is a param source. */
|
|
968
1009
|
function isParamSource(value) {
|
|
969
1010
|
return typeof value === "object" && value !== null && blindCast(value)[PARAM_SOURCE] === true;
|
|
970
1011
|
}
|
|
@@ -977,6 +1018,18 @@ function isParamSource(value) {
|
|
|
977
1018
|
function isConfigKeySegment(name) {
|
|
978
1019
|
return /^[A-Za-z0-9]+$/.test(name);
|
|
979
1020
|
}
|
|
1021
|
+
function valueResourceOrigin(node) {
|
|
1022
|
+
if (!isNode(node) || node.kind !== "resource" || !(VALUE_RESOURCE in node)) return void 0;
|
|
1023
|
+
const value = node[VALUE_RESOURCE];
|
|
1024
|
+
return isSecretSource(value) || isParamSource(value) ? sourceOriginOf(value) : void 0;
|
|
1025
|
+
}
|
|
1026
|
+
function provisionedValue(origin, address) {
|
|
1027
|
+
const { source, ...kept } = origin;
|
|
1028
|
+
return blindCast(buildSource(isSecretSource(source) ? SECRET_SOURCE : PARAM_SOURCE, source.payload, {
|
|
1029
|
+
...kept,
|
|
1030
|
+
resource: address
|
|
1031
|
+
}, isSecretPointer(source) ? "secret" : "plain", { id: { value: address } }));
|
|
1032
|
+
}
|
|
980
1033
|
/**
|
|
981
1034
|
* True if `value` was constructed by this module's factories. Checks the
|
|
982
1035
|
* brand only, never a prototype — a graph may mix nodes from a different
|
|
@@ -1118,10 +1171,8 @@ function loadService(root, rootId) {
|
|
|
1118
1171
|
inputBindings: [],
|
|
1119
1172
|
params: [],
|
|
1120
1173
|
secretSources: [],
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
configurationKeyText: {}
|
|
1124
|
-
}
|
|
1174
|
+
valueReads: [],
|
|
1175
|
+
appConfigurationRead: { rootInput: [] }
|
|
1125
1176
|
};
|
|
1126
1177
|
}
|
|
1127
1178
|
function joinPath(path, key) {
|
|
@@ -1235,7 +1286,7 @@ function checkResult(result, fnLabel) {
|
|
|
1235
1286
|
const walk = (value, path) => {
|
|
1236
1287
|
const atPath = path === "" ? "" : ` at "${path}"`;
|
|
1237
1288
|
if (value === void 0) throw new LoadError(`${fnLabel} returned undefined${atPath}. Return a result for every environment; Composer never picks a default.`);
|
|
1238
|
-
if (isSecretSource(value) || isParamSource(value)) throw new LoadError(`${fnLabel} returned a source${atPath},
|
|
1289
|
+
if (isSecretSource(value) || isParamSource(value)) throw new LoadError(`${fnLabel} returned a source${atPath}, a value known only at boot. resolve() returns plain data; bind the source directly.`);
|
|
1239
1290
|
if (isValue(value)) throw new LoadError(`${fnLabel} returned a value${atPath}, not a real value. List that value as a dependency; fn receives its real value.`);
|
|
1240
1291
|
const notPlain = describeNotPlain(value);
|
|
1241
1292
|
if (notPlain !== void 0) throw new LoadError(`${fnLabel} returned ${notPlain}${atPath}. resolve() returns plain data: strings, finite numbers, booleans, null, arrays and plain objects.`);
|
|
@@ -1265,7 +1316,7 @@ function firstPointer(value, path = [], seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
1265
1316
|
function refusePointerDependency(fnLabel, dependency, real) {
|
|
1266
1317
|
const found = firstPointer(real);
|
|
1267
1318
|
if (found === void 0) return;
|
|
1268
|
-
const label = sourceOriginOf(found.pointer)?.label ?? "a
|
|
1319
|
+
const label = sourceOriginOf(found.pointer)?.label ?? "a source";
|
|
1269
1320
|
const origin = originOf(dependency);
|
|
1270
1321
|
if (origin.kind !== "input") throw new LoadError(`${fnLabel} lists ${label}, which is known only at boot. A resolve() dependency must be a deploy-time value. Bind ${label} directly into the input of the service that reads it.`);
|
|
1271
1322
|
const listed = `${inputFieldLabel(origin)} of module "${origin.module}"`;
|
|
@@ -1336,7 +1387,7 @@ function refuseSecretBoxes(address, value, path) {
|
|
|
1336
1387
|
address,
|
|
1337
1388
|
kind: "moduleInput",
|
|
1338
1389
|
path
|
|
1339
|
-
})} is bound to a SecretString. A secret's value never appears in the code; bind
|
|
1390
|
+
})} is bound to a SecretString. A secret's value never appears in the code; bind a secret source, or pass on an input field typed secretString().`);
|
|
1340
1391
|
if (Array.isArray(value)) {
|
|
1341
1392
|
for (const [index, member] of value.entries()) refuseSecretBoxes(address, member, joinPath(path, index));
|
|
1342
1393
|
return;
|
|
@@ -1344,10 +1395,17 @@ function refuseSecretBoxes(address, value, path) {
|
|
|
1344
1395
|
if (isPlainObject(value)) for (const [key, member] of Object.entries(value)) refuseSecretBoxes(address, member, joinPath(path, key));
|
|
1345
1396
|
}
|
|
1346
1397
|
/** The original source each runtime value in `value` names, by its path. */
|
|
1347
|
-
function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map()) {
|
|
1348
|
-
if (isSecretSource(value) || isParamSource(value))
|
|
1349
|
-
|
|
1350
|
-
|
|
1398
|
+
function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map(), ancestors = /* @__PURE__ */ new Set()) {
|
|
1399
|
+
if (isSecretSource(value) || isParamSource(value)) {
|
|
1400
|
+
found.set(path, sourceOriginOf(value)?.source ?? value);
|
|
1401
|
+
return found;
|
|
1402
|
+
}
|
|
1403
|
+
if (!Array.isArray(value) && !isPlainObject(value)) return found;
|
|
1404
|
+
if (ancestors.has(value)) return found;
|
|
1405
|
+
ancestors.add(value);
|
|
1406
|
+
const entries = Array.isArray(value) ? value.map((member, index) => [index, member]) : Object.entries(value);
|
|
1407
|
+
for (const [key, member] of entries) sourcesByPath(member, joinPath(path, key), found, ancestors);
|
|
1408
|
+
ancestors.delete(value);
|
|
1351
1409
|
return found;
|
|
1352
1410
|
}
|
|
1353
1411
|
function validateModuleInput(entry, resolved, environment) {
|
|
@@ -1380,11 +1438,18 @@ function validateModuleInput(entry, resolved, environment) {
|
|
|
1380
1438
|
};
|
|
1381
1439
|
return restore(result.value, "");
|
|
1382
1440
|
}
|
|
1441
|
+
function refuseSourcesInParams(params) {
|
|
1442
|
+
for (const { serviceAddress, slot, binding } of params) {
|
|
1443
|
+
const [source] = pointersIn(binding);
|
|
1444
|
+
if (source === void 0) continue;
|
|
1445
|
+
throw new LoadError(`Service "${serviceAddress}" binds its param "${slot}" to ${sourceOriginOf(source)?.label ?? "a source"}, a value known only at boot. A param takes a literal or a value the deploy has. Bind the value to a field of the service's input instead.`);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1383
1448
|
function refusePointersInProps(address, props) {
|
|
1384
1449
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
1385
1450
|
const walk = (value, path) => {
|
|
1386
1451
|
if (isSecretSource(value) || isParamSource(value)) {
|
|
1387
|
-
const label = sourceOriginOf(value)?.label ??
|
|
1452
|
+
const label = sourceOriginOf(value)?.label ?? "a source";
|
|
1388
1453
|
throw new LoadError(`${describeSite({
|
|
1389
1454
|
address,
|
|
1390
1455
|
kind: "props",
|
|
@@ -1406,22 +1471,12 @@ function refusePointersInProps(address, props) {
|
|
|
1406
1471
|
function resolveValues(input) {
|
|
1407
1472
|
const { environment } = input;
|
|
1408
1473
|
const rootFields = /* @__PURE__ */ new Map();
|
|
1409
|
-
const keysRead = /* @__PURE__ */ new Map();
|
|
1410
|
-
/** The text the app configuration holds for `key`, recorded; `undefined` when it holds none or `''`. */
|
|
1411
|
-
const configurationText = (key, label, site) => {
|
|
1412
|
-
let raw;
|
|
1413
|
-
if (input.appConfigurationRead !== void 0) raw = input.appConfigurationRead.configurationKeyText[key];
|
|
1414
|
-
else if (input.configuration !== void 0) raw = input.configuration[key];
|
|
1415
|
-
else throw new LoadError(`${describeSite(site)} depends on ${label}, but Load was given no app configuration to read "${key}" from. Pass { configuration } to Load; the deploy and dev commands pass the values the \`config\` adapters return.`);
|
|
1416
|
-
if (raw !== void 0 && raw !== "" && typeof raw !== "string") throw new LoadError(`${describeSite(site)} depends on ${label}, which reads "${key}" from the values the \`config\` adapters return, but they return ${describeKind(raw)} for it, not text. ${label} reads text; to pass other data, declare it in the root module's input.`);
|
|
1417
|
-
const text = raw === void 0 || raw === "" ? void 0 : raw;
|
|
1418
|
-
keysRead.set(key, {
|
|
1419
|
-
label,
|
|
1420
|
-
text
|
|
1421
|
-
});
|
|
1422
|
-
return text;
|
|
1423
|
-
};
|
|
1424
1474
|
const secretUses = /* @__PURE__ */ new Map();
|
|
1475
|
+
for (const [address, value] of input.valueResources) if (isSecretSource(value)) secretUses.set(value, {
|
|
1476
|
+
source: value,
|
|
1477
|
+
address,
|
|
1478
|
+
nodeKind: "resource"
|
|
1479
|
+
});
|
|
1425
1480
|
const recordSecret = (source, site) => {
|
|
1426
1481
|
const canonical = canonicalSecret(source);
|
|
1427
1482
|
if (secretUses.has(canonical)) return;
|
|
@@ -1431,8 +1486,8 @@ function resolveValues(input) {
|
|
|
1431
1486
|
nodeKind: nodeKindOf(site)
|
|
1432
1487
|
});
|
|
1433
1488
|
};
|
|
1434
|
-
const secretSourcesReceivedBy = (inputBindings
|
|
1435
|
-
for (const { serviceAddress, binding } of
|
|
1489
|
+
const secretSourcesReceivedBy = (inputBindings) => {
|
|
1490
|
+
for (const { serviceAddress, binding } of inputBindings) for (const pointer of pointersIn(binding)) {
|
|
1436
1491
|
if (!isSecretSource(pointer)) continue;
|
|
1437
1492
|
const canonical = canonicalSecret(pointer);
|
|
1438
1493
|
if (secretUses.get(canonical)?.nodeKind === "service") continue;
|
|
@@ -1482,14 +1537,11 @@ function resolveValues(input) {
|
|
|
1482
1537
|
break;
|
|
1483
1538
|
case "source":
|
|
1484
1539
|
if (isSecretSource(origin.source)) recordSecret(origin.source, site);
|
|
1485
|
-
|
|
1486
|
-
else result = configurationText(origin.configurationKey, origin.label, site);
|
|
1540
|
+
result = origin.source;
|
|
1487
1541
|
break;
|
|
1488
1542
|
case "computed": {
|
|
1489
1543
|
const args = origin.dependencies.map((dependency) => {
|
|
1490
1544
|
const real = resolveOne(dependency, site);
|
|
1491
|
-
const source = originOf(dependency);
|
|
1492
|
-
if (real === void 0 && source.kind === "source" && source.sourceKind === "param") throw new LoadError(`${fnLabelFor(site)} lists ${source.label}, but "${source.configurationKey}" is unset or empty, so it has no real value. Set "${source.configurationKey}", or bind ${source.label} directly into an input binding, where an absent value leaves the key out and the schema decides.`);
|
|
1493
1545
|
refusePointerDependency(fnLabelFor(site), dependency, real);
|
|
1494
1546
|
return real;
|
|
1495
1547
|
});
|
|
@@ -1547,35 +1599,11 @@ function resolveValues(input) {
|
|
|
1547
1599
|
return validated;
|
|
1548
1600
|
};
|
|
1549
1601
|
const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isLoadRoot)?.moduleAddress ?? "";
|
|
1550
|
-
const appConfigurationReadOf = (
|
|
1551
|
-
if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
|
|
1552
|
-
const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
|
|
1553
|
-
binding,
|
|
1554
|
-
site: {
|
|
1555
|
-
address: serviceAddress,
|
|
1556
|
-
kind: "serviceInput",
|
|
1557
|
-
path: ""
|
|
1558
|
-
}
|
|
1559
|
-
})), ...params.map(({ serviceAddress, slot, binding }) => ({
|
|
1560
|
-
binding,
|
|
1561
|
-
site: {
|
|
1562
|
-
address: serviceAddress,
|
|
1563
|
-
kind: "param",
|
|
1564
|
-
path: slot
|
|
1565
|
-
}
|
|
1566
|
-
}))];
|
|
1567
|
-
for (const { binding, site } of kept) for (const pointer of pointersIn(binding)) {
|
|
1568
|
-
if (!isParamSource(pointer)) continue;
|
|
1569
|
-
const origin = sourceOriginOf(pointer);
|
|
1570
|
-
if (origin?.sourceKind === "param" && origin.configurationKey !== void 0) configurationText(origin.configurationKey, origin.label, site);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1602
|
+
const appConfigurationReadOf = (secretSources) => {
|
|
1573
1603
|
for (const use of secretSources) {
|
|
1574
1604
|
const origin = sourceOriginOf(use.source);
|
|
1575
1605
|
if (origin?.sourceKind !== "secret") continue;
|
|
1576
1606
|
const key = origin.secretsKey;
|
|
1577
|
-
const read = key === void 0 ? void 0 : keysRead.get(key);
|
|
1578
|
-
if (key !== void 0 && read !== void 0) throw new LoadError(`${read.label} reads "${key}" from the app configuration, and ${origin.label} names "${key}" as a secret. A name is a plain value or a secret, not both: Composer hands the deploy's second process every plain value it reads, in a file, and never writes a secret to a file. Give the plain value and the secret different names.`);
|
|
1579
1607
|
const field = [...rootFields.values()].find((candidate) => candidate.path[0] === key);
|
|
1580
1608
|
if (key !== void 0 && field !== void 0) throw new LoadError(`${inputFieldLabel({
|
|
1581
1609
|
kind: "input",
|
|
@@ -1591,25 +1619,21 @@ function resolveValues(input) {
|
|
|
1591
1619
|
path: field.path
|
|
1592
1620
|
})} of root module "${rootModuleAddress()}" holds ${kind}, which JSON cannot hold exactly. The deploy hands the root's input to its second process in a JSON file, so a field the root's body passes on must hold text, a finite number, a boolean, null, or arrays and plain objects of these.`);
|
|
1593
1621
|
}
|
|
1594
|
-
|
|
1595
|
-
for (const [key, { text }] of keysRead) if (text !== void 0) configurationKeyText[key] = text;
|
|
1596
|
-
return {
|
|
1597
|
-
rootInput: [...rootFields.values()],
|
|
1598
|
-
configurationKeyText
|
|
1599
|
-
};
|
|
1622
|
+
return { rootInput: [...rootFields.values()] };
|
|
1600
1623
|
};
|
|
1601
1624
|
for (const entry of input.moduleInputs) validatedInputOf(entry);
|
|
1602
1625
|
for (const { value, site } of found) resolveOne(value, site);
|
|
1603
1626
|
const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
|
|
1604
1627
|
if (found.length === 0) {
|
|
1605
1628
|
for (const [address, props] of authoredProps) refusePointersInProps(address, props);
|
|
1606
|
-
|
|
1629
|
+
refuseSourcesInParams(input.params);
|
|
1630
|
+
const secretSources = secretSourcesReceivedBy(input.inputBindings);
|
|
1607
1631
|
return {
|
|
1608
1632
|
inputBindings: input.inputBindings,
|
|
1609
1633
|
params: input.params,
|
|
1610
1634
|
resourceProps: authoredProps,
|
|
1611
1635
|
secretSources,
|
|
1612
|
-
appConfigurationRead: appConfigurationReadOf(
|
|
1636
|
+
appConfigurationRead: appConfigurationReadOf(secretSources)
|
|
1613
1637
|
};
|
|
1614
1638
|
}
|
|
1615
1639
|
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
@@ -1635,15 +1659,28 @@ function resolveValues(input) {
|
|
|
1635
1659
|
binding
|
|
1636
1660
|
}];
|
|
1637
1661
|
});
|
|
1638
|
-
|
|
1662
|
+
refuseSourcesInParams(params);
|
|
1663
|
+
const secretSources = secretSourcesReceivedBy(inputBindings);
|
|
1639
1664
|
return {
|
|
1640
1665
|
resourceProps,
|
|
1641
1666
|
inputBindings,
|
|
1642
1667
|
params,
|
|
1643
1668
|
secretSources,
|
|
1644
|
-
appConfigurationRead: appConfigurationReadOf(
|
|
1669
|
+
appConfigurationRead: appConfigurationReadOf(secretSources)
|
|
1645
1670
|
};
|
|
1646
1671
|
}
|
|
1672
|
+
function valueReadsOf(inputBindings) {
|
|
1673
|
+
const reads = [];
|
|
1674
|
+
for (const { serviceAddress, binding } of inputBindings) for (const [path, source] of sourcesByPath(binding)) {
|
|
1675
|
+
const resource = sourceOriginOf(source)?.resource;
|
|
1676
|
+
if (resource !== void 0) reads.push({
|
|
1677
|
+
reader: serviceAddress,
|
|
1678
|
+
resource,
|
|
1679
|
+
path
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
return reads;
|
|
1683
|
+
}
|
|
1647
1684
|
/**
|
|
1648
1685
|
* Brands a ref-port with the AUTHORED endpoint it stands for — which port of
|
|
1649
1686
|
* which node the author wired, before any forwarding chain resolves. Read
|
|
@@ -1715,6 +1752,9 @@ function producerIdOf(ref) {
|
|
|
1715
1752
|
* identity the branding copy creates, never on reading this back.
|
|
1716
1753
|
*/
|
|
1717
1754
|
const MODULE_INPUT_KEY = Symbol("prisma:module-input-key");
|
|
1755
|
+
function describeNode(node) {
|
|
1756
|
+
return valueResourceOrigin(node)?.label ?? `${node.kind} "${node.name}"`;
|
|
1757
|
+
}
|
|
1718
1758
|
/** Whether `ref` carries a callable `satisfies` that accepts `required` truthily. */
|
|
1719
1759
|
function satisfiesRequired(ref, required) {
|
|
1720
1760
|
return typeof ref === "object" && ref !== null && "satisfies" in ref && typeof ref.satisfies === "function" && ref.satisfies(required);
|
|
@@ -1784,9 +1824,9 @@ function validateServiceParamBinding(child, id, paramWiring, enclosingModuleName
|
|
|
1784
1824
|
* children carry it as their `parent`, and this module's own boundary ports
|
|
1785
1825
|
* (and the authored edges touching them) are recorded against it.
|
|
1786
1826
|
*/
|
|
1787
|
-
function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading) {
|
|
1827
|
+
function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading) {
|
|
1788
1828
|
ports.push(...boundaryPortsOf(selfId, moduleNode));
|
|
1789
|
-
const
|
|
1829
|
+
const localNodes = /* @__PURE__ */ new Map();
|
|
1790
1830
|
const used = /* @__PURE__ */ new Set();
|
|
1791
1831
|
const ctxInputs = {};
|
|
1792
1832
|
for (const key of Object.keys(moduleNode.deps)) {
|
|
@@ -1836,13 +1876,20 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1836
1876
|
if (isValue(id)) throw new LoadError(`provision() received a value as its id (module "${moduleNode.name}"). A value can configure a node, never decide its address: the graph is the same whatever inputs Composer is given (ADR-0062).`);
|
|
1837
1877
|
if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
|
|
1838
1878
|
if (!isConfigKeySegment(id)) throw new LoadError(`provision() id "${id}" (module "${moduleNode.name}") must contain only ASCII letters and digits ([A-Za-z0-9]) — the id becomes an address segment, and addresses derive deterministic config keys (segments uppercased and joined with "_"). "${id}" would put "${id.toUpperCase()}" inside the derived key. ("_" collides with the key separator and "." with the address separator.)`);
|
|
1839
|
-
|
|
1879
|
+
const fullAddress = `${selfId}.${id}`;
|
|
1840
1880
|
const untrusted = child;
|
|
1841
1881
|
if (!isNode(untrusted) || untrusted.kind !== "service" && untrusted.kind !== "resource" && untrusted.kind !== "module") throw new LoadError(`provision("${id}") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);
|
|
1842
1882
|
if (untrusted.kind === "module" && typeof untrusted.isRoot === "function" && untrusted.isRoot()) throw new LoadError(`Module "${selfId}" provisions the app root "${untrusted.name}". An app root is the deploy's entry and cannot be provisioned. Build the module with module() instead.`);
|
|
1843
|
-
|
|
1844
|
-
|
|
1883
|
+
const holder = localNodes.get(id);
|
|
1884
|
+
if (holder !== void 0) throw new LoadError(`Duplicate provision id "${id}" in module "${selfId}": "${fullAddress}" already holds ${describeNode(holder)}, and ${describeNode(child)} takes the same id. Give one of them a different id with provision(node, { id: '…' }).`);
|
|
1885
|
+
localNodes.set(id, child);
|
|
1845
1886
|
if (child.kind === "resource") {
|
|
1887
|
+
const valueOrigin = valueResourceOrigin(child);
|
|
1888
|
+
if (valueOrigin !== void 0) {
|
|
1889
|
+
if (typeof moduleNode.isRoot !== "function" || !moduleNode.isRoot()) throw new LoadError(`Module "${selfId}" provisions "${id}", a resource that is a value. Only the app root, built with appRoot(), can provision one. Provision it in the root and pass its value down through this module's input.`);
|
|
1890
|
+
const also = child.provides !== void 0 ? "provides a contract" : Object.keys(slotsOf(child)).length > 0 ? "declares dependency slots" : void 0;
|
|
1891
|
+
if (also !== void 0) throw new LoadError(`Resource "${fullAddress}" is a value and also ${also}. A resource that is a value provides no contract and has no dependencies.`);
|
|
1892
|
+
}
|
|
1846
1893
|
if (provisionWiring !== void 0) throw new LoadError(`provision("${id}") received deps for a resource — a resource's slots are wired when it is constructed, not at provision().`);
|
|
1847
1894
|
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a resource — a resource has no secret slots to satisfy.`);
|
|
1848
1895
|
if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a resource — a resource declares no input schema.`);
|
|
@@ -1875,6 +1922,11 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1875
1922
|
targetKind: "resource",
|
|
1876
1923
|
enclosingModuleName: moduleNode.name
|
|
1877
1924
|
});
|
|
1925
|
+
if (valueOrigin !== void 0) {
|
|
1926
|
+
const value = provisionedValue(valueOrigin, fullAddress);
|
|
1927
|
+
valueResources.set(fullAddress, value);
|
|
1928
|
+
return value;
|
|
1929
|
+
}
|
|
1878
1930
|
return refForResource(fullAddress, child);
|
|
1879
1931
|
}
|
|
1880
1932
|
for (const [input, ref] of Object.entries(provisionWiring ?? {})) if (isValue(ref)) throw new LoadError(`The deps for "${fullAddress}.${input}" are bound to a value. A value can configure a node, never decide its edges: the graph is the same whatever inputs Composer is given (ADR-0062).`);
|
|
@@ -1882,7 +1934,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1882
1934
|
markUsed(Object.values(localWiring));
|
|
1883
1935
|
const localParams = { ...provisionParams ?? {} };
|
|
1884
1936
|
if (child.kind === "service") {
|
|
1885
|
-
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a service — a service takes its secrets as
|
|
1937
|
+
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a service — a service takes its secrets as values bound to secretString() fields of its \`input\` binding, not a secrets map.`);
|
|
1886
1938
|
if (child.inputSchema !== void 0 && provisionInput === void 0) throw new LoadError(`Input of provisioned service "${id}" is not bound (module "${moduleNode.name}") — the service declares an input schema; bind it with \`input: { … }\` on its provision() call.`);
|
|
1887
1939
|
if (child.inputSchema === void 0 && provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding, but the service declares no input schema (module "${moduleNode.name}").`);
|
|
1888
1940
|
if (provisionInput !== void 0) inputBindings.push({
|
|
@@ -1934,7 +1986,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1934
1986
|
targetKind: "module",
|
|
1935
1987
|
enclosingModuleName: moduleNode.name
|
|
1936
1988
|
});
|
|
1937
|
-
const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
1989
|
+
const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
|
|
1938
1990
|
nodes.push({
|
|
1939
1991
|
id: fullAddress,
|
|
1940
1992
|
parent: selfId,
|
|
@@ -2009,11 +2061,12 @@ function loadModule(root, opts) {
|
|
|
2009
2061
|
const inputBindings = [];
|
|
2010
2062
|
const paramBindings = [];
|
|
2011
2063
|
const byId = /* @__PURE__ */ new Map();
|
|
2064
|
+
const valueResources = /* @__PURE__ */ new Map();
|
|
2012
2065
|
const ports = [];
|
|
2013
2066
|
const authoredEdges = [];
|
|
2014
2067
|
const loading = { sealed: false };
|
|
2015
2068
|
try {
|
|
2016
|
-
flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
2069
|
+
flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
|
|
2017
2070
|
for (const entry of pending) validateWiring(entry, byId);
|
|
2018
2071
|
assertDependencyDag(edges);
|
|
2019
2072
|
} finally {
|
|
@@ -2023,12 +2076,11 @@ function loadModule(root, opts) {
|
|
|
2023
2076
|
for (const [address, node] of byId) if (node.kind === "resource") resources.set(address, node);
|
|
2024
2077
|
const resolved = resolveValues({
|
|
2025
2078
|
environment: opts?.environment,
|
|
2026
|
-
configuration: opts?.configuration,
|
|
2027
|
-
appConfigurationRead: opts?.appConfigurationRead,
|
|
2028
2079
|
inputBindings,
|
|
2029
2080
|
params: paramBindings,
|
|
2030
2081
|
moduleInputs,
|
|
2031
|
-
resources
|
|
2082
|
+
resources,
|
|
2083
|
+
valueResources
|
|
2032
2084
|
});
|
|
2033
2085
|
const resolvedNodes = nodes.map((entry) => {
|
|
2034
2086
|
const props = resolved.resourceProps.get(entry.id);
|
|
@@ -2052,6 +2104,7 @@ function loadModule(root, opts) {
|
|
|
2052
2104
|
inputBindings: resolved.inputBindings,
|
|
2053
2105
|
params: resolved.params,
|
|
2054
2106
|
secretSources: resolved.secretSources,
|
|
2107
|
+
valueReads: valueReadsOf(resolved.inputBindings),
|
|
2055
2108
|
appConfigurationRead: resolved.appConfigurationRead
|
|
2056
2109
|
};
|
|
2057
2110
|
}
|
|
@@ -2139,7 +2192,7 @@ function nodeAddresses(graph) {
|
|
|
2139
2192
|
return graph.nodes.map(({ id }) => id).sort();
|
|
2140
2193
|
}
|
|
2141
2194
|
//#endregion
|
|
2142
|
-
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-
|
|
2195
|
+
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-DyW59rJ7.mjs
|
|
2143
2196
|
function adapterInvalid(list, index, input, summary, fix) {
|
|
2144
2197
|
return new CliStructuredError("CONFIG.ADAPTER_INVALID", summary, {
|
|
2145
2198
|
fix,
|
|
@@ -2483,6 +2536,7 @@ async function runPipeline(entry, overrideName, environment, cwd, source, deps =
|
|
|
2483
2536
|
configuration
|
|
2484
2537
|
});
|
|
2485
2538
|
redaction.addKnownSecrets(valuesUnderSecretsKeys(configuration, secrets, secretsKeys(graph)));
|
|
2539
|
+
checkGraph(graph, config.extensions);
|
|
2486
2540
|
validateRegistryCoverage(graph, config);
|
|
2487
2541
|
deps.onEvent?.({ kind: "loaded" });
|
|
2488
2542
|
let assembled;
|
|
@@ -2502,6 +2556,14 @@ async function runPipeline(entry, overrideName, environment, cwd, source, deps =
|
|
|
2502
2556
|
secrets
|
|
2503
2557
|
};
|
|
2504
2558
|
}
|
|
2559
|
+
function checkGraph(graph, extensions) {
|
|
2560
|
+
for (const extension of extensions) try {
|
|
2561
|
+
extension.checkGraph?.(graph);
|
|
2562
|
+
} catch (error) {
|
|
2563
|
+
if (error instanceof GraphCheckError) throw new GraphCheckError(error.message, { extension: extension.id });
|
|
2564
|
+
throw error;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2505
2567
|
/** Letters, digits, `-` and `_`, starting with a letter or digit: always a valid git ref, so no `git` is needed to check it. */
|
|
2506
2568
|
const PLAIN_ENVIRONMENT_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
2507
2569
|
/** An environment name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */
|
|
@@ -2514,4 +2576,4 @@ function validateEnvironmentName(environment, spawn = spawnSync) {
|
|
|
2514
2576
|
//#endregion
|
|
2515
2577
|
export { nodeAddresses as a, __require as c, validateEnvironmentName as i, __toESM as l, resolveAppIdentity as n, secretsKeys as o, runPipeline as r, __commonJSMin as s, checkConfigSource as t };
|
|
2516
2578
|
|
|
2517
|
-
//# sourceMappingURL=validate-environment-
|
|
2579
|
+
//# sourceMappingURL=validate-environment-DyW59rJ7-B1PoUO20.mjs.map
|