@prisma/composer 0.2.0 → 0.3.0-dev.10

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 (91) hide show
  1. package/dist/{app-config-DJdU4ubR-BwioNK8j.d.mts → app-config-bsTo57A8-BfG21wAI.d.mts} +89 -5
  2. package/dist/app-config-bsTo57A8-BfG21wAI.d.mts.map +1 -0
  3. package/dist/app-config-joXc-BKm-CdcXqNMD.mjs +22 -0
  4. package/dist/app-config-joXc-BKm-CdcXqNMD.mjs.map +1 -0
  5. package/dist/arktype.d.mts +16 -0
  6. package/dist/arktype.d.mts.map +1 -0
  7. package/dist/arktype.mjs +22 -0
  8. package/dist/arktype.mjs.map +1 -0
  9. package/dist/assertions.d.mts.map +1 -0
  10. package/dist/bin.mjs +2444 -206
  11. package/dist/bin.mjs.map +1 -1
  12. package/dist/{casts-Ci5rYYaR.mjs → casts-DpaahrlC-C5XMnP9S.mjs} +2 -2
  13. package/dist/casts-DpaahrlC-C5XMnP9S.mjs.map +1 -0
  14. package/dist/casts.d.mts.map +1 -0
  15. package/dist/casts.mjs +1 -1
  16. package/dist/config-DUzvB5cQ.d.mts +1 -0
  17. package/dist/config.d.mts +3 -3
  18. package/dist/config.mjs +2 -9
  19. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs +313 -0
  20. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs.map +1 -0
  21. package/dist/deploy-DUzvB5cQ.d.mts +1 -0
  22. package/dist/deploy.d.mts +2 -2
  23. package/dist/deploy.mjs +1 -311
  24. package/dist/{dist-B0axxnBf.mjs → dist-BdvFDCLV.mjs} +12 -76
  25. package/dist/dist-BdvFDCLV.mjs.map +1 -0
  26. package/dist/{graph-B7NcPiOr-aSUOCGTH.d.mts → graph-DDpXh7S8-b-93BcHn.d.mts} +3 -3
  27. package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +1 -0
  28. package/dist/{graph-BmrUEdo9-6Oq1hSmS.mjs → graph-DgbALPDo-BEHF94BN.mjs} +75 -52
  29. package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +1 -0
  30. package/dist/{graph-types-BgT9UEdm-Bz-_OcJH.d.mts → graph-types-C3FOaaXm-C6_rGzfn.d.mts} +87 -87
  31. package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +1 -0
  32. package/dist/index-BQVrMGfe.d.mts +22 -0
  33. package/dist/index-BQVrMGfe.d.mts.map +1 -0
  34. package/dist/index.d.mts +5 -4
  35. package/dist/index.mjs +4 -3
  36. package/dist/local-target.d.mts +29 -0
  37. package/dist/local-target.d.mts.map +1 -0
  38. package/dist/local-target.mjs +47 -0
  39. package/dist/local-target.mjs.map +1 -0
  40. package/dist/{nextjs-DLyeRR7M-B9ukbB2L.d.mts → nextjs-DLyeRR7M-D47aMmfr.d.mts} +3 -3
  41. package/dist/nextjs-DLyeRR7M-D47aMmfr.d.mts.map +1 -0
  42. package/dist/nextjs-control.d.mts +4 -4
  43. package/dist/nextjs-control.d.mts.map +1 -0
  44. package/dist/nextjs-control.mjs +2 -1
  45. package/dist/nextjs-control.mjs.map +1 -1
  46. package/dist/nextjs.d.mts +1 -1
  47. package/dist/node-control.d.mts +3 -3
  48. package/dist/node-control.d.mts.map +1 -0
  49. package/dist/node-control.mjs +44 -25
  50. package/dist/node-control.mjs.map +1 -1
  51. package/dist/node.d.mts +2 -2
  52. package/dist/node.d.mts.map +1 -0
  53. package/dist/report.d.mts +2 -2
  54. package/dist/report.d.mts.map +1 -0
  55. package/dist/report.mjs +4 -0
  56. package/dist/report.mjs.map +1 -1
  57. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +25 -0
  58. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +1 -0
  59. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs +55 -0
  60. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +1 -0
  61. package/dist/service-rpc.d.mts +15 -5
  62. package/dist/service-rpc.d.mts.map +1 -0
  63. package/dist/service-rpc.mjs +6 -4
  64. package/dist/service-rpc.mjs.map +1 -1
  65. package/dist/testing.d.mts +17 -11
  66. package/dist/testing.d.mts.map +1 -0
  67. package/dist/testing.mjs +12 -20
  68. package/dist/testing.mjs.map +1 -1
  69. package/package.json +15 -12
  70. package/src/exports/arktype.ts +1 -0
  71. package/src/exports/assertions.ts +1 -0
  72. package/src/exports/casts.ts +1 -0
  73. package/src/exports/config.ts +1 -0
  74. package/src/exports/deploy.ts +1 -0
  75. package/src/exports/index.ts +1 -0
  76. package/src/exports/local-target.ts +1 -0
  77. package/src/exports/nextjs-control.ts +1 -0
  78. package/src/exports/nextjs.ts +2 -0
  79. package/src/exports/node-control.ts +1 -0
  80. package/src/exports/node.ts +2 -0
  81. package/src/exports/report.ts +1 -0
  82. package/src/exports/service-rpc.ts +1 -0
  83. package/src/exports/testing.ts +1 -0
  84. package/dist/casts-Ci5rYYaR.mjs.map +0 -1
  85. package/dist/config-ByZICgry.d.mts +0 -1
  86. package/dist/config.mjs.map +0 -1
  87. package/dist/deploy-ByZICgry.d.mts +0 -1
  88. package/dist/deploy.mjs.map +0 -1
  89. package/dist/dist-B0axxnBf.mjs.map +0 -1
  90. package/dist/graph-BmrUEdo9-6Oq1hSmS.mjs.map +0 -1
  91. package/dist/index-B2DJ5CN4.d.mts +0 -32
package/dist/deploy.mjs CHANGED
@@ -1,312 +1,2 @@
1
- import { s as isParamSource, t as Load } from "./graph-BmrUEdo9-6Oq1hSmS.mjs";
2
- import { r as deserializeContainers } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
3
- import * as Alchemy from "alchemy";
4
- import * as Effect from "effect/Effect";
5
- import * as Layer from "effect/Layer";
6
- //#region ../../0-framework/1-core/core/dist/deploy.mjs
7
- var LowerError = class extends Error {
8
- constructor(message) {
9
- super(message);
10
- this.name = "LowerError";
11
- }
12
- };
13
- /**
14
- * Resolves one SERVICE-OWN param to its config value. The full resolution
15
- * order across both value channels:
16
- *
17
- * 1. A param claiming BOTH a provision-time binding and a `provision` need
18
- * (ADR-0031) is a loud error — two sources for one value.
19
- * 2. A provision-time binding (a schema-validated literal, or an opaque
20
- * `ParamSource` the target resolves at boot per ADR-0019) beats the
21
- * declared `default`.
22
- * 3. A framework-minted `provision` need is resolved per dependency EDGE
23
- * against the consumer extension's registry — that path fills CONNECTION
24
- * params in `buildConfig`'s inputs loop, never this function. A
25
- * service-own param has no edge to mint against, so an unbound need here
26
- * falls through like any unbound param.
27
- * 4. The `default`, else absent (only legal when `optional`), else a loud
28
- * error naming the param, the service, and the fix.
29
- */
30
- function resolveParam(node, serviceId, name, param, bound) {
31
- if (bound !== void 0) {
32
- if (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.`);
33
- if (isParamSource(bound)) return bound;
34
- const result = param.schema["~standard"].validate(bound);
35
- if (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.`);
36
- if (result.issues !== void 0) {
37
- const messages = result.issues.map((issue) => issue.message).join("; ");
38
- throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") received an invalid provision-time value: ${messages}`);
39
- }
40
- return result.value;
41
- }
42
- if (param.default !== void 0) return param.default;
43
- if (param.optional === true) return void 0;
44
- throw 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.`);
45
- }
46
- /**
47
- * Assembles a service's typed Config. Connection params come from the
48
- * dependency edge's lowered outputs — or, for a param carrying a `provision`
49
- * need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints
50
- * it, the producer hands nothing over. The service's own params resolve via
51
- * `resolveParam` (provision-time binding, then default, then loud
52
- * unbound-required failure).
53
- *
54
- * This is also where the connection contract is enforced: a producer that fails to
55
- * supply a required param its consumer's connection declares fails the deploy
56
- * here, naming the edge, rather than reaching the consumer as `undefined`.
57
- */
58
- function buildConfig(node, id, graph, lowered, provisioned) {
59
- const inputs = {};
60
- for (const [inputName, inputNode] of Object.entries(node.inputs)) {
61
- const edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === "dependency");
62
- const producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};
63
- const values = {};
64
- for (const [name, param] of Object.entries(inputNode.connection.params)) {
65
- if (param.provision !== void 0) {
66
- values[name] = provisioned.get(`${id}.${inputName}`);
67
- continue;
68
- }
69
- const value = producedOutputs[name];
70
- if (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.`);
71
- values[name] = value;
72
- }
73
- inputs[inputName] = values;
74
- }
75
- const boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));
76
- const service = {};
77
- for (const [name, param] of Object.entries(node.params)) {
78
- const value = resolveParam(node, id, name, param, boundParams.get(name));
79
- if (value !== void 0) service[name] = value;
80
- }
81
- return {
82
- service,
83
- inputs
84
- };
85
- }
86
- /**
87
- * Joins resolved report entries back to their graph nodes — the last step of a
88
- * deploy report, run inside the Action with apply's resolved values.
89
- *
90
- * The entries cross Alchemy's action-input boundary, so they carry addresses
91
- * and plain entities only; the graph is held by closure on this side. That
92
- * split is why this join exists at all, and it is what keeps functions and
93
- * Standard Schemas (which a node carries, and which the plan's input hash
94
- * would have to serialize) out of the input.
95
- *
96
- * Skips an address the graph no longer holds: entries are data, the graph is
97
- * truth.
98
- */
99
- function joinDeployment(graph, entries) {
100
- const nodes = [];
101
- for (const entry of entries) {
102
- const node = graph.nodes.find((n) => n.id === entry.address)?.node;
103
- if (node === void 0 || node.kind !== "service" && node.kind !== "resource") continue;
104
- nodes.push({
105
- address: entry.address,
106
- node,
107
- entities: entry.entities
108
- });
109
- }
110
- return nodes;
111
- }
112
- function missingBundleError(id) {
113
- return new LowerError(`No bundle provided for service "${id}" (opts.bundles["${id}"] is required).`);
114
- }
115
- function duplicateExtensionError(id) {
116
- return new LowerError(`Extension "${id}" is listed more than once in \`extensions\` — each extension id must be unique.`);
117
- }
118
- /** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */
119
- function extensionsById(config) {
120
- const map = /* @__PURE__ */ new Map();
121
- for (const extension of config.extensions) {
122
- if (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));
123
- map.set(extension.id, extension);
124
- }
125
- return Effect.succeed(map);
126
- }
127
- function unknownExtensionError(extension, id) {
128
- return 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).`);
129
- }
130
- function unknownNodeTypeError(extension, type) {
131
- return new LowerError(`Extension "${extension.id}" has no descriptor for node type "${type}" (known: ${Object.keys(extension.nodes).join(", ")}).`);
132
- }
133
- /** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */
134
- function unknownProvisionerError(extension, brand, edgeId) {
135
- const known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(", ") : "(none registered)";
136
- return new LowerError(`Extension "${extension.id}" has no provisioner for need "${String(brand)}" (needed by edge "${edgeId}") (known: ${known}).`);
137
- }
138
- /** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */
139
- function crossExtensionProvisionError(edgeId) {
140
- return new LowerError(`Provisioned edge "${edgeId}" spans two extensions — cross-extension provisioned edges aren't supported yet.`);
141
- }
142
- /**
143
- * More than one provisioned param on one connection (ADR-0031). One edge mints
144
- * ONE value, keyed by edge id, so a second need on the same connection would
145
- * silently receive the first's value under the first's brand.
146
- */
147
- function multipleProvisionedParamsError(edgeId, names) {
148
- return new LowerError(`Connection input "${edgeId}" declares more than one provisioned param (${names.join(", ")}) — only one provisioned param per connection is supported.`);
149
- }
150
- function wrongKindError(extension, type, expected, got) {
151
- return new LowerError(`Extension "${extension}"'s descriptor for node type "${type}" is a "${got}" descriptor — this node needs a "${expected}" descriptor.`);
152
- }
153
- /** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */
154
- function descriptorFor(extensions, node, id) {
155
- const extension = extensions.get(node.extension);
156
- if (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));
157
- const descriptor = extension.nodes[node.type];
158
- if (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));
159
- if (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
160
- return Effect.succeed(descriptor);
161
- }
162
- /**
163
- * The state-layer precedence a deploy resolves to: an explicit opts.state
164
- * always wins; failing that, the config's own (required) state descriptor,
165
- * created with its owning extension's resolved container (`undefined` when
166
- * that extension declared none). A pure function so the precedence is
167
- * testable without booting Alchemy.
168
- */
169
- function resolveStateLayer(opts, config, containers) {
170
- return opts.state ?? config.state.create(containers.get(config.state.extension));
171
- }
172
- /**
173
- * All configured extensions' providers merged, config array order — an
174
- * extension without `providers` is skipped; no used-extensions-only
175
- * filtering (ADR-0017's pinned providers rule).
176
- */
177
- function mergedProviders(config) {
178
- const [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);
179
- return first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);
180
- }
181
- /**
182
- * Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
183
- * Fails with LowerError or whatever an extension's lowering raises — the error type is open.
184
- */
185
- function lowering(root, config, opts) {
186
- return Effect.gen(function* () {
187
- const graph = Load(root, { id: opts.name });
188
- const extensions = yield* extensionsById(config);
189
- const containers = deserializeContainers(config.extensions, process.env);
190
- const lowered = /* @__PURE__ */ new Map();
191
- const entries = [];
192
- const provisioned = /* @__PURE__ */ new Map();
193
- const applications = /* @__PURE__ */ new Map();
194
- for (const descriptor of config.extensions) {
195
- if (descriptor.application === void 0) continue;
196
- const appCtx = {
197
- id: graph.root.id,
198
- address: "",
199
- node: graph.root.node,
200
- graph,
201
- opts,
202
- application: void 0,
203
- container: containers.get(descriptor.id),
204
- lowered,
205
- provisioned
206
- };
207
- applications.set(descriptor.id, yield* descriptor.application.provision(appCtx));
208
- }
209
- for (const edge of graph.edges) {
210
- if (edge.kind !== "dependency") continue;
211
- const consumer = graph.nodes.find((n) => n.id === edge.to)?.node;
212
- if (consumer === void 0 || consumer.kind !== "service") continue;
213
- const slot = consumer.inputs[edge.input];
214
- if (slot === void 0) continue;
215
- const provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);
216
- if (provisionedParams.length === 0) continue;
217
- const edgeId = `${edge.to}.${edge.input}`;
218
- if (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));
219
- const need = provisionedParams[0]?.[1].provision;
220
- if (need === void 0) continue;
221
- const provider = graph.nodes.find((n) => n.id === edge.from)?.node;
222
- if (provider === void 0 || provider.kind !== "service" && provider.kind !== "resource") continue;
223
- if (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));
224
- const extension = extensions.get(consumer.extension);
225
- if (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));
226
- const provisioner = extension.provisions?.get(need.brand);
227
- if (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));
228
- const ref = yield* provisioner.provision({
229
- edgeId,
230
- consumerAddress: edge.to,
231
- providerAddress: edge.from,
232
- input: edge.input,
233
- need
234
- });
235
- provisioned.set(edgeId, ref);
236
- }
237
- for (const { id, node } of graph.nodes) {
238
- if (node.kind === "module") continue;
239
- if (node.kind === "dependency") continue;
240
- const ctx = {
241
- id,
242
- address: id,
243
- node,
244
- graph,
245
- opts,
246
- application: applications.get(node.extension),
247
- container: containers.get(node.extension),
248
- lowered,
249
- provisioned
250
- };
251
- const descriptor = yield* descriptorFor(extensions, node, id);
252
- if (descriptor.kind === "resource") {
253
- const result = yield* descriptor(ctx);
254
- lowered.set(id, result.outputs);
255
- entries.push({
256
- address: id,
257
- entities: result.entities
258
- });
259
- continue;
260
- }
261
- if (descriptor.kind !== "service") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
262
- const service = node;
263
- const provisionedNode = yield* descriptor.provision(ctx);
264
- const typedConfig = buildConfig(service, id, graph, lowered, provisioned);
265
- const serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);
266
- const bundle = opts.bundles[id];
267
- if (bundle === void 0) return yield* Effect.fail(missingBundleError(id));
268
- const artifact = yield* descriptor.package(ctx, {
269
- assembled: {
270
- dir: bundle.dir,
271
- entry: bundle.entry
272
- },
273
- address: id
274
- });
275
- const result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);
276
- lowered.set(id, result.outputs);
277
- entries.push({
278
- address: id,
279
- entities: result.entities
280
- });
281
- }
282
- if (opts.report !== void 0) {
283
- const report = opts.report;
284
- yield* Alchemy.Action("composer-deployment-report", (input) => Effect.sync(() => {
285
- report({
286
- app: opts.name,
287
- nodes: joinDeployment(graph, input.entries)
288
- });
289
- }))({
290
- nonce: Date.now(),
291
- entries
292
- });
293
- }
294
- });
295
- }
296
- /**
297
- * The whole-stack wrapper: Load → route each node through the config's
298
- * extension registries → an Alchemy Stack (the default export the alchemy
299
- * CLI consumes).
300
- */
301
- function lower(root, config, opts) {
302
- const stackEffect = Effect.orDie(lowering(root, config, opts));
303
- const containers = deserializeContainers(config.extensions, process.env);
304
- return Alchemy.Stack(opts.name, {
305
- providers: mergedProviders(config),
306
- state: resolveStateLayer(opts, config, containers)
307
- }, stackEffect);
308
- }
309
- //#endregion
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";
310
2
  export { LowerError, buildConfig, joinDeployment, lower, lowering, mergedProviders, resolveStateLayer };
311
-
312
- //# sourceMappingURL=deploy.mjs.map
@@ -1,43 +1,5 @@
1
- import { t as blindCast } from "./casts-Ci5rYYaR.mjs";
2
- import "./graph-BmrUEdo9-6Oq1hSmS.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
1
+ import "./graph-DgbALPDo-BEHF94BN.mjs";
2
+ import "./secret-DoWGmN7m-DO5Brq1Y.mjs";
41
3
  //#region ../../0-framework/1-core/core/dist/index.mjs
42
4
  /**
43
5
  * A data-only descriptor of a param's schema for introspection — the
@@ -81,20 +43,20 @@ function configOf(root) {
81
43
  return entries;
82
44
  }
83
45
  /**
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.
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).
89
51
  */
90
- function provisionManifest(graph) {
91
- return graph.secrets;
52
+ function inputManifest(graph) {
53
+ return graph.inputBindings;
92
54
  }
93
55
  /**
94
56
  * The app's param-binding manifest: every param a `provision()` call bound —
95
57
  * literal or an opaque, target-defined `ParamSource` — at the address that
96
58
  * declared it. The param sibling of `provisionManifest`, for a deploy
97
- * target's own preflight to consume (D2). Pure graph introspection,
59
+ * target's own preflight to consume. Pure graph introspection,
98
60
  * TARGET-AGNOSTIC; a param this manifest omits simply falls back to its own
99
61
  * `default` at `buildConfig`.
100
62
  */
@@ -131,14 +93,6 @@ function param(schema, opts = {}) {
131
93
  return withFacets(schema, opts);
132
94
  }
133
95
  /**
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
- /**
142
96
  * Given a service and a concrete typed Config, hydrate every input
143
97
  * (connection.hydrate with its typed value slice). A resource dep and a
144
98
  * connection dep hydrate through identical machinery — the loaded client is
@@ -169,25 +123,7 @@ function hydrateSync(root, config) {
169
123
  }
170
124
  return deps;
171
125
  }
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
- }
190
126
  //#endregion
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 };
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 };
192
128
 
193
- //# sourceMappingURL=dist-B0axxnBf.mjs.map
129
+ //# sourceMappingURL=dist-BdvFDCLV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-BdvFDCLV.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["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-DgbALPDo.mjs\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\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 input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042). Pure graph introspection, TARGET-AGNOSTIC — a deploy\n* target's recursive descent classifies the binding's leaves (its preflight\n* verifies each `envSecret` leaf's platform var exists before deploy; the\n* values are provisioned out-of-band).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\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. 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* 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//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isProvisionNeed, isSecretSource, isSecretString, module, number, param, paramManifest, paramNeed, paramSource, provisionNeed, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAWA,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,cAAc,MAAM,MAAM;EAClC,UAAU,MAAM,aAAa;EAC7B,SAAS,MAAM;CAChB,CAAC;CACD,OAAO;AACR;;;;;;;;AAQA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;;;;;;;;;AASA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;AACA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,EAAE,aAAa;EACrB,SAAS;EACT,QAAQ;EACR,WAAW,UAAU,MAAM,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;CAClH,EAAE;AACH;AACA,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,QAAQ;AACxE,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,CAAC;AAC9F,SAAS,WAAW,QAAQ,MAAM;CACjC,OAAO;EACN;EACA,GAAG,KAAK,aAAa,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;EAC7D,GAAG,KAAK,YAAY,KAAK,IAAI,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;EAC1D,GAAG,KAAK,cAAc,KAAK,IAAI,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;CACjE;AACD;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG;CACjC,OAAO,WAAW,QAAQ,IAAI;AAC/B;;;;;;;;AAUA,eAAe,QAAQ,MAAM,QAAQ;CACpC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,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"}
@@ -1,5 +1,5 @@
1
- import { V as ServiceNode, d as Graph, x as NodeId, y as ModuleNode } from "./graph-types-BgT9UEdm-Bz-_OcJH.mjs";
2
- //#region ../../0-framework/1-core/core/dist/graph-B7NcPiOr.d.mts
1
+ import { U as ServiceNode, d as Graph, w as NodeId, x as ModuleNode } from "./graph-types-C3FOaaXm-C6_rGzfn.mjs";
2
+ //#region ../../0-framework/1-core/core/dist/graph-DDpXh7S8.d.mts
3
3
  //#region src/graph.d.ts
4
4
  /**
5
5
  * Builds the in-memory graph from a root node. A service root walks its own
@@ -15,4 +15,4 @@ declare function Load(root: ServiceNode | ModuleNode, opts?: {
15
15
  }): Graph;
16
16
  //#endregion
17
17
  export { Load as t };
18
- //# sourceMappingURL=graph-B7NcPiOr-aSUOCGTH.d.mts.map
18
+ //# sourceMappingURL=graph-DDpXh7S8-b-93BcHn.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-DDpXh7S8-b-93BcHn.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/graph-DDpXh7S8.d.mts"],"mappings":";;;;;;;;;;;;iBAWiB,KAAK,MAAM,cAAc,YAAY;EACpD,KAAK;IACH"}