@prisma/composer 0.38.0 → 0.39.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.
Files changed (108) hide show
  1. package/dist/{app-config-lMqqcFA1-DacpRpC4.d.mts → app-config-_XNdvjus-DcCvJysR.d.mts} +76 -24
  2. package/dist/app-config-_XNdvjus-DcCvJysR.d.mts.map +1 -0
  3. package/dist/{app-configuration-file-CeJvBAti-D3uDlheX.mjs → app-configuration-file-Cw9autUL-DebaEvDz.mjs} +20 -25
  4. package/dist/app-configuration-file-Cw9autUL-DebaEvDz.mjs.map +1 -0
  5. package/dist/arktype.d.mts +1 -1
  6. package/dist/arktype.mjs +1 -1
  7. package/dist/arktype.mjs.map +1 -1
  8. package/dist/config-Czql2X9e.d.mts +1 -0
  9. package/dist/config.d.mts +3 -3
  10. package/dist/config.mjs +2 -3
  11. package/dist/control.d.mts +13 -7
  12. package/dist/control.d.mts.map +1 -1
  13. package/dist/control.mjs +3 -3
  14. package/dist/control.mjs.map +1 -1
  15. package/dist/{deploy-DergV8De.mjs → deploy-C_PZEjcg.mjs} +18 -29
  16. package/dist/deploy-C_PZEjcg.mjs.map +1 -0
  17. package/dist/deploy-aDxtc_ck.d.mts +2 -0
  18. package/dist/deploy.d.mts +4 -4
  19. package/dist/deploy.mjs +3 -3
  20. package/dist/{deployment-summary-BiBkPWlB-CyC2pudN.mjs → deployment-summary-B6rYxEZe-E4IIcngK.mjs} +11 -5
  21. package/dist/deployment-summary-B6rYxEZe-E4IIcngK.mjs.map +1 -0
  22. package/dist/{deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts → deployment-summary-p88NV5m5-k9oQRopA.d.mts} +3 -3
  23. package/dist/{deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts.map → deployment-summary-p88NV5m5-k9oQRopA.d.mts.map} +1 -1
  24. package/dist/{describe-kind-Cpm_euxo-CkhlGJUL.mjs → describe-kind-Cpm_euxo-D9WDxl5C.mjs} +3 -3
  25. package/dist/describe-kind-Cpm_euxo-D9WDxl5C.mjs.map +1 -0
  26. package/dist/{dev-current-D-Qb6Yem-Cvy2dWhe.mjs → dev-current-D8GwJQex-BqMILWv-.mjs} +5 -5
  27. package/dist/{dev-current-D-Qb6Yem-Cvy2dWhe.mjs.map → dev-current-D8GwJQex-BqMILWv-.mjs.map} +1 -1
  28. package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs → dev-environment-name-6eEr5PW8-6sPgQZG3.mjs} +2 -2
  29. package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map → dev-environment-name-6eEr5PW8-6sPgQZG3.mjs.map} +1 -1
  30. package/dist/{dist-NyTyCEnG.mjs → dist-BN9EXWWX.mjs} +4 -26
  31. package/dist/dist-BN9EXWWX.mjs.map +1 -0
  32. package/dist/errors-0e8IVwzi.mjs.map +1 -1
  33. package/dist/{execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs → execute-deploy-destroy-1SIH5uAu-lMyvQ0el.mjs} +27 -16
  34. package/dist/execute-deploy-destroy-1SIH5uAu-lMyvQ0el.mjs.map +1 -0
  35. package/dist/{execute-dev-current-tBKmDAjV-0LnPjGGi.mjs → execute-dev-current-DsAsDBB1-DhnVrBHM.mjs} +6 -6
  36. package/dist/{execute-dev-current-tBKmDAjV-0LnPjGGi.mjs.map → execute-dev-current-DsAsDBB1-DhnVrBHM.mjs.map} +1 -1
  37. package/dist/{execute-dev-gjIKYybU-BMpgGLtS.mjs → execute-dev-xPaS5SAl-BTzRomlR.mjs} +88 -20
  38. package/dist/execute-dev-xPaS5SAl-BTzRomlR.mjs.map +1 -0
  39. package/dist/{execute-log-c0_dL_Bv-Dq1glmTO.mjs → execute-log-Be9DYRI6-CCRtbIwA.mjs} +6 -6
  40. package/dist/{execute-log-c0_dL_Bv-Dq1glmTO.mjs.map → execute-log-Be9DYRI6-CCRtbIwA.mjs.map} +1 -1
  41. package/dist/{graph-D1zpgcLm-YlrEdzUB.d.mts → graph-DU0omY5O-BHO71z0F.d.mts} +3 -3
  42. package/dist/graph-DU0omY5O-BHO71z0F.d.mts.map +1 -0
  43. package/dist/{graph-CBt9CRBT-yMupsISb.mjs → graph-K7VOpCAj-D6UHSltu.mjs} +141 -101
  44. package/dist/graph-K7VOpCAj-D6UHSltu.mjs.map +1 -0
  45. package/dist/{graph-types-BiFZrE06-D6vaGxXz.d.mts → graph-types-Bzj1fahC-C8rOVj0c.d.mts} +96 -89
  46. package/dist/graph-types-Bzj1fahC-C8rOVj0c.d.mts.map +1 -0
  47. package/dist/http.d.mts +2 -2
  48. package/dist/http.mjs +2 -2
  49. package/dist/{index-CMklpG87.d.mts → index-B8s0bLZY.d.mts} +3 -3
  50. package/dist/{index-CMklpG87.d.mts.map → index-B8s0bLZY.d.mts.map} +1 -1
  51. package/dist/index.d.mts +5 -5
  52. package/dist/index.mjs +4 -4
  53. package/dist/internal-app-configuration-file.d.mts +8 -7
  54. package/dist/internal-app-configuration-file.d.mts.map +1 -1
  55. package/dist/internal-app-configuration-file.mjs +1 -1
  56. package/dist/{local-target-Dd8FJEb5.mjs → local-target-COdS1iNs.mjs} +3 -3
  57. package/dist/{local-target-Dd8FJEb5.mjs.map → local-target-COdS1iNs.mjs.map} +1 -1
  58. package/dist/local-target.d.mts +3 -3
  59. package/dist/local-target.d.mts.map +1 -1
  60. package/dist/local-target.mjs +1 -1
  61. package/dist/{nextjs-DLyeRR7M-RqgYxqhI.d.mts → nextjs-DLyeRR7M-Z_xX74Cp.d.mts} +3 -3
  62. package/dist/{nextjs-DLyeRR7M-RqgYxqhI.d.mts.map → nextjs-DLyeRR7M-Z_xX74Cp.d.mts.map} +1 -1
  63. package/dist/nextjs-control.d.mts +4 -4
  64. package/dist/nextjs.d.mts +1 -1
  65. package/dist/node-control.d.mts +3 -3
  66. package/dist/node.d.mts +2 -2
  67. package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts → pointer-DclJZFQi-DJa4t8Wa.d.mts} +3 -3
  68. package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts.map → pointer-DclJZFQi-DJa4t8Wa.d.mts.map} +1 -1
  69. package/dist/preflight-transport-DJjTWvyH-CEJ9WlaN.mjs +125 -0
  70. package/dist/preflight-transport-DJjTWvyH-CEJ9WlaN.mjs.map +1 -0
  71. package/dist/{redaction-HnbkSFrK-BXRZ3B33.mjs → redaction-C-NnlVUh-B1nJc6rb.mjs} +26 -5
  72. package/dist/redaction-C-NnlVUh-B1nJc6rb.mjs.map +1 -0
  73. package/dist/{redaction-Bf8FvTFH-pjMN5nIB.d.mts → redaction-CqdeMBKw-BAOFeUYp.d.mts} +15 -8
  74. package/dist/{redaction-Bf8FvTFH-pjMN5nIB.d.mts.map → redaction-CqdeMBKw-BAOFeUYp.d.mts.map} +1 -1
  75. package/dist/report.d.mts +3 -3
  76. package/dist/report.mjs +11 -1
  77. package/dist/report.mjs.map +1 -1
  78. package/dist/{run-alchemy-OS_ix5g0-DCvUYZ7T.mjs → run-alchemy-CyciV8i0-BxPAyrch.mjs} +3 -3
  79. package/dist/{run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map → run-alchemy-CyciV8i0-BxPAyrch.mjs.map} +1 -1
  80. package/dist/service-rpc.d.mts +2 -2
  81. package/dist/service-rpc.mjs +2 -2
  82. package/dist/testing.d.mts +1 -1
  83. package/dist/{validate-environment-CpQLC3CA-COmDdusV.mjs → validate-environment-DyW59rJ7-DTFBmAno.mjs} +16 -7
  84. package/dist/validate-environment-DyW59rJ7-DTFBmAno.mjs.map +1 -0
  85. package/dist/zod.d.mts +1 -1
  86. package/dist/zod.mjs +1 -1
  87. package/dist/zod.mjs.map +1 -1
  88. package/package.json +13 -13
  89. package/skills/prisma-composer-core-concepts/SKILL.md +44 -50
  90. package/dist/app-config-lMqqcFA1-DacpRpC4.d.mts.map +0 -1
  91. package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +0 -1
  92. package/dist/config-BFuriECI.mjs +0 -39
  93. package/dist/config-BFuriECI.mjs.map +0 -1
  94. package/dist/config-Bpbj7Riz.d.mts +0 -1
  95. package/dist/container-transport-HcvNOGZL-twPi2TIv.mjs +0 -49
  96. package/dist/container-transport-HcvNOGZL-twPi2TIv.mjs.map +0 -1
  97. package/dist/deploy-DergV8De.mjs.map +0 -1
  98. package/dist/deploy-Dh_I6YLS.d.mts +0 -2
  99. package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +0 -1
  100. package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +0 -1
  101. package/dist/dist-NyTyCEnG.mjs.map +0 -1
  102. package/dist/execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs.map +0 -1
  103. package/dist/execute-dev-gjIKYybU-BMpgGLtS.mjs.map +0 -1
  104. package/dist/graph-CBt9CRBT-yMupsISb.mjs.map +0 -1
  105. package/dist/graph-D1zpgcLm-YlrEdzUB.d.mts.map +0 -1
  106. package/dist/graph-types-BiFZrE06-D6vaGxXz.d.mts.map +0 -1
  107. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +0 -1
  108. package/dist/validate-environment-CpQLC3CA-COmDdusV.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
2
+ import { i as POINTER, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-D9WDxl5C.mjs";
3
3
  import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
4
4
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
5
- //#region ../../0-framework/1-core/core/dist/graph-CBt9CRBT.mjs
5
+ //#region ../../0-framework/1-core/core/dist/graph-K7VOpCAj.mjs
6
6
  /** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
7
7
  const RESOURCE_OUT_PORT = "$out";
8
8
  /**
@@ -16,6 +16,12 @@ var LoadError = class extends CliStructuredError {
16
16
  super("COMPOSE.GRAPH_INVALID", message, options);
17
17
  }
18
18
  };
19
+ /** What an extension's `checkGraph` throws to refuse a graph it cannot deploy. Any other throw from the hook is a bug (ADR-0044). The CLI adds the refusing extension's id as `meta.extension`. */
20
+ var GraphCheckError = class extends CliStructuredError {
21
+ constructor(message, options) {
22
+ super("COMPOSE.GRAPH_INVALID", message, options?.extension === void 0 ? void 0 : { meta: { extension: options.extension } });
23
+ }
24
+ };
19
25
  /** The declared style of an untrusted contract value, or `undefined` when it declares none. */
20
26
  function contractStyleOf(contract) {
21
27
  if (typeof contract !== "object" || contract === null || !("style" in contract)) return void 0;
@@ -23,6 +29,7 @@ function contractStyleOf(contract) {
23
29
  }
24
30
  const VALUE = blindCast(Symbol.for("prisma:value"));
25
31
  const VALUE_ORIGIN = blindCast(Symbol.for("prisma:value-origin"));
32
+ const VALUE_RESOURCE = blindCast(Symbol.for("prisma:value-resource"));
26
33
  /**
27
34
  * A value computed from other values. `fn` receives the dependencies' real
28
35
  * values as one tuple, in order, and returns plain data. Each dependency must
@@ -170,19 +177,20 @@ function buildModuleInput(moduleAddress) {
170
177
  */
171
178
  const NODE = Symbol.for("prisma:node");
172
179
  const SECRET_SOURCE = blindCast(Symbol.for("prisma:secret-source"));
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. */
180
+ /** Builds a secret source from a target-defined payload: the SPI a deploy target's own constructor calls. The source is a value whose real value at deploy is itself, a pointer. Core forwards it and never inspects the payload. */
174
181
  function secretSource(payload, options) {
175
- const label = sourceLabel("secretSource", options?.label, "a secret source");
182
+ const label = sourceLabel("secretSource", options?.label);
176
183
  const secretsKey = options?.secretsKey;
177
184
  if (secretsKey !== void 0 && (typeof secretsKey !== "string" || secretsKey.length === 0)) throw new Error("secretSource() secretsKey must be a non-empty string.");
178
185
  return blindCast(buildSource(SECRET_SOURCE, payload, {
179
186
  kind: "source",
180
187
  sourceKind: "secret",
181
188
  label,
182
- secretsKey
189
+ secretsKey,
190
+ resource: void 0
183
191
  }, "secret"));
184
192
  }
185
- /** True if `value` is a secret source, such as an `envSecret()` result. */
193
+ /** True if `value` is a secret source. */
186
194
  function isSecretSource(value) {
187
195
  return typeof value === "object" && value !== null && blindCast(value)[SECRET_SOURCE] === true;
188
196
  }
@@ -200,35 +208,35 @@ function isProvisionNeed(value) {
200
208
  return typeof value === "object" && value !== null && blindCast(value)[PROVISION_NEED] === true;
201
209
  }
202
210
  const PARAM_SOURCE = blindCast(Symbol.for("prisma:param-source"));
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. */
211
+ /** Builds a param source from a target-defined payload: the SPI a deploy target's own constructor calls. Core forwards it and never inspects the payload. */
204
212
  function paramSource(payload, options) {
205
- const label = sourceLabel("paramSource", options?.label, "a param source");
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.");
213
+ const label = sourceLabel("paramSource", options?.label);
208
214
  const redacted = options?.redacted === true;
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.");
210
215
  return blindCast(buildSource(PARAM_SOURCE, payload, {
211
216
  kind: "source",
212
217
  sourceKind: "param",
213
218
  label,
214
- configurationKey
215
- }, configurationKey !== void 0 ? void 0 : redacted ? "secret" : "plain"));
219
+ resource: void 0
220
+ }, redacted ? "secret" : "plain"));
216
221
  }
217
- function sourceLabel(factory, label, fallback) {
218
- if (label === void 0) return fallback;
222
+ function sourceLabel(factory, label) {
223
+ if (label === void 0) return "a source";
219
224
  if (typeof label !== "string" || label.length === 0) throw new Error(`${factory}() label must be a non-empty string.`);
220
225
  return label;
221
226
  }
222
- function buildSource(brand, payload, origin, kind) {
227
+ function buildSource(brand, payload, origin, kind, hidden = {}) {
223
228
  const source = {
224
229
  [VALUE]: true,
225
230
  [VALUE_ORIGIN]: origin,
226
231
  [brand]: true,
227
- ...kind === void 0 ? {} : { [POINTER]: kind },
232
+ [POINTER]: kind,
228
233
  payload
229
234
  };
230
235
  Object.defineProperty(origin, "source", { value: source });
231
- Object.defineProperties(source, coercions(origin));
236
+ Object.defineProperties(source, {
237
+ ...coercions(origin),
238
+ ...hidden
239
+ });
232
240
  Object.freeze(origin);
233
241
  return Object.freeze(source);
234
242
  }
@@ -247,7 +255,7 @@ function coercions(origin) {
247
255
  const sourceMisuses = /* @__PURE__ */ new WeakSet();
248
256
  function sourceMisuse(origin, what) {
249
257
  const { label } = 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]) => …).`);
258
+ const error = new LoadError(`${label} is known only at boot: the deploy holds a pointer to it, never its value, and ${what}. A module body can only pass it on, into a provision() binding; to compute with the value, do it in the service that reads it.`);
251
259
  sourceMisuses.add(error);
252
260
  return error;
253
261
  }
@@ -261,7 +269,7 @@ function sourceOriginOf(source) {
261
269
  const origin = originOf(source);
262
270
  return origin.kind === "source" ? origin : void 0;
263
271
  }
264
- /** True if `value` is a param source, such as an `envParam()` result. */
272
+ /** True if `value` is a param source. */
265
273
  function isParamSource(value) {
266
274
  return typeof value === "object" && value !== null && blindCast(value)[PARAM_SOURCE] === true;
267
275
  }
@@ -389,6 +397,38 @@ var FrozenResourceNode = class extends ResourceNodeBase {
389
397
  function resource(def) {
390
398
  return new FrozenResourceNode(def);
391
399
  }
400
+ function isSourceValue(value) {
401
+ return (isSecretSource(value) || isParamSource(value)) && sourceOriginOf(value) !== void 0;
402
+ }
403
+ var FrozenValueResourceNode = class extends ResourceNodeBase {
404
+ [VALUE_RESOURCE];
405
+ constructor(def) {
406
+ super(def);
407
+ this[VALUE_RESOURCE] = def.value;
408
+ freezeNode(this);
409
+ }
410
+ };
411
+ /** Builds a frozen resource node that is a value: `value`, a source built with `secretSource()` or `paramSource()`. It provides no contract and has no dependencies. */
412
+ function valueResource(def) {
413
+ if (!isSourceValue(def.value)) throw new Error("valueResource() value must be a source, built with secretSource() or paramSource().");
414
+ return new FrozenValueResourceNode(def);
415
+ }
416
+ function valueResourceOrigin(node) {
417
+ if (!isNode(node) || node.kind !== "resource" || !(VALUE_RESOURCE in node)) return void 0;
418
+ const value = node[VALUE_RESOURCE];
419
+ return isSecretSource(value) || isParamSource(value) ? sourceOriginOf(value) : void 0;
420
+ }
421
+ /** True for a resource node that is a value: one that holds a source under the value resource key. */
422
+ function isValueResource(node) {
423
+ return valueResourceOrigin(node) !== void 0;
424
+ }
425
+ function provisionedValue(origin, address) {
426
+ const { source, ...kept } = origin;
427
+ return blindCast(buildSource(isSecretSource(source) ? SECRET_SOURCE : PARAM_SOURCE, source.payload, {
428
+ ...kept,
429
+ resource: address
430
+ }, isSecretPointer(source) ? "secret" : "plain", { id: { value: address } }));
431
+ }
392
432
  /**
393
433
  * Constructs a branded, frozen Service node — declarations only (inputs,
394
434
  * params, the input schema, build adapter, and the ports it exposes). Pure;
@@ -637,10 +677,8 @@ function loadService(root, rootId) {
637
677
  inputBindings: [],
638
678
  params: [],
639
679
  secretSources: [],
640
- appConfigurationRead: {
641
- rootInput: [],
642
- configurationKeyText: {}
643
- }
680
+ valueReads: [],
681
+ appConfigurationRead: { rootInput: [] }
644
682
  };
645
683
  }
646
684
  function joinPath(path, key) {
@@ -754,7 +792,7 @@ function checkResult(result, fnLabel) {
754
792
  const walk = (value, path) => {
755
793
  const atPath = path === "" ? "" : ` at "${path}"`;
756
794
  if (value === void 0) throw new LoadError(`${fnLabel} returned undefined${atPath}. Return a result for every environment; Composer never picks a default.`);
757
- if (isSecretSource(value) || isParamSource(value)) throw new LoadError(`${fnLabel} returned a source${atPath}, such as envSecret() or envParam() called inside the function. resolve() returns plain data; bind a source directly.`);
795
+ if (isSecretSource(value) || isParamSource(value)) throw new LoadError(`${fnLabel} returned a source${atPath}, a value known only at boot. resolve() returns plain data; bind the source directly.`);
758
796
  if (isValue(value)) throw new LoadError(`${fnLabel} returned a value${atPath}, not a real value. List that value as a dependency; fn receives its real value.`);
759
797
  const notPlain = describeNotPlain(value);
760
798
  if (notPlain !== void 0) throw new LoadError(`${fnLabel} returned ${notPlain}${atPath}. resolve() returns plain data: strings, finite numbers, booleans, null, arrays and plain objects.`);
@@ -784,7 +822,7 @@ function firstPointer(value, path = [], seen = /* @__PURE__ */ new WeakSet()) {
784
822
  function refusePointerDependency(fnLabel, dependency, real) {
785
823
  const found = firstPointer(real);
786
824
  if (found === void 0) return;
787
- const label = sourceOriginOf(found.pointer)?.label ?? "a value known only at boot";
825
+ const label = sourceOriginOf(found.pointer)?.label ?? "a source";
788
826
  const origin = originOf(dependency);
789
827
  if (origin.kind !== "input") throw new LoadError(`${fnLabel} lists ${label}, which is known only at boot. A resolve() dependency must be a deploy-time value. Bind ${label} directly into the input of the service that reads it.`);
790
828
  const listed = `${inputFieldLabel(origin)} of module "${origin.module}"`;
@@ -855,7 +893,7 @@ function refuseSecretBoxes(address, value, path) {
855
893
  address,
856
894
  kind: "moduleInput",
857
895
  path
858
- })} 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().`);
896
+ })} is bound to a SecretString. A secret's value never appears in the code; bind a secret source, or pass on an input field typed secretString().`);
859
897
  if (Array.isArray(value)) {
860
898
  for (const [index, member] of value.entries()) refuseSecretBoxes(address, member, joinPath(path, index));
861
899
  return;
@@ -863,10 +901,17 @@ function refuseSecretBoxes(address, value, path) {
863
901
  if (isPlainObject(value)) for (const [key, member] of Object.entries(value)) refuseSecretBoxes(address, member, joinPath(path, key));
864
902
  }
865
903
  /** The original source each runtime value in `value` names, by its path. */
866
- function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map()) {
867
- if (isSecretSource(value) || isParamSource(value)) found.set(path, sourceOriginOf(value)?.source ?? value);
868
- else if (Array.isArray(value)) for (const [index, member] of value.entries()) sourcesByPath(member, joinPath(path, index), found);
869
- else if (isPlainObject(value)) for (const [key, member] of Object.entries(value)) sourcesByPath(member, joinPath(path, key), found);
904
+ function sourcesByPath(value, path = "", found = /* @__PURE__ */ new Map(), ancestors = /* @__PURE__ */ new Set()) {
905
+ if (isSecretSource(value) || isParamSource(value)) {
906
+ found.set(path, sourceOriginOf(value)?.source ?? value);
907
+ return found;
908
+ }
909
+ if (!Array.isArray(value) && !isPlainObject(value)) return found;
910
+ if (ancestors.has(value)) return found;
911
+ ancestors.add(value);
912
+ const entries = Array.isArray(value) ? value.map((member, index) => [index, member]) : Object.entries(value);
913
+ for (const [key, member] of entries) sourcesByPath(member, joinPath(path, key), found, ancestors);
914
+ ancestors.delete(value);
870
915
  return found;
871
916
  }
872
917
  function validateModuleInput(entry, resolved, environment) {
@@ -899,11 +944,18 @@ function validateModuleInput(entry, resolved, environment) {
899
944
  };
900
945
  return restore(result.value, "");
901
946
  }
947
+ function refuseSourcesInParams(params) {
948
+ for (const { serviceAddress, slot, binding } of params) {
949
+ const [source] = pointersIn(binding);
950
+ if (source === void 0) continue;
951
+ throw new LoadError(`Service "${serviceAddress}" binds its param "${slot}" to ${sourceOriginOf(source)?.label ?? "a source"}, a value known only at boot. A param takes a literal or a value the deploy has. Bind the value to a field of the service's input instead.`);
952
+ }
953
+ }
902
954
  function refusePointersInProps(address, props) {
903
955
  const seen = /* @__PURE__ */ new WeakSet();
904
956
  const walk = (value, path) => {
905
957
  if (isSecretSource(value) || isParamSource(value)) {
906
- const label = sourceOriginOf(value)?.label ?? (isSecretSource(value) ? "a secret source" : "a param source");
958
+ const label = sourceOriginOf(value)?.label ?? "a source";
907
959
  throw new LoadError(`${describeSite({
908
960
  address,
909
961
  kind: "props",
@@ -925,22 +977,12 @@ function refusePointersInProps(address, props) {
925
977
  function resolveValues(input) {
926
978
  const { environment } = input;
927
979
  const rootFields = /* @__PURE__ */ new Map();
928
- const keysRead = /* @__PURE__ */ new Map();
929
- /** The text the app configuration holds for `key`, recorded; `undefined` when it holds none or `''`. */
930
- const configurationText = (key, label, site) => {
931
- let raw;
932
- if (input.appConfigurationRead !== void 0) raw = input.appConfigurationRead.configurationKeyText[key];
933
- else if (input.configuration !== void 0) raw = input.configuration[key];
934
- 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.`);
935
- 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.`);
936
- const text = raw === void 0 || raw === "" ? void 0 : raw;
937
- keysRead.set(key, {
938
- label,
939
- text
940
- });
941
- return text;
942
- };
943
980
  const secretUses = /* @__PURE__ */ new Map();
981
+ for (const [address, value] of input.valueResources) if (isSecretSource(value)) secretUses.set(value, {
982
+ source: value,
983
+ address,
984
+ nodeKind: "resource"
985
+ });
944
986
  const recordSecret = (source, site) => {
945
987
  const canonical = canonicalSecret(source);
946
988
  if (secretUses.has(canonical)) return;
@@ -950,8 +992,8 @@ function resolveValues(input) {
950
992
  nodeKind: nodeKindOf(site)
951
993
  });
952
994
  };
953
- const secretSourcesReceivedBy = (inputBindings, params) => {
954
- for (const { serviceAddress, binding } of [...inputBindings, ...params]) for (const pointer of pointersIn(binding)) {
995
+ const secretSourcesReceivedBy = (inputBindings) => {
996
+ for (const { serviceAddress, binding } of inputBindings) for (const pointer of pointersIn(binding)) {
955
997
  if (!isSecretSource(pointer)) continue;
956
998
  const canonical = canonicalSecret(pointer);
957
999
  if (secretUses.get(canonical)?.nodeKind === "service") continue;
@@ -1001,14 +1043,11 @@ function resolveValues(input) {
1001
1043
  break;
1002
1044
  case "source":
1003
1045
  if (isSecretSource(origin.source)) recordSecret(origin.source, site);
1004
- if (origin.sourceKind === "secret" || origin.configurationKey === void 0) result = origin.source;
1005
- else result = configurationText(origin.configurationKey, origin.label, site);
1046
+ result = origin.source;
1006
1047
  break;
1007
1048
  case "computed": {
1008
1049
  const args = origin.dependencies.map((dependency) => {
1009
1050
  const real = resolveOne(dependency, site);
1010
- const source = originOf(dependency);
1011
- 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.`);
1012
1051
  refusePointerDependency(fnLabelFor(site), dependency, real);
1013
1052
  return real;
1014
1053
  });
@@ -1066,35 +1105,11 @@ function resolveValues(input) {
1066
1105
  return validated;
1067
1106
  };
1068
1107
  const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isLoadRoot)?.moduleAddress ?? "";
1069
- const appConfigurationReadOf = (inputBindings, params, secretSources) => {
1070
- if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
1071
- const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
1072
- binding,
1073
- site: {
1074
- address: serviceAddress,
1075
- kind: "serviceInput",
1076
- path: ""
1077
- }
1078
- })), ...params.map(({ serviceAddress, slot, binding }) => ({
1079
- binding,
1080
- site: {
1081
- address: serviceAddress,
1082
- kind: "param",
1083
- path: slot
1084
- }
1085
- }))];
1086
- for (const { binding, site } of kept) for (const pointer of pointersIn(binding)) {
1087
- if (!isParamSource(pointer)) continue;
1088
- const origin = sourceOriginOf(pointer);
1089
- if (origin?.sourceKind === "param" && origin.configurationKey !== void 0) configurationText(origin.configurationKey, origin.label, site);
1090
- }
1091
- }
1108
+ const appConfigurationReadOf = (secretSources) => {
1092
1109
  for (const use of secretSources) {
1093
1110
  const origin = sourceOriginOf(use.source);
1094
1111
  if (origin?.sourceKind !== "secret") continue;
1095
1112
  const key = origin.secretsKey;
1096
- const read = key === void 0 ? void 0 : keysRead.get(key);
1097
- 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.`);
1098
1113
  const field = [...rootFields.values()].find((candidate) => candidate.path[0] === key);
1099
1114
  if (key !== void 0 && field !== void 0) throw new LoadError(`${inputFieldLabel({
1100
1115
  kind: "input",
@@ -1110,25 +1125,21 @@ function resolveValues(input) {
1110
1125
  path: field.path
1111
1126
  })} 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.`);
1112
1127
  }
1113
- const configurationKeyText = {};
1114
- for (const [key, { text }] of keysRead) if (text !== void 0) configurationKeyText[key] = text;
1115
- return {
1116
- rootInput: [...rootFields.values()],
1117
- configurationKeyText
1118
- };
1128
+ return { rootInput: [...rootFields.values()] };
1119
1129
  };
1120
1130
  for (const entry of input.moduleInputs) validatedInputOf(entry);
1121
1131
  for (const { value, site } of found) resolveOne(value, site);
1122
1132
  const authoredProps = new Map([...input.resources].map(([address, resource]) => [address, resource.props]));
1123
1133
  if (found.length === 0) {
1124
1134
  for (const [address, props] of authoredProps) refusePointersInProps(address, props);
1125
- const secretSources = secretSourcesReceivedBy(input.inputBindings, input.params);
1135
+ refuseSourcesInParams(input.params);
1136
+ const secretSources = secretSourcesReceivedBy(input.inputBindings);
1126
1137
  return {
1127
1138
  inputBindings: input.inputBindings,
1128
1139
  params: input.params,
1129
1140
  resourceProps: authoredProps,
1130
1141
  secretSources,
1131
- appConfigurationRead: appConfigurationReadOf(input.inputBindings, input.params, secretSources)
1142
+ appConfigurationRead: appConfigurationReadOf(secretSources)
1132
1143
  };
1133
1144
  }
1134
1145
  const inProgress = /* @__PURE__ */ new WeakSet();
@@ -1154,15 +1165,28 @@ function resolveValues(input) {
1154
1165
  binding
1155
1166
  }];
1156
1167
  });
1157
- const secretSources = secretSourcesReceivedBy(inputBindings, params);
1168
+ refuseSourcesInParams(params);
1169
+ const secretSources = secretSourcesReceivedBy(inputBindings);
1158
1170
  return {
1159
1171
  resourceProps,
1160
1172
  inputBindings,
1161
1173
  params,
1162
1174
  secretSources,
1163
- appConfigurationRead: appConfigurationReadOf(inputBindings, params, secretSources)
1175
+ appConfigurationRead: appConfigurationReadOf(secretSources)
1164
1176
  };
1165
1177
  }
1178
+ function valueReadsOf(inputBindings) {
1179
+ const reads = [];
1180
+ for (const { serviceAddress, binding } of inputBindings) for (const [path, source] of sourcesByPath(binding)) {
1181
+ const resource = sourceOriginOf(source)?.resource;
1182
+ if (resource !== void 0) reads.push({
1183
+ reader: serviceAddress,
1184
+ resource,
1185
+ path
1186
+ });
1187
+ }
1188
+ return reads;
1189
+ }
1166
1190
  /**
1167
1191
  * Brands a ref-port with the AUTHORED endpoint it stands for — which port of
1168
1192
  * which node the author wired, before any forwarding chain resolves. Read
@@ -1234,6 +1258,9 @@ function producerIdOf(ref) {
1234
1258
  * identity the branding copy creates, never on reading this back.
1235
1259
  */
1236
1260
  const MODULE_INPUT_KEY = Symbol("prisma:module-input-key");
1261
+ function describeNode(node) {
1262
+ return valueResourceOrigin(node)?.label ?? `${node.kind} "${node.name}"`;
1263
+ }
1237
1264
  /** Whether `ref` carries a callable `satisfies` that accepts `required` truthily. */
1238
1265
  function satisfiesRequired(ref, required) {
1239
1266
  return typeof ref === "object" && ref !== null && "satisfies" in ref && typeof ref.satisfies === "function" && ref.satisfies(required);
@@ -1303,9 +1330,9 @@ function validateServiceParamBinding(child, id, paramWiring, enclosingModuleName
1303
1330
  * children carry it as their `parent`, and this module's own boundary ports
1304
1331
  * (and the authored edges touching them) are recorded against it.
1305
1332
  */
1306
- function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading) {
1333
+ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading) {
1307
1334
  ports.push(...boundaryPortsOf(selfId, moduleNode));
1308
- const localIds = /* @__PURE__ */ new Set();
1335
+ const localNodes = /* @__PURE__ */ new Map();
1309
1336
  const used = /* @__PURE__ */ new Set();
1310
1337
  const ctxInputs = {};
1311
1338
  for (const key of Object.keys(moduleNode.deps)) {
@@ -1355,13 +1382,20 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1355
1382
  if (isValue(id)) throw new LoadError(`provision() received a value as its id (module "${moduleNode.name}"). A value can configure a node, never decide its address: the graph is the same whatever inputs Composer is given (ADR-0062).`);
1356
1383
  if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
1357
1384
  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.)`);
1358
- if (localIds.has(id)) throw new LoadError(`Duplicate provision id "${id}" in module "${moduleNode.name}".`);
1385
+ const fullAddress = `${selfId}.${id}`;
1359
1386
  const untrusted = child;
1360
1387
  if (!isNode(untrusted) || untrusted.kind !== "service" && untrusted.kind !== "resource" && untrusted.kind !== "module") throw new LoadError(`provision("${id}") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);
1361
1388
  if (untrusted.kind === "module" && typeof untrusted.isRoot === "function" && untrusted.isRoot()) throw new LoadError(`Module "${selfId}" provisions the app root "${untrusted.name}". An app root is the deploy's entry and cannot be provisioned. Build the module with module() instead.`);
1362
- localIds.add(id);
1363
- const fullAddress = `${selfId}.${id}`;
1389
+ const holder = localNodes.get(id);
1390
+ if (holder !== void 0) throw new LoadError(`Duplicate provision id "${id}" in module "${selfId}": "${fullAddress}" already holds ${describeNode(holder)}, and ${describeNode(child)} takes the same id. Give one of them a different id with provision(node, { id: '…' }).`);
1391
+ localNodes.set(id, child);
1364
1392
  if (child.kind === "resource") {
1393
+ const valueOrigin = valueResourceOrigin(child);
1394
+ if (valueOrigin !== void 0) {
1395
+ if (typeof moduleNode.isRoot !== "function" || !moduleNode.isRoot()) throw new LoadError(`Module "${selfId}" provisions "${id}", a resource that is a value. Only the app root, built with appRoot(), can provision one. Provision it in the root and pass its value down through this module's input.`);
1396
+ const also = child.provides !== void 0 ? "provides a contract" : Object.keys(slotsOf(child)).length > 0 ? "declares dependency slots" : void 0;
1397
+ if (also !== void 0) throw new LoadError(`Resource "${fullAddress}" is a value and also ${also}. A resource that is a value provides no contract and has no dependencies.`);
1398
+ }
1365
1399
  if (provisionWiring !== void 0) throw new LoadError(`provision("${id}") received deps for a resource — a resource's slots are wired when it is constructed, not at provision().`);
1366
1400
  if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a resource — a resource has no secret slots to satisfy.`);
1367
1401
  if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a resource — a resource declares no input schema.`);
@@ -1394,6 +1428,11 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1394
1428
  targetKind: "resource",
1395
1429
  enclosingModuleName: moduleNode.name
1396
1430
  });
1431
+ if (valueOrigin !== void 0) {
1432
+ const value = provisionedValue(valueOrigin, fullAddress);
1433
+ valueResources.set(fullAddress, value);
1434
+ return value;
1435
+ }
1397
1436
  return refForResource(fullAddress, child);
1398
1437
  }
1399
1438
  for (const [input, ref] of Object.entries(provisionWiring ?? {})) if (isValue(ref)) throw new LoadError(`The deps for "${fullAddress}.${input}" are bound to a value. A value can configure a node, never decide its edges: the graph is the same whatever inputs Composer is given (ADR-0062).`);
@@ -1401,7 +1440,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1401
1440
  markUsed(Object.values(localWiring));
1402
1441
  const localParams = { ...provisionParams ?? {} };
1403
1442
  if (child.kind === "service") {
1404
- 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.`);
1443
+ if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a service — a service takes its secrets as values bound to secretString() fields of its \`input\` binding, not a secrets map.`);
1405
1444
  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.`);
1406
1445
  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}").`);
1407
1446
  if (provisionInput !== void 0) inputBindings.push({
@@ -1453,7 +1492,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
1453
1492
  targetKind: "module",
1454
1493
  enclosingModuleName: moduleNode.name
1455
1494
  });
1456
- const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
1495
+ const childOutputs = flatten(child, fullAddress, localWiring, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
1457
1496
  nodes.push({
1458
1497
  id: fullAddress,
1459
1498
  parent: selfId,
@@ -1528,11 +1567,12 @@ function loadModule(root, opts) {
1528
1567
  const inputBindings = [];
1529
1568
  const paramBindings = [];
1530
1569
  const byId = /* @__PURE__ */ new Map();
1570
+ const valueResources = /* @__PURE__ */ new Map();
1531
1571
  const ports = [];
1532
1572
  const authoredEdges = [];
1533
1573
  const loading = { sealed: false };
1534
1574
  try {
1535
- flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, ports, authoredEdges, loading);
1575
+ flatten(root, rootId, {}, nodes, edges, pending, inputBindings, paramBindings, moduleInputs, byId, valueResources, ports, authoredEdges, loading);
1536
1576
  for (const entry of pending) validateWiring(entry, byId);
1537
1577
  assertDependencyDag(edges);
1538
1578
  } finally {
@@ -1542,12 +1582,11 @@ function loadModule(root, opts) {
1542
1582
  for (const [address, node] of byId) if (node.kind === "resource") resources.set(address, node);
1543
1583
  const resolved = resolveValues({
1544
1584
  environment: opts?.environment,
1545
- configuration: opts?.configuration,
1546
- appConfigurationRead: opts?.appConfigurationRead,
1547
1585
  inputBindings,
1548
1586
  params: paramBindings,
1549
1587
  moduleInputs,
1550
- resources
1588
+ resources,
1589
+ valueResources
1551
1590
  });
1552
1591
  const resolvedNodes = nodes.map((entry) => {
1553
1592
  const props = resolved.resourceProps.get(entry.id);
@@ -1571,6 +1610,7 @@ function loadModule(root, opts) {
1571
1610
  inputBindings: resolved.inputBindings,
1572
1611
  params: resolved.params,
1573
1612
  secretSources: resolved.secretSources,
1613
+ valueReads: valueReadsOf(resolved.inputBindings),
1574
1614
  appConfigurationRead: resolved.appConfigurationRead
1575
1615
  };
1576
1616
  }
@@ -1658,6 +1698,6 @@ function nodeAddresses(graph) {
1658
1698
  return graph.nodes.map(({ id }) => id).sort();
1659
1699
  }
1660
1700
  //#endregion
1661
- export { slotsOf as C, service as S, provisionNeed as _, appRoot as a, secretSource as b, freezeNode as c, isProvisionNeed as d, isSecretSource as f, paramSource as g, nodeAddresses as h, ResourceNodeBase as i, isNode as l, module as m, LoadError as n, assertAppName as o, isValue as p, RESOURCE_OUT_PORT as r, dependency as s, Load as t, isParamSource as u, resolve as v, secretsKeys as x, resource as y };
1701
+ export { secretsKeys as C, valueResource as E, secretSource as S, slotsOf as T, nodeAddresses as _, ResourceNodeBase as a, resolve as b, dependency as c, isParamSource as d, isProvisionNeed as f, module as g, isValueResource as h, RESOURCE_OUT_PORT as i, freezeNode as l, isValue as m, Load as n, appRoot as o, isSecretSource as p, LoadError as r, assertAppName as s, GraphCheckError as t, isNode as u, paramSource as v, service as w, resource as x, provisionNeed as y };
1662
1702
 
1663
- //# sourceMappingURL=graph-CBt9CRBT-yMupsISb.mjs.map
1703
+ //# sourceMappingURL=graph-K7VOpCAj-D6UHSltu.mjs.map