@prisma/composer 0.36.0-dev.5 → 0.36.0-dev.7
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-BvxeTt2h-CcVmwsq6.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-Dc69sCgo.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-C7E-BpRH.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
- package/dist/{dev-current-BurA9uhA-C7E-BpRH.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-0Iux8Khv.mjs → dist-C7SnNTD3.mjs} +2 -2
- package/dist/{dist-0Iux8Khv.mjs.map → dist-C7SnNTD3.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-Cww6zOSC-CIPx-m4I.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-BP9S193k.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-C6bs4ONa.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
- package/dist/{execute-dev-current-Cd4YEUZk-C6bs4ONa.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
- package/dist/{execute-log-BC5o35wQ-C8QWELlP.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
- package/dist/{execute-log-BC5o35wQ-C8QWELlP.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
- package/dist/{graph-gE31_ToO-BouKBfIS.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +183 -44
- package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
- package/dist/{graph-CN8VuVZN-Ck2y98XZ.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
- package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
- package/dist/{graph-types-R38xjBnN-cDTIX_rZ.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +138 -67
- 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-BHdm4Q39.d.mts → index-DWQ6BSgm.d.mts} +3 -3
- package/dist/{index-BHdm4Q39.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-CuGngjU4.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-CuGngjU4.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-B0ESzFBn.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 +7 -24
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/dist/app-config-BvxeTt2h-CcVmwsq6.d.mts.map +0 -1
- package/dist/config-Cn9vjklJ.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-Cn9vjklJ.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-Cm4lN6w9-Dc69sCgo.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-CIPx-m4I.mjs.map +0 -1
- package/dist/execute-dev-4KYkqSMh-BP9S193k.mjs.map +0 -1
- package/dist/graph-CN8VuVZN-Ck2y98XZ.d.mts.map +0 -1
- package/dist/graph-gE31_ToO-BouKBfIS.mjs.map +0 -1
- package/dist/graph-types-R38xjBnN-cDTIX_rZ.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-B0ESzFBn.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
|
/**
|
|
@@ -79,6 +78,7 @@ function inputFieldLabel(origin) {
|
|
|
79
78
|
return origin.path.length === 0 ? "input" : `input.${origin.path.join(".")}`;
|
|
80
79
|
}
|
|
81
80
|
function misuse(origin, what) {
|
|
81
|
+
if (origin.path.length === 0) return new LoadError(`input of module "${origin.module}" is a dictionary of values, not data, and ${what}. A module body can only pass the fields of its input on, by name: into a provision() binding or, for a plain field, as a resolve() dependency.`);
|
|
82
82
|
const field = inputFieldLabel(origin);
|
|
83
83
|
return new LoadError(`${field} of module "${origin.module}" is a value, not its real value, and ${what}. A module body can only pass an input field on: into a provision() binding or as a resolve() dependency. To compute with it, it must be a plain field, not a wrapped or secret one; list it: resolve([${field}], ([v]) => …).`);
|
|
84
84
|
}
|
|
@@ -94,7 +94,9 @@ function primitiveMisuse(hint) {
|
|
|
94
94
|
* Builds the `input` a module body receives. Every property access returns a
|
|
95
95
|
* value recording its key path, and the same path always returns the same
|
|
96
96
|
* object, so Load's identity-keyed maps see one value per field. Any way of
|
|
97
|
-
* reading the real value throws a LoadError naming the field.
|
|
97
|
+
* reading the real value throws a LoadError naming the field. At run time the
|
|
98
|
+
* whole input still answers the value brand, at path `[]`, so Load can find
|
|
99
|
+
* and refuse it wherever it is passed on.
|
|
98
100
|
*/
|
|
99
101
|
function buildModuleInput(moduleAddress) {
|
|
100
102
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -171,10 +173,13 @@ const SECRET_SOURCE = blindCast(Symbol.for("prisma:secret-source"));
|
|
|
171
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. */
|
|
172
174
|
function secretSource(payload, options) {
|
|
173
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.");
|
|
174
178
|
return blindCast(buildSource(SECRET_SOURCE, payload, {
|
|
175
179
|
kind: "source",
|
|
180
|
+
sourceKind: "secret",
|
|
176
181
|
label,
|
|
177
|
-
|
|
182
|
+
secretsKey
|
|
178
183
|
}, "secret"));
|
|
179
184
|
}
|
|
180
185
|
/** True if `value` is a secret source, such as an `envSecret()` result. */
|
|
@@ -198,15 +203,16 @@ const PARAM_SOURCE = blindCast(Symbol.for("prisma:param-source"));
|
|
|
198
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. */
|
|
199
204
|
function paramSource(payload, options) {
|
|
200
205
|
const label = sourceLabel("paramSource", options?.label, "a param source");
|
|
201
|
-
const
|
|
202
|
-
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.");
|
|
203
208
|
const redacted = options?.redacted === true;
|
|
204
|
-
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.");
|
|
205
210
|
return blindCast(buildSource(PARAM_SOURCE, payload, {
|
|
206
211
|
kind: "source",
|
|
212
|
+
sourceKind: "param",
|
|
207
213
|
label,
|
|
208
|
-
|
|
209
|
-
},
|
|
214
|
+
configurationKey
|
|
215
|
+
}, configurationKey !== void 0 ? void 0 : redacted ? "secret" : "plain"));
|
|
210
216
|
}
|
|
211
217
|
function sourceLabel(factory, label, fallback) {
|
|
212
218
|
if (label === void 0) return fallback;
|
|
@@ -241,7 +247,7 @@ function coercions(origin) {
|
|
|
241
247
|
const sourceMisuses = /* @__PURE__ */ new WeakSet();
|
|
242
248
|
function sourceMisuse(origin, what) {
|
|
243
249
|
const { label } = origin;
|
|
244
|
-
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]) => …).`);
|
|
245
251
|
sourceMisuses.add(error);
|
|
246
252
|
return error;
|
|
247
253
|
}
|
|
@@ -602,7 +608,11 @@ function loadService(root, rootId) {
|
|
|
602
608
|
authoredEdges: [],
|
|
603
609
|
inputBindings: [],
|
|
604
610
|
params: [],
|
|
605
|
-
secretSources: []
|
|
611
|
+
secretSources: [],
|
|
612
|
+
appConfigurationRead: {
|
|
613
|
+
rootInput: [],
|
|
614
|
+
configurationKeyText: {}
|
|
615
|
+
}
|
|
606
616
|
};
|
|
607
617
|
}
|
|
608
618
|
function joinPath(path, key) {
|
|
@@ -655,6 +665,29 @@ function describeNotPlain(value) {
|
|
|
655
665
|
default: return;
|
|
656
666
|
}
|
|
657
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.";
|
|
658
691
|
function isThenable(value) {
|
|
659
692
|
if (isValue(value)) return false;
|
|
660
693
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
@@ -777,8 +810,12 @@ function readPath(data, origin) {
|
|
|
777
810
|
...origin,
|
|
778
811
|
path: origin.path.slice(0, index)
|
|
779
812
|
});
|
|
780
|
-
|
|
781
|
-
if (
|
|
813
|
+
const schemaAdvice = `The module's input schema must output a plain object for its body to read fields.`;
|
|
814
|
+
if (isSecretSource(current) || isParamSource(current)) throw new LoadError(`${missing}: ${parent} stands for a value only the platform has at boot, so it has no fields` + (index === 0 ? `. ${schemaAdvice}` : " and can only be passed on unchanged."));
|
|
815
|
+
if (!isPlainObject(current)) {
|
|
816
|
+
const advice = index === 0 ? schemaAdvice : `To compute with it, it must be a plain field, not a wrapped or secret one; list it: resolve([${parent}], ([v]) => …).`;
|
|
817
|
+
throw new LoadError(`${missing}: ${parent} is ${describeData(current)}, not a plain object, so it has no fields. ${advice}`);
|
|
818
|
+
}
|
|
782
819
|
if (!Object.hasOwn(current, key)) return void 0;
|
|
783
820
|
current = current[key];
|
|
784
821
|
}
|
|
@@ -811,7 +848,7 @@ function validateModuleInput(entry, resolved, environment) {
|
|
|
811
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.`);
|
|
812
849
|
if (result.issues !== void 0) {
|
|
813
850
|
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
814
|
-
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}"`}.`);
|
|
815
852
|
throw new LoadError(`The input binding of module "${address}" does not match the module's input schema: ${messages}`);
|
|
816
853
|
}
|
|
817
854
|
const bound = sourcesByPath(resolved);
|
|
@@ -858,7 +895,23 @@ function refusePointersInProps(address, props) {
|
|
|
858
895
|
* returns each binding with its values replaced by their real values.
|
|
859
896
|
*/
|
|
860
897
|
function resolveValues(input) {
|
|
861
|
-
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
|
+
};
|
|
862
915
|
const secretUses = /* @__PURE__ */ new Map();
|
|
863
916
|
const recordSecret = (source, site) => {
|
|
864
917
|
const canonical = canonicalSecret(source);
|
|
@@ -920,20 +973,14 @@ function resolveValues(input) {
|
|
|
920
973
|
break;
|
|
921
974
|
case "source":
|
|
922
975
|
if (isSecretSource(origin.source)) recordSecret(origin.source, site);
|
|
923
|
-
if (origin.
|
|
924
|
-
else
|
|
925
|
-
else {
|
|
926
|
-
const raw = configPool[origin.poolKey];
|
|
927
|
-
if (raw === void 0 || raw === "") result = void 0;
|
|
928
|
-
else if (typeof raw === "string") result = raw;
|
|
929
|
-
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.`);
|
|
930
|
-
}
|
|
976
|
+
if (origin.sourceKind === "secret" || origin.configurationKey === void 0) result = origin.source;
|
|
977
|
+
else result = configurationText(origin.configurationKey, origin.label, site);
|
|
931
978
|
break;
|
|
932
979
|
case "computed": {
|
|
933
980
|
const args = origin.dependencies.map((dependency) => {
|
|
934
981
|
const real = resolveOne(dependency, site);
|
|
935
982
|
const source = originOf(dependency);
|
|
936
|
-
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.`);
|
|
937
984
|
refusePointerDependency(fnLabelFor(site), dependency, real);
|
|
938
985
|
return real;
|
|
939
986
|
});
|
|
@@ -950,8 +997,21 @@ function resolveValues(input) {
|
|
|
950
997
|
case "input": {
|
|
951
998
|
const entry = moduleInputByAddress.get(origin.module);
|
|
952
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.`);
|
|
953
|
-
if (
|
|
954
|
-
|
|
1000
|
+
if (origin.path.length === 0) {
|
|
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." : "";
|
|
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.`);
|
|
1003
|
+
}
|
|
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
|
+
}
|
|
955
1015
|
break;
|
|
956
1016
|
}
|
|
957
1017
|
}
|
|
@@ -960,6 +1020,7 @@ function resolveValues(input) {
|
|
|
960
1020
|
return result;
|
|
961
1021
|
};
|
|
962
1022
|
const validatedInputOf = (entry) => {
|
|
1023
|
+
if (entry.checked !== void 0) return void 0;
|
|
963
1024
|
if (validatedInputs.has(entry.moduleAddress)) return validatedInputs.get(entry.moduleAddress);
|
|
964
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.`);
|
|
965
1026
|
validating.add(entry.moduleAddress);
|
|
@@ -976,16 +1037,70 @@ function resolveValues(input) {
|
|
|
976
1037
|
validatedInputs.set(entry.moduleAddress, validated);
|
|
977
1038
|
return validated;
|
|
978
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
|
+
};
|
|
979
1092
|
for (const entry of input.moduleInputs) validatedInputOf(entry);
|
|
980
1093
|
for (const { value, site } of found) resolveOne(value, site);
|
|
981
1094
|
const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
|
|
982
1095
|
if (found.length === 0) {
|
|
983
1096
|
for (const [address, props] of authoredProps) refusePointersInProps(address, props);
|
|
1097
|
+
const secretSources = secretSourcesReceivedBy(input.inputBindings, input.params);
|
|
984
1098
|
return {
|
|
985
1099
|
inputBindings: input.inputBindings,
|
|
986
1100
|
params: input.params,
|
|
987
1101
|
resourceProps: authoredProps,
|
|
988
|
-
secretSources
|
|
1102
|
+
secretSources,
|
|
1103
|
+
appConfigurationRead: appConfigurationReadOf(input.inputBindings, input.params, secretSources)
|
|
989
1104
|
};
|
|
990
1105
|
}
|
|
991
1106
|
const inProgress = /* @__PURE__ */ new WeakSet();
|
|
@@ -1011,11 +1126,13 @@ function resolveValues(input) {
|
|
|
1011
1126
|
binding
|
|
1012
1127
|
}];
|
|
1013
1128
|
});
|
|
1129
|
+
const secretSources = secretSourcesReceivedBy(inputBindings, params);
|
|
1014
1130
|
return {
|
|
1015
1131
|
resourceProps,
|
|
1016
1132
|
inputBindings,
|
|
1017
1133
|
params,
|
|
1018
|
-
secretSources
|
|
1134
|
+
secretSources,
|
|
1135
|
+
appConfigurationRead: appConfigurationReadOf(inputBindings, params, secretSources)
|
|
1019
1136
|
};
|
|
1020
1137
|
}
|
|
1021
1138
|
/**
|
|
@@ -1260,7 +1377,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1260
1377
|
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}").`);
|
|
1261
1378
|
if (provisionInput !== void 0) inputBindings.push({
|
|
1262
1379
|
serviceAddress: fullAddress,
|
|
1263
|
-
binding:
|
|
1380
|
+
binding: provisionInput
|
|
1264
1381
|
});
|
|
1265
1382
|
validateServiceParamBinding(child, id, localParams, moduleNode.name);
|
|
1266
1383
|
for (const [slot, binding] of Object.entries(localParams)) paramBindings.push({
|
|
@@ -1296,7 +1413,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1296
1413
|
moduleAddress: fullAddress,
|
|
1297
1414
|
schema: childInputSchema,
|
|
1298
1415
|
binding: provisionInput,
|
|
1299
|
-
|
|
1416
|
+
isRoot: false
|
|
1300
1417
|
});
|
|
1301
1418
|
edges.push(...wiringEdges(localWiring, fullAddress));
|
|
1302
1419
|
recordAuthoredWiring(fullAddress, localWiring);
|
|
@@ -1360,16 +1477,22 @@ function loadModule(root, opts) {
|
|
|
1360
1477
|
const names = rootDepKeys.map((k) => `"${k}"`).join(", ");
|
|
1361
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.`);
|
|
1362
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.");
|
|
1363
1481
|
const moduleInputs = [];
|
|
1364
|
-
if (root.inputSchema !== void 0) {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
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.`);
|
|
1373
1496
|
const nodes = [];
|
|
1374
1497
|
const edges = [];
|
|
1375
1498
|
const pending = [];
|
|
@@ -1390,7 +1513,8 @@ function loadModule(root, opts) {
|
|
|
1390
1513
|
for (const [address, node] of byId) if (node.kind === "resource") resources.set(address, node);
|
|
1391
1514
|
const resolved = resolveValues({
|
|
1392
1515
|
environment: opts?.environment,
|
|
1393
|
-
|
|
1516
|
+
configuration: opts?.configuration,
|
|
1517
|
+
appConfigurationRead: opts?.appConfigurationRead,
|
|
1394
1518
|
inputBindings,
|
|
1395
1519
|
params: paramBindings,
|
|
1396
1520
|
moduleInputs,
|
|
@@ -1417,7 +1541,8 @@ function loadModule(root, opts) {
|
|
|
1417
1541
|
authoredEdges,
|
|
1418
1542
|
inputBindings: resolved.inputBindings,
|
|
1419
1543
|
params: resolved.params,
|
|
1420
|
-
secretSources: resolved.secretSources
|
|
1544
|
+
secretSources: resolved.secretSources,
|
|
1545
|
+
appConfigurationRead: resolved.appConfigurationRead
|
|
1421
1546
|
};
|
|
1422
1547
|
}
|
|
1423
1548
|
/**
|
|
@@ -1489,7 +1614,21 @@ function Load(root, opts) {
|
|
|
1489
1614
|
if (root.kind === "service") return loadService(root, opts?.id ?? "root");
|
|
1490
1615
|
throw new LoadError("Load expects a service or module root (received another node kind).");
|
|
1491
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
|
+
}
|
|
1492
1631
|
//#endregion
|
|
1493
|
-
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 };
|
|
1494
1633
|
|
|
1495
|
-
//# sourceMappingURL=graph-
|
|
1634
|
+
//# sourceMappingURL=graph-Bqr7PSGl-BM-M-TlO.mjs.map
|