@prisma/composer 0.3.0-dev.8 → 0.3.0

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 (63) hide show
  1. package/dist/{app-config-C_AkdBtt-D0rtdLlj.d.mts → app-config-Dw3r7sUa-D3dr8rg2.d.mts} +4 -4
  2. package/dist/{app-config-C_AkdBtt-D0rtdLlj.d.mts.map → app-config-Dw3r7sUa-D3dr8rg2.d.mts.map} +1 -1
  3. package/dist/bin.mjs +32 -56
  4. package/dist/bin.mjs.map +1 -1
  5. package/dist/{casts-DpaahrlC-C5XMnP9S.mjs → casts-Ci5rYYaR.mjs} +2 -2
  6. package/dist/casts-Ci5rYYaR.mjs.map +1 -0
  7. package/dist/casts.mjs +1 -1
  8. package/dist/config-121C4hAb.d.mts +1 -0
  9. package/dist/config.d.mts +2 -2
  10. package/dist/deploy-121C4hAb.d.mts +1 -0
  11. package/dist/{deploy-C4DxNkJ9-D73lmBqy.mjs → deploy-H3PKi0ZR-Chgm12Bn.mjs} +3 -3
  12. package/dist/{deploy-C4DxNkJ9-D73lmBqy.mjs.map → deploy-H3PKi0ZR-Chgm12Bn.mjs.map} +1 -1
  13. package/dist/deploy.d.mts +2 -2
  14. package/dist/deploy.mjs +1 -1
  15. package/dist/{dist-CG0jqp27.mjs → dist-BkSJOwTm.mjs} +75 -11
  16. package/dist/dist-BkSJOwTm.mjs.map +1 -0
  17. package/dist/{graph-DgbALPDo-BEHF94BN.mjs → graph-CP16cJyH-D5IW87Y-.mjs} +41 -60
  18. package/dist/graph-CP16cJyH-D5IW87Y-.mjs.map +1 -0
  19. package/dist/{graph-CNZcSnM6-Do0zmuzA.d.mts → graph-DUSgjmzA-DhtkTqoz.d.mts} +3 -3
  20. package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts.map +1 -0
  21. package/dist/{graph-types-DcBX92Gs-Dnhu7wre.d.mts → graph-types-BcbVhojU-C3fhxjPK.d.mts} +86 -86
  22. package/dist/graph-types-BcbVhojU-C3fhxjPK.d.mts.map +1 -0
  23. package/dist/index-BFBNz7Aw.d.mts +32 -0
  24. package/dist/index-BFBNz7Aw.d.mts.map +1 -0
  25. package/dist/index.d.mts +4 -5
  26. package/dist/index.mjs +3 -4
  27. package/dist/local-target.d.mts +1 -1
  28. package/dist/local-target.mjs +1 -1
  29. package/dist/local-target.mjs.map +1 -1
  30. package/dist/{nextjs-DLyeRR7M-xWd8GKgK.d.mts → nextjs-DLyeRR7M-DwnBjryZ.d.mts} +3 -3
  31. package/dist/{nextjs-DLyeRR7M-xWd8GKgK.d.mts.map → nextjs-DLyeRR7M-DwnBjryZ.d.mts.map} +1 -1
  32. package/dist/nextjs-control.d.mts +4 -4
  33. package/dist/nextjs.d.mts +1 -1
  34. package/dist/node-control.d.mts +3 -3
  35. package/dist/node.d.mts +2 -2
  36. package/dist/report.d.mts +2 -2
  37. package/dist/report.mjs +0 -4
  38. package/dist/report.mjs.map +1 -1
  39. package/dist/service-rpc.d.mts +2 -2
  40. package/dist/service-rpc.mjs +3 -3
  41. package/dist/testing.d.mts +11 -17
  42. package/dist/testing.d.mts.map +1 -1
  43. package/dist/testing.mjs +20 -12
  44. package/dist/testing.mjs.map +1 -1
  45. package/package.json +11 -12
  46. package/dist/arktype.d.mts +0 -16
  47. package/dist/arktype.d.mts.map +0 -1
  48. package/dist/arktype.mjs +0 -22
  49. package/dist/arktype.mjs.map +0 -1
  50. package/dist/casts-DpaahrlC-C5XMnP9S.mjs.map +0 -1
  51. package/dist/config-B1rI-XeI.d.mts +0 -1
  52. package/dist/deploy-B1rI-XeI.d.mts +0 -1
  53. package/dist/dist-CG0jqp27.mjs.map +0 -1
  54. package/dist/graph-CNZcSnM6-Do0zmuzA.d.mts.map +0 -1
  55. package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +0 -1
  56. package/dist/graph-types-DcBX92Gs-Dnhu7wre.d.mts.map +0 -1
  57. package/dist/index-BkJ2OjXF.d.mts +0 -22
  58. package/dist/index-BkJ2OjXF.d.mts.map +0 -1
  59. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
  60. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
  61. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs +0 -55
  62. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
  63. package/src/exports/arktype.ts +0 -1
@@ -1,4 +1,4 @@
1
- //#region ../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs
1
+ //#region ../../0-framework/0-foundation/foundation/dist/casts.mjs
2
2
  /**
3
3
  * **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**
4
4
  *
@@ -79,4 +79,4 @@ function castAs(value) {
79
79
  //#endregion
80
80
  export { castAs as n, blindCast as t };
81
81
 
82
- //# sourceMappingURL=casts-DpaahrlC-C5XMnP9S.mjs.map
82
+ //# sourceMappingURL=casts-Ci5rYYaR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"casts-Ci5rYYaR.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/casts.mjs"],"sourcesContent":["//#region src/casts.ts\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n/**\n* Type-checked, runtime pass-through alternative to a bare `as Type` cast.\n*\n* Use `castAs` when the value already satisfies the target type but you want to make\n* the type assertion explicit at the call site — for example, when an inferred type is\n* wider than the type you want to publish, or when a literal object should be tagged\n* with its nominal interface. Unlike {@link blindCast}, the compiler still checks that\n* the value is assignable to the target type, so this helper cannot smuggle in an\n* unsafe assertion.\n*\n* `castAs` exists alongside `blindCast` so authors pick the right name at the call\n* site: a `castAs` is type-checked and benign; a `blindCast` is the unsafe escape\n* hatch. The split makes review faster — readers know which casts to scrutinize and\n* which are pure annotations.\n*\n* @example\n* ```typescript\n* interface FancyObject {\n* key: string;\n* keyTwo: {\n* subKey: string;\n* subKeyTwo: number;\n* };\n* }\n*\n* const typedObject = castAs<FancyObject>({\n* key: 'Chookede',\n* keyTwo: {\n* subKey: 'Choookeeeee',\n* subKeyTwo: 2,\n* },\n* });\n* ```\n*\n* @typeParam Type - The type to constrain and tag the value with. The value must be assignable to `Type`.\n*/\nfunction castAs(value) {\n\treturn value;\n}\n//#endregion\nexport { blindCast, castAs };\n\n//# sourceMappingURL=casts.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,UAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,OAAO,OAAO;CACtB,OAAO;AACR"}
package/dist/casts.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as castAs, t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
1
+ import { n as castAs, t as blindCast } from "./casts-Ci5rYYaR.mjs";
2
2
  export { blindCast, castAs };
@@ -0,0 +1 @@
1
+ import "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { D as PreflightInput, F as containerEnv, I as containerEnvVarName, L as defineConfig, M as StateDescriptor, N as TeardownInput, O as PrismaAppConfig, R as deserializeContainers, _ as LocalTargetProvidersInput, c as DEV_DIR, f as ExtensionDescriptor, g as LocalTargetEmulatorsInput, h as LocalTargetDescriptor, m as LocalTargetAttachment, o as ContainerDescriptor, p as LocalTargetAttachInput, s as ContainerInstance, v as LocateContainerInput, w as NodeDescriptor, z as isBuildOnlyExtension } from "./app-config-C_AkdBtt-D0rtdLlj.mjs";
2
- import "./config-B1rI-XeI.mjs";
1
+ import { D as PreflightInput, F as containerEnv, I as containerEnvVarName, L as defineConfig, M as StateDescriptor, N as TeardownInput, O as PrismaAppConfig, R as deserializeContainers, _ as LocalTargetProvidersInput, c as DEV_DIR, f as ExtensionDescriptor, g as LocalTargetEmulatorsInput, h as LocalTargetDescriptor, m as LocalTargetAttachment, o as ContainerDescriptor, p as LocalTargetAttachInput, s as ContainerInstance, v as LocateContainerInput, w as NodeDescriptor, z as isBuildOnlyExtension } from "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
2
+ import "./config-121C4hAb.mjs";
3
3
  export { type ContainerDescriptor, type ContainerInstance, DEV_DIR, ExtensionDescriptor, LocalTargetAttachInput, LocalTargetAttachment, LocalTargetDescriptor, LocalTargetEmulatorsInput, LocalTargetProvidersInput, type LocateContainerInput, NodeDescriptor, PreflightInput, PrismaAppConfig, StateDescriptor, TeardownInput, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, isBuildOnlyExtension };
@@ -0,0 +1 @@
1
+ import "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
@@ -1,9 +1,9 @@
1
- import { s as isParamSource, t as Load } from "./graph-DgbALPDo-BEHF94BN.mjs";
1
+ import { s as isParamSource, t as Load } from "./graph-CP16cJyH-D5IW87Y-.mjs";
2
2
  import { r as deserializeContainers } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
3
3
  import * as Alchemy from "alchemy";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as Layer from "effect/Layer";
6
- //#region ../../0-framework/1-core/core/dist/deploy-C4DxNkJ9.mjs
6
+ //#region ../../0-framework/1-core/core/dist/deploy-H3PKi0ZR.mjs
7
7
  var LowerError = class extends Error {
8
8
  constructor(message) {
9
9
  super(message);
@@ -310,4 +310,4 @@ function lower(root, config, opts) {
310
310
  //#endregion
311
311
  export { lowering as a, lower as i, buildConfig as n, mergedProviders as o, joinDeployment as r, resolveStateLayer as s, LowerError as t };
312
312
 
313
- //# sourceMappingURL=deploy-C4DxNkJ9-D73lmBqy.mjs.map
313
+ //# sourceMappingURL=deploy-H3PKi0ZR-Chgm12Bn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-C4DxNkJ9-D73lmBqy.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy-C4DxNkJ9.mjs"],"sourcesContent":["import { o as isParamSource, t as Load } from \"./graph-DgbALPDo.mjs\";\nimport { r as deserializeContainers } from \"./container-transport-DKmKg5JQ.mjs\";\nimport * as Alchemy from \"alchemy\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n//#region src/control/deploy.ts\nvar LowerError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LowerError\";\n\t}\n};\n/**\n* Resolves one SERVICE-OWN param to its config value. The full resolution\n* order across both value channels:\n*\n* 1. A param claiming BOTH a provision-time binding and a `provision` need\n* (ADR-0031) is a loud error — two sources for one value.\n* 2. A provision-time binding (a schema-validated literal, or an opaque\n* `ParamSource` the target resolves at boot per ADR-0019) beats the\n* declared `default`.\n* 3. A framework-minted `provision` need is resolved per dependency EDGE\n* against the consumer extension's registry — that path fills CONNECTION\n* params in `buildConfig`'s inputs loop, never this function. A\n* service-own param has no edge to mint against, so an unbound need here\n* falls through like any unbound param.\n* 4. The `default`, else absent (only legal when `optional`), else a loud\n* error naming the param, the service, and the fix.\n*/\nfunction resolveParam(node, serviceId, name, param, bound) {\n\tif (bound !== void 0) {\n\t\tif (param.provision !== void 0) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has two sources claiming one value: a provision-time binding (${isParamSource(bound) ? \"a param source\" : \"a literal value\"}) AND a framework provision need (\"${String(param.provision.brand)}\") on its declaration — remove the binding or drop the \\`provision\\` facet.`);\n\t\tif (isParamSource(bound)) return bound;\n\t\tconst result = param.schema[\"~standard\"].validate(bound);\n\t\tif (result instanceof Promise) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") uses an async Standard Schema — a provision-time literal value requires a synchronous validator.`);\n\t\tif (result.issues !== void 0) {\n\t\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\t\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") received an invalid provision-time value: ${messages}`);\n\t\t}\n\t\treturn result.value;\n\t}\n\tif (param.default !== void 0) return param.default;\n\tif (param.optional === true) return void 0;\n\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has no default, is not optional, and was not bound at provision — bind it with a literal value or a param source (e.g. envParam('NAME')) on its provision() call, or give it a default.`);\n}\n/**\n* Assembles a service's typed Config. Connection params come from the\n* dependency edge's lowered outputs — or, for a param carrying a `provision`\n* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints\n* it, the producer hands nothing over. The service's own params resolve via\n* `resolveParam` (provision-time binding, then default, then loud\n* unbound-required failure).\n*\n* This is also where the connection contract is enforced: a producer that fails to\n* supply a required param its consumer's connection declares fails the deploy\n* here, naming the edge, rather than reaching the consumer as `undefined`.\n*/\nfunction buildConfig(node, id, graph, lowered, provisioned) {\n\tconst inputs = {};\n\tfor (const [inputName, inputNode] of Object.entries(node.inputs)) {\n\t\tconst edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === \"dependency\");\n\t\tconst producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};\n\t\tconst values = {};\n\t\tfor (const [name, param] of Object.entries(inputNode.connection.params)) {\n\t\t\tif (param.provision !== void 0) {\n\t\t\t\tvalues[name] = provisioned.get(`${id}.${inputName}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst value = producedOutputs[name];\n\t\t\tif (value === void 0 && param.optional !== true && edge !== void 0) throw new LowerError(`Connection input \"${id}.${inputName}\" declares param \"${name}\", but its producer \"${edge.from}\" did not supply it — the producer's outputs carry [${Object.keys(producedOutputs).join(\", \") || \"nothing\"}]. Add \"${name}\" to the outputs the producer returns from its lowering, or declare the param optional on the connection.`);\n\t\t\tvalues[name] = value;\n\t\t}\n\t\tinputs[inputName] = values;\n\t}\n\tconst boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));\n\tconst service = {};\n\tfor (const [name, param] of Object.entries(node.params)) {\n\t\tconst value = resolveParam(node, id, name, param, boundParams.get(name));\n\t\tif (value !== void 0) service[name] = value;\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n}\n/**\n* Joins resolved report entries back to their graph nodes — the last step of a\n* deploy report, run inside the Action with apply's resolved values.\n*\n* The entries cross Alchemy's action-input boundary, so they carry addresses\n* and plain entities only; the graph is held by closure on this side. That\n* split is why this join exists at all, and it is what keeps functions and\n* Standard Schemas (which a node carries, and which the plan's input hash\n* would have to serialize) out of the input.\n*\n* Skips an address the graph no longer holds: entries are data, the graph is\n* truth.\n*/\nfunction joinDeployment(graph, entries) {\n\tconst nodes = [];\n\tfor (const entry of entries) {\n\t\tconst node = graph.nodes.find((n) => n.id === entry.address)?.node;\n\t\tif (node === void 0 || node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tnodes.push({\n\t\t\taddress: entry.address,\n\t\t\tnode,\n\t\t\tentities: entry.entities\n\t\t});\n\t}\n\treturn nodes;\n}\nfunction missingBundleError(id) {\n\treturn new LowerError(`No bundle provided for service \"${id}\" (opts.bundles[\"${id}\"] is required).`);\n}\nfunction duplicateExtensionError(id) {\n\treturn new LowerError(`Extension \"${id}\" is listed more than once in \\`extensions\\` — each extension id must be unique.`);\n}\n/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */\nfunction extensionsById(config) {\n\tconst map = /* @__PURE__ */ new Map();\n\tfor (const extension of config.extensions) {\n\t\tif (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));\n\t\tmap.set(extension.id, extension);\n\t}\n\treturn Effect.succeed(map);\n}\nfunction unknownExtensionError(extension, id) {\n\treturn new LowerError(`No extension \"${extension}\" is configured (needed by node \"${id}\") — add it to prisma-composer.config.ts's \\`extensions\\` (import its /control entry and list its descriptor).`);\n}\nfunction unknownNodeTypeError(extension, type) {\n\treturn new LowerError(`Extension \"${extension.id}\" has no descriptor for node type \"${type}\" (known: ${Object.keys(extension.nodes).join(\", \")}).`);\n}\n/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */\nfunction unknownProvisionerError(extension, brand, edgeId) {\n\tconst known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(\", \") : \"(none registered)\";\n\treturn new LowerError(`Extension \"${extension.id}\" has no provisioner for need \"${String(brand)}\" (needed by edge \"${edgeId}\") (known: ${known}).`);\n}\n/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */\nfunction crossExtensionProvisionError(edgeId) {\n\treturn new LowerError(`Provisioned edge \"${edgeId}\" spans two extensions — cross-extension provisioned edges aren't supported yet.`);\n}\n/**\n* More than one provisioned param on one connection (ADR-0031). One edge mints\n* ONE value, keyed by edge id, so a second need on the same connection would\n* silently receive the first's value under the first's brand.\n*/\nfunction multipleProvisionedParamsError(edgeId, names) {\n\treturn new LowerError(`Connection input \"${edgeId}\" declares more than one provisioned param (${names.join(\", \")}) — only one provisioned param per connection is supported.`);\n}\nfunction wrongKindError(extension, type, expected, got) {\n\treturn new LowerError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${got}\" descriptor — this node needs a \"${expected}\" descriptor.`);\n}\n/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */\nfunction descriptorFor(extensions, node, id) {\n\tconst extension = extensions.get(node.extension);\n\tif (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));\n\tconst descriptor = extension.nodes[node.type];\n\tif (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));\n\tif (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\treturn Effect.succeed(descriptor);\n}\n/**\n* The state-layer precedence a deploy resolves to: an explicit opts.state\n* always wins; failing that, the config's own (required) state descriptor,\n* created with its owning extension's resolved container (`undefined` when\n* that extension declared none). A pure function so the precedence is\n* testable without booting Alchemy.\n*/\nfunction resolveStateLayer(opts, config, containers) {\n\treturn opts.state ?? config.state.create(containers.get(config.state.extension));\n}\n/**\n* All configured extensions' providers merged, config array order — an\n* extension without `providers` is skipped; no used-extensions-only\n* filtering (ADR-0017's pinned providers rule).\n*/\nfunction mergedProviders(config) {\n\tconst [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/**\n* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.\n* Fails with LowerError or whatever an extension's lowering raises — the error type is open.\n*/\nfunction lowering(root, config, opts) {\n\treturn Effect.gen(function* () {\n\t\tconst graph = Load(root, { id: opts.name });\n\t\tconst extensions = yield* extensionsById(config);\n\t\tconst containers = deserializeContainers(config.extensions, process.env);\n\t\tconst lowered = /* @__PURE__ */ new Map();\n\t\tconst entries = [];\n\t\tconst provisioned = /* @__PURE__ */ new Map();\n\t\tconst applications = /* @__PURE__ */ new Map();\n\t\tfor (const descriptor of config.extensions) {\n\t\t\tif (descriptor.application === void 0) continue;\n\t\t\tconst appCtx = {\n\t\t\t\tid: graph.root.id,\n\t\t\t\taddress: \"\",\n\t\t\t\tnode: graph.root.node,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: void 0,\n\t\t\t\tcontainer: containers.get(descriptor.id),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tapplications.set(descriptor.id, yield* descriptor.application.provision(appCtx));\n\t\t}\n\t\tfor (const edge of graph.edges) {\n\t\t\tif (edge.kind !== \"dependency\") continue;\n\t\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\t\tconst slot = consumer.inputs[edge.input];\n\t\t\tif (slot === void 0) continue;\n\t\t\tconst provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);\n\t\t\tif (provisionedParams.length === 0) continue;\n\t\t\tconst edgeId = `${edge.to}.${edge.input}`;\n\t\t\tif (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));\n\t\t\tconst need = provisionedParams[0]?.[1].provision;\n\t\t\tif (need === void 0) continue;\n\t\t\tconst provider = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\t\tif (provider === void 0 || provider.kind !== \"service\" && provider.kind !== \"resource\") continue;\n\t\t\tif (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));\n\t\t\tconst extension = extensions.get(consumer.extension);\n\t\t\tif (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));\n\t\t\tconst provisioner = extension.provisions?.get(need.brand);\n\t\t\tif (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));\n\t\t\tconst ref = yield* provisioner.provision({\n\t\t\t\tedgeId,\n\t\t\t\tconsumerAddress: edge.to,\n\t\t\t\tproviderAddress: edge.from,\n\t\t\t\tinput: edge.input,\n\t\t\t\tneed\n\t\t\t});\n\t\t\tprovisioned.set(edgeId, ref);\n\t\t}\n\t\tfor (const { id, node } of graph.nodes) {\n\t\t\tif (node.kind === \"module\") continue;\n\t\t\tif (node.kind === \"dependency\") continue;\n\t\t\tconst ctx = {\n\t\t\t\tid,\n\t\t\t\taddress: id,\n\t\t\t\tnode,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: applications.get(node.extension),\n\t\t\t\tcontainer: containers.get(node.extension),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tconst descriptor = yield* descriptorFor(extensions, node, id);\n\t\t\tif (descriptor.kind === \"resource\") {\n\t\t\t\tconst result = yield* descriptor(ctx);\n\t\t\t\tlowered.set(id, result.outputs);\n\t\t\t\tentries.push({\n\t\t\t\t\taddress: id,\n\t\t\t\t\tentities: result.entities\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (descriptor.kind !== \"service\") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\t\t\tconst service = node;\n\t\t\tconst provisionedNode = yield* descriptor.provision(ctx);\n\t\t\tconst typedConfig = buildConfig(service, id, graph, lowered, provisioned);\n\t\t\tconst serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);\n\t\t\tconst bundle = opts.bundles[id];\n\t\t\tif (bundle === void 0) return yield* Effect.fail(missingBundleError(id));\n\t\t\tconst artifact = yield* descriptor.package(ctx, {\n\t\t\t\tassembled: {\n\t\t\t\t\tdir: bundle.dir,\n\t\t\t\t\tentry: bundle.entry\n\t\t\t\t},\n\t\t\t\taddress: id\n\t\t\t});\n\t\t\tconst result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);\n\t\t\tlowered.set(id, result.outputs);\n\t\t\tentries.push({\n\t\t\t\taddress: id,\n\t\t\t\tentities: result.entities\n\t\t\t});\n\t\t}\n\t\tif (opts.report !== void 0) {\n\t\t\tconst report = opts.report;\n\t\t\tyield* Alchemy.Action(\"composer-deployment-report\", (input) => Effect.sync(() => {\n\t\t\t\treport({\n\t\t\t\t\tapp: opts.name,\n\t\t\t\t\tnodes: joinDeployment(graph, input.entries)\n\t\t\t\t});\n\t\t\t}))({\n\t\t\t\tnonce: Date.now(),\n\t\t\t\tentries\n\t\t\t});\n\t\t}\n\t});\n}\n/**\n* The whole-stack wrapper: Load → route each node through the config's\n* extension registries → an Alchemy Stack (the default export the alchemy\n* CLI consumes).\n*/\nfunction lower(root, config, opts) {\n\tconst stackEffect = Effect.orDie(lowering(root, config, opts));\n\tconst containers = deserializeContainers(config.extensions, process.env);\n\tconst providers = opts.providers ?? mergedProviders(config);\n\treturn Alchemy.Stack(opts.name, {\n\t\tproviders,\n\t\tstate: resolveStateLayer(opts, config, containers)\n\t}, stackEffect);\n}\n//#endregion\nexport { lowering as a, lower as i, buildConfig as n, mergedProviders as o, joinDeployment as r, resolveStateLayer as s, LowerError as t };\n\n//# sourceMappingURL=deploy-C4DxNkJ9.mjs.map"],"mappings":";;;;;;AAMA,IAAI,aAAa,cAAc,MAAM;CACpC,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;;AAkBA,SAAS,aAAa,MAAM,WAAW,MAAM,OAAO,OAAO;CAC1D,IAAI,UAAU,KAAK,GAAG;EACrB,IAAI,MAAM,cAAc,KAAK,GAAG,MAAM,IAAI,WAAW,UAAU,KAAK,QAAQ,UAAU,cAAc,KAAK,KAAK,mEAAmE,cAAc,KAAK,IAAI,mBAAmB,kBAAkB,qCAAqC,OAAO,MAAM,UAAU,KAAK,EAAE,4EAA4E;EAC5X,IAAI,cAAc,KAAK,GAAG,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,GAAG;GAC3B,MAAM,SAAS,KAAK;GACpB,OAAO,QAAQ,OAAO,+BAA+B,UAAU,OAAO,WAAW;IAChF,OAAO;KACN,KAAK,KAAK;KACV,OAAO,eAAe,OAAO,MAAM,OAAO;IAC3C,CAAC;GACF,CAAC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,IAAI;IAChB;GACD,CAAC;EACF;CACD,CAAC;AACF;;;;;;AAMA,SAAS,MAAM,MAAM,QAAQ,MAAM;CAClC,MAAM,cAAc,OAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,CAAC;CAC7D,MAAM,aAAa,sBAAsB,OAAO,YAAY,QAAQ,GAAG;CACvE,MAAM,YAAY,KAAK,aAAa,gBAAgB,MAAM;CAC1D,OAAO,QAAQ,MAAM,KAAK,MAAM;EAC/B;EACA,OAAO,kBAAkB,MAAM,QAAQ,UAAU;CAClD,GAAG,WAAW;AACf"}
1
+ {"version":3,"file":"deploy-H3PKi0ZR-Chgm12Bn.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy-H3PKi0ZR.mjs"],"sourcesContent":["import { o as isParamSource, t as Load } from \"./graph-CP16cJyH.mjs\";\nimport { r as deserializeContainers } from \"./container-transport-DKmKg5JQ.mjs\";\nimport * as Alchemy from \"alchemy\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n//#region src/control/deploy.ts\nvar LowerError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LowerError\";\n\t}\n};\n/**\n* Resolves one SERVICE-OWN param to its config value. The full resolution\n* order across both value channels:\n*\n* 1. A param claiming BOTH a provision-time binding and a `provision` need\n* (ADR-0031) is a loud error — two sources for one value.\n* 2. A provision-time binding (a schema-validated literal, or an opaque\n* `ParamSource` the target resolves at boot per ADR-0019) beats the\n* declared `default`.\n* 3. A framework-minted `provision` need is resolved per dependency EDGE\n* against the consumer extension's registry — that path fills CONNECTION\n* params in `buildConfig`'s inputs loop, never this function. A\n* service-own param has no edge to mint against, so an unbound need here\n* falls through like any unbound param.\n* 4. The `default`, else absent (only legal when `optional`), else a loud\n* error naming the param, the service, and the fix.\n*/\nfunction resolveParam(node, serviceId, name, param, bound) {\n\tif (bound !== void 0) {\n\t\tif (param.provision !== void 0) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has two sources claiming one value: a provision-time binding (${isParamSource(bound) ? \"a param source\" : \"a literal value\"}) AND a framework provision need (\"${String(param.provision.brand)}\") on its declaration — remove the binding or drop the \\`provision\\` facet.`);\n\t\tif (isParamSource(bound)) return bound;\n\t\tconst result = param.schema[\"~standard\"].validate(bound);\n\t\tif (result instanceof Promise) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") uses an async Standard Schema — a provision-time literal value requires a synchronous validator.`);\n\t\tif (result.issues !== void 0) {\n\t\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\t\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") received an invalid provision-time value: ${messages}`);\n\t\t}\n\t\treturn result.value;\n\t}\n\tif (param.default !== void 0) return param.default;\n\tif (param.optional === true) return void 0;\n\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has no default, is not optional, and was not bound at provision — bind it with a literal value or a param source (e.g. envParam('NAME')) on its provision() call, or give it a default.`);\n}\n/**\n* Assembles a service's typed Config. Connection params come from the\n* dependency edge's lowered outputs — or, for a param carrying a `provision`\n* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints\n* it, the producer hands nothing over. The service's own params resolve via\n* `resolveParam` (provision-time binding, then default, then loud\n* unbound-required failure).\n*\n* This is also where the connection contract is enforced: a producer that fails to\n* supply a required param its consumer's connection declares fails the deploy\n* here, naming the edge, rather than reaching the consumer as `undefined`.\n*/\nfunction buildConfig(node, id, graph, lowered, provisioned) {\n\tconst inputs = {};\n\tfor (const [inputName, inputNode] of Object.entries(node.inputs)) {\n\t\tconst edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === \"dependency\");\n\t\tconst producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};\n\t\tconst values = {};\n\t\tfor (const [name, param] of Object.entries(inputNode.connection.params)) {\n\t\t\tif (param.provision !== void 0) {\n\t\t\t\tvalues[name] = provisioned.get(`${id}.${inputName}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst value = producedOutputs[name];\n\t\t\tif (value === void 0 && param.optional !== true && edge !== void 0) throw new LowerError(`Connection input \"${id}.${inputName}\" declares param \"${name}\", but its producer \"${edge.from}\" did not supply it — the producer's outputs carry [${Object.keys(producedOutputs).join(\", \") || \"nothing\"}]. Add \"${name}\" to the outputs the producer returns from its lowering, or declare the param optional on the connection.`);\n\t\t\tvalues[name] = value;\n\t\t}\n\t\tinputs[inputName] = values;\n\t}\n\tconst boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));\n\tconst service = {};\n\tfor (const [name, param] of Object.entries(node.params)) {\n\t\tconst value = resolveParam(node, id, name, param, boundParams.get(name));\n\t\tif (value !== void 0) service[name] = value;\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n}\n/**\n* Joins resolved report entries back to their graph nodes — the last step of a\n* deploy report, run inside the Action with apply's resolved values.\n*\n* The entries cross Alchemy's action-input boundary, so they carry addresses\n* and plain entities only; the graph is held by closure on this side. That\n* split is why this join exists at all, and it is what keeps functions and\n* Standard Schemas (which a node carries, and which the plan's input hash\n* would have to serialize) out of the input.\n*\n* Skips an address the graph no longer holds: entries are data, the graph is\n* truth.\n*/\nfunction joinDeployment(graph, entries) {\n\tconst nodes = [];\n\tfor (const entry of entries) {\n\t\tconst node = graph.nodes.find((n) => n.id === entry.address)?.node;\n\t\tif (node === void 0 || node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tnodes.push({\n\t\t\taddress: entry.address,\n\t\t\tnode,\n\t\t\tentities: entry.entities\n\t\t});\n\t}\n\treturn nodes;\n}\nfunction missingBundleError(id) {\n\treturn new LowerError(`No bundle provided for service \"${id}\" (opts.bundles[\"${id}\"] is required).`);\n}\nfunction duplicateExtensionError(id) {\n\treturn new LowerError(`Extension \"${id}\" is listed more than once in \\`extensions\\` — each extension id must be unique.`);\n}\n/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */\nfunction extensionsById(config) {\n\tconst map = /* @__PURE__ */ new Map();\n\tfor (const extension of config.extensions) {\n\t\tif (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));\n\t\tmap.set(extension.id, extension);\n\t}\n\treturn Effect.succeed(map);\n}\nfunction unknownExtensionError(extension, id) {\n\treturn new LowerError(`No extension \"${extension}\" is configured (needed by node \"${id}\") — add it to prisma-composer.config.ts's \\`extensions\\` (import its /control entry and list its descriptor).`);\n}\nfunction unknownNodeTypeError(extension, type) {\n\treturn new LowerError(`Extension \"${extension.id}\" has no descriptor for node type \"${type}\" (known: ${Object.keys(extension.nodes).join(\", \")}).`);\n}\n/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */\nfunction unknownProvisionerError(extension, brand, edgeId) {\n\tconst known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(\", \") : \"(none registered)\";\n\treturn new LowerError(`Extension \"${extension.id}\" has no provisioner for need \"${String(brand)}\" (needed by edge \"${edgeId}\") (known: ${known}).`);\n}\n/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */\nfunction crossExtensionProvisionError(edgeId) {\n\treturn new LowerError(`Provisioned edge \"${edgeId}\" spans two extensions — cross-extension provisioned edges aren't supported yet.`);\n}\n/**\n* More than one provisioned param on one connection (ADR-0031). One edge mints\n* ONE value, keyed by edge id, so a second need on the same connection would\n* silently receive the first's value under the first's brand.\n*/\nfunction multipleProvisionedParamsError(edgeId, names) {\n\treturn new LowerError(`Connection input \"${edgeId}\" declares more than one provisioned param (${names.join(\", \")}) — only one provisioned param per connection is supported.`);\n}\nfunction wrongKindError(extension, type, expected, got) {\n\treturn new LowerError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${got}\" descriptor — this node needs a \"${expected}\" descriptor.`);\n}\n/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */\nfunction descriptorFor(extensions, node, id) {\n\tconst extension = extensions.get(node.extension);\n\tif (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));\n\tconst descriptor = extension.nodes[node.type];\n\tif (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));\n\tif (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\treturn Effect.succeed(descriptor);\n}\n/**\n* The state-layer precedence a deploy resolves to: an explicit opts.state\n* always wins; failing that, the config's own (required) state descriptor,\n* created with its owning extension's resolved container (`undefined` when\n* that extension declared none). A pure function so the precedence is\n* testable without booting Alchemy.\n*/\nfunction resolveStateLayer(opts, config, containers) {\n\treturn opts.state ?? config.state.create(containers.get(config.state.extension));\n}\n/**\n* All configured extensions' providers merged, config array order — an\n* extension without `providers` is skipped; no used-extensions-only\n* filtering (ADR-0017's pinned providers rule).\n*/\nfunction mergedProviders(config) {\n\tconst [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/**\n* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.\n* Fails with LowerError or whatever an extension's lowering raises — the error type is open.\n*/\nfunction lowering(root, config, opts) {\n\treturn Effect.gen(function* () {\n\t\tconst graph = Load(root, { id: opts.name });\n\t\tconst extensions = yield* extensionsById(config);\n\t\tconst containers = deserializeContainers(config.extensions, process.env);\n\t\tconst lowered = /* @__PURE__ */ new Map();\n\t\tconst entries = [];\n\t\tconst provisioned = /* @__PURE__ */ new Map();\n\t\tconst applications = /* @__PURE__ */ new Map();\n\t\tfor (const descriptor of config.extensions) {\n\t\t\tif (descriptor.application === void 0) continue;\n\t\t\tconst appCtx = {\n\t\t\t\tid: graph.root.id,\n\t\t\t\taddress: \"\",\n\t\t\t\tnode: graph.root.node,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: void 0,\n\t\t\t\tcontainer: containers.get(descriptor.id),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tapplications.set(descriptor.id, yield* descriptor.application.provision(appCtx));\n\t\t}\n\t\tfor (const edge of graph.edges) {\n\t\t\tif (edge.kind !== \"dependency\") continue;\n\t\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\t\tconst slot = consumer.inputs[edge.input];\n\t\t\tif (slot === void 0) continue;\n\t\t\tconst provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);\n\t\t\tif (provisionedParams.length === 0) continue;\n\t\t\tconst edgeId = `${edge.to}.${edge.input}`;\n\t\t\tif (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));\n\t\t\tconst need = provisionedParams[0]?.[1].provision;\n\t\t\tif (need === void 0) continue;\n\t\t\tconst provider = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\t\tif (provider === void 0 || provider.kind !== \"service\" && provider.kind !== \"resource\") continue;\n\t\t\tif (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));\n\t\t\tconst extension = extensions.get(consumer.extension);\n\t\t\tif (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));\n\t\t\tconst provisioner = extension.provisions?.get(need.brand);\n\t\t\tif (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));\n\t\t\tconst ref = yield* provisioner.provision({\n\t\t\t\tedgeId,\n\t\t\t\tconsumerAddress: edge.to,\n\t\t\t\tproviderAddress: edge.from,\n\t\t\t\tinput: edge.input,\n\t\t\t\tneed\n\t\t\t});\n\t\t\tprovisioned.set(edgeId, ref);\n\t\t}\n\t\tfor (const { id, node } of graph.nodes) {\n\t\t\tif (node.kind === \"module\") continue;\n\t\t\tif (node.kind === \"dependency\") continue;\n\t\t\tconst ctx = {\n\t\t\t\tid,\n\t\t\t\taddress: id,\n\t\t\t\tnode,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: applications.get(node.extension),\n\t\t\t\tcontainer: containers.get(node.extension),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tconst descriptor = yield* descriptorFor(extensions, node, id);\n\t\t\tif (descriptor.kind === \"resource\") {\n\t\t\t\tconst result = yield* descriptor(ctx);\n\t\t\t\tlowered.set(id, result.outputs);\n\t\t\t\tentries.push({\n\t\t\t\t\taddress: id,\n\t\t\t\t\tentities: result.entities\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (descriptor.kind !== \"service\") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\t\t\tconst service = node;\n\t\t\tconst provisionedNode = yield* descriptor.provision(ctx);\n\t\t\tconst typedConfig = buildConfig(service, id, graph, lowered, provisioned);\n\t\t\tconst serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);\n\t\t\tconst bundle = opts.bundles[id];\n\t\t\tif (bundle === void 0) return yield* Effect.fail(missingBundleError(id));\n\t\t\tconst artifact = yield* descriptor.package(ctx, {\n\t\t\t\tassembled: {\n\t\t\t\t\tdir: bundle.dir,\n\t\t\t\t\tentry: bundle.entry\n\t\t\t\t},\n\t\t\t\taddress: id\n\t\t\t});\n\t\t\tconst result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);\n\t\t\tlowered.set(id, result.outputs);\n\t\t\tentries.push({\n\t\t\t\taddress: id,\n\t\t\t\tentities: result.entities\n\t\t\t});\n\t\t}\n\t\tif (opts.report !== void 0) {\n\t\t\tconst report = opts.report;\n\t\t\tyield* Alchemy.Action(\"composer-deployment-report\", (input) => Effect.sync(() => {\n\t\t\t\treport({\n\t\t\t\t\tapp: opts.name,\n\t\t\t\t\tnodes: joinDeployment(graph, input.entries)\n\t\t\t\t});\n\t\t\t}))({\n\t\t\t\tnonce: Date.now(),\n\t\t\t\tentries\n\t\t\t});\n\t\t}\n\t});\n}\n/**\n* The whole-stack wrapper: Load → route each node through the config's\n* extension registries → an Alchemy Stack (the default export the alchemy\n* CLI consumes).\n*/\nfunction lower(root, config, opts) {\n\tconst stackEffect = Effect.orDie(lowering(root, config, opts));\n\tconst containers = deserializeContainers(config.extensions, process.env);\n\tconst providers = opts.providers ?? mergedProviders(config);\n\treturn Alchemy.Stack(opts.name, {\n\t\tproviders,\n\t\tstate: resolveStateLayer(opts, config, containers)\n\t}, stackEffect);\n}\n//#endregion\nexport { lowering as a, lower as i, buildConfig as n, mergedProviders as o, joinDeployment as r, resolveStateLayer as s, LowerError as t };\n\n//# sourceMappingURL=deploy-H3PKi0ZR.mjs.map"],"mappings":";;;;;;AAMA,IAAI,aAAa,cAAc,MAAM;CACpC,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;;AAkBA,SAAS,aAAa,MAAM,WAAW,MAAM,OAAO,OAAO;CAC1D,IAAI,UAAU,KAAK,GAAG;EACrB,IAAI,MAAM,cAAc,KAAK,GAAG,MAAM,IAAI,WAAW,UAAU,KAAK,QAAQ,UAAU,cAAc,KAAK,KAAK,mEAAmE,cAAc,KAAK,IAAI,mBAAmB,kBAAkB,qCAAqC,OAAO,MAAM,UAAU,KAAK,EAAE,4EAA4E;EAC5X,IAAI,cAAc,KAAK,GAAG,OAAO;EACjC,MAAM,SAAS,MAAM,OAAO,YAAY,CAAC,SAAS,KAAK;EACvD,IAAI,kBAAkB,SAAS,MAAM,IAAI,WAAW,UAA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AAK;KACV,OAAO,eAAe,OAAO,MAAM,OAAO;IAC3C,CAAC;GACF,CAAC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,IAAI;IAChB;GACD,CAAC;EACF;CACD,CAAC;AACF;;;;;;AAMA,SAAS,MAAM,MAAM,QAAQ,MAAM;CAClC,MAAM,cAAc,OAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,CAAC;CAC7D,MAAM,aAAa,sBAAsB,OAAO,YAAY,QAAQ,GAAG;CACvE,MAAM,YAAY,KAAK,aAAa,gBAAgB,MAAM;CAC1D,OAAO,QAAQ,MAAM,KAAK,MAAM;EAC/B;EACA,OAAO,kBAAkB,MAAM,QAAQ,UAAU;CAClD,GAAG,WAAW;AACf"}
package/dist/deploy.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as ProvisionerDescriptor, B as joinDeployment, C as Lowering, E as PackageInput, H as lowering, P as buildConfig, S as LoweredResult, T as Outputs, U as mergedProviders, V as lower, W as resolveStateLayer, a as Bundle, b as LowerError, d as DeploymentResult, i as AssembleInput, j as ServiceLowering, k as ProvisionEdge, l as DeployedEntity, n as ApplicationDescriptor, r as Artifact, t as AlchemyStateLayer, u as DeployedNode, x as LowerOptions, y as LowerContext } from "./app-config-C_AkdBtt-D0rtdLlj.mjs";
2
- import "./deploy-B1rI-XeI.mjs";
1
+ import { A as ProvisionerDescriptor, B as joinDeployment, C as Lowering, E as PackageInput, H as lowering, P as buildConfig, S as LoweredResult, T as Outputs, U as mergedProviders, V as lower, W as resolveStateLayer, a as Bundle, b as LowerError, d as DeploymentResult, i as AssembleInput, j as ServiceLowering, k as ProvisionEdge, l as DeployedEntity, n as ApplicationDescriptor, r as Artifact, t as AlchemyStateLayer, u as DeployedNode, x as LowerOptions, y as LowerContext } from "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
2
+ import "./deploy-121C4hAb.mjs";
3
3
  export { AlchemyStateLayer, ApplicationDescriptor, Artifact, AssembleInput, Bundle, DeployedEntity, DeployedNode, DeploymentResult, LowerContext, LowerError, LowerOptions, LoweredResult, Lowering, Outputs, PackageInput, ProvisionEdge, ProvisionerDescriptor, ServiceLowering, buildConfig, joinDeployment, lower, lowering, mergedProviders, resolveStateLayer };
package/dist/deploy.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as lowering, i as lower, n as buildConfig, o as mergedProviders, r as joinDeployment, s as resolveStateLayer, t as LowerError } from "./deploy-C4DxNkJ9-D73lmBqy.mjs";
1
+ import { a as lowering, i as lower, n as buildConfig, o as mergedProviders, r as joinDeployment, s as resolveStateLayer, t as LowerError } from "./deploy-H3PKi0ZR-Chgm12Bn.mjs";
2
2
  export { LowerError, buildConfig, joinDeployment, lower, lowering, mergedProviders, resolveStateLayer };
@@ -1,5 +1,43 @@
1
- import "./graph-DgbALPDo-BEHF94BN.mjs";
2
- import "./secret-DoWGmN7m-DO5Brq1Y.mjs";
1
+ import { t as blindCast } from "./casts-Ci5rYYaR.mjs";
2
+ import "./graph-CP16cJyH-D5IW87Y-.mjs";
3
+ //#region ../../0-framework/0-foundation/foundation/dist/secret.mjs
4
+ /**
5
+ * A value wrapper that redacts everywhere except the one explicit reader,
6
+ * `expose()`. Sensitivity is carried by the TYPE (`SecretBox<T>`), not a flag a
7
+ * sink must remember to check: `String(box)`, template interpolation,
8
+ * `JSON.stringify`, and `console.log`/`util.inspect` all print `[REDACTED]`, so
9
+ * a secret can't leak through an accidental log or serialization.
10
+ *
11
+ * Shape matches the platform's own `secrecy` type (pdp-control-plane). The class
12
+ * is nominal enough on its own — no phantom brand.
13
+ */
14
+ const REDACTED = "[REDACTED]";
15
+ var SecretBox = class {
16
+ #value;
17
+ constructor(value) {
18
+ this.#value = value;
19
+ }
20
+ /** The sole explicit door to the wrapped value. */
21
+ expose() {
22
+ return this.#value;
23
+ }
24
+ toString() {
25
+ return REDACTED;
26
+ }
27
+ toJSON() {
28
+ return REDACTED;
29
+ }
30
+ valueOf() {
31
+ return REDACTED;
32
+ }
33
+ [Symbol.toPrimitive]() {
34
+ return REDACTED;
35
+ }
36
+ [Symbol.for("nodejs.util.inspect.custom")]() {
37
+ return REDACTED;
38
+ }
39
+ };
40
+ //#endregion
3
41
  //#region ../../0-framework/1-core/core/dist/index.mjs
4
42
  /**
5
43
  * A data-only descriptor of a param's schema for introspection — the
@@ -43,14 +81,14 @@ function configOf(root) {
43
81
  return entries;
44
82
  }
45
83
  /**
46
- * The app's input manifest: every service input binding a `provision()` call
47
- * supplied (ADR-0042). Pure graph introspection, TARGET-AGNOSTIC a deploy
48
- * target's recursive descent classifies the binding's leaves (its preflight
49
- * verifies each `envSecret` leaf's platform var exists before deploy; the
50
- * values are provisioned out-of-band).
84
+ * The app's provision manifest: every secret binding the root resolved across
85
+ * the graph (ADR-0029) an opaque, target-defined source per service secret
86
+ * slot; a deploy target's preflight reads its own payload. Pure graph
87
+ * introspection, TARGET-AGNOSTIC the target consumes it to verify each secret
88
+ * exists on the platform before deploy. The values are provisioned out-of-band.
51
89
  */
52
- function inputManifest(graph) {
53
- return graph.inputBindings;
90
+ function provisionManifest(graph) {
91
+ return graph.secrets;
54
92
  }
55
93
  /**
56
94
  * The app's param-binding manifest: every param a `provision()` call bound —
@@ -93,6 +131,14 @@ function param(schema, opts = {}) {
93
131
  return withFacets(schema, opts);
94
132
  }
95
133
  /**
134
+ * The boot-side half of the runtime split (see core-model.md § Runtime:
135
+ * booting a service). Core's job at boot is structural only: turn a
136
+ * concrete, typed Config into hydrated deps by calling each input's
137
+ * connection.hydrate with its value slice. No environment read, no
138
+ * validation, no strings — the pack's `load()` already read the process-local
139
+ * stash into a typed Config before calling this.
140
+ */
141
+ /**
96
142
  * Given a service and a concrete typed Config, hydrate every input
97
143
  * (connection.hydrate with its typed value slice). A resource dep and a
98
144
  * connection dep hydrate through identical machinery — the loaded client is
@@ -123,7 +169,25 @@ function hydrateSync(root, config) {
123
169
  }
124
170
  return deps;
125
171
  }
172
+ /**
173
+ * Wraps each of a service's resolved secret values in a redacting `SecretBox`
174
+ * — what the node's `secrets()` accessor returns (ADR-0021, sibling to
175
+ * `load()`/`config()`). The RESOLUTION of a secret's value (the boot
176
+ * double-lookup that reads the platform var the pointer names) is the target
177
+ * pack's job; core is handed the already-resolved strings and only boxes them,
178
+ * so a secret is redacted by TYPE from here on. A declared slot missing from
179
+ * `values` is a target contract violation, named loudly.
180
+ */
181
+ function hydrateSecrets(root, values) {
182
+ const boxed = {};
183
+ for (const slot of Object.keys(root.secretSlots)) {
184
+ const value = values[slot];
185
+ if (value === void 0) throw new Error(`secret slot "${slot}" has no resolved value — the target must resolve every declared secret before hydrateSecrets().`);
186
+ boxed[slot] = new SecretBox(value);
187
+ }
188
+ return blindCast(boxed);
189
+ }
126
190
  //#endregion
127
- export { number as a, string as c, inputManifest as i, hydrate as n, param as o, hydrateSync as r, paramManifest as s, configOf as t };
191
+ export { number as a, provisionManifest as c, hydrateSync as i, string as l, hydrate as n, param as o, hydrateSecrets as r, paramManifest as s, configOf as t, SecretBox as u };
128
192
 
129
- //# sourceMappingURL=dist-CG0jqp27.mjs.map
193
+ //# sourceMappingURL=dist-BkSJOwTm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-BkSJOwTm.mjs","names":["#value","SecretBox$1"],"sources":["../../../0-framework/0-foundation/foundation/dist/secret.mjs","../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["//#region src/secret.ts\n/**\n* A value wrapper that redacts everywhere except the one explicit reader,\n* `expose()`. Sensitivity is carried by the TYPE (`SecretBox<T>`), not a flag a\n* sink must remember to check: `String(box)`, template interpolation,\n* `JSON.stringify`, and `console.log`/`util.inspect` all print `[REDACTED]`, so\n* a secret can't leak through an accidental log or serialization.\n*\n* Shape matches the platform's own `secrecy` type (pdp-control-plane). The class\n* is nominal enough on its own — no phantom brand.\n*/\nconst REDACTED = \"[REDACTED]\";\nvar SecretBox = class {\n\t#value;\n\tconstructor(value) {\n\t\tthis.#value = value;\n\t}\n\t/** The sole explicit door to the wrapped value. */\n\texpose() {\n\t\treturn this.#value;\n\t}\n\ttoString() {\n\t\treturn REDACTED;\n\t}\n\ttoJSON() {\n\t\treturn REDACTED;\n\t}\n\tvalueOf() {\n\t\treturn REDACTED;\n\t}\n\t[Symbol.toPrimitive]() {\n\t\treturn REDACTED;\n\t}\n\t[Symbol.for(\"nodejs.util.inspect.custom\")]() {\n\t\treturn REDACTED;\n\t}\n};\n//#endregion\nexport { SecretBox };\n\n//# sourceMappingURL=secret.mjs.map","import { _ as LoadError, a as isNode, c as isSecretSource, d as paramSource, f as provisionNeed, g as service, h as secretSource, i as freezeNode, l as module, m as secret, n as ResourceNodeBase, o as isParamSource, p as resource, r as dependency, s as isProvisionNeed, t as Load, u as paramNeed } from \"./graph-CP16cJyH.mjs\";\nimport { SecretBox, SecretBox as SecretBox$1 } from \"@internal/foundation/secret\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's provision manifest: every secret binding the root resolved across\n* the graph (ADR-0029) — an opaque, target-defined source per service secret\n* slot; a deploy target's preflight reads its own payload. Pure graph\n* introspection, TARGET-AGNOSTIC — the target consumes it to verify each secret\n* exists on the platform before deploy. The values are provisioned out-of-band.\n*/\nfunction provisionManifest(graph) {\n\treturn graph.secrets;\n}\n/**\n* The app's param-binding manifest: every param a `provision()` call bound —\n* literal or an opaque, target-defined `ParamSource` — at the address that\n* declared it. The param sibling of `provisionManifest`, for a deploy\n* target's own preflight to consume (D2). Pure graph introspection,\n* TARGET-AGNOSTIC; a param this manifest omits simply falls back to its own\n* `default` at `buildConfig`.\n*/\nfunction paramManifest(graph) {\n\treturn graph.params;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {},\n\t\t...opts.provision !== void 0 ? { provision: opts.provision } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* The boot-side half of the runtime split (see core-model.md § Runtime:\n* booting a service). Core's job at boot is structural only: turn a\n* concrete, typed Config into hydrated deps by calling each input's\n* connection.hydrate with its value slice. No environment read, no\n* validation, no strings — the pack's `load()` already read the process-local\n* stash into a typed Config before calling this.\n*/\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n/**\n* Wraps each of a service's resolved secret values in a redacting `SecretBox`\n* — what the node's `secrets()` accessor returns (ADR-0021, sibling to\n* `load()`/`config()`). The RESOLUTION of a secret's value (the boot\n* double-lookup that reads the platform var the pointer names) is the target\n* pack's job; core is handed the already-resolved strings and only boxes them,\n* so a secret is redacted by TYPE from here on. A declared slot missing from\n* `values` is a target contract violation, named loudly.\n*/\nfunction hydrateSecrets(root, values) {\n\tconst boxed = {};\n\tfor (const slot of Object.keys(root.secretSlots)) {\n\t\tconst value = values[slot];\n\t\tif (value === void 0) throw new Error(`secret slot \"${slot}\" has no resolved value — the target must resolve every declared secret before hydrateSecrets().`);\n\t\tboxed[slot] = new SecretBox$1(value);\n\t}\n\treturn blindCast(boxed);\n}\n//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSecrets, hydrateSync, isNode, isParamSource, isProvisionNeed, isSecretSource, module, number, param, paramManifest, paramNeed, paramSource, provisionManifest, provisionNeed, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;AAWA,MAAM,WAAW;AACjB,IAAI,YAAY,MAAM;CACrB;CACA,YAAY,OAAO;EAClB,KAAKA,SAAS;CACf;;CAEA,SAAS;EACR,OAAO,KAAKA;CACb;CACA,WAAW;EACV,OAAO;CACR;CACA,SAAS;EACR,OAAO;CACR;CACA,UAAU;EACT,OAAO;CACR;CACA,CAAC,OAAO,eAAe;EACtB,OAAO;CACR;CACA,CAAC,OAAO,IAAI,4BAA4B,KAAK;EAC5C,OAAO;CACR;AACD;;;;;;;;;;;ACxBA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,WAAW,MAAM,GAAG,QAAQ,KAAK;GACjF,OAAO,EAAE,MAAM;GACf;GACA,QAAQ,cAAc,MAAM,MAAM;GAClC,UAAU,MAAM,aAAa;GAC7B,SAAS,MAAM;EAChB,CAAC;CACF;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG,QAAQ,KAAK;EACrE,OAAO;EACP;EACA,QAAQ,cAA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,OAAO,SAAS,CAAC;EACvC,KAAK,QAAQ,MAAM,UAAU,WAAW,QAAQ,MAAM;CACvD;CACA,OAAO;AACR;;;;;;;AAOA,SAAS,YAAY,MAAM,QAAQ;CAClC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,MAAM,SAAS,UAAU,WAAW,QAAQ,MAAM;EAClD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,iCAAiC,KAAK,oEAAoE;EACzJ,KAAK,QAAQ;CACd;CACA,OAAO;AACR;;;;;;;;;;AAUA,SAAS,eAAe,MAAM,QAAQ;CACrC,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,QAAQ,OAAO,KAAK,KAAK,WAAW,GAAG;EACjD,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,gBAAgB,KAAK,iGAAiG;EAC5J,MAAM,QAAQ,IAAIC,UAAY,KAAK;CACpC;CACA,OAAO,UAAU,KAAK;AACvB"}
@@ -1,5 +1,5 @@
1
- import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- //#region ../../0-framework/1-core/core/dist/graph-DgbALPDo.mjs
1
+ import { t as blindCast } from "./casts-Ci5rYYaR.mjs";
2
+ //#region ../../0-framework/1-core/core/dist/graph-CP16cJyH.mjs
3
3
  /** Thrown by Load when the graph is malformed. */
4
4
  var LoadError = class extends Error {
5
5
  constructor(message) {
@@ -94,6 +94,11 @@ function freezeParams(params) {
94
94
  for (const [name, param] of Object.entries(params)) frozen[name] = Object.freeze({ ...param });
95
95
  return Object.freeze(frozen);
96
96
  }
97
+ function freezeSecrets(secrets) {
98
+ const frozen = {};
99
+ for (const [name, need] of Object.entries(secrets)) frozen[name] = Object.freeze({ ...need });
100
+ return blindCast(Object.freeze(frozen));
101
+ }
97
102
  /** A frozen shallow copy that keeps the caller's declared type. */
98
103
  function frozenShallowCopy(obj) {
99
104
  return blindCast(Object.freeze({ ...obj }));
@@ -147,8 +152,7 @@ function resource(def) {
147
152
  }
148
153
  /**
149
154
  * Constructs a branded, frozen Service node — declarations only (inputs,
150
- * params, the input schema, build adapter, and the ports it exposes). Pure;
151
- * carries no runtime behavior.
155
+ * params, build adapter, and the ports it exposes). Pure; carries no runtime behavior.
152
156
  */
153
157
  function service(def) {
154
158
  requireName(def.name, "service");
@@ -156,7 +160,8 @@ function service(def) {
156
160
  requireType(def.type, "service");
157
161
  requireConfigKeySegmentNames(Object.keys(def.inputs), "input", "service");
158
162
  requireConfigKeySegmentNames(Object.keys(def.params), "param", "service");
159
- if (def.input !== void 0 && typeof def.input["~standard"]?.validate !== "function") throw new Error("service() `input` must be a Standard Schema (an object with a \"~standard\".validate function) — see https://standardschema.dev (ADR-0042).");
163
+ requireConfigKeySegmentNames(Object.keys(def.secrets ?? {}), "secret", "service");
164
+ for (const slot of Object.keys(def.secrets ?? {})) if (Object.hasOwn(def.params, slot)) throw new Error(`service() secret slot "${slot}" collides with a param of the same name — a secret slot and a service param derive the same config key (COMPOSER_<addr>_${slot.toUpperCase()}); rename one.`);
160
165
  return Object.freeze({
161
166
  [NODE]: true,
162
167
  kind: "service",
@@ -165,7 +170,7 @@ function service(def) {
165
170
  type: def.type,
166
171
  inputs: frozenShallowCopy(def.inputs),
167
172
  params: freezeParams(def.params),
168
- inputSchema: blindCast(def.input),
173
+ secretSlots: freezeSecrets(def.secrets ?? blindCast({})),
169
174
  build: Object.freeze({ ...def.build }),
170
175
  expose: def.expose !== void 0 ? frozenShallowCopy(def.expose) : void 0
171
176
  });
@@ -303,7 +308,11 @@ function serviceInputs(service, serviceId) {
303
308
  }
304
309
  function loadService(root, rootId) {
305
310
  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.`);
306
- 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).`);
311
+ const secretSlots = Object.keys(root.secretSlots);
312
+ if (secretSlots.length > 0) {
313
+ const names = secretSlots.map((k) => `"${k}"`).join(", ");
314
+ 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').`);
315
+ }
307
316
  const rootGraphNode = {
308
317
  id: rootId,
309
318
  node: root
@@ -313,7 +322,7 @@ function loadService(root, rootId) {
313
322
  root: rootGraphNode,
314
323
  nodes: [...topoSort(nodes, edges), rootGraphNode],
315
324
  edges,
316
- inputBindings: [],
325
+ secrets: [],
317
326
  params: []
318
327
  };
319
328
  }
@@ -396,25 +405,6 @@ function validateWiring(pending, byId) {
396
405
  if (value.kind === "dependency") throw new LoadError(`Dependency input "${input}" of provisioned ${targetKind} "${targetId}" is not wired to a producer (module "${enclosingModuleName}").`);
397
406
  }
398
407
  }
399
- /**
400
- * Flattens a value into itself plus every nested object/array member value —
401
- * identity fodder for the ctx.secrets/ctx.params usage marking, which must
402
- * see a forwarded source wherever it sits inside an input binding (ADR-0042).
403
- * A secret/param source is an opaque leaf: it is pushed (a forwarded ref IS
404
- * such a source, so identity-matching still needs it) but never descended
405
- * into, so a ref buried in an unrelated source's payload is not falsely seen
406
- * as used. `seen` guards object cycles so a self-referential binding cannot
407
- * recurse forever.
408
- */
409
- function deepValues(value, out, seen = /* @__PURE__ */ new WeakSet()) {
410
- out.push(value);
411
- if (typeof value !== "object" || value === null) return;
412
- if (isSecretSource(value) || isParamSource(value)) return;
413
- if (seen.has(value)) return;
414
- seen.add(value);
415
- const members = Array.isArray(value) ? value : Object.values(value);
416
- for (const member of members) deepValues(member, out, seen);
417
- }
418
408
  /** The (unvalidated) edges a `wiring` object implies — one dependency edge per entry; `validateWiring` does the real checking. */
419
409
  function wiringEdges(wiring, targetId) {
420
410
  return Object.entries(wiring).map(([input, ref]) => ({
@@ -425,12 +415,11 @@ function wiringEdges(wiring, targetId) {
425
415
  }));
426
416
  }
427
417
  /**
428
- * Checks the secrets wired into one provisioned child MODULE: every declared
429
- * forwarding slot is bound to a real secret source (an `envSecret` or a
430
- * forwarded ctx.secrets ref), and no wired key names a slot the module
431
- * doesn't declare — the secret analog of `validateWiring`'s per-input checks,
432
- * but resolved inline (a source carries its own name, so no whole-graph pass
433
- * is needed).
418
+ * Checks the secrets wired into one provisioned child: every declared slot is
419
+ * bound to a real secret source (an `envSecret` or a forwarded ctx.secrets
420
+ * ref), and no wired key names a slot the child doesn't declare — the secret
421
+ * analog of `validateWiring`'s per-input checks, but resolved inline (a source
422
+ * carries its own name, so no whole-graph pass is needed).
434
423
  */
435
424
  function validateSecretBinding(child, id, secretWiring, enclosingModuleName) {
436
425
  const { kind } = child;
@@ -478,7 +467,7 @@ function validateParamNeedBinding(child, id, paramWiring, enclosingModuleName) {
478
467
  * forward in a producer provisioned by an ancestor scope, and it is the
479
468
  * shared `byId` (keyed by full address) that lets that resolve.
480
469
  */
481
- function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes, edges, pending, inputBindings, paramBindings, byId) {
470
+ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes, edges, pending, secretBindings, paramBindings, byId) {
482
471
  const localIds = /* @__PURE__ */ new Set();
483
472
  const used = /* @__PURE__ */ new Set();
484
473
  const usedSecrets = /* @__PURE__ */ new Set();
@@ -492,7 +481,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
492
481
  } : wired;
493
482
  }
494
483
  const markUsed = (values) => {
495
- for (const value of values) for (const key of Object.keys(ctxInputs)) if (value === ctxInputs[key]) used.add(key);
484
+ for (const value of Object.values(values)) for (const key of Object.keys(ctxInputs)) if (value === ctxInputs[key]) used.add(key);
496
485
  };
497
486
  const ctxSecrets = {};
498
487
  for (const key of Object.keys(moduleNode.secretSlots)) {
@@ -503,7 +492,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
503
492
  } : bound;
504
493
  }
505
494
  const markSecretsUsed = (values) => {
506
- for (const value of values) for (const key of Object.keys(ctxSecrets)) if (value === ctxSecrets[key]) usedSecrets.add(key);
495
+ for (const value of Object.values(values)) for (const key of Object.keys(ctxSecrets)) if (value === ctxSecrets[key]) usedSecrets.add(key);
507
496
  };
508
497
  const ctxParams = {};
509
498
  for (const key of Object.keys(moduleNode.paramSlots)) {
@@ -514,13 +503,12 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
514
503
  } : bound;
515
504
  }
516
505
  const markParamsUsed = (values) => {
517
- for (const value of values) for (const key of Object.keys(ctxParams)) if (value === ctxParams[key]) usedParams.add(key);
506
+ for (const value of Object.values(values)) for (const key of Object.keys(ctxParams)) if (value === ctxParams[key]) usedParams.add(key);
518
507
  };
519
508
  const provision = (child, opts) => {
520
509
  const id = opts?.id ?? child.name;
521
510
  const provisionWiring = opts?.deps;
522
511
  const provisionSecrets = opts?.secrets;
523
- const provisionInput = opts?.input;
524
512
  const provisionParams = opts?.params;
525
513
  if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
526
514
  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.)`);
@@ -532,7 +520,6 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
532
520
  if (child.kind === "resource") {
533
521
  if (provisionWiring !== void 0) throw new LoadError(`provision("${id}") received deps for a resource — a resource has no dependency slots to satisfy.`);
534
522
  if (provisionSecrets !== void 0) throw new LoadError(`provision("${id}") received secrets for a resource — a resource has no secret slots to satisfy.`);
535
- if (provisionInput !== void 0) throw new LoadError(`provision("${id}") received an input binding for a resource — a resource declares no input schema.`);
536
523
  if (provisionParams !== void 0) throw new LoadError(`provision("${id}") received params for a resource — a resource has no params to satisfy.`);
537
524
  if (child.type.length === 0) throw new LoadError(`provision("${id}") received a resource with an empty node type.`);
538
525
  byId.set(fullAddress, child);
@@ -543,23 +530,19 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
543
530
  return refForResource(fullAddress, child);
544
531
  }
545
532
  const localWiring = { ...provisionWiring ?? {} };
546
- markUsed(Object.values(localWiring));
533
+ markUsed(localWiring);
547
534
  const localSecrets = { ...provisionSecrets ?? {} };
548
- markSecretsUsed(Object.values(localSecrets));
535
+ markSecretsUsed(localSecrets);
536
+ validateSecretBinding(child, id, localSecrets, moduleNode.name);
549
537
  const localParams = { ...provisionParams ?? {} };
550
- markParamsUsed(Object.values(localParams));
538
+ markParamsUsed(localParams);
551
539
  if (child.kind === "service") {
552
- 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.`);
553
- 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.`);
554
- 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}").`);
555
- if (provisionInput !== void 0) {
556
- const leaves = [];
557
- deepValues(provisionInput, leaves);
558
- markSecretsUsed(leaves);
559
- markParamsUsed(leaves);
560
- inputBindings.push({
540
+ for (const slot of Object.keys(child.secretSlots)) {
541
+ const bound = localSecrets[slot];
542
+ if (isSecretSource(bound)) secretBindings.push({
561
543
  serviceAddress: fullAddress,
562
- binding: blindCast(provisionInput)
544
+ slot,
545
+ source: bound
563
546
  });
564
547
  }
565
548
  validateServiceParamBinding(child, id, localParams, moduleNode.name);
@@ -584,8 +567,6 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
584
567
  byId.set(fullAddress, child);
585
568
  return refFor(fullAddress, child);
586
569
  }
587
- 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.`);
588
- validateSecretBinding(child, id, localSecrets, moduleNode.name);
589
570
  validateParamNeedBinding(child, id, localParams, moduleNode.name);
590
571
  edges.push(...wiringEdges(localWiring, fullAddress));
591
572
  pending.push({
@@ -595,7 +576,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
595
576
  targetKind: "module",
596
577
  enclosingModuleName: moduleNode.name
597
578
  });
598
- const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, inputBindings, paramBindings, byId);
579
+ const childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, secretBindings, paramBindings, byId);
599
580
  nodes.push({
600
581
  id: fullAddress,
601
582
  node: child
@@ -613,7 +594,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
613
594
  provision: blindCast(provision)
614
595
  });
615
596
  const outputs = blindCast(moduleNode.body(ctx) ?? {});
616
- markUsed(Object.values(outputs));
597
+ markUsed(outputs);
617
598
  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.`);
618
599
  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.`);
619
600
  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.`);
@@ -644,10 +625,10 @@ function loadModule(root, opts) {
644
625
  const nodes = [];
645
626
  const edges = [];
646
627
  const pending = [];
647
- const inputBindings = [];
628
+ const secretBindings = [];
648
629
  const paramBindings = [];
649
630
  const byId = /* @__PURE__ */ new Map();
650
- flatten(root, void 0, {}, {}, {}, nodes, edges, pending, inputBindings, paramBindings, byId);
631
+ flatten(root, void 0, {}, {}, {}, nodes, edges, pending, secretBindings, paramBindings, byId);
651
632
  for (const entry of pending) validateWiring(entry, byId);
652
633
  assertDependencyDag(edges);
653
634
  const rootGraphNode = {
@@ -658,7 +639,7 @@ function loadModule(root, opts) {
658
639
  root: rootGraphNode,
659
640
  nodes: [...topoSort(nodes, edges), rootGraphNode],
660
641
  edges,
661
- inputBindings,
642
+ secrets: secretBindings,
662
643
  params: paramBindings
663
644
  };
664
645
  }
@@ -708,4 +689,4 @@ function Load(root, opts) {
708
689
  //#endregion
709
690
  export { service as _, freezeNode as a, isProvisionNeed as c, paramNeed as d, paramSource as f, secretSource as g, secret as h, dependency as i, isSecretSource as l, resource as m, LoadError as n, isNode as o, provisionNeed as p, ResourceNodeBase as r, isParamSource as s, Load as t, module as u };
710
691
 
711
- //# sourceMappingURL=graph-DgbALPDo-BEHF94BN.mjs.map
692
+ //# sourceMappingURL=graph-CP16cJyH-D5IW87Y-.mjs.map