@prisma/composer 0.39.0-dev.1 → 0.39.0-dev.11
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-config-UeKFBma7-CohaMmWp.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +88 -83
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
- package/dist/{app-configuration-file-CeJvBAti-D3uDlheX.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +50 -85
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
- package/dist/app-converge-bS1l9jIf-DRGbjw2D.mjs +88 -0
- package/dist/app-converge-bS1l9jIf-DRGbjw2D.mjs.map +1 -0
- package/dist/arktype.d.mts +7 -5
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +7 -5
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-Bpi8QVLB.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/control.d.mts +19 -21
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/converge-in-process-CTomEXaD-BnDylZP8.d.mts +67 -0
- package/dist/converge-in-process-CTomEXaD-BnDylZP8.d.mts.map +1 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
- package/dist/{deploy-3EXLVrtG.mjs → deploy-CSU0kr4j.mjs} +130 -38
- package/dist/deploy-CSU0kr4j.mjs.map +1 -0
- package/dist/deploy-DHgEJDpg.d.mts +32 -0
- package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{deployment-summary-p88NV5m5-SgniM8TX.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +7 -4
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map +1 -0
- package/dist/{deployment-summary-D74WrJX7-DQ3LDUuO.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +16 -44
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map +1 -0
- package/dist/{describe-kind-Cpm_euxo-CkhlGJUL.mjs → describe-kind-Cpm_euxo-DsSPENQa.mjs} +4 -4
- package/dist/describe-kind-Cpm_euxo-DsSPENQa.mjs.map +1 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
- package/dist/dev-converge-worker.d.mts +1 -0
- package/dist/dev-converge-worker.mjs +142 -0
- package/dist/dev-converge-worker.mjs.map +1 -0
- package/dist/{dev-current-wD5YDLjA-CzyFYXni.mjs → dev-current-lAlj53eX-DrtBnAmA.mjs} +11 -7
- package/dist/dev-current-lAlj53eX-DrtBnAmA.mjs.map +1 -0
- package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
- package/dist/{dist-ynqBR6y8.mjs → dist-Cf_mZHaH.mjs} +4 -26
- package/dist/dist-Cf_mZHaH.mjs.map +1 -0
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
- package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
- package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-DOzo2Psp-DmS5miT4.mjs → execute-deploy-destroy-DN16ETAk-BaopEKsA.mjs} +376 -86
- package/dist/execute-deploy-destroy-DN16ETAk-BaopEKsA.mjs.map +1 -0
- package/dist/{execute-dev-BIyOI3Ys-BbDOLlV4.mjs → execute-dev-DnVmNpc1-kSyPML7l.mjs} +455 -221
- package/dist/execute-dev-DnVmNpc1-kSyPML7l.mjs.map +1 -0
- package/dist/{execute-dev-current-CKOzjWuO-BPecs6Lf.mjs → execute-dev-current-CZdmxVQ4-Bij2LeBY.mjs} +7 -7
- package/dist/{execute-dev-current-CKOzjWuO-BPecs6Lf.mjs.map → execute-dev-current-CZdmxVQ4-Bij2LeBY.mjs.map} +1 -1
- package/dist/{execute-log-BDdHor71-B2p8Zae2.mjs → execute-log-Bl-j6izb-BTAo6tRM.mjs} +8 -8
- package/dist/{execute-log-BDdHor71-B2p8Zae2.mjs.map → execute-log-Bl-j6izb-BTAo6tRM.mjs.map} +1 -1
- package/dist/{graph-C7mdtisq-RnKiwVsx.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
- package/dist/{graph-BzPLUUsB-D7EnB1F5.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +150 -107
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
- package/dist/{graph-types-s5V7pGj2-BxSqB1ZH.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +101 -98
- package/dist/graph-types-D4PrtP-l-B0uuchTl.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-DyuwxTtd.d.mts → index-D8chHe55.d.mts} +3 -3
- package/dist/{index-DyuwxTtd.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/internal-app-configuration-file.d.mts +7 -10
- package/dist/internal-app-configuration-file.d.mts.map +1 -1
- package/dist/internal-app-configuration-file.mjs +2 -2
- package/dist/internal-converge-contract.d.mts +16 -0
- package/dist/internal-converge-contract.d.mts.map +1 -0
- package/dist/internal-converge-contract.mjs +16 -0
- package/dist/internal-converge-contract.mjs.map +1 -0
- package/dist/internal-converge.d.mts +5 -0
- package/dist/internal-converge.mjs +4 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
- package/dist/local-target-7KRsLMDO.d.mts +31 -0
- package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
- package/dist/{local-target-Dd8FJEb5.mjs → local-target-DhU1vaxd.mjs} +8 -8
- package/dist/{local-target-Dd8FJEb5.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
- package/dist/local-target.d.mts +3 -31
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-0lw_cBIr.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-0lw_cBIr.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts → pointer-BX2KJ720-BxcfpaHP.d.mts} +8 -6
- package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts.map → pointer-BX2KJ720-BxcfpaHP.d.mts.map} +1 -1
- package/dist/{preflight-transport-DmmtoFPH-CnDWufmu.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +7 -44
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
- package/dist/{redaction-DXung4ip-bBoNomi3.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +32 -15
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-D_HvoMrf.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +65 -16
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +2 -2
- package/dist/report.mjs.map +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
- package/dist/zod.d.mts +6 -5
- package/dist/zod.d.mts.map +1 -1
- package/dist/zod.mjs +6 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +15 -13
- package/skills/prisma-composer-core-concepts/SKILL.md +47 -66
- package/src/exports/dev-converge-worker.ts +2 -0
- package/src/exports/internal-converge-contract.ts +1 -0
- package/src/exports/internal-converge.ts +1 -0
- package/dist/app-config-UeKFBma7-CohaMmWp.d.mts.map +0 -1
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +0 -1
- package/dist/config-BeZEgGCg.d.mts +0 -1
- package/dist/deploy-3EXLVrtG.mjs.map +0 -1
- package/dist/deploy-Xi4_JrtE.d.mts +0 -2
- package/dist/deployment-summary-D74WrJX7-DQ3LDUuO.mjs.map +0 -1
- package/dist/deployment-summary-p88NV5m5-SgniM8TX.d.mts.map +0 -1
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +0 -1
- package/dist/dev-current-wD5YDLjA-CzyFYXni.mjs.map +0 -1
- package/dist/dist-ynqBR6y8.mjs.map +0 -1
- package/dist/execute-deploy-destroy-DOzo2Psp-DmS5miT4.mjs.map +0 -1
- package/dist/execute-dev-BIyOI3Ys-BbDOLlV4.mjs.map +0 -1
- package/dist/graph-BzPLUUsB-D7EnB1F5.mjs.map +0 -1
- package/dist/graph-C7mdtisq-RnKiwVsx.d.mts.map +0 -1
- package/dist/graph-types-s5V7pGj2-BxSqB1ZH.d.mts.map +0 -1
- package/dist/local-target.d.mts.map +0 -1
- package/dist/preflight-transport-DmmtoFPH-CnDWufmu.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-D_HvoMrf.d.mts.map +0 -1
- package/dist/redaction-DXung4ip-bBoNomi3.mjs.map +0 -1
- package/dist/run-alchemy-CRLAyOtt-CBUV28We.mjs +0 -236
- package/dist/run-alchemy-CRLAyOtt-CBUV28We.mjs.map +0 -1
- package/dist/validate-environment-D1BTCkTs-BQprjyNP.mjs +0 -739
- package/dist/validate-environment-D1BTCkTs-BQprjyNP.mjs.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
-
import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-
|
|
2
|
+
import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-DsSPENQa.mjs";
|
|
3
3
|
import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
|
|
4
|
-
import { t as CliStructuredError } from "./errors-
|
|
5
|
-
//#region ../../0-framework/1-core/core/dist/graph-
|
|
4
|
+
import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
|
|
5
|
+
//#region ../../0-framework/1-core/core/dist/graph-D2WMLL43.mjs
|
|
6
6
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
7
7
|
const RESOURCE_OUT_PORT = "$out";
|
|
8
8
|
/**
|
|
9
9
|
* Thrown by Load when the graph is malformed. Structured at origin
|
|
10
|
-
* (base-type rule 6)
|
|
11
|
-
*
|
|
10
|
+
* (base-type rule 6) under one type-level code. Not every error Load throws
|
|
11
|
+
* is one: a Load that needs a root input field an earlier Load did not read
|
|
12
|
+
* throws an error whose name is the value of `ROOT_INPUT_UNREAD_ERROR`. The `name` stays
|
|
12
13
|
* `CliStructuredError` — structural recognition depends on it.
|
|
13
14
|
*/
|
|
14
15
|
var LoadError = class extends CliStructuredError {
|
|
@@ -29,6 +30,7 @@ function contractStyleOf(contract) {
|
|
|
29
30
|
}
|
|
30
31
|
const VALUE = blindCast(Symbol.for("prisma:value"));
|
|
31
32
|
const VALUE_ORIGIN = blindCast(Symbol.for("prisma:value-origin"));
|
|
33
|
+
const VALUE_RESOURCE = blindCast(Symbol.for("prisma:value-resource"));
|
|
32
34
|
/**
|
|
33
35
|
* A value computed from other values. `fn` receives the dependencies' real
|
|
34
36
|
* values as one tuple, in order, and returns plain data. Each dependency must
|
|
@@ -176,19 +178,20 @@ function buildModuleInput(moduleAddress) {
|
|
|
176
178
|
*/
|
|
177
179
|
const NODE = Symbol.for("prisma:node");
|
|
178
180
|
const SECRET_SOURCE = blindCast(Symbol.for("prisma:secret-source"));
|
|
179
|
-
/** Builds a secret source from a target-defined payload: the SPI a deploy target's own constructor
|
|
181
|
+
/** Builds a secret source from a target-defined payload: the SPI a deploy target's own constructor calls. The source is a value whose real value at deploy is itself, a pointer. Core forwards it and never inspects the payload. */
|
|
180
182
|
function secretSource(payload, options) {
|
|
181
|
-
const label = sourceLabel("secretSource", options?.label
|
|
183
|
+
const label = sourceLabel("secretSource", options?.label);
|
|
182
184
|
const secretsKey = options?.secretsKey;
|
|
183
185
|
if (secretsKey !== void 0 && (typeof secretsKey !== "string" || secretsKey.length === 0)) throw new Error("secretSource() secretsKey must be a non-empty string.");
|
|
184
186
|
return blindCast(buildSource(SECRET_SOURCE, payload, {
|
|
185
187
|
kind: "source",
|
|
186
188
|
sourceKind: "secret",
|
|
187
189
|
label,
|
|
188
|
-
secretsKey
|
|
190
|
+
secretsKey,
|
|
191
|
+
resource: void 0
|
|
189
192
|
}, "secret"));
|
|
190
193
|
}
|
|
191
|
-
/** True if `value` is a secret source
|
|
194
|
+
/** True if `value` is a secret source. */
|
|
192
195
|
function isSecretSource(value) {
|
|
193
196
|
return typeof value === "object" && value !== null && blindCast(value)[SECRET_SOURCE] === true;
|
|
194
197
|
}
|
|
@@ -206,35 +209,35 @@ function isProvisionNeed(value) {
|
|
|
206
209
|
return typeof value === "object" && value !== null && blindCast(value)[PROVISION_NEED] === true;
|
|
207
210
|
}
|
|
208
211
|
const PARAM_SOURCE = blindCast(Symbol.for("prisma:param-source"));
|
|
209
|
-
/** Builds a param source from a target-defined payload: the SPI a deploy target's own constructor
|
|
212
|
+
/** Builds a param source from a target-defined payload: the SPI a deploy target's own constructor calls. Core forwards it and never inspects the payload. */
|
|
210
213
|
function paramSource(payload, options) {
|
|
211
|
-
const label = sourceLabel("paramSource", options?.label
|
|
212
|
-
const configurationKey = options?.configurationKey;
|
|
213
|
-
if (configurationKey !== void 0 && (typeof configurationKey !== "string" || configurationKey.length === 0)) throw new Error("paramSource() configurationKey must be a non-empty string.");
|
|
214
|
+
const label = sourceLabel("paramSource", options?.label);
|
|
214
215
|
const redacted = options?.redacted === true;
|
|
215
|
-
if (configurationKey !== void 0 && redacted) throw new Error("paramSource() takes configurationKey, for a value known at deploy, or redacted, for a secret known only at boot, not both.");
|
|
216
216
|
return blindCast(buildSource(PARAM_SOURCE, payload, {
|
|
217
217
|
kind: "source",
|
|
218
218
|
sourceKind: "param",
|
|
219
219
|
label,
|
|
220
|
-
|
|
221
|
-
},
|
|
220
|
+
resource: void 0
|
|
221
|
+
}, redacted ? "secret" : "plain"));
|
|
222
222
|
}
|
|
223
|
-
function sourceLabel(factory, label
|
|
224
|
-
if (label === void 0) return
|
|
223
|
+
function sourceLabel(factory, label) {
|
|
224
|
+
if (label === void 0) return "a source";
|
|
225
225
|
if (typeof label !== "string" || label.length === 0) throw new Error(`${factory}() label must be a non-empty string.`);
|
|
226
226
|
return label;
|
|
227
227
|
}
|
|
228
|
-
function buildSource(brand, payload, origin, kind) {
|
|
228
|
+
function buildSource(brand, payload, origin, kind, hidden = {}) {
|
|
229
229
|
const source = {
|
|
230
230
|
[VALUE]: true,
|
|
231
231
|
[VALUE_ORIGIN]: origin,
|
|
232
232
|
[brand]: true,
|
|
233
|
-
|
|
233
|
+
[POINTER]: kind,
|
|
234
234
|
payload
|
|
235
235
|
};
|
|
236
236
|
Object.defineProperty(origin, "source", { value: source });
|
|
237
|
-
Object.defineProperties(source,
|
|
237
|
+
Object.defineProperties(source, {
|
|
238
|
+
...coercions(origin),
|
|
239
|
+
...hidden
|
|
240
|
+
});
|
|
238
241
|
Object.freeze(origin);
|
|
239
242
|
return Object.freeze(source);
|
|
240
243
|
}
|
|
@@ -253,7 +256,7 @@ function coercions(origin) {
|
|
|
253
256
|
const sourceMisuses = /* @__PURE__ */ new WeakSet();
|
|
254
257
|
function sourceMisuse(origin, what) {
|
|
255
258
|
const { label } = origin;
|
|
256
|
-
const error = new LoadError(
|
|
259
|
+
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.`);
|
|
257
260
|
sourceMisuses.add(error);
|
|
258
261
|
return error;
|
|
259
262
|
}
|
|
@@ -267,7 +270,7 @@ function sourceOriginOf(source) {
|
|
|
267
270
|
const origin = originOf(source);
|
|
268
271
|
return origin.kind === "source" ? origin : void 0;
|
|
269
272
|
}
|
|
270
|
-
/** True if `value` is a param source
|
|
273
|
+
/** True if `value` is a param source. */
|
|
271
274
|
function isParamSource(value) {
|
|
272
275
|
return typeof value === "object" && value !== null && blindCast(value)[PARAM_SOURCE] === true;
|
|
273
276
|
}
|
|
@@ -395,6 +398,38 @@ var FrozenResourceNode = class extends ResourceNodeBase {
|
|
|
395
398
|
function resource(def) {
|
|
396
399
|
return new FrozenResourceNode(def);
|
|
397
400
|
}
|
|
401
|
+
function isSourceValue(value) {
|
|
402
|
+
return (isSecretSource(value) || isParamSource(value)) && sourceOriginOf(value) !== void 0;
|
|
403
|
+
}
|
|
404
|
+
var FrozenValueResourceNode = class extends ResourceNodeBase {
|
|
405
|
+
[VALUE_RESOURCE];
|
|
406
|
+
constructor(def) {
|
|
407
|
+
super(def);
|
|
408
|
+
this[VALUE_RESOURCE] = def.value;
|
|
409
|
+
freezeNode(this);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
/** Builds a frozen resource node that is a value: `value`, a source built with `secretSource()` or `paramSource()`. It provides no contract and has no dependencies. */
|
|
413
|
+
function valueResource(def) {
|
|
414
|
+
if (!isSourceValue(def.value)) throw new Error("valueResource() value must be a source, built with secretSource() or paramSource().");
|
|
415
|
+
return new FrozenValueResourceNode(def);
|
|
416
|
+
}
|
|
417
|
+
function valueResourceOrigin(node) {
|
|
418
|
+
if (!isNode(node) || node.kind !== "resource" || !(VALUE_RESOURCE in node)) return void 0;
|
|
419
|
+
const value = node[VALUE_RESOURCE];
|
|
420
|
+
return isSecretSource(value) || isParamSource(value) ? sourceOriginOf(value) : void 0;
|
|
421
|
+
}
|
|
422
|
+
/** True for a resource node that is a value: one that holds a source under the value resource key. */
|
|
423
|
+
function isValueResource(node) {
|
|
424
|
+
return valueResourceOrigin(node) !== void 0;
|
|
425
|
+
}
|
|
426
|
+
function provisionedValue(origin, address) {
|
|
427
|
+
const { source, ...kept } = origin;
|
|
428
|
+
return blindCast(buildSource(isSecretSource(source) ? SECRET_SOURCE : PARAM_SOURCE, source.payload, {
|
|
429
|
+
...kept,
|
|
430
|
+
resource: address
|
|
431
|
+
}, isSecretPointer(source) ? "secret" : "plain", { id: { value: address } }));
|
|
432
|
+
}
|
|
398
433
|
/**
|
|
399
434
|
* Constructs a branded, frozen Service node — declarations only (inputs,
|
|
400
435
|
* params, the input schema, build adapter, and the ports it exposes). Pure;
|
|
@@ -643,10 +678,8 @@ function loadService(root, rootId) {
|
|
|
643
678
|
inputBindings: [],
|
|
644
679
|
params: [],
|
|
645
680
|
secretSources: [],
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
configurationKeyText: {}
|
|
649
|
-
}
|
|
681
|
+
valueReads: [],
|
|
682
|
+
appConfigurationRead: { rootInput: [] }
|
|
650
683
|
};
|
|
651
684
|
}
|
|
652
685
|
function joinPath(path, key) {
|
|
@@ -721,6 +754,14 @@ function jsonInexactKind(value) {
|
|
|
721
754
|
}
|
|
722
755
|
return describeNotPlain(value) ?? describeKind(value);
|
|
723
756
|
}
|
|
757
|
+
/** The `name` of the error a Load that takes what an earlier Load read fails with when it needs a root input field that Load did not read. */
|
|
758
|
+
const ROOT_INPUT_UNREAD_ERROR = "RootInputUnreadError";
|
|
759
|
+
var RootInputUnreadError = class extends Error {
|
|
760
|
+
constructor(message) {
|
|
761
|
+
super(message);
|
|
762
|
+
this.name = ROOT_INPUT_UNREAD_ERROR;
|
|
763
|
+
}
|
|
764
|
+
};
|
|
724
765
|
const SAME_GRAPH_ADVICE = "A module body must build the same graph every time; one that reads the process environment, a file or the clock can build a different one.";
|
|
725
766
|
function isThenable(value) {
|
|
726
767
|
if (isValue(value)) return false;
|
|
@@ -760,7 +801,7 @@ function checkResult(result, fnLabel) {
|
|
|
760
801
|
const walk = (value, path) => {
|
|
761
802
|
const atPath = path === "" ? "" : ` at "${path}"`;
|
|
762
803
|
if (value === void 0) throw new LoadError(`${fnLabel} returned undefined${atPath}. Return a result for every environment; Composer never picks a default.`);
|
|
763
|
-
if (isSecretSource(value) || isParamSource(value)) throw new LoadError(`${fnLabel} returned a source${atPath},
|
|
804
|
+
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.`);
|
|
764
805
|
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.`);
|
|
765
806
|
const notPlain = describeNotPlain(value);
|
|
766
807
|
if (notPlain !== void 0) throw new LoadError(`${fnLabel} returned ${notPlain}${atPath}. resolve() returns plain data: strings, finite numbers, booleans, null, arrays and plain objects.`);
|
|
@@ -790,7 +831,7 @@ function firstPointer(value, path = [], seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
790
831
|
function refusePointerDependency(fnLabel, dependency, real) {
|
|
791
832
|
const found = firstPointer(real);
|
|
792
833
|
if (found === void 0) return;
|
|
793
|
-
const label = sourceOriginOf(found.pointer)?.label ?? "a
|
|
834
|
+
const label = sourceOriginOf(found.pointer)?.label ?? "a source";
|
|
794
835
|
const origin = originOf(dependency);
|
|
795
836
|
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.`);
|
|
796
837
|
const listed = `${inputFieldLabel(origin)} of module "${origin.module}"`;
|
|
@@ -861,7 +902,7 @@ function refuseSecretBoxes(address, value, path) {
|
|
|
861
902
|
address,
|
|
862
903
|
kind: "moduleInput",
|
|
863
904
|
path
|
|
864
|
-
})} is bound to a SecretString. A secret's value never appears in the code; bind
|
|
905
|
+
})} 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().`);
|
|
865
906
|
if (Array.isArray(value)) {
|
|
866
907
|
for (const [index, member] of value.entries()) refuseSecretBoxes(address, member, joinPath(path, index));
|
|
867
908
|
return;
|
|
@@ -869,10 +910,17 @@ function refuseSecretBoxes(address, value, path) {
|
|
|
869
910
|
if (isPlainObject(value)) for (const [key, member] of Object.entries(value)) refuseSecretBoxes(address, member, joinPath(path, key));
|
|
870
911
|
}
|
|
871
912
|
/** The original source each runtime value in `value` names, by its path. */
|
|
872
|
-
function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map()) {
|
|
873
|
-
if (isSecretSource(value) || isParamSource(value))
|
|
874
|
-
|
|
875
|
-
|
|
913
|
+
function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map(), ancestors = /* @__PURE__ */ new Set()) {
|
|
914
|
+
if (isSecretSource(value) || isParamSource(value)) {
|
|
915
|
+
found.set(path, sourceOriginOf(value)?.source ?? value);
|
|
916
|
+
return found;
|
|
917
|
+
}
|
|
918
|
+
if (!Array.isArray(value) && !isPlainObject(value)) return found;
|
|
919
|
+
if (ancestors.has(value)) return found;
|
|
920
|
+
ancestors.add(value);
|
|
921
|
+
const entries = Array.isArray(value) ? value.map((member, index) => [index, member]) : Object.entries(value);
|
|
922
|
+
for (const [key, member] of entries) sourcesByPath(member, joinPath(path, key), found, ancestors);
|
|
923
|
+
ancestors.delete(value);
|
|
876
924
|
return found;
|
|
877
925
|
}
|
|
878
926
|
function validateModuleInput(entry, resolved, environment) {
|
|
@@ -905,11 +953,18 @@ function validateModuleInput(entry, resolved, environment) {
|
|
|
905
953
|
};
|
|
906
954
|
return restore(result.value, "");
|
|
907
955
|
}
|
|
956
|
+
function refuseSourcesInParams(params) {
|
|
957
|
+
for (const { serviceAddress, slot, binding } of params) {
|
|
958
|
+
const [source] = pointersIn(binding);
|
|
959
|
+
if (source === void 0) continue;
|
|
960
|
+
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.`);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
908
963
|
function refusePointersInProps(address, props) {
|
|
909
964
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
910
965
|
const walk = (value, path) => {
|
|
911
966
|
if (isSecretSource(value) || isParamSource(value)) {
|
|
912
|
-
const label = sourceOriginOf(value)?.label ??
|
|
967
|
+
const label = sourceOriginOf(value)?.label ?? "a source";
|
|
913
968
|
throw new LoadError(`${describeSite({
|
|
914
969
|
address,
|
|
915
970
|
kind: "props",
|
|
@@ -931,22 +986,12 @@ function refusePointersInProps(address, props) {
|
|
|
931
986
|
function resolveValues(input) {
|
|
932
987
|
const { environment } = input;
|
|
933
988
|
const rootFields = /* @__PURE__ */ new Map();
|
|
934
|
-
const keysRead = /* @__PURE__ */ new Map();
|
|
935
|
-
/** The text the app configuration holds for `key`, recorded; `undefined` when it holds none or `''`. */
|
|
936
|
-
const configurationText = (key, label, site) => {
|
|
937
|
-
let raw;
|
|
938
|
-
if (input.appConfigurationRead !== void 0) raw = input.appConfigurationRead.configurationKeyText[key];
|
|
939
|
-
else if (input.configuration !== void 0) raw = input.configuration[key];
|
|
940
|
-
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.`);
|
|
941
|
-
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.`);
|
|
942
|
-
const text = raw === void 0 || raw === "" ? void 0 : raw;
|
|
943
|
-
keysRead.set(key, {
|
|
944
|
-
label,
|
|
945
|
-
text
|
|
946
|
-
});
|
|
947
|
-
return text;
|
|
948
|
-
};
|
|
949
989
|
const secretUses = /* @__PURE__ */ new Map();
|
|
990
|
+
for (const [address, value] of input.valueResources) if (isSecretSource(value)) secretUses.set(value, {
|
|
991
|
+
source: value,
|
|
992
|
+
address,
|
|
993
|
+
nodeKind: "resource"
|
|
994
|
+
});
|
|
950
995
|
const recordSecret = (source, site) => {
|
|
951
996
|
const canonical = canonicalSecret(source);
|
|
952
997
|
if (secretUses.has(canonical)) return;
|
|
@@ -956,8 +1001,8 @@ function resolveValues(input) {
|
|
|
956
1001
|
nodeKind: nodeKindOf(site)
|
|
957
1002
|
});
|
|
958
1003
|
};
|
|
959
|
-
const secretSourcesReceivedBy = (inputBindings
|
|
960
|
-
for (const { serviceAddress, binding } of
|
|
1004
|
+
const secretSourcesReceivedBy = (inputBindings) => {
|
|
1005
|
+
for (const { serviceAddress, binding } of inputBindings) for (const pointer of pointersIn(binding)) {
|
|
961
1006
|
if (!isSecretSource(pointer)) continue;
|
|
962
1007
|
const canonical = canonicalSecret(pointer);
|
|
963
1008
|
if (secretUses.get(canonical)?.nodeKind === "service") continue;
|
|
@@ -1007,14 +1052,11 @@ function resolveValues(input) {
|
|
|
1007
1052
|
break;
|
|
1008
1053
|
case "source":
|
|
1009
1054
|
if (isSecretSource(origin.source)) recordSecret(origin.source, site);
|
|
1010
|
-
|
|
1011
|
-
else result = configurationText(origin.configurationKey, origin.label, site);
|
|
1055
|
+
result = origin.source;
|
|
1012
1056
|
break;
|
|
1013
1057
|
case "computed": {
|
|
1014
1058
|
const args = origin.dependencies.map((dependency) => {
|
|
1015
1059
|
const real = resolveOne(dependency, site);
|
|
1016
|
-
const source = originOf(dependency);
|
|
1017
|
-
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.`);
|
|
1018
1060
|
refusePointerDependency(fnLabelFor(site), dependency, real);
|
|
1019
1061
|
return real;
|
|
1020
1062
|
});
|
|
@@ -1037,7 +1079,7 @@ function resolveValues(input) {
|
|
|
1037
1079
|
}
|
|
1038
1080
|
if (entry.checked !== void 0) {
|
|
1039
1081
|
const field = entry.checked.find((candidate) => candidate.path.join("\0") === origin.path.join("\0"));
|
|
1040
|
-
if (field === void 0) throw new
|
|
1082
|
+
if (field === void 0) throw new RootInputUnreadError(`${inputFieldLabel(origin)} of root module "${origin.module}" was not read when this command started, so it has no value here. ${SAME_GRAPH_ADVICE}`);
|
|
1041
1083
|
result = field.value;
|
|
1042
1084
|
} else {
|
|
1043
1085
|
result = readPath(validatedInputOf(entry), origin);
|
|
@@ -1072,41 +1114,17 @@ function resolveValues(input) {
|
|
|
1072
1114
|
return validated;
|
|
1073
1115
|
};
|
|
1074
1116
|
const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isLoadRoot)?.moduleAddress ?? "";
|
|
1075
|
-
const appConfigurationReadOf = (
|
|
1076
|
-
if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
|
|
1077
|
-
const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
|
|
1078
|
-
binding,
|
|
1079
|
-
site: {
|
|
1080
|
-
address: serviceAddress,
|
|
1081
|
-
kind: "serviceInput",
|
|
1082
|
-
path: ""
|
|
1083
|
-
}
|
|
1084
|
-
})), ...params.map(({ serviceAddress, slot, binding }) => ({
|
|
1085
|
-
binding,
|
|
1086
|
-
site: {
|
|
1087
|
-
address: serviceAddress,
|
|
1088
|
-
kind: "param",
|
|
1089
|
-
path: slot
|
|
1090
|
-
}
|
|
1091
|
-
}))];
|
|
1092
|
-
for (const { binding, site } of kept) for (const pointer of pointersIn(binding)) {
|
|
1093
|
-
if (!isParamSource(pointer)) continue;
|
|
1094
|
-
const origin = sourceOriginOf(pointer);
|
|
1095
|
-
if (origin?.sourceKind === "param" && origin.configurationKey !== void 0) configurationText(origin.configurationKey, origin.label, site);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1117
|
+
const appConfigurationReadOf = (secretSources) => {
|
|
1098
1118
|
for (const use of secretSources) {
|
|
1099
1119
|
const origin = sourceOriginOf(use.source);
|
|
1100
1120
|
if (origin?.sourceKind !== "secret") continue;
|
|
1101
1121
|
const key = origin.secretsKey;
|
|
1102
|
-
const read = key === void 0 ? void 0 : keysRead.get(key);
|
|
1103
|
-
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.`);
|
|
1104
1122
|
const field = [...rootFields.values()].find((candidate) => candidate.path[0] === key);
|
|
1105
1123
|
if (key !== void 0 && field !== void 0) throw new LoadError(`${inputFieldLabel({
|
|
1106
1124
|
kind: "input",
|
|
1107
1125
|
module: rootModuleAddress(),
|
|
1108
1126
|
path: field.path
|
|
1109
|
-
})} of root module "${rootModuleAddress()}" 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:
|
|
1127
|
+
})} of root module "${rootModuleAddress()}" 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: a root input field is a plain value, which \`prisma deploy\` sends to the platform as plain configuration, \`prisma dev\` gives to the local services as plain configuration, and \`destroy\` writes to a file. Read the secret with ${origin.label} only, or give the plain value a different name.`);
|
|
1110
1128
|
}
|
|
1111
1129
|
for (const field of rootFields.values()) {
|
|
1112
1130
|
const kind = "value" in field ? jsonInexactKind(field.value) : void 0;
|
|
@@ -1114,27 +1132,23 @@ function resolveValues(input) {
|
|
|
1114
1132
|
kind: "input",
|
|
1115
1133
|
module: rootModuleAddress(),
|
|
1116
1134
|
path: field.path
|
|
1117
|
-
})} of root module "${rootModuleAddress()}" holds ${kind}, which JSON cannot hold exactly.
|
|
1135
|
+
})} of root module "${rootModuleAddress()}" holds ${kind}, which JSON cannot hold exactly. \`destroy\` 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.`);
|
|
1118
1136
|
}
|
|
1119
|
-
|
|
1120
|
-
for (const [key, { text }] of keysRead) if (text !== void 0) configurationKeyText[key] = text;
|
|
1121
|
-
return {
|
|
1122
|
-
rootInput: [...rootFields.values()],
|
|
1123
|
-
configurationKeyText
|
|
1124
|
-
};
|
|
1137
|
+
return { rootInput: [...rootFields.values()] };
|
|
1125
1138
|
};
|
|
1126
1139
|
for (const entry of input.moduleInputs) validatedInputOf(entry);
|
|
1127
1140
|
for (const { value, site } of found) resolveOne(value, site);
|
|
1128
1141
|
const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
|
|
1129
1142
|
if (found.length === 0) {
|
|
1130
1143
|
for (const [address, props] of authoredProps) refusePointersInProps(address, props);
|
|
1131
|
-
|
|
1144
|
+
refuseSourcesInParams(input.params);
|
|
1145
|
+
const secretSources = secretSourcesReceivedBy(input.inputBindings);
|
|
1132
1146
|
return {
|
|
1133
1147
|
inputBindings: input.inputBindings,
|
|
1134
1148
|
params: input.params,
|
|
1135
1149
|
resourceProps: authoredProps,
|
|
1136
1150
|
secretSources,
|
|
1137
|
-
appConfigurationRead: appConfigurationReadOf(
|
|
1151
|
+
appConfigurationRead: appConfigurationReadOf(secretSources)
|
|
1138
1152
|
};
|
|
1139
1153
|
}
|
|
1140
1154
|
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
@@ -1160,15 +1174,28 @@ function resolveValues(input) {
|
|
|
1160
1174
|
binding
|
|
1161
1175
|
}];
|
|
1162
1176
|
});
|
|
1163
|
-
|
|
1177
|
+
refuseSourcesInParams(params);
|
|
1178
|
+
const secretSources = secretSourcesReceivedBy(inputBindings);
|
|
1164
1179
|
return {
|
|
1165
1180
|
resourceProps,
|
|
1166
1181
|
inputBindings,
|
|
1167
1182
|
params,
|
|
1168
1183
|
secretSources,
|
|
1169
|
-
appConfigurationRead: appConfigurationReadOf(
|
|
1184
|
+
appConfigurationRead: appConfigurationReadOf(secretSources)
|
|
1170
1185
|
};
|
|
1171
1186
|
}
|
|
1187
|
+
function valueReadsOf(inputBindings) {
|
|
1188
|
+
const reads = [];
|
|
1189
|
+
for (const { serviceAddress, binding } of inputBindings) for (const [path, source] of sourcesByPath(binding)) {
|
|
1190
|
+
const resource = sourceOriginOf(source)?.resource;
|
|
1191
|
+
if (resource !== void 0) reads.push({
|
|
1192
|
+
reader: serviceAddress,
|
|
1193
|
+
resource,
|
|
1194
|
+
path
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
return reads;
|
|
1198
|
+
}
|
|
1172
1199
|
/**
|
|
1173
1200
|
* Brands a ref-port with the AUTHORED endpoint it stands for — which port of
|
|
1174
1201
|
* which node the author wired, before any forwarding chain resolves. Read
|
|
@@ -1240,6 +1267,9 @@ function producerIdOf(ref) {
|
|
|
1240
1267
|
* identity the branding copy creates, never on reading this back.
|
|
1241
1268
|
*/
|
|
1242
1269
|
const MODULE_INPUT_KEY = Symbol("prisma:module-input-key");
|
|
1270
|
+
function describeNode(node) {
|
|
1271
|
+
return valueResourceOrigin(node)?.label ?? `${node.kind} "${node.name}"`;
|
|
1272
|
+
}
|
|
1243
1273
|
/** Whether `ref` carries a callable `satisfies` that accepts `required` truthily. */
|
|
1244
1274
|
function satisfiesRequired(ref, required) {
|
|
1245
1275
|
return typeof ref === "object" && ref !== null && "satisfies" in ref && typeof ref.satisfies === "function" && ref.satisfies(required);
|
|
@@ -1309,9 +1339,9 @@ function validateServiceParamBinding(child, id, paramWiring, enclosingModuleName
|
|
|
1309
1339
|
* children carry it as their `parent`, and this module's own boundary ports
|
|
1310
1340
|
* (and the authored edges touching them) are recorded against it.
|
|
1311
1341
|
*/
|
|
1312
|
-
function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading) {
|
|
1342
|
+
function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading) {
|
|
1313
1343
|
ports.push(...boundaryPortsOf(selfId, moduleNode));
|
|
1314
|
-
const
|
|
1344
|
+
const localNodes = /* @__PURE__ */ new Map();
|
|
1315
1345
|
const used = /* @__PURE__ */ new Set();
|
|
1316
1346
|
const ctxInputs = {};
|
|
1317
1347
|
for (const key of Object.keys(moduleNode.deps)) {
|
|
@@ -1361,13 +1391,20 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1361
1391
|
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).`);
|
|
1362
1392
|
if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
|
|
1363
1393
|
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.)`);
|
|
1364
|
-
|
|
1394
|
+
const fullAddress = `${selfId}.${id}`;
|
|
1365
1395
|
const untrusted = child;
|
|
1366
1396
|
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).`);
|
|
1367
1397
|
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.`);
|
|
1368
|
-
|
|
1369
|
-
|
|
1398
|
+
const holder = localNodes.get(id);
|
|
1399
|
+
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: '…' }).`);
|
|
1400
|
+
localNodes.set(id, child);
|
|
1370
1401
|
if (child.kind === "resource") {
|
|
1402
|
+
const valueOrigin = valueResourceOrigin(child);
|
|
1403
|
+
if (valueOrigin !== void 0) {
|
|
1404
|
+
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.`);
|
|
1405
|
+
const also = child.provides !== void 0 ? "provides a contract" : Object.keys(slotsOf(child)).length > 0 ? "declares dependency slots" : void 0;
|
|
1406
|
+
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.`);
|
|
1407
|
+
}
|
|
1371
1408
|
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().`);
|
|
1372
1409
|
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a resource — a resource has no secret slots to satisfy.`);
|
|
1373
1410
|
if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a resource — a resource declares no input schema.`);
|
|
@@ -1400,6 +1437,11 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1400
1437
|
targetKind: "resource",
|
|
1401
1438
|
enclosingModuleName: moduleNode.name
|
|
1402
1439
|
});
|
|
1440
|
+
if (valueOrigin !== void 0) {
|
|
1441
|
+
const value = provisionedValue(valueOrigin, fullAddress);
|
|
1442
|
+
valueResources.set(fullAddress, value);
|
|
1443
|
+
return value;
|
|
1444
|
+
}
|
|
1403
1445
|
return refForResource(fullAddress, child);
|
|
1404
1446
|
}
|
|
1405
1447
|
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).`);
|
|
@@ -1407,7 +1449,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1407
1449
|
markUsed(Object.values(localWiring));
|
|
1408
1450
|
const localParams = { ...provisionParams ?? {} };
|
|
1409
1451
|
if (child.kind === "service") {
|
|
1410
|
-
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a service — a service takes its secrets as
|
|
1452
|
+
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.`);
|
|
1411
1453
|
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.`);
|
|
1412
1454
|
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}").`);
|
|
1413
1455
|
if (provisionInput !== void 0) inputBindings.push({
|
|
@@ -1459,7 +1501,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1459
1501
|
targetKind: "module",
|
|
1460
1502
|
enclosingModuleName: moduleNode.name
|
|
1461
1503
|
});
|
|
1462
|
-
const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
1504
|
+
const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
|
|
1463
1505
|
nodes.push({
|
|
1464
1506
|
id: fullAddress,
|
|
1465
1507
|
parent: selfId,
|
|
@@ -1534,11 +1576,12 @@ function loadModule(root, opts) {
|
|
|
1534
1576
|
const inputBindings = [];
|
|
1535
1577
|
const paramBindings = [];
|
|
1536
1578
|
const byId = /* @__PURE__ */ new Map();
|
|
1579
|
+
const valueResources = /* @__PURE__ */ new Map();
|
|
1537
1580
|
const ports = [];
|
|
1538
1581
|
const authoredEdges = [];
|
|
1539
1582
|
const loading = { sealed: false };
|
|
1540
1583
|
try {
|
|
1541
|
-
flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
1584
|
+
flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
|
|
1542
1585
|
for (const entry of pending) validateWiring(entry, byId);
|
|
1543
1586
|
assertDependencyDag(edges);
|
|
1544
1587
|
} finally {
|
|
@@ -1548,12 +1591,11 @@ function loadModule(root, opts) {
|
|
|
1548
1591
|
for (const [address, node] of byId) if (node.kind === "resource") resources.set(address, node);
|
|
1549
1592
|
const resolved = resolveValues({
|
|
1550
1593
|
environment: opts?.environment,
|
|
1551
|
-
configuration: opts?.configuration,
|
|
1552
|
-
appConfigurationRead: opts?.appConfigurationRead,
|
|
1553
1594
|
inputBindings,
|
|
1554
1595
|
params: paramBindings,
|
|
1555
1596
|
moduleInputs,
|
|
1556
|
-
resources
|
|
1597
|
+
resources,
|
|
1598
|
+
valueResources
|
|
1557
1599
|
});
|
|
1558
1600
|
const resolvedNodes = nodes.map((entry) => {
|
|
1559
1601
|
const props = resolved.resourceProps.get(entry.id);
|
|
@@ -1577,6 +1619,7 @@ function loadModule(root, opts) {
|
|
|
1577
1619
|
inputBindings: resolved.inputBindings,
|
|
1578
1620
|
params: resolved.params,
|
|
1579
1621
|
secretSources: resolved.secretSources,
|
|
1622
|
+
valueReads: valueReadsOf(resolved.inputBindings),
|
|
1580
1623
|
appConfigurationRead: resolved.appConfigurationRead
|
|
1581
1624
|
};
|
|
1582
1625
|
}
|
|
@@ -1664,6 +1707,6 @@ function nodeAddresses(graph) {
|
|
|
1664
1707
|
return graph.nodes.map(({ id }) => id).sort();
|
|
1665
1708
|
}
|
|
1666
1709
|
//#endregion
|
|
1667
|
-
export {
|
|
1710
|
+
export { resolve as C, service as D, secretsKeys as E, slotsOf as O, provisionNeed as S, secretSource as T, isValueResource as _, ROOT_INPUT_UNREAD_ERROR as a, originOf as b, assertAppName as c, isNode as d, isParamSource as f, isValue as g, isSecretSource as h, RESOURCE_OUT_PORT as i, valueResource as k, dependency as l, isProvisionNeed as m, Load as n, ResourceNodeBase as o, isPlainObject as p, LoadError as r, appRoot as s, GraphCheckError as t, freezeNode as u, module as v, resource as w, paramSource as x, nodeAddresses as y };
|
|
1668
1711
|
|
|
1669
|
-
//# sourceMappingURL=graph-
|
|
1712
|
+
//# sourceMappingURL=graph-D2WMLL43-CeiC5wdy.mjs.map
|