@prisma/composer-cli 0.36.0-dev.2 → 0.36.0-dev.3
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/{dev-current-BNoPkDRU-D_UIh9Ne.mjs → dev-current-BNoPkDRU-DGd_7FDS.mjs} +4 -4
- package/dist/{dev-current-BNoPkDRU-D_UIh9Ne.mjs.map → dev-current-BNoPkDRU-DGd_7FDS.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-BIqwt1RF-DiqyXoh9.mjs → execute-deploy-destroy-BIqwt1RF-D3F6yxLV.mjs} +3 -3
- package/dist/{execute-deploy-destroy-BIqwt1RF-DiqyXoh9.mjs.map → execute-deploy-destroy-BIqwt1RF-D3F6yxLV.mjs.map} +1 -1
- package/dist/{execute-dev-DIEyloWn-CBl6TlQ0.mjs → execute-dev-DIEyloWn-CjtRM3-x.mjs} +3 -3
- package/dist/{execute-dev-DIEyloWn-CBl6TlQ0.mjs.map → execute-dev-DIEyloWn-CjtRM3-x.mjs.map} +1 -1
- package/dist/{execute-dev-current-CeKI-tiC-BVg5a-5b.mjs → execute-dev-current-CeKI-tiC-fd62IW2Y.mjs} +3 -3
- package/dist/{execute-dev-current-CeKI-tiC-BVg5a-5b.mjs.map → execute-dev-current-CeKI-tiC-fd62IW2Y.mjs.map} +1 -1
- package/dist/{family-Dy3ZQOxG-BGwHvqM_.d.mts → family-Dy3ZQOxG-CcELNRXg.d.mts} +82 -29
- package/dist/family-Dy3ZQOxG-CcELNRXg.d.mts.map +1 -0
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +2 -2
- package/dist/{list-deployed-s0gjqC-r.mjs → list-deployed-2Xs64YAh.mjs} +3 -3
- package/dist/{list-deployed-s0gjqC-r.mjs.map → list-deployed-2Xs64YAh.mjs.map} +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/{validate-environment-CEhUSEg2-ExABehBM.mjs → validate-environment-CEhUSEg2-BohWFcgr.mjs} +272 -19
- package/dist/validate-environment-CEhUSEg2-BohWFcgr.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/family-Dy3ZQOxG-BGwHvqM_.d.mts.map +0 -1
- package/dist/validate-environment-CEhUSEg2-ExABehBM.mjs.map +0 -1
|
@@ -101,7 +101,58 @@ async function assembleServices(graph, config, cwd, run, onEvent, options = {})
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
|
-
//#region ../../0-framework/
|
|
104
|
+
//#region ../../0-framework/0-foundation/foundation/dist/secret-DoWGmN7m.mjs
|
|
105
|
+
/**
|
|
106
|
+
* A value wrapper that redacts everywhere except the one explicit reader,
|
|
107
|
+
* `expose()`. Sensitivity is carried by the TYPE (`SecretBox<T>`), not a flag a
|
|
108
|
+
* sink must remember to check: `String(box)`, template interpolation,
|
|
109
|
+
* `JSON.stringify`, and `console.log`/`util.inspect` all print `[REDACTED]`, so
|
|
110
|
+
* a secret can't leak through an accidental log or serialization.
|
|
111
|
+
*
|
|
112
|
+
* Every box carries a brand property keyed by the registered symbol
|
|
113
|
+
* `Symbol.for('prisma:secret-box')`, which is what `isSecretString` checks. A
|
|
114
|
+
* symbol key is invisible to `JSON.stringify` and `Object.keys`, so the box's
|
|
115
|
+
* public shape still matches the platform's own `secrecy` type
|
|
116
|
+
* (pdp-control-plane).
|
|
117
|
+
*/
|
|
118
|
+
const REDACTED = "[REDACTED]";
|
|
119
|
+
const SECRET_BOX = blindCast(Symbol.for("prisma:secret-box"));
|
|
120
|
+
var SecretBox = class {
|
|
121
|
+
[SECRET_BOX] = true;
|
|
122
|
+
#value;
|
|
123
|
+
constructor(value) {
|
|
124
|
+
this.#value = value;
|
|
125
|
+
}
|
|
126
|
+
/** The sole explicit door to the wrapped value. */
|
|
127
|
+
expose() {
|
|
128
|
+
return this.#value;
|
|
129
|
+
}
|
|
130
|
+
toString() {
|
|
131
|
+
return REDACTED;
|
|
132
|
+
}
|
|
133
|
+
toJSON() {
|
|
134
|
+
return REDACTED;
|
|
135
|
+
}
|
|
136
|
+
valueOf() {
|
|
137
|
+
return REDACTED;
|
|
138
|
+
}
|
|
139
|
+
[Symbol.toPrimitive]() {
|
|
140
|
+
return REDACTED;
|
|
141
|
+
}
|
|
142
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
143
|
+
return REDACTED;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* True for a redacting secret box — what a schema's secret leaf checks
|
|
148
|
+
* (ADR-0042). Reads the brand rather than `instanceof`, so a box from a
|
|
149
|
+
* duplicated module copy in a bundle counts and a look-alike does not.
|
|
150
|
+
*/
|
|
151
|
+
function isSecretString(value) {
|
|
152
|
+
return typeof value === "object" && value !== null && blindCast(value)[SECRET_BOX] === true;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region ../../0-framework/1-core/core/dist/graph-KEuXGBfJ.mjs
|
|
105
156
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
106
157
|
const RESOURCE_OUT_PORT = "$out";
|
|
107
158
|
/**
|
|
@@ -313,12 +364,102 @@ function loadService(root, rootId) {
|
|
|
313
364
|
params: []
|
|
314
365
|
};
|
|
315
366
|
}
|
|
367
|
+
const INSPECT = Symbol.for("nodejs.util.inspect.custom");
|
|
368
|
+
/** `input` or `input.a.b`: how an error names an input field. */
|
|
369
|
+
function inputFieldLabel(origin) {
|
|
370
|
+
return origin.path.length === 0 ? "input" : `input.${origin.path.join(".")}`;
|
|
371
|
+
}
|
|
372
|
+
function misuse(origin, what) {
|
|
373
|
+
const field = inputFieldLabel(origin);
|
|
374
|
+
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, list it: resolve([${field}], ([v]) => …).`);
|
|
375
|
+
}
|
|
376
|
+
function primitiveMisuse(hint) {
|
|
377
|
+
switch (hint) {
|
|
378
|
+
case "string": return "it was turned into text (a template literal or String())";
|
|
379
|
+
case "number": return "it was turned into a number (arithmetic, or a comparison such as <)";
|
|
380
|
+
default: return "it was combined with + or compared with ==";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Builds the `input` a module body receives. Every property access returns a
|
|
385
|
+
* value recording its key path, and the same path always returns the same
|
|
386
|
+
* object, so Load's identity-keyed maps see one value per field. Any way of
|
|
387
|
+
* reading the real value throws a LoadError naming the field.
|
|
388
|
+
*/
|
|
389
|
+
function buildModuleInput(moduleAddress) {
|
|
390
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
391
|
+
const valueAt = (path) => {
|
|
392
|
+
const key = JSON.stringify(path);
|
|
393
|
+
const existing = byPath.get(key);
|
|
394
|
+
if (existing !== void 0) return existing;
|
|
395
|
+
const origin = Object.freeze({
|
|
396
|
+
kind: "input",
|
|
397
|
+
module: moduleAddress,
|
|
398
|
+
path: Object.freeze([...path])
|
|
399
|
+
});
|
|
400
|
+
const thrower = (what) => () => {
|
|
401
|
+
throw misuse(origin, what);
|
|
402
|
+
};
|
|
403
|
+
const handler = {
|
|
404
|
+
get(_target, property) {
|
|
405
|
+
if (property === VALUE) return true;
|
|
406
|
+
if (property === VALUE_ORIGIN) return origin;
|
|
407
|
+
if (property === Symbol.toPrimitive) return (hint) => {
|
|
408
|
+
throw misuse(origin, primitiveMisuse(hint));
|
|
409
|
+
};
|
|
410
|
+
if (property === "toString") return thrower("its toString() was called");
|
|
411
|
+
if (property === "valueOf") return thrower("its valueOf() was called");
|
|
412
|
+
if (property === "toJSON") return thrower("it was serialized with JSON.stringify");
|
|
413
|
+
if (property === Symbol.iterator || property === Symbol.asyncIterator) return thrower("it was iterated (array spread, for…of or array destructuring)");
|
|
414
|
+
if (typeof property === "symbol") return void 0;
|
|
415
|
+
return valueAt([...path, property]);
|
|
416
|
+
},
|
|
417
|
+
has(_target, property) {
|
|
418
|
+
if (property === VALUE || property === VALUE_ORIGIN) return true;
|
|
419
|
+
if (typeof property === "symbol") return false;
|
|
420
|
+
throw misuse(origin, `it was checked with the in operator ("${property}" in …)`);
|
|
421
|
+
},
|
|
422
|
+
ownKeys() {
|
|
423
|
+
throw misuse(origin, "its keys were listed (Object.keys, object spread, for…in or Object.entries)");
|
|
424
|
+
},
|
|
425
|
+
getOwnPropertyDescriptor() {
|
|
426
|
+
throw misuse(origin, "its properties were inspected");
|
|
427
|
+
},
|
|
428
|
+
set(_target, property) {
|
|
429
|
+
throw misuse(origin, `its field "${String(property)}" was assigned to`);
|
|
430
|
+
},
|
|
431
|
+
defineProperty(_target, property) {
|
|
432
|
+
throw misuse(origin, `its field "${String(property)}" was assigned to`);
|
|
433
|
+
},
|
|
434
|
+
deleteProperty() {
|
|
435
|
+
throw misuse(origin, "a property was deleted from it");
|
|
436
|
+
},
|
|
437
|
+
setPrototypeOf() {
|
|
438
|
+
throw misuse(origin, "its prototype was changed");
|
|
439
|
+
},
|
|
440
|
+
preventExtensions() {
|
|
441
|
+
throw misuse(origin, "it was frozen or sealed");
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const target = Object.create(null);
|
|
445
|
+
Object.defineProperty(target, INSPECT, {
|
|
446
|
+
value: () => `[${inputFieldLabel(origin)} of module "${origin.module}"]`,
|
|
447
|
+
configurable: true
|
|
448
|
+
});
|
|
449
|
+
const proxy = new Proxy(target, handler);
|
|
450
|
+
byPath.set(key, proxy);
|
|
451
|
+
return proxy;
|
|
452
|
+
};
|
|
453
|
+
return blindCast(valueAt([]));
|
|
454
|
+
}
|
|
455
|
+
const SENTINEL_SOURCE = Symbol("prisma:module-input-sentinel");
|
|
316
456
|
function joinPath(path, key) {
|
|
317
457
|
return path === "" ? String(key) : `${path}.${key}`;
|
|
318
458
|
}
|
|
319
459
|
function describeSite(site) {
|
|
320
460
|
switch (site.kind) {
|
|
321
|
-
case "
|
|
461
|
+
case "serviceInput": return site.path === "" ? `the input binding of service "${site.address}"` : `input key "${site.path}" of service "${site.address}"`;
|
|
462
|
+
case "moduleInput": return site.path === "" ? `the input binding of module "${site.address}"` : `input key "${site.path}" of module "${site.address}"`;
|
|
322
463
|
case "param": return `param "${site.path}" of service "${site.address}"`;
|
|
323
464
|
case "props": return site.path === "" ? `the props of resource "${site.address}"` : `prop "${site.path}" of resource "${site.address}"`;
|
|
324
465
|
}
|
|
@@ -355,6 +496,7 @@ function describeNotPlain(value) {
|
|
|
355
496
|
}
|
|
356
497
|
}
|
|
357
498
|
function isThenable(value) {
|
|
499
|
+
if (isValue(value)) return false;
|
|
358
500
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
359
501
|
}
|
|
360
502
|
function checkResult(result, fnLabel) {
|
|
@@ -390,14 +532,80 @@ function substitute(value, results, inProgress) {
|
|
|
390
532
|
const rebuilt = {};
|
|
391
533
|
let changed = false;
|
|
392
534
|
for (const [key, member] of Object.entries(value)) {
|
|
393
|
-
|
|
394
|
-
if (
|
|
535
|
+
const real = substitute(member, results, inProgress);
|
|
536
|
+
if (real === void 0 && isValue(member)) {
|
|
537
|
+
changed = true;
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
rebuilt[key] = real;
|
|
541
|
+
if (real !== member) changed = true;
|
|
395
542
|
}
|
|
396
543
|
inProgress.delete(value);
|
|
397
544
|
return changed ? rebuilt : value;
|
|
398
545
|
}
|
|
399
546
|
return value;
|
|
400
547
|
}
|
|
548
|
+
function describeData(value) {
|
|
549
|
+
if (Array.isArray(value)) return "an array";
|
|
550
|
+
if (isSecretSource(value)) return "a secret";
|
|
551
|
+
if (typeof value === "object") return "an object that is not plain data";
|
|
552
|
+
return `a ${typeof value}`;
|
|
553
|
+
}
|
|
554
|
+
/** The data at `origin`'s path inside a validated input; `undefined` where a key or a parent is absent. */
|
|
555
|
+
function readPath(data, origin) {
|
|
556
|
+
let current = data;
|
|
557
|
+
for (const [index, key] of origin.path.entries()) {
|
|
558
|
+
if (current === void 0 || current === null) return void 0;
|
|
559
|
+
if (!isPlainObject(current) || isSecretSource(current)) {
|
|
560
|
+
const parent = inputFieldLabel({
|
|
561
|
+
...origin,
|
|
562
|
+
path: origin.path.slice(0, index)
|
|
563
|
+
});
|
|
564
|
+
throw new LoadError(`${inputFieldLabel(origin)} of module "${origin.module}" does not exist: ${parent} is ${describeData(current)}, not a plain object, so it has no fields. To compute with it, list it: resolve([${parent}], ([v]) => …).`);
|
|
565
|
+
}
|
|
566
|
+
if (!Object.hasOwn(current, key)) return void 0;
|
|
567
|
+
current = current[key];
|
|
568
|
+
}
|
|
569
|
+
return current;
|
|
570
|
+
}
|
|
571
|
+
function validateModuleInput(entry, resolved) {
|
|
572
|
+
const address = entry.moduleAddress;
|
|
573
|
+
const withSentinels = (value, path) => {
|
|
574
|
+
if (isSecretSource(value)) {
|
|
575
|
+
const sentinel = new SecretBox("");
|
|
576
|
+
Object.defineProperty(sentinel, SENTINEL_SOURCE, { value });
|
|
577
|
+
return sentinel;
|
|
578
|
+
}
|
|
579
|
+
if (isParamSource(value)) throw new LoadError(`${describeSite({
|
|
580
|
+
address,
|
|
581
|
+
kind: "moduleInput",
|
|
582
|
+
path
|
|
583
|
+
})} is bound to a param source, such as envParam(). A module's input does not take a param source yet; bind it on the service's input inside the module, or forward it through the module's params slot.`);
|
|
584
|
+
if (isSecretString(value)) throw new LoadError(`${describeSite({
|
|
585
|
+
address,
|
|
586
|
+
kind: "moduleInput",
|
|
587
|
+
path
|
|
588
|
+
})} is bound to a SecretString. A secret's value never appears in the code; bind envSecret('NAME'), or pass on an input field typed secretString().`);
|
|
589
|
+
if (Array.isArray(value)) return value.map((member, index) => withSentinels(member, joinPath(path, index)));
|
|
590
|
+
if (isPlainObject(value)) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, withSentinels(member, joinPath(path, key))]));
|
|
591
|
+
return value;
|
|
592
|
+
};
|
|
593
|
+
const result = entry.schema["~standard"].validate(withSentinels(resolved, ""));
|
|
594
|
+
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.`);
|
|
595
|
+
if (result.issues !== void 0) throw new LoadError(`The input binding of module "${address}" does not match the module's input schema: ${result.issues.map((issue) => issue.message).join("; ")}`);
|
|
596
|
+
const restore = (value, path) => {
|
|
597
|
+
if (isSecretString(value)) {
|
|
598
|
+
const source = blindCast(value)[SENTINEL_SOURCE];
|
|
599
|
+
if (isSecretSource(source)) return source;
|
|
600
|
+
const atPath = path === "" ? "" : ` at "${path}"`;
|
|
601
|
+
throw new LoadError(`The input schema of module "${address}" produced a SecretString${atPath} that its binding did not supply. A module's schema may check a secret field, never create one.`);
|
|
602
|
+
}
|
|
603
|
+
if (Array.isArray(value)) return value.map((member, index) => restore(member, joinPath(path, index)));
|
|
604
|
+
if (isPlainObject(value)) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, restore(member, joinPath(path, key))]));
|
|
605
|
+
return value;
|
|
606
|
+
};
|
|
607
|
+
return restore(result.value, "");
|
|
608
|
+
}
|
|
401
609
|
/**
|
|
402
610
|
* Resolves every value the graph binds, dependency-first, once each, and
|
|
403
611
|
* returns each binding with its values replaced by their real values.
|
|
@@ -407,7 +615,7 @@ function resolveValues(input) {
|
|
|
407
615
|
const found = [];
|
|
408
616
|
for (const { serviceAddress, binding } of input.inputBindings) collect(binding, {
|
|
409
617
|
address: serviceAddress,
|
|
410
|
-
kind: "
|
|
618
|
+
kind: "serviceInput",
|
|
411
619
|
path: ""
|
|
412
620
|
}, found, /* @__PURE__ */ new WeakSet());
|
|
413
621
|
for (const { serviceAddress, slot, binding } of input.params) collect(binding, {
|
|
@@ -423,6 +631,9 @@ function resolveValues(input) {
|
|
|
423
631
|
};
|
|
424
632
|
collect(resource.props, site, found, /* @__PURE__ */ new WeakSet());
|
|
425
633
|
}
|
|
634
|
+
const moduleInputByAddress = new Map(input.moduleInputs.map((entry) => [entry.moduleAddress, entry]));
|
|
635
|
+
const validatedInputs = /* @__PURE__ */ new Map();
|
|
636
|
+
const validating = /* @__PURE__ */ new Set();
|
|
426
637
|
const results = /* @__PURE__ */ new Map();
|
|
427
638
|
const visiting = [];
|
|
428
639
|
const fnLabelFor = (site) => visiting.length === 1 ? `The resolve() function for ${describeSite(site)}` : `A resolve() function that ${describeSite(site)} depends on`;
|
|
@@ -449,11 +660,35 @@ function resolveValues(input) {
|
|
|
449
660
|
checkResult(result, fnLabelFor(site));
|
|
450
661
|
break;
|
|
451
662
|
}
|
|
663
|
+
case "input": {
|
|
664
|
+
const entry = moduleInputByAddress.get(origin.module);
|
|
665
|
+
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.`);
|
|
666
|
+
result = readPath(validatedInputOf(entry), origin);
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
452
669
|
}
|
|
453
670
|
visiting.pop();
|
|
454
671
|
results.set(value, result);
|
|
455
672
|
return result;
|
|
456
673
|
};
|
|
674
|
+
const validatedInputOf = (entry) => {
|
|
675
|
+
if (validatedInputs.has(entry.moduleAddress)) return validatedInputs.get(entry.moduleAddress);
|
|
676
|
+
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.`);
|
|
677
|
+
validating.add(entry.moduleAddress);
|
|
678
|
+
const site = {
|
|
679
|
+
address: entry.moduleAddress,
|
|
680
|
+
kind: "moduleInput",
|
|
681
|
+
path: ""
|
|
682
|
+
};
|
|
683
|
+
const values = [];
|
|
684
|
+
collect(entry.binding, site, values, /* @__PURE__ */ new WeakSet());
|
|
685
|
+
for (const { value, site: valueSite } of values) resolveOne(value, valueSite);
|
|
686
|
+
const validated = validateModuleInput(entry, substitute(entry.binding, results, /* @__PURE__ */ new WeakSet()));
|
|
687
|
+
validating.delete(entry.moduleAddress);
|
|
688
|
+
validatedInputs.set(entry.moduleAddress, validated);
|
|
689
|
+
return validated;
|
|
690
|
+
};
|
|
691
|
+
for (const entry of input.moduleInputs) validatedInputOf(entry);
|
|
457
692
|
for (const { value, site } of found) resolveOne(value, site);
|
|
458
693
|
const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
|
|
459
694
|
if (found.length === 0) return {
|
|
@@ -476,12 +711,13 @@ function resolveValues(input) {
|
|
|
476
711
|
binding: blindCast(binding)
|
|
477
712
|
};
|
|
478
713
|
}),
|
|
479
|
-
params: input.params.
|
|
714
|
+
params: input.params.flatMap((entry) => {
|
|
480
715
|
const binding = substitute(entry.binding, results, inProgress);
|
|
481
|
-
|
|
716
|
+
if (binding === void 0 && isValue(entry.binding)) return [];
|
|
717
|
+
return [binding === entry.binding ? entry : {
|
|
482
718
|
...entry,
|
|
483
719
|
binding
|
|
484
|
-
};
|
|
720
|
+
}];
|
|
485
721
|
})
|
|
486
722
|
};
|
|
487
723
|
}
|
|
@@ -597,16 +833,16 @@ function validateWiring(pending, byId) {
|
|
|
597
833
|
* Flattens a value into itself plus every nested object/array member value —
|
|
598
834
|
* identity fodder for the ctx.secrets/ctx.params usage marking, which must
|
|
599
835
|
* see a forwarded source wherever it sits inside an input binding (ADR-0042).
|
|
600
|
-
* A secret/param source is an opaque leaf: it is pushed (a
|
|
601
|
-
* such a source, so identity-matching still needs it) but
|
|
602
|
-
* into, so a ref buried in an unrelated source's payload is
|
|
603
|
-
* as used. `seen` guards object cycles so a self-referential binding cannot
|
|
836
|
+
* A value or a secret/param source is an opaque leaf: it is pushed (a
|
|
837
|
+
* forwarded ref IS such a source, so identity-matching still needs it) but
|
|
838
|
+
* never descended into, so a ref buried in an unrelated source's payload is
|
|
839
|
+
* not falsely seen as used. `seen` guards object cycles so a self-referential binding cannot
|
|
604
840
|
* recurse forever.
|
|
605
841
|
*/
|
|
606
842
|
function deepValues(value, out, seen = /* @__PURE__ */ new WeakSet()) {
|
|
607
843
|
out.push(value);
|
|
608
844
|
if (typeof value !== "object" || value === null) return;
|
|
609
|
-
if (isSecretSource(value) || isParamSource(value)) return;
|
|
845
|
+
if (isValue(value) || isSecretSource(value) || isParamSource(value)) return;
|
|
610
846
|
if (seen.has(value)) return;
|
|
611
847
|
seen.add(value);
|
|
612
848
|
const members = Array.isArray(value) ? value : Object.values(value);
|
|
@@ -681,7 +917,7 @@ function validateParamNeedBinding(child, id, address, paramWiring, enclosingModu
|
|
|
681
917
|
* children carry it as their `parent`, and this module's own boundary ports
|
|
682
918
|
* (and the authored edges touching them) are recorded against it.
|
|
683
919
|
*/
|
|
684
|
-
function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, edges, pending, inputBindings, paramBindings, byId, ports, authoredEdges, loading) {
|
|
920
|
+
function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading) {
|
|
685
921
|
ports.push(...boundaryPortsOf(selfId, moduleNode));
|
|
686
922
|
const localIds = /* @__PURE__ */ new Set();
|
|
687
923
|
const used = /* @__PURE__ */ new Set();
|
|
@@ -843,7 +1079,20 @@ function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, e
|
|
|
843
1079
|
byId.set(fullAddress, child);
|
|
844
1080
|
return refFor(fullAddress, child);
|
|
845
1081
|
}
|
|
846
|
-
|
|
1082
|
+
const childInputSchema = child.inputSchema;
|
|
1083
|
+
if (childInputSchema === void 0 && provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding, but the module declares no input schema (module "${moduleNode.name}").`);
|
|
1084
|
+
if (childInputSchema !== void 0 && provisionInput === void 0) throw new LoadError(`Input of provisioned module "${id}" is not bound (module "${moduleNode.name}") — the module declares an input schema; bind it with \`input: { … }\` on its provision() call.`);
|
|
1085
|
+
if (childInputSchema !== void 0) {
|
|
1086
|
+
const leaves = [];
|
|
1087
|
+
deepValues(provisionInput, leaves);
|
|
1088
|
+
markSecretsUsed(leaves);
|
|
1089
|
+
markParamsUsed(leaves);
|
|
1090
|
+
moduleInputs.push({
|
|
1091
|
+
moduleAddress: fullAddress,
|
|
1092
|
+
schema: childInputSchema,
|
|
1093
|
+
binding: provisionInput
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
847
1096
|
validateSecretBinding(child, id, fullAddress, localSecrets, moduleNode.name);
|
|
848
1097
|
validateParamNeedBinding(child, id, fullAddress, localParams, moduleNode.name);
|
|
849
1098
|
edges.push(...wiringEdges(localWiring, fullAddress));
|
|
@@ -855,7 +1104,7 @@ function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, e
|
|
|
855
1104
|
targetKind: "module",
|
|
856
1105
|
enclosingModuleName: moduleNode.name
|
|
857
1106
|
});
|
|
858
|
-
const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, inputBindings, paramBindings, byId, ports, authoredEdges, loading);
|
|
1107
|
+
const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
859
1108
|
nodes.push({
|
|
860
1109
|
id: fullAddress,
|
|
861
1110
|
parent: selfId,
|
|
@@ -879,6 +1128,7 @@ function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, e
|
|
|
879
1128
|
deps: ctxInputs,
|
|
880
1129
|
secrets: ctxSecrets,
|
|
881
1130
|
params: ctxParams,
|
|
1131
|
+
input: moduleNode.inputSchema === void 0 ? void 0 : buildModuleInput(selfId),
|
|
882
1132
|
environment: environmentFacts,
|
|
883
1133
|
provision: blindCast(provision)
|
|
884
1134
|
});
|
|
@@ -890,6 +1140,7 @@ function flatten(moduleNode, selfId, wiring, secretWiring, paramWiring, nodes, e
|
|
|
890
1140
|
for (const [key, contract] of Object.entries(moduleNode.expose)) {
|
|
891
1141
|
const port = outputs[key];
|
|
892
1142
|
if (port === void 0) throw new LoadError(`Module "${moduleNode.name}" declares expose "${key}" but its body did not return a port for it.`);
|
|
1143
|
+
if (isValue(port)) throw new LoadError(`Module "${moduleNode.name}" returned a value for expose "${key}". A value can configure a node, never decide its edges: return a port of a node the body provisions.`);
|
|
893
1144
|
if (!satisfiesRequired(port, contract)) throw new LoadError(`Module "${moduleNode.name}"'s returned port for expose "${key}" does not satisfy its declared contract.`);
|
|
894
1145
|
const from = authoredSourceOf(port);
|
|
895
1146
|
if (from !== void 0) authoredEdges.push({
|
|
@@ -920,17 +1171,19 @@ function loadModule(root, opts) {
|
|
|
920
1171
|
const names = rootParamKeys.map((k) => `"${k}"`).join(", ");
|
|
921
1172
|
throw new LoadError(`Module "${root.name}" declares param${rootParamKeys.length > 1 ? "s" : ""} ${names} but is being deployed as the root — a root has no enclosing scope to bind them; the root binds params directly on each provision() call, it does not declare param-forwarding slots of its own.`);
|
|
922
1173
|
}
|
|
1174
|
+
if (root.inputSchema !== void 0) throw new LoadError(`Module "${root.name}" declares input but is being deployed as the root. Composer cannot fill a root's input yet; provision "${root.name}" from another module and bind its input there.`);
|
|
923
1175
|
const nodes = [];
|
|
924
1176
|
const edges = [];
|
|
925
1177
|
const pending = [];
|
|
926
1178
|
const inputBindings = [];
|
|
927
1179
|
const paramBindings = [];
|
|
1180
|
+
const moduleInputs = [];
|
|
928
1181
|
const byId = /* @__PURE__ */ new Map();
|
|
929
1182
|
const ports = [];
|
|
930
1183
|
const authoredEdges = [];
|
|
931
1184
|
const loading = { sealed: false };
|
|
932
1185
|
try {
|
|
933
|
-
flatten(root, rootId, {}, {}, {}, nodes, edges, pending, inputBindings, paramBindings, byId, ports, authoredEdges, loading);
|
|
1186
|
+
flatten(root, rootId, {}, {}, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
|
|
934
1187
|
for (const entry of pending) validateWiring(entry, byId);
|
|
935
1188
|
assertDependencyDag(edges);
|
|
936
1189
|
} finally {
|
|
@@ -942,6 +1195,7 @@ function loadModule(root, opts) {
|
|
|
942
1195
|
environment: opts?.environment,
|
|
943
1196
|
inputBindings,
|
|
944
1197
|
params: paramBindings,
|
|
1198
|
+
moduleInputs,
|
|
945
1199
|
resources
|
|
946
1200
|
});
|
|
947
1201
|
const resolvedNodes = nodes.map((entry) => {
|
|
@@ -1036,7 +1290,6 @@ function Load(root, opts) {
|
|
|
1036
1290
|
if (root.kind === "service") return loadService(root, opts?.id ?? "root");
|
|
1037
1291
|
throw new LoadError("Load expects a service or module root (received another node kind).");
|
|
1038
1292
|
}
|
|
1039
|
-
blindCast(Symbol.for("prisma:secret-box"));
|
|
1040
1293
|
//#endregion
|
|
1041
1294
|
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-CEhUSEg2.mjs
|
|
1042
1295
|
/**
|
|
@@ -1340,4 +1593,4 @@ function validateEnvironmentName(environment, spawn = spawnSync) {
|
|
|
1340
1593
|
//#endregion
|
|
1341
1594
|
export { validateEnvironmentName as i, resolveAppIdentity as n, runPipeline as r, checkConfigSource as t };
|
|
1342
1595
|
|
|
1343
|
-
//# sourceMappingURL=validate-environment-CEhUSEg2-
|
|
1596
|
+
//# sourceMappingURL=validate-environment-CEhUSEg2-BohWFcgr.mjs.map
|