@prisma/composer 0.3.0 → 0.4.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-Dw3r7sUa-D3dr8rg2.d.mts → app-config-bsTo57A8-BfG21wAI.d.mts} +4 -4
- package/dist/{app-config-Dw3r7sUa-D3dr8rg2.d.mts.map → app-config-bsTo57A8-BfG21wAI.d.mts.map} +1 -1
- package/dist/arktype.d.mts +16 -0
- package/dist/arktype.d.mts.map +1 -0
- package/dist/arktype.mjs +22 -0
- package/dist/arktype.mjs.map +1 -0
- package/dist/bin.mjs +56 -32
- package/dist/bin.mjs.map +1 -1
- package/dist/{casts-Ci5rYYaR.mjs → casts-DpaahrlC-C5XMnP9S.mjs} +2 -2
- package/dist/casts-DpaahrlC-C5XMnP9S.mjs.map +1 -0
- package/dist/casts.mjs +1 -1
- package/dist/config-DUzvB5cQ.d.mts +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/{deploy-H3PKi0ZR-Chgm12Bn.mjs → deploy-C4DxNkJ9-D73lmBqy.mjs} +3 -3
- package/dist/{deploy-H3PKi0ZR-Chgm12Bn.mjs.map → deploy-C4DxNkJ9-D73lmBqy.mjs.map} +1 -1
- package/dist/deploy-DUzvB5cQ.d.mts +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/deploy.mjs +1 -1
- package/dist/{dist-BkSJOwTm.mjs → dist-BdvFDCLV.mjs} +12 -76
- package/dist/dist-BdvFDCLV.mjs.map +1 -0
- package/dist/{graph-DUSgjmzA-DhtkTqoz.d.mts → graph-DDpXh7S8-b-93BcHn.d.mts} +3 -3
- package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +1 -0
- package/dist/{graph-CP16cJyH-D5IW87Y-.mjs → graph-DgbALPDo-BEHF94BN.mjs} +60 -41
- package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +1 -0
- package/dist/{graph-types-BcbVhojU-C3fhxjPK.d.mts → graph-types-C3FOaaXm-C6_rGzfn.d.mts} +87 -87
- package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +1 -0
- package/dist/index-BQVrMGfe.d.mts +22 -0
- package/dist/index-BQVrMGfe.d.mts.map +1 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +4 -3
- package/dist/local-target.d.mts +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/local-target.mjs.map +1 -1
- package/dist/{nextjs-DLyeRR7M-DwnBjryZ.d.mts → nextjs-DLyeRR7M-D47aMmfr.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-DwnBjryZ.d.mts.map → nextjs-DLyeRR7M-D47aMmfr.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/report.d.mts +2 -2
- package/dist/report.mjs +4 -0
- package/dist/report.mjs.map +1 -1
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +25 -0
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +1 -0
- package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs +55 -0
- package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +1 -0
- package/dist/service-rpc.d.mts +15 -5
- package/dist/service-rpc.d.mts.map +1 -1
- package/dist/service-rpc.mjs +6 -4
- package/dist/service-rpc.mjs.map +1 -1
- package/dist/testing.d.mts +17 -11
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +12 -20
- package/dist/testing.mjs.map +1 -1
- package/package.json +12 -11
- package/src/exports/arktype.ts +1 -0
- package/dist/casts-Ci5rYYaR.mjs.map +0 -1
- package/dist/config-121C4hAb.d.mts +0 -1
- package/dist/deploy-121C4hAb.d.mts +0 -1
- package/dist/dist-BkSJOwTm.mjs.map +0 -1
- package/dist/graph-CP16cJyH-D5IW87Y-.mjs.map +0 -1
- package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts.map +0 -1
- package/dist/graph-types-BcbVhojU-C3fhxjPK.d.mts.map +0 -1
- package/dist/index-BFBNz7Aw.d.mts +0 -32
- package/dist/index-BFBNz7Aw.d.mts.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./graph-
|
|
1
|
+
import { F as ResourceNode, M as ProvisionNeed, U as ServiceNode, d as Graph, n as Config, t as BuildAdapter, w as NodeId, x as ModuleNode } from "./graph-types-C3FOaaXm-C6_rGzfn.mjs";
|
|
2
|
+
import "./graph-DDpXh7S8-b-93BcHn.mjs";
|
|
3
3
|
import * as Alchemy from "alchemy";
|
|
4
4
|
import { Input, StackServices } from "alchemy";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
import { State } from "alchemy/State/State";
|
|
8
|
-
//#region ../../0-framework/1-core/core/dist/app-config-
|
|
8
|
+
//#region ../../0-framework/1-core/core/dist/app-config-bsTo57A8.d.mts
|
|
9
9
|
//#region src/container-transport.d.ts
|
|
10
10
|
/**
|
|
11
11
|
* Carries resolved containers from the CLI process into the alchemy process
|
|
@@ -492,4 +492,4 @@ interface PrismaAppConfig {
|
|
|
492
492
|
declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
|
|
493
493
|
//#endregion
|
|
494
494
|
export { ProvisionerDescriptor as A, joinDeployment as B, Lowering as C, PreflightInput as D, PackageInput as E, containerEnv as F, lowering as H, containerEnvVarName as I, defineConfig as L, StateDescriptor as M, TeardownInput as N, PrismaAppConfig as O, buildConfig as P, deserializeContainers as R, LoweredResult as S, Outputs as T, mergedProviders as U, lower as V, resolveStateLayer as W, LocalTargetProvidersInput as _, Bundle as a, LowerError as b, DEV_DIR as c, DeploymentResult as d, ExtensionDescriptor as f, LocalTargetEmulatorsInput as g, LocalTargetDescriptor as h, AssembleInput as i, ServiceLowering as j, ProvisionEdge as k, DeployedEntity as l, LocalTargetAttachment as m, ApplicationDescriptor as n, ContainerDescriptor as o, LocalTargetAttachInput as p, Artifact as r, ContainerInstance as s, AlchemyStateLayer as t, DeployedNode as u, LocateContainerInput as v, NodeDescriptor as w, LowerOptions as x, LowerContext as y, isBuildOnlyExtension as z };
|
|
495
|
-
//# sourceMappingURL=app-config-
|
|
495
|
+
//# sourceMappingURL=app-config-bsTo57A8-BfG21wAI.d.mts.map
|
package/dist/{app-config-Dw3r7sUa-D3dr8rg2.d.mts.map → app-config-bsTo57A8-BfG21wAI.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config-
|
|
1
|
+
{"version":3,"file":"app-config-bsTo57A8-BfG21wAI.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-bsTo57A8.d.mts"],"mappings":"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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { n as SecretString } from "./secret-CHOw4LBU-C8yXoC9N.mjs";
|
|
2
|
+
//#region ../../0-framework/0-foundation/foundation/dist/arktype.d.mts
|
|
3
|
+
//#region src/arktype.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A schema leaf that accepts only a redacting `SecretString` box, so
|
|
6
|
+
* `input().<field>.expose()` type-checks and binding a plain literal there
|
|
7
|
+
* fails the deploy (ADR-0042).
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* input: type({ signingKey: secretString() })
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const secretString: () => import("arktype/internal/variants/object.ts").ObjectType<SecretString, {}>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { secretString };
|
|
16
|
+
//# sourceMappingURL=arktype.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arktype.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.d.mts"],"mappings":";;;;;;;;;;;;cAWc,kEAAkE,WAAW"}
|
package/dist/arktype.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as isSecretString } from "./secret-DoWGmN7m-DO5Brq1Y.mjs";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
//#region ../../0-framework/0-foundation/foundation/dist/arktype.mjs
|
|
4
|
+
/**
|
|
5
|
+
* ArkType spellings of the framework's schema leaves. Opt-in: the framework
|
|
6
|
+
* accepts any Standard Schema library (ADR-0042) and nothing outside this
|
|
7
|
+
* module imports arktype, so an app that uses Zod never loads it.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A schema leaf that accepts only a redacting `SecretString` box, so
|
|
11
|
+
* `input().<field>.expose()` type-checks and binding a plain literal there
|
|
12
|
+
* fails the deploy (ADR-0042).
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* input: type({ signingKey: secretString() })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const secretString = () => type("unknown").narrow((value, ctx) => isSecretString(value) || ctx.mustBe("a SecretString box — bind this field to a secret"));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { secretString };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=arktype.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arktype.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.mjs"],"sourcesContent":["import { n as isSecretString } from \"./secret-DoWGmN7m.mjs\";\nimport { type } from \"arktype\";\n//#region src/arktype.ts\n/**\n* ArkType spellings of the framework's schema leaves. Opt-in: the framework\n* accepts any Standard Schema library (ADR-0042) and nothing outside this\n* module imports arktype, so an app that uses Zod never loads it.\n*/\n/**\n* A schema leaf that accepts only a redacting `SecretString` box, so\n* `input().<field>.expose()` type-checks and binding a plain literal there\n* fails the deploy (ADR-0042).\n*\n* ```ts\n* input: type({ signingKey: secretString() })\n* ```\n*/\nconst secretString = () => type(\"unknown\").narrow((value, ctx) => isSecretString(value) || ctx.mustBe(\"a SecretString box — bind this field to a secret\"));\n//#endregion\nexport { secretString };\n\n//# sourceMappingURL=arktype.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,KAAK,SAAS,CAAC,CAAC,QAAQ,OAAO,QAAQ,eAAe,KAAK,KAAK,IAAI,OAAO,kDAAkD,CAAC"}
|
package/dist/bin.mjs
CHANGED
|
@@ -58,7 +58,7 @@ function isBuildOnlyExtension(extension) {
|
|
|
58
58
|
return Object.values(extension.nodes).every((node) => node.kind === "build") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region ../../0-framework/0-foundation/foundation/dist/casts.mjs
|
|
61
|
+
//#region ../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs
|
|
62
62
|
/**
|
|
63
63
|
* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**
|
|
64
64
|
*
|
|
@@ -98,7 +98,7 @@ function blindCast(input) {
|
|
|
98
98
|
return input;
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
|
-
//#region ../../0-framework/1-core/core/dist/graph-
|
|
101
|
+
//#region ../../0-framework/1-core/core/dist/graph-DgbALPDo.mjs
|
|
102
102
|
/** Thrown by Load when the graph is malformed. */
|
|
103
103
|
var LoadError = class extends Error {
|
|
104
104
|
constructor(message) {
|
|
@@ -215,11 +215,7 @@ function serviceInputs(service, serviceId) {
|
|
|
215
215
|
}
|
|
216
216
|
function loadService(root, rootId) {
|
|
217
217
|
for (const [input, value] of Object.entries(root.inputs)) if (isNode(value) && value.kind === "dependency") throw new LoadError(`Service "${rootId}" has an unwired dependency input "${input}" — this service is composed by a module; deploy the module instead of loading "${rootId}" directly.`);
|
|
218
|
-
|
|
219
|
-
if (secretSlots.length > 0) {
|
|
220
|
-
const names = secretSlots.map((k) => `"${k}"`).join(", ");
|
|
221
|
-
throw new LoadError(`Service "${rootId}" declares secret slot${secretSlots.length > 1 ? "s" : ""} ${names} but is being loaded directly — a lone service has no enclosing scope to bind them. Compose it inside a module that binds each with envSecret('NAME').`);
|
|
222
|
-
}
|
|
218
|
+
if (root.inputSchema !== void 0) throw new LoadError(`Service "${rootId}" declares an input schema but is being loaded directly — a lone service has no enclosing scope to bind its input. Compose it inside a module whose provision() call binds \`input: { … }\` (ADR-0042).`);
|
|
223
219
|
const rootGraphNode = {
|
|
224
220
|
id: rootId,
|
|
225
221
|
node: root
|
|
@@ -229,7 +225,7 @@ function loadService(root, rootId) {
|
|
|
229
225
|
root: rootGraphNode,
|
|
230
226
|
nodes: [...topoSort(nodes, edges), rootGraphNode],
|
|
231
227
|
edges,
|
|
232
|
-
|
|
228
|
+
inputBindings: [],
|
|
233
229
|
params: []
|
|
234
230
|
};
|
|
235
231
|
}
|
|
@@ -312,6 +308,25 @@ function validateWiring(pending, byId) {
|
|
|
312
308
|
if (value.kind === "dependency") throw new LoadError(`Dependency input "${input}" of provisioned ${targetKind} "${targetId}" is not wired to a producer (module "${enclosingModuleName}").`);
|
|
313
309
|
}
|
|
314
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Flattens a value into itself plus every nested object/array member value —
|
|
313
|
+
* identity fodder for the ctx.secrets/ctx.params usage marking, which must
|
|
314
|
+
* see a forwarded source wherever it sits inside an input binding (ADR-0042).
|
|
315
|
+
* A secret/param source is an opaque leaf: it is pushed (a forwarded ref IS
|
|
316
|
+
* such a source, so identity-matching still needs it) but never descended
|
|
317
|
+
* into, so a ref buried in an unrelated source's payload is not falsely seen
|
|
318
|
+
* as used. `seen` guards object cycles so a self-referential binding cannot
|
|
319
|
+
* recurse forever.
|
|
320
|
+
*/
|
|
321
|
+
function deepValues(value, out, seen = /* @__PURE__ */ new WeakSet()) {
|
|
322
|
+
out.push(value);
|
|
323
|
+
if (typeof value !== "object" || value === null) return;
|
|
324
|
+
if (isSecretSource(value) || isParamSource(value)) return;
|
|
325
|
+
if (seen.has(value)) return;
|
|
326
|
+
seen.add(value);
|
|
327
|
+
const members = Array.isArray(value) ? value : Object.values(value);
|
|
328
|
+
for (const member of members) deepValues(member, out, seen);
|
|
329
|
+
}
|
|
315
330
|
/** The (unvalidated) edges a `wiring` object implies — one dependency edge per entry; `validateWiring` does the real checking. */
|
|
316
331
|
function wiringEdges(wiring, targetId) {
|
|
317
332
|
return Object.entries(wiring).map(([input, ref]) => ({
|
|
@@ -322,11 +337,12 @@ function wiringEdges(wiring, targetId) {
|
|
|
322
337
|
}));
|
|
323
338
|
}
|
|
324
339
|
/**
|
|
325
|
-
* Checks the secrets wired into one provisioned child: every declared
|
|
326
|
-
* bound to a real secret source (an `envSecret` or a
|
|
327
|
-
* ref), and no wired key names a slot the
|
|
328
|
-
* analog of `validateWiring`'s per-input checks,
|
|
329
|
-
* carries its own name, so no whole-graph pass
|
|
340
|
+
* Checks the secrets wired into one provisioned child MODULE: every declared
|
|
341
|
+
* forwarding slot is bound to a real secret source (an `envSecret` or a
|
|
342
|
+
* forwarded ctx.secrets ref), and no wired key names a slot the module
|
|
343
|
+
* doesn't declare — the secret analog of `validateWiring`'s per-input checks,
|
|
344
|
+
* but resolved inline (a source carries its own name, so no whole-graph pass
|
|
345
|
+
* is needed).
|
|
330
346
|
*/
|
|
331
347
|
function validateSecretBinding(child, id, secretWiring, enclosingModuleName) {
|
|
332
348
|
const { kind } = child;
|
|
@@ -374,7 +390,7 @@ function validateParamNeedBinding(child, id, paramWiring, enclosingModuleName) {
|
|
|
374
390
|
* forward in a producer provisioned by an ancestor scope, and it is the
|
|
375
391
|
* shared `byId` (keyed by full address) that lets that resolve.
|
|
376
392
|
*/
|
|
377
|
-
function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes, edges, pending,
|
|
393
|
+
function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes, edges, pending, inputBindings, paramBindings, byId) {
|
|
378
394
|
const localIds = /* @__PURE__ */ new Set();
|
|
379
395
|
const used = /* @__PURE__ */ new Set();
|
|
380
396
|
const usedSecrets = /* @__PURE__ */ new Set();
|
|
@@ -388,7 +404,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
388
404
|
} : wired;
|
|
389
405
|
}
|
|
390
406
|
const markUsed = (values) => {
|
|
391
|
-
for (const value of
|
|
407
|
+
for (const value of values) for (const key of Object.keys(ctxInputs)) if (value === ctxInputs[key]) used.add(key);
|
|
392
408
|
};
|
|
393
409
|
const ctxSecrets = {};
|
|
394
410
|
for (const key of Object.keys(moduleNode.secretSlots)) {
|
|
@@ -399,7 +415,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
399
415
|
} : bound;
|
|
400
416
|
}
|
|
401
417
|
const markSecretsUsed = (values) => {
|
|
402
|
-
for (const value of
|
|
418
|
+
for (const value of values) for (const key of Object.keys(ctxSecrets)) if (value === ctxSecrets[key]) usedSecrets.add(key);
|
|
403
419
|
};
|
|
404
420
|
const ctxParams = {};
|
|
405
421
|
for (const key of Object.keys(moduleNode.paramSlots)) {
|
|
@@ -410,12 +426,13 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
410
426
|
} : bound;
|
|
411
427
|
}
|
|
412
428
|
const markParamsUsed = (values) => {
|
|
413
|
-
for (const value of
|
|
429
|
+
for (const value of values) for (const key of Object.keys(ctxParams)) if (value === ctxParams[key]) usedParams.add(key);
|
|
414
430
|
};
|
|
415
431
|
const provision = (child, opts) => {
|
|
416
432
|
const id = opts?.id ?? child.name;
|
|
417
433
|
const provisionWiring = opts?.deps;
|
|
418
434
|
const provisionSecrets = opts?.secrets;
|
|
435
|
+
const provisionInput = opts?.input;
|
|
419
436
|
const provisionParams = opts?.params;
|
|
420
437
|
if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
|
|
421
438
|
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.)`);
|
|
@@ -427,6 +444,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
427
444
|
if (child.kind === "resource") {
|
|
428
445
|
if (provisionWiring !== void 0) throw new LoadError(`provision("${id}") received deps for a resource — a resource has no dependency slots to satisfy.`);
|
|
429
446
|
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a resource — a resource has no secret slots to satisfy.`);
|
|
447
|
+
if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a resource — a resource declares no input schema.`);
|
|
430
448
|
if (provisionParams !== void 0) throw new LoadError(`provision("${id}") received params for a resource — a resource has no params to satisfy.`);
|
|
431
449
|
if (child.type.length === 0) throw new LoadError(`provision("${id}") received a resource with an empty node type.`);
|
|
432
450
|
byId.set(fullAddress, child);
|
|
@@ -437,19 +455,23 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
437
455
|
return refForResource(fullAddress, child);
|
|
438
456
|
}
|
|
439
457
|
const localWiring = { ...provisionWiring ?? {} };
|
|
440
|
-
markUsed(localWiring);
|
|
458
|
+
markUsed(Object.values(localWiring));
|
|
441
459
|
const localSecrets = { ...provisionSecrets ?? {} };
|
|
442
|
-
markSecretsUsed(localSecrets);
|
|
443
|
-
validateSecretBinding(child, id, localSecrets, moduleNode.name);
|
|
460
|
+
markSecretsUsed(Object.values(localSecrets));
|
|
444
461
|
const localParams = { ...provisionParams ?? {} };
|
|
445
|
-
markParamsUsed(localParams);
|
|
462
|
+
markParamsUsed(Object.values(localParams));
|
|
446
463
|
if (child.kind === "service") {
|
|
447
|
-
for (
|
|
448
|
-
|
|
449
|
-
|
|
464
|
+
if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a service — a service takes its secrets as envSecret(...) leaves of its \`input\` binding (ADR-0042), not a secrets map.`);
|
|
465
|
+
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.`);
|
|
466
|
+
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}").`);
|
|
467
|
+
if (provisionInput !== void 0) {
|
|
468
|
+
const leaves = [];
|
|
469
|
+
deepValues(provisionInput, leaves);
|
|
470
|
+
markSecretsUsed(leaves);
|
|
471
|
+
markParamsUsed(leaves);
|
|
472
|
+
inputBindings.push({
|
|
450
473
|
serviceAddress: fullAddress,
|
|
451
|
-
|
|
452
|
-
source: bound
|
|
474
|
+
binding: blindCast(provisionInput)
|
|
453
475
|
});
|
|
454
476
|
}
|
|
455
477
|
validateServiceParamBinding(child, id, localParams, moduleNode.name);
|
|
@@ -474,6 +496,8 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
474
496
|
byId.set(fullAddress, child);
|
|
475
497
|
return refFor(fullAddress, child);
|
|
476
498
|
}
|
|
499
|
+
if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a module — a module has no input schema; bind the input on the service that declares it.`);
|
|
500
|
+
validateSecretBinding(child, id, localSecrets, moduleNode.name);
|
|
477
501
|
validateParamNeedBinding(child, id, localParams, moduleNode.name);
|
|
478
502
|
edges.push(...wiringEdges(localWiring, fullAddress));
|
|
479
503
|
pending.push({
|
|
@@ -483,7 +507,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
483
507
|
targetKind: "module",
|
|
484
508
|
enclosingModuleName: moduleNode.name
|
|
485
509
|
});
|
|
486
|
-
const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending,
|
|
510
|
+
const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, inputBindings, paramBindings, byId);
|
|
487
511
|
nodes.push({
|
|
488
512
|
id: fullAddress,
|
|
489
513
|
node: child
|
|
@@ -501,7 +525,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
|
|
|
501
525
|
provision: blindCast(provision)
|
|
502
526
|
});
|
|
503
527
|
const outputs = blindCast(moduleNode.body(ctx) ?? {});
|
|
504
|
-
markUsed(outputs);
|
|
528
|
+
markUsed(Object.values(outputs));
|
|
505
529
|
for (const key of Object.keys(moduleNode.deps)) if (!used.has(key)) throw new LoadError(`Module "${moduleNode.name}" declares input "${key}" but never forwards it into a provision nor returns it as an output.`);
|
|
506
530
|
for (const key of Object.keys(moduleNode.secretSlots)) if (!usedSecrets.has(key)) throw new LoadError(`Module "${moduleNode.name}" declares secret "${key}" but never forwards it into a provision.`);
|
|
507
531
|
for (const key of Object.keys(moduleNode.paramSlots)) if (!usedParams.has(key)) throw new LoadError(`Module "${moduleNode.name}" declares param "${key}" but never forwards it into a provision.`);
|
|
@@ -532,10 +556,10 @@ function loadModule(root, opts) {
|
|
|
532
556
|
const nodes = [];
|
|
533
557
|
const edges = [];
|
|
534
558
|
const pending = [];
|
|
535
|
-
const
|
|
559
|
+
const inputBindings = [];
|
|
536
560
|
const paramBindings = [];
|
|
537
561
|
const byId = /* @__PURE__ */ new Map();
|
|
538
|
-
flatten(root, void 0, {}, {}, {}, nodes, edges, pending,
|
|
562
|
+
flatten(root, void 0, {}, {}, {}, nodes, edges, pending, inputBindings, paramBindings, byId);
|
|
539
563
|
for (const entry of pending) validateWiring(entry, byId);
|
|
540
564
|
assertDependencyDag(edges);
|
|
541
565
|
const rootGraphNode = {
|
|
@@ -546,7 +570,7 @@ function loadModule(root, opts) {
|
|
|
546
570
|
root: rootGraphNode,
|
|
547
571
|
nodes: [...topoSort(nodes, edges), rootGraphNode],
|
|
548
572
|
edges,
|
|
549
|
-
|
|
573
|
+
inputBindings,
|
|
550
574
|
params: paramBindings
|
|
551
575
|
};
|
|
552
576
|
}
|
|
@@ -594,7 +618,7 @@ function Load(root, opts) {
|
|
|
594
618
|
throw new LoadError("Load expects a service or module root (received another node kind).");
|
|
595
619
|
}
|
|
596
620
|
//#endregion
|
|
597
|
-
//#region ../../0-framework/1-core/core/dist/deploy-
|
|
621
|
+
//#region ../../0-framework/1-core/core/dist/deploy-C4DxNkJ9.mjs
|
|
598
622
|
var LowerError = class extends Error {
|
|
599
623
|
constructor(message) {
|
|
600
624
|
super(message);
|