@prisma/composer 0.36.0-dev.6 → 0.36.0-dev.8
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-RX-7kHbF-BroG2yMY.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +31 -31
- package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
- package/dist/arktype.mjs +1 -2
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-CDkq5Ayl.d.mts +1 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
- package/dist/config.d.mts +7 -9
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/control.d.mts +6 -183
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-CmiYExQA.mjs +373 -0
- package/dist/deploy-CmiYExQA.mjs.map +1 -0
- package/dist/deploy-DQyaIoNe.d.mts +2 -0
- package/dist/deploy.d.mts +4 -3
- package/dist/deploy.mjs +3 -365
- package/dist/{deployment-summary-QkZexVIS-DqL4znd4.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +9 -46
- package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
- package/dist/{deployment-summary-Cm4lN6w9-CGdGdlFC.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +4 -5
- package/dist/deployment-summary-p88NV5m5-BJOosgmI.d.mts.map +1 -0
- package/dist/{secret-DoWGmN7m-CI5Yrldp.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +13 -2
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
- package/dist/{dev-current-BurA9uhA-DixUKm8W.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
- package/dist/{dev-current-BurA9uhA-DixUKm8W.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
- package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
- package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
- package/dist/{dist-DLOn1x6Z.mjs → dist-C7SnNTD3.mjs} +2 -2
- package/dist/{dist-DLOn1x6Z.mjs.map → dist-C7SnNTD3.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-Cww6zOSC-D8eKSdMX.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +59 -35
- package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
- package/dist/{execute-dev-4KYkqSMh-Ny8ATEfU.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +79 -48
- package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
- package/dist/{execute-dev-current-Cd4YEUZk-DBj9y27X.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
- package/dist/{execute-dev-current-Cd4YEUZk-DBj9y27X.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
- package/dist/{execute-log-BC5o35wQ-photDb2l.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
- package/dist/{execute-log-BC5o35wQ-photDb2l.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
- package/dist/{graph-nazLWyK2-BBciBJje.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +169 -40
- package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
- package/dist/{graph-B_szUZs6--jpigkBW.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
- package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
- package/dist/{graph-types-CViux_yr-CVV2nQ0l.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +60 -14
- package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-BNYl6MsF.d.mts → index-DWQ6BSgm.d.mts} +3 -3
- package/dist/{index-BNYl6MsF.d.mts.map → index-DWQ6BSgm.d.mts.map} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/internal-app-configuration-file.d.mts +19 -0
- package/dist/internal-app-configuration-file.d.mts.map +1 -0
- package/dist/internal-app-configuration-file.mjs +2 -0
- package/dist/{local-target-zSdLvLyy.mjs → local-target-Dd8FJEb5.mjs} +4 -3
- package/dist/{local-target-zSdLvLyy.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/local-target.d.mts.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-C9O2M7Z4.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-C9O2M7Z4.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs-control.mjs +2 -2
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-B-Z6i3cD-C30mHT0u.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -13
- package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/{validate-environment-BNZC6W46-CNGrBiHh.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +76 -13
- package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
- package/dist/zod.mjs +1 -2
- package/dist/zod.mjs.map +1 -1
- package/package.json +13 -13
- package/skills/prisma-composer-core-concepts/SKILL.md +6 -5
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/dist/app-config-RX-7kHbF-BroG2yMY.d.mts.map +0 -1
- package/dist/config-Dp3ZVNnN.d.mts +0 -1
- package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs +0 -84
- package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs.map +0 -1
- package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs +0 -63
- package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs.map +0 -1
- package/dist/deploy-Dp3ZVNnN.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-Cm4lN6w9-CGdGdlFC.d.mts.map +0 -1
- package/dist/deployment-summary-QkZexVIS-DqL4znd4.mjs.map +0 -1
- package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs +0 -14
- package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs.map +0 -1
- package/dist/execute-deploy-destroy-Cww6zOSC-D8eKSdMX.mjs.map +0 -1
- package/dist/execute-dev-4KYkqSMh-Ny8ATEfU.mjs.map +0 -1
- package/dist/graph-B_szUZs6--jpigkBW.d.mts.map +0 -1
- package/dist/graph-nazLWyK2-BBciBJje.mjs.map +0 -1
- package/dist/graph-types-CViux_yr-CVV2nQ0l.d.mts.map +0 -1
- package/dist/internal-pools.d.mts +0 -18
- package/dist/internal-pools.d.mts.map +0 -1
- package/dist/internal-pools.mjs +0 -2
- package/dist/run-alchemy-B-Z6i3cD-C30mHT0u.mjs.map +0 -1
- package/dist/secret-DoWGmN7m-CI5Yrldp.mjs.map +0 -1
- package/dist/validate-environment-BNZC6W46-CNGrBiHh.mjs.map +0 -1
- package/src/exports/internal-pools.ts +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as describeKind } from "./describe-kind-Cpm_euxo-JFh8ejof.mjs";
|
|
2
|
+
import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
|
|
4
3
|
import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
|
|
5
4
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
6
|
-
//#region ../../0-framework/1-core/core/dist/graph-
|
|
5
|
+
//#region ../../0-framework/1-core/core/dist/graph-Bqr7PSGl.mjs
|
|
7
6
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
8
7
|
const RESOURCE_OUT_PORT = "$out";
|
|
9
8
|
/**
|
|
@@ -174,10 +173,13 @@ const SECRET_SOURCE = blindCast(Symbol.for("prisma:secret-source"));
|
|
|
174
173
|
/** Builds a secret source from a target-defined payload: the SPI a deploy target's own constructor (e.g. `envSecret`) calls. The source is a value whose real value at deploy is itself, a pointer. Core forwards it and never inspects the payload. */
|
|
175
174
|
function secretSource(payload, options) {
|
|
176
175
|
const label = sourceLabel("secretSource", options?.label, "a secret source");
|
|
176
|
+
const secretsKey = options?.secretsKey;
|
|
177
|
+
if (secretsKey !== void 0 && (typeof secretsKey !== "string" || secretsKey.length === 0)) throw new Error("secretSource() secretsKey must be a non-empty string.");
|
|
177
178
|
return blindCast(buildSource(SECRET_SOURCE, payload, {
|
|
178
179
|
kind: "source",
|
|
180
|
+
sourceKind: "secret",
|
|
179
181
|
label,
|
|
180
|
-
|
|
182
|
+
secretsKey
|
|
181
183
|
}, "secret"));
|
|
182
184
|
}
|
|
183
185
|
/** True if `value` is a secret source, such as an `envSecret()` result. */
|
|
@@ -201,15 +203,16 @@ const PARAM_SOURCE = blindCast(Symbol.for("prisma:param-source"));
|
|
|
201
203
|
/** Builds a param source from a target-defined payload: the SPI a deploy target's own constructor (e.g. `envParam`) calls. Core forwards it and never inspects the payload. */
|
|
202
204
|
function paramSource(payload, options) {
|
|
203
205
|
const label = sourceLabel("paramSource", options?.label, "a param source");
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
+
const configurationKey = options?.configurationKey;
|
|
207
|
+
if (configurationKey !== void 0 && (typeof configurationKey !== "string" || configurationKey.length === 0)) throw new Error("paramSource() configurationKey must be a non-empty string.");
|
|
206
208
|
const redacted = options?.redacted === true;
|
|
207
|
-
if (
|
|
209
|
+
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.");
|
|
208
210
|
return blindCast(buildSource(PARAM_SOURCE, payload, {
|
|
209
211
|
kind: "source",
|
|
212
|
+
sourceKind: "param",
|
|
210
213
|
label,
|
|
211
|
-
|
|
212
|
-
},
|
|
214
|
+
configurationKey
|
|
215
|
+
}, configurationKey !== void 0 ? void 0 : redacted ? "secret" : "plain"));
|
|
213
216
|
}
|
|
214
217
|
function sourceLabel(factory, label, fallback) {
|
|
215
218
|
if (label === void 0) return fallback;
|
|
@@ -244,7 +247,7 @@ function coercions(origin) {
|
|
|
244
247
|
const sourceMisuses = /* @__PURE__ */ new WeakSet();
|
|
245
248
|
function sourceMisuse(origin, what) {
|
|
246
249
|
const { label } = origin;
|
|
247
|
-
const error = new LoadError(origin.
|
|
250
|
+
const error = new LoadError(origin.sourceKind === "secret" || origin.configurationKey === void 0 ? `${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.` : `${label} is a value, not its real value, and ${what}. A module body can only pass it on: into a provision() binding or as a resolve() dependency. To compute with it, list it: resolve([${label}], ([v]) => …).`);
|
|
248
251
|
sourceMisuses.add(error);
|
|
249
252
|
return error;
|
|
250
253
|
}
|
|
@@ -605,7 +608,11 @@ function loadService(root, rootId) {
|
|
|
605
608
|
authoredEdges: [],
|
|
606
609
|
inputBindings: [],
|
|
607
610
|
params: [],
|
|
608
|
-
secretSources: []
|
|
611
|
+
secretSources: [],
|
|
612
|
+
appConfigurationRead: {
|
|
613
|
+
rootInput: [],
|
|
614
|
+
configurationKeyText: {}
|
|
615
|
+
}
|
|
609
616
|
};
|
|
610
617
|
}
|
|
611
618
|
function joinPath(path, key) {
|
|
@@ -658,6 +665,29 @@ function describeNotPlain(value) {
|
|
|
658
665
|
default: return;
|
|
659
666
|
}
|
|
660
667
|
}
|
|
668
|
+
/** How `value` would not survive `JSON.stringify` and `JSON.parse` unchanged, or `undefined` when it would. A key whose value is `undefined` is dropped, which a body cannot tell from absent. */
|
|
669
|
+
function jsonInexactKind(value) {
|
|
670
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return void 0;
|
|
671
|
+
if (typeof value === "number") return Number.isFinite(value) ? void 0 : "a non-finite number";
|
|
672
|
+
if (Array.isArray(value)) {
|
|
673
|
+
for (const member of value) {
|
|
674
|
+
if (member === void 0) return "an array with a missing member";
|
|
675
|
+
const kind = jsonInexactKind(member);
|
|
676
|
+
if (kind !== void 0) return kind;
|
|
677
|
+
}
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (isPlainObject(value)) {
|
|
681
|
+
for (const member of Object.values(value)) {
|
|
682
|
+
if (member === void 0) continue;
|
|
683
|
+
const kind = jsonInexactKind(member);
|
|
684
|
+
if (kind !== void 0) return kind;
|
|
685
|
+
}
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
return describeNotPlain(value) ?? describeKind(value);
|
|
689
|
+
}
|
|
690
|
+
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.";
|
|
661
691
|
function isThenable(value) {
|
|
662
692
|
if (isValue(value)) return false;
|
|
663
693
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
@@ -818,7 +848,7 @@ function validateModuleInput(entry, resolved, environment) {
|
|
|
818
848
|
if (result instanceof Promise) throw new LoadError(`The input schema of module "${address}" returned a Promise from validate(). A module's input is validated synchronously at Load; use a schema with no asynchronous checks.`);
|
|
819
849
|
if (result.issues !== void 0) {
|
|
820
850
|
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
821
|
-
if (entry.
|
|
851
|
+
if (entry.isRoot) throw new LoadError(`The input of root module "${address}" does not match its input schema: ${messages}. A root's input is the values the \`config\` adapters in prisma.config.ts return${environment === void 0 ? "" : ` for the environment "${environment.name}"`}.`);
|
|
822
852
|
throw new LoadError(`The input binding of module "${address}" does not match the module's input schema: ${messages}`);
|
|
823
853
|
}
|
|
824
854
|
const bound = sourcesByPath(resolved);
|
|
@@ -865,7 +895,23 @@ function refusePointersInProps(address, props) {
|
|
|
865
895
|
* returns each binding with its values replaced by their real values.
|
|
866
896
|
*/
|
|
867
897
|
function resolveValues(input) {
|
|
868
|
-
const { environment
|
|
898
|
+
const { environment } = input;
|
|
899
|
+
const rootFields = /* @__PURE__ */ new Map();
|
|
900
|
+
const keysRead = /* @__PURE__ */ new Map();
|
|
901
|
+
/** The text the app configuration holds for `key`, recorded; `undefined` when it holds none or `''`. */
|
|
902
|
+
const configurationText = (key, label, site) => {
|
|
903
|
+
let raw;
|
|
904
|
+
if (input.appConfigurationRead !== void 0) raw = input.appConfigurationRead.configurationKeyText[key];
|
|
905
|
+
else if (input.configuration !== void 0) raw = input.configuration[key];
|
|
906
|
+
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.`);
|
|
907
|
+
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.`);
|
|
908
|
+
const text = raw === void 0 || raw === "" ? void 0 : raw;
|
|
909
|
+
keysRead.set(key, {
|
|
910
|
+
label,
|
|
911
|
+
text
|
|
912
|
+
});
|
|
913
|
+
return text;
|
|
914
|
+
};
|
|
869
915
|
const secretUses = /* @__PURE__ */ new Map();
|
|
870
916
|
const recordSecret = (source, site) => {
|
|
871
917
|
const canonical = canonicalSecret(source);
|
|
@@ -927,20 +973,14 @@ function resolveValues(input) {
|
|
|
927
973
|
break;
|
|
928
974
|
case "source":
|
|
929
975
|
if (isSecretSource(origin.source)) recordSecret(origin.source, site);
|
|
930
|
-
if (origin.
|
|
931
|
-
else
|
|
932
|
-
else {
|
|
933
|
-
const raw = configPool[origin.poolKey];
|
|
934
|
-
if (raw === void 0 || raw === "") result = void 0;
|
|
935
|
-
else if (typeof raw === "string") result = raw;
|
|
936
|
-
else throw new LoadError(`${describeSite(site)} depends on ${origin.label}, which reads "${origin.poolKey}" from the values the \`config\` adapters return, but they return ${describeKind(raw)} for it, not text. ${origin.label} reads text; to pass other data, declare it in the root module's input.`);
|
|
937
|
-
}
|
|
976
|
+
if (origin.sourceKind === "secret" || origin.configurationKey === void 0) result = origin.source;
|
|
977
|
+
else result = configurationText(origin.configurationKey, origin.label, site);
|
|
938
978
|
break;
|
|
939
979
|
case "computed": {
|
|
940
980
|
const args = origin.dependencies.map((dependency) => {
|
|
941
981
|
const real = resolveOne(dependency, site);
|
|
942
982
|
const source = originOf(dependency);
|
|
943
|
-
if (real === void 0 && source.kind === "source") throw new LoadError(`${fnLabelFor(site)} lists ${source.label}, but "${source.
|
|
983
|
+
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.`);
|
|
944
984
|
refusePointerDependency(fnLabelFor(site), dependency, real);
|
|
945
985
|
return real;
|
|
946
986
|
});
|
|
@@ -958,10 +998,20 @@ function resolveValues(input) {
|
|
|
958
998
|
const entry = moduleInputByAddress.get(origin.module);
|
|
959
999
|
if (entry === void 0) throw new LoadError(`${describeSite(site)} depends on ${inputFieldLabel(origin)} of module "${origin.module}", which this Load does not provision. An input field can be passed on only inside the body of the module that received it.`);
|
|
960
1000
|
if (origin.path.length === 0) {
|
|
961
|
-
const everyVariable = entry.
|
|
1001
|
+
const everyVariable = entry.isRoot ? " The root's input is every value the `config` adapters return, which by default is every variable of the process environment, secrets included." : "";
|
|
962
1002
|
throw new LoadError(`${describeSite(site)} depends on the whole input of module "${origin.module}". A module body's input is a dictionary of values, not a value, so it cannot be passed on whole.${everyVariable} Pass its fields on by name, such as input.from.`);
|
|
963
1003
|
}
|
|
964
|
-
|
|
1004
|
+
if (entry.checked !== void 0) {
|
|
1005
|
+
const field = entry.checked.find((candidate) => candidate.path.join("\0") === origin.path.join("\0"));
|
|
1006
|
+
if (field === void 0) throw new LoadError(`${inputFieldLabel(origin)} of root module "${origin.module}" is not in the app configuration file. The first process's root body did not pass it on, so the deploy's two processes built different graphs. ${SAME_GRAPH_ADVICE}`);
|
|
1007
|
+
result = field.value;
|
|
1008
|
+
} else {
|
|
1009
|
+
result = readPath(validatedInputOf(entry), origin);
|
|
1010
|
+
if (entry.isRoot) rootFields.set(origin.path.join("\0"), result === void 0 ? { path: origin.path } : {
|
|
1011
|
+
path: origin.path,
|
|
1012
|
+
value: result
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
965
1015
|
break;
|
|
966
1016
|
}
|
|
967
1017
|
}
|
|
@@ -970,6 +1020,7 @@ function resolveValues(input) {
|
|
|
970
1020
|
return result;
|
|
971
1021
|
};
|
|
972
1022
|
const validatedInputOf = (entry) => {
|
|
1023
|
+
if (entry.checked !== void 0) return void 0;
|
|
973
1024
|
if (validatedInputs.has(entry.moduleAddress)) return validatedInputs.get(entry.moduleAddress);
|
|
974
1025
|
if (validating.has(entry.moduleAddress)) throw new LoadError(`The input binding of module "${entry.moduleAddress}" depends on that module's own input. Remove the cycle.`);
|
|
975
1026
|
validating.add(entry.moduleAddress);
|
|
@@ -986,16 +1037,70 @@ function resolveValues(input) {
|
|
|
986
1037
|
validatedInputs.set(entry.moduleAddress, validated);
|
|
987
1038
|
return validated;
|
|
988
1039
|
};
|
|
1040
|
+
const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isRoot)?.moduleAddress ?? "";
|
|
1041
|
+
const appConfigurationReadOf = (inputBindings, params, secretSources) => {
|
|
1042
|
+
if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
|
|
1043
|
+
const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
|
|
1044
|
+
binding,
|
|
1045
|
+
site: {
|
|
1046
|
+
address: serviceAddress,
|
|
1047
|
+
kind: "serviceInput",
|
|
1048
|
+
path: ""
|
|
1049
|
+
}
|
|
1050
|
+
})), ...params.map(({ serviceAddress, slot, binding }) => ({
|
|
1051
|
+
binding,
|
|
1052
|
+
site: {
|
|
1053
|
+
address: serviceAddress,
|
|
1054
|
+
kind: "param",
|
|
1055
|
+
path: slot
|
|
1056
|
+
}
|
|
1057
|
+
}))];
|
|
1058
|
+
for (const { binding, site } of kept) for (const pointer of pointersIn(binding)) {
|
|
1059
|
+
if (!isParamSource(pointer)) continue;
|
|
1060
|
+
const origin = sourceOriginOf(pointer);
|
|
1061
|
+
if (origin?.sourceKind === "param" && origin.configurationKey !== void 0) configurationText(origin.configurationKey, origin.label, site);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
for (const use of secretSources) {
|
|
1065
|
+
const origin = sourceOriginOf(use.source);
|
|
1066
|
+
if (origin?.sourceKind !== "secret") continue;
|
|
1067
|
+
const key = origin.secretsKey;
|
|
1068
|
+
const read = key === void 0 ? void 0 : keysRead.get(key);
|
|
1069
|
+
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.`);
|
|
1070
|
+
const field = [...rootFields.values()].find((candidate) => candidate.path[0] === key);
|
|
1071
|
+
if (key !== void 0 && field !== void 0) throw new LoadError(`${inputFieldLabel({
|
|
1072
|
+
kind: "input",
|
|
1073
|
+
module: rootModuleAddress(),
|
|
1074
|
+
path: field.path
|
|
1075
|
+
})} 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: Composer hands the deploy's second process every root input field the root's body passes on, in a file, and never writes a secret to a file. Read the secret with ${origin.label} only, or give the plain value a different name.`);
|
|
1076
|
+
}
|
|
1077
|
+
for (const field of rootFields.values()) {
|
|
1078
|
+
const kind = "value" in field ? jsonInexactKind(field.value) : void 0;
|
|
1079
|
+
if (kind !== void 0) throw new LoadError(`${inputFieldLabel({
|
|
1080
|
+
kind: "input",
|
|
1081
|
+
module: rootModuleAddress(),
|
|
1082
|
+
path: field.path
|
|
1083
|
+
})} 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.`);
|
|
1084
|
+
}
|
|
1085
|
+
const configurationKeyText = {};
|
|
1086
|
+
for (const [key, { text }] of keysRead) if (text !== void 0) configurationKeyText[key] = text;
|
|
1087
|
+
return {
|
|
1088
|
+
rootInput: [...rootFields.values()],
|
|
1089
|
+
configurationKeyText
|
|
1090
|
+
};
|
|
1091
|
+
};
|
|
989
1092
|
for (const entry of input.moduleInputs) validatedInputOf(entry);
|
|
990
1093
|
for (const { value, site } of found) resolveOne(value, site);
|
|
991
1094
|
const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
|
|
992
1095
|
if (found.length === 0) {
|
|
993
1096
|
for (const [address, props] of authoredProps) refusePointersInProps(address, props);
|
|
1097
|
+
const secretSources = secretSourcesReceivedBy(input.inputBindings, input.params);
|
|
994
1098
|
return {
|
|
995
1099
|
inputBindings: input.inputBindings,
|
|
996
1100
|
params: input.params,
|
|
997
1101
|
resourceProps: authoredProps,
|
|
998
|
-
secretSources
|
|
1102
|
+
secretSources,
|
|
1103
|
+
appConfigurationRead: appConfigurationReadOf(input.inputBindings, input.params, secretSources)
|
|
999
1104
|
};
|
|
1000
1105
|
}
|
|
1001
1106
|
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
@@ -1021,11 +1126,13 @@ function resolveValues(input) {
|
|
|
1021
1126
|
binding
|
|
1022
1127
|
}];
|
|
1023
1128
|
});
|
|
1129
|
+
const secretSources = secretSourcesReceivedBy(inputBindings, params);
|
|
1024
1130
|
return {
|
|
1025
1131
|
resourceProps,
|
|
1026
1132
|
inputBindings,
|
|
1027
1133
|
params,
|
|
1028
|
-
secretSources
|
|
1134
|
+
secretSources,
|
|
1135
|
+
appConfigurationRead: appConfigurationReadOf(inputBindings, params, secretSources)
|
|
1029
1136
|
};
|
|
1030
1137
|
}
|
|
1031
1138
|
/**
|
|
@@ -1306,7 +1413,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1306
1413
|
moduleAddress: fullAddress,
|
|
1307
1414
|
schema: childInputSchema,
|
|
1308
1415
|
binding: provisionInput,
|
|
1309
|
-
|
|
1416
|
+
isRoot: false
|
|
1310
1417
|
});
|
|
1311
1418
|
edges.push(...wiringEdges(localWiring, fullAddress));
|
|
1312
1419
|
recordAuthoredWiring(fullAddress, localWiring);
|
|
@@ -1370,16 +1477,22 @@ function loadModule(root, opts) {
|
|
|
1370
1477
|
const names = rootDepKeys.map((k) => `"${k}"`).join(", ");
|
|
1371
1478
|
throw new LoadError(`Module "${root.name}" declares ${rootDepKeys.length > 1 ? "dependencies" : "dependency"} ${names} but is being deployed as the root — a root has no enclosing scope to wire them; compose "${root.name}" from another module that provisions and wires it instead.`);
|
|
1372
1479
|
}
|
|
1480
|
+
if (opts?.configuration !== void 0 && opts.appConfigurationRead !== void 0) throw new LoadError("Load takes configuration, in the first process, or appConfigurationRead, in the second, not both.");
|
|
1373
1481
|
const moduleInputs = [];
|
|
1374
|
-
if (root.inputSchema !== void 0) {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1482
|
+
if (root.inputSchema !== void 0) if (opts?.appConfigurationRead !== void 0) moduleInputs.push({
|
|
1483
|
+
moduleAddress: rootId,
|
|
1484
|
+
schema: root.inputSchema,
|
|
1485
|
+
binding: void 0,
|
|
1486
|
+
isRoot: true,
|
|
1487
|
+
checked: opts.appConfigurationRead.rootInput
|
|
1488
|
+
});
|
|
1489
|
+
else if (opts?.configuration !== void 0) moduleInputs.push({
|
|
1490
|
+
moduleAddress: rootId,
|
|
1491
|
+
schema: root.inputSchema,
|
|
1492
|
+
binding: opts.configuration,
|
|
1493
|
+
isRoot: true
|
|
1494
|
+
});
|
|
1495
|
+
else throw new LoadError(`Module "${root.name}" declares input and is being deployed as the root, but Load was given no app configuration to fill it from. Pass { configuration } to Load; prisma deploy and prisma dev pass the values the \`config\` adapters return.`);
|
|
1383
1496
|
const nodes = [];
|
|
1384
1497
|
const edges = [];
|
|
1385
1498
|
const pending = [];
|
|
@@ -1400,7 +1513,8 @@ function loadModule(root, opts) {
|
|
|
1400
1513
|
for (const [address, node] of byId) if (node.kind === "resource") resources.set(address, node);
|
|
1401
1514
|
const resolved = resolveValues({
|
|
1402
1515
|
environment: opts?.environment,
|
|
1403
|
-
|
|
1516
|
+
configuration: opts?.configuration,
|
|
1517
|
+
appConfigurationRead: opts?.appConfigurationRead,
|
|
1404
1518
|
inputBindings,
|
|
1405
1519
|
params: paramBindings,
|
|
1406
1520
|
moduleInputs,
|
|
@@ -1427,7 +1541,8 @@ function loadModule(root, opts) {
|
|
|
1427
1541
|
authoredEdges,
|
|
1428
1542
|
inputBindings: resolved.inputBindings,
|
|
1429
1543
|
params: resolved.params,
|
|
1430
|
-
secretSources: resolved.secretSources
|
|
1544
|
+
secretSources: resolved.secretSources,
|
|
1545
|
+
appConfigurationRead: resolved.appConfigurationRead
|
|
1431
1546
|
};
|
|
1432
1547
|
}
|
|
1433
1548
|
/**
|
|
@@ -1499,7 +1614,21 @@ function Load(root, opts) {
|
|
|
1499
1614
|
if (root.kind === "service") return loadService(root, opts?.id ?? "root");
|
|
1500
1615
|
throw new LoadError("Load expects a service or module root (received another node kind).");
|
|
1501
1616
|
}
|
|
1617
|
+
/** The app secrets key of every secret source the graph names, once each, in the order Load met them. A source built without a `secretsKey` is left out. */
|
|
1618
|
+
function secretsKeys(graph) {
|
|
1619
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1620
|
+
for (const { source } of graph.secretSources) {
|
|
1621
|
+
const origin = sourceOriginOf(source);
|
|
1622
|
+
const key = origin?.sourceKind === "secret" ? origin.secretsKey : void 0;
|
|
1623
|
+
if (key !== void 0) keys.add(key);
|
|
1624
|
+
}
|
|
1625
|
+
return [...keys];
|
|
1626
|
+
}
|
|
1627
|
+
/** The address of every node in the graph, sorted. Two Loads of the same graph give the same list. */
|
|
1628
|
+
function nodeAddresses(graph) {
|
|
1629
|
+
return graph.nodes.map(({ id }) => id).sort();
|
|
1630
|
+
}
|
|
1502
1631
|
//#endregion
|
|
1503
|
-
export {
|
|
1632
|
+
export { slotsOf as S, resolve as _, assertAppName as a, secretsKeys as b, isNode as c, isSecretSource as d, isValue as f, provisionNeed as g, paramSource as h, ResourceNodeBase as i, isParamSource as l, nodeAddresses as m, LoadError as n, dependency as o, module as p, RESOURCE_OUT_PORT as r, freezeNode as s, Load as t, isProvisionNeed as u, resource as v, service as x, secretSource as y };
|
|
1504
1633
|
|
|
1505
|
-
//# sourceMappingURL=graph-
|
|
1634
|
+
//# sourceMappingURL=graph-Bqr7PSGl-BM-M-TlO.mjs.map
|