@prisma/composer-prisma-cloud 0.1.0-dev.1

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 (46) hide show
  1. package/LICENSE +201 -0
  2. package/dist/control.d.mts +53 -0
  3. package/dist/control.mjs +2031 -0
  4. package/dist/control.mjs.map +1 -0
  5. package/dist/cron/index.d.mts +99 -0
  6. package/dist/cron/index.mjs +392 -0
  7. package/dist/cron/index.mjs.map +1 -0
  8. package/dist/cron/scheduler-entrypoint.mjs +7769 -0
  9. package/dist/cron/scheduler-entrypoint.mjs.map +1 -0
  10. package/dist/cron/scheduler-service.mjs +318 -0
  11. package/dist/cron/scheduler-service.mjs.map +1 -0
  12. package/dist/index.d.mts +205 -0
  13. package/dist/index.mjs +182 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/param-DB0B8m15-IvzNq9BM.mjs +92 -0
  16. package/dist/param-DB0B8m15-IvzNq9BM.mjs.map +1 -0
  17. package/dist/prisma-next-COrwlg3N.mjs +176 -0
  18. package/dist/prisma-next-COrwlg3N.mjs.map +1 -0
  19. package/dist/prisma-next.d.mts +71 -0
  20. package/dist/prisma-next.mjs +2 -0
  21. package/dist/serializer-DAEWRfnm-D3GW9dOZ.mjs +235 -0
  22. package/dist/serializer-DAEWRfnm-D3GW9dOZ.mjs.map +1 -0
  23. package/dist/storage/index.d.mts +55 -0
  24. package/dist/storage/index.mjs +411 -0
  25. package/dist/storage/index.mjs.map +1 -0
  26. package/dist/storage/storage-entrypoint.mjs +1173 -0
  27. package/dist/storage/storage-entrypoint.mjs.map +1 -0
  28. package/dist/storage/storage-service.mjs +377 -0
  29. package/dist/storage/storage-service.mjs.map +1 -0
  30. package/dist/storage/testing.d.mts +85 -0
  31. package/dist/storage/testing.mjs +531 -0
  32. package/dist/storage/testing.mjs.map +1 -0
  33. package/dist/streams/index.d.mts +47 -0
  34. package/dist/streams/index.mjs +450 -0
  35. package/dist/streams/index.mjs.map +1 -0
  36. package/dist/streams/streams-entrypoint.mjs +40575 -0
  37. package/dist/streams/streams-entrypoint.mjs.map +1 -0
  38. package/dist/streams/streams-service.mjs +424 -0
  39. package/dist/streams/streams-service.mjs.map +1 -0
  40. package/dist/streams/testing.d.mts +33 -0
  41. package/dist/streams/testing.mjs +31335 -0
  42. package/dist/streams/testing.mjs.map +1 -0
  43. package/dist/testing.d.mts +25 -0
  44. package/dist/testing.mjs +32 -0
  45. package/dist/testing.mjs.map +1 -0
  46. package/package.json +74 -0
@@ -0,0 +1,235 @@
1
+ import { secretSource } from "@prisma/composer";
2
+ import { blindCast } from "@prisma/composer/casts";
3
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/serializer-DAEWRfnm.mjs
4
+ /**
5
+ * Brands the payload `envSecret` builds. Core's `secretSource()` is a public
6
+ * SPI, so a user could bypass `envSecret` and bind a raw `secretSource('x')`;
7
+ * the brand lets `secretName` reject such a source (or another target's) with a
8
+ * clear error instead of reading an absent `.name`.
9
+ */
10
+ const PRISMA_CLOUD_SECRET_SOURCE = blindCast(Symbol.for("prisma:prisma-cloud-secret-source"));
11
+ const RESERVED_SECRET_PREFIX = "COMPOSER_";
12
+ const POISONED_SECRET_NAMES = /* @__PURE__ */ new Set(["DATABASE_URL", "DATABASE_URL_POOLED"]);
13
+ /**
14
+ * Binds a secret slot to a named Prisma Cloud platform env var (ADR-0029). The
15
+ * value is provisioned out-of-band; only the name is carried. The name may not
16
+ * use the framework's reserved `COMPOSER_` prefix or the poisoned
17
+ * `DATABASE_URL(_POOLED)` keys.
18
+ */
19
+ function envSecret(name) {
20
+ if (typeof name !== "string" || name.length === 0) throw new Error("envSecret() requires a non-empty platform env-var name, e.g. envSecret('STRIPE_SECRET_KEY').");
21
+ if (name.startsWith(RESERVED_SECRET_PREFIX)) throw new Error(`envSecret name "${name}" may not start with "${RESERVED_SECRET_PREFIX}" — that prefix is reserved for the framework's own generated config keys.`);
22
+ if (POISONED_SECRET_NAMES.has(name)) throw new Error(`envSecret name "${name}" is reserved — ${[...POISONED_SECRET_NAMES].join(" and ")} are poisoned at project provision and cannot back a secret.`);
23
+ return secretSource({
24
+ [PRISMA_CLOUD_SECRET_SOURCE]: true,
25
+ name
26
+ });
27
+ }
28
+ /** True only for a payload that `envSecret` built — i.e. one carrying the brand. */
29
+ function isEnvSecretPayload(payload) {
30
+ return typeof payload === "object" && payload !== null && blindCast(payload)[PRISMA_CLOUD_SECRET_SOURCE] === true;
31
+ }
32
+ /**
33
+ * Reads the Prisma Cloud env-var name back out of a secret binding's opaque
34
+ * source. A source not built by `envSecret` (a raw `secretSource(...)` or
35
+ * another target's source) carries no name — reject it here. `secretName` runs
36
+ * in preflight before any provisioning, so a foreign source fails early and
37
+ * clearly rather than producing a broken deploy with an undefined name.
38
+ */
39
+ function secretName(binding) {
40
+ const payload = binding.source.payload;
41
+ if (!isEnvSecretPayload(payload)) throw new Error(`secret slot "${binding.slot}" of service "${binding.serviceAddress}" is bound to a source not created by envSecret() — bind secrets with envSecret('NAME') from @prisma/composer-prisma-cloud.`);
42
+ return payload.name;
43
+ }
44
+ /**
45
+ * Walks a node's own params, then each dependency input's connection params —
46
+ * the same enumeration order `configOf` uses, but carrying the raw
47
+ * `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
48
+ * projection.
49
+ */
50
+ function paramEntries(node) {
51
+ const entries = [];
52
+ for (const [input, value] of Object.entries(node.inputs)) {
53
+ if (typeof value !== "object" || value === null) continue;
54
+ const params = blindCast(value).connection.params;
55
+ for (const [name, param] of Object.entries(params)) entries.push({
56
+ owner: { input },
57
+ name,
58
+ param
59
+ });
60
+ }
61
+ for (const [name, param] of Object.entries(node.params)) entries.push({
62
+ owner: "service",
63
+ name,
64
+ param
65
+ });
66
+ return entries;
67
+ }
68
+ const configKey = (address, d) => {
69
+ const segments = address.split(".").filter((s) => s.length > 0);
70
+ const owner = d.owner === "service" ? [] : [d.owner.input];
71
+ return [
72
+ "COMPOSER",
73
+ ...segments,
74
+ ...owner,
75
+ d.name
76
+ ].join("_").toUpperCase();
77
+ };
78
+ /**
79
+ * Typed value → its stored string. Service-own literals are JSON-encoded; a
80
+ * dependency-input value is a provisioning ref at deploy (and a resolved
81
+ * string at boot) and passes through untouched — LANDMINE: JSON-encoding it
82
+ * would break the ordering edge Alchemy resolves through it.
83
+ */
84
+ function encode(owner, value) {
85
+ return owner === "service" ? JSON.stringify(value) : blindCast(value);
86
+ }
87
+ /** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
88
+ function decode(owner, raw) {
89
+ return owner === "service" ? JSON.parse(raw) : raw;
90
+ }
91
+ const PARAM_POINTER_PREFIX = "@composer-param-pointer:";
92
+ /** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */
93
+ const isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);
94
+ /** Builds a param pointer row's stored value from the platform var NAME it points to. */
95
+ const encodeParamPointer = (name) => `${PARAM_POINTER_PREFIX}${name}`;
96
+ /** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */
97
+ const decodeParamPointer = (raw) => raw.slice(24);
98
+ function coerce(raw, d, key) {
99
+ if (!(raw !== void 0 && raw !== "")) {
100
+ if (d.param.default !== void 0) return d.param.default;
101
+ if (d.param.optional === true) return void 0;
102
+ throw new Error(`missing required config param "${d.name}" (env ${key})`);
103
+ }
104
+ if (d.owner === "service" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);
105
+ try {
106
+ return standardValidateSync(d.param.schema, decode(d.owner, raw));
107
+ } catch (cause) {
108
+ const message = cause instanceof Error ? cause.message : String(cause);
109
+ throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
110
+ }
111
+ }
112
+ /**
113
+ * Boot resolution for an env-sourced param: double-lookup (pointer → platform
114
+ * var), then the param's own schema on the raw string — no JSON decode, and
115
+ * no redaction (it's config, not a secret). An UNSET platform var is a loud
116
+ * boot failure naming both the param and the platform var; an EMPTY string is
117
+ * not special-cased here — it reaches the schema like any other value, so it
118
+ * passes iff the schema accepts it (deliberately unlike a literal param's own
119
+ * ""-means-absent rule, and unlike a secret's non-empty requirement).
120
+ */
121
+ function coerceEnvSourcedParam(raw, d, key) {
122
+ const platformVar = decodeParamPointer(raw);
123
+ const value = process.env[platformVar];
124
+ if (value === void 0) throw new Error(`env-sourced config param "${d.name}" (env ${key} → ${platformVar}) is unset: the platform variable "${platformVar}" was not injected — the deploy did not provision it.`);
125
+ try {
126
+ return standardValidateSync(d.param.schema, value);
127
+ } catch (cause) {
128
+ const message = cause instanceof Error ? cause.message : String(cause);
129
+ throw new Error(`invalid value for env-sourced config param "${d.name}" (env ${key} → ${platformVar}): ${message}`);
130
+ }
131
+ }
132
+ /**
133
+ * Boot: read each declared param from env by its key, reverse the param's own
134
+ * serialization (missing/invalid fails loudly), assemble the typed Config.
135
+ * Secrets ride a separate channel (deserializeSecrets), not this one.
136
+ */
137
+ const deserialize = (node, address) => {
138
+ const service = {};
139
+ const inputs = {};
140
+ for (const d of paramEntries(node)) {
141
+ const key = configKey(address, d);
142
+ const value = coerce(process.env[key], d, key);
143
+ if (d.owner === "service") service[d.name] = value;
144
+ else {
145
+ let bucket = inputs[d.owner.input];
146
+ if (bucket === void 0) {
147
+ bucket = {};
148
+ inputs[d.owner.input] = bucket;
149
+ }
150
+ bucket[d.name] = value;
151
+ }
152
+ }
153
+ return {
154
+ service,
155
+ inputs
156
+ };
157
+ };
158
+ /**
159
+ * run()'s setup step: write the resolved config to the environment under
160
+ * address-free keys (configKey("", d) + each serialize suffix), which load()
161
+ * reads back with no address. Uses env, not a module variable, because a
162
+ * framework may fork worker processes that inherit env but not memory.
163
+ * Writes only these keys; nothing else is touched.
164
+ */
165
+ const stash = (node, config) => {
166
+ for (const d of paramEntries(node)) {
167
+ const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
168
+ if (value === void 0) continue;
169
+ process.env[configKey("", d)] = encode(d.owner, value);
170
+ }
171
+ };
172
+ /** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
173
+ const secretKey = (address, slot) => configKey(address, {
174
+ owner: "service",
175
+ name: slot
176
+ });
177
+ /**
178
+ * Deploy: the pointer rows for a node's secret slots — each slot's key mapped to
179
+ * the platform NAME the root bound it to (looked up in `graph.secrets`). Never a
180
+ * value. A declared slot with no binding is a Load-invariant violation (Load
181
+ * binds every slot), surfaced loudly here rather than written as a blank row.
182
+ */
183
+ function secretPointerRows(node, address, bindings) {
184
+ const rows = [];
185
+ for (const slot of Object.keys(node.secretSlots)) {
186
+ const binding = bindings.find((b) => b.serviceAddress === address && b.slot === slot);
187
+ if (binding === void 0) throw new Error(`secret slot "${slot}" of "${address}" has no bound platform name — Load should have bound it (ADR-0029).`);
188
+ rows.push({
189
+ key: secretKey(address, slot),
190
+ name: secretName(binding)
191
+ });
192
+ }
193
+ return rows;
194
+ }
195
+ /**
196
+ * Boot: resolve every secret slot to its value by double-lookup — read the
197
+ * pointer key (the platform NAME), then read that platform var. A missing
198
+ * pointer or a missing/empty platform value is a loud failure naming both keys.
199
+ * Returns a plain Record for core's `hydrateSecrets` to box.
200
+ */
201
+ const deserializeSecrets = (node, address) => {
202
+ const values = {};
203
+ for (const slot of Object.keys(node.secretSlots)) {
204
+ const key = secretKey(address, slot);
205
+ const name = process.env[key];
206
+ if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
207
+ const value = process.env[name];
208
+ if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
209
+ values[slot] = value;
210
+ }
211
+ return values;
212
+ };
213
+ /**
214
+ * run()'s setup step for secrets: re-emit each slot's pointer NAME under its
215
+ * address-free key, so the address-free `deserializeSecrets` double-looks-up
216
+ * identically. Never the value — the value stays only in the platform var.
217
+ */
218
+ const stashSecrets = (node, address) => {
219
+ for (const slot of Object.keys(node.secretSlots)) {
220
+ const name = process.env[secretKey(address, slot)];
221
+ if (name === void 0) continue;
222
+ process.env[secretKey("", slot)] = name;
223
+ }
224
+ };
225
+ /** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
226
+ function standardValidateSync(schema, value) {
227
+ const result = schema["~standard"].validate(value);
228
+ if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
229
+ if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
230
+ return result.value;
231
+ }
232
+ //#endregion
233
+ export { encodeParamPointer as a, secretName as c, stashSecrets as d, encode as i, secretPointerRows as l, deserialize as n, envSecret as o, deserializeSecrets as r, paramEntries as s, configKey as t, stash as u };
234
+
235
+ //# sourceMappingURL=serializer-DAEWRfnm-D3GW9dOZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer-DAEWRfnm-D3GW9dOZ.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/serializer-DAEWRfnm.mjs"],"sourcesContent":["import { secretSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/secret.ts\n/**\n* Brands the payload `envSecret` builds. Core's `secretSource()` is a public\n* SPI, so a user could bypass `envSecret` and bind a raw `secretSource('x')`;\n* the brand lets `secretName` reject such a source (or another target's) with a\n* clear error instead of reading an absent `.name`.\n*/\nconst PRISMA_CLOUD_SECRET_SOURCE = blindCast(Symbol.for(\"prisma:prisma-cloud-secret-source\"));\nconst RESERVED_SECRET_PREFIX = \"COMPOSER_\";\nconst POISONED_SECRET_NAMES = /* @__PURE__ */ new Set([\"DATABASE_URL\", \"DATABASE_URL_POOLED\"]);\n/**\n* Binds a secret slot to a named Prisma Cloud platform env var (ADR-0029). The\n* value is provisioned out-of-band; only the name is carried. The name may not\n* use the framework's reserved `COMPOSER_` prefix or the poisoned\n* `DATABASE_URL(_POOLED)` keys.\n*/\nfunction envSecret(name) {\n\tif (typeof name !== \"string\" || name.length === 0) throw new Error(\"envSecret() requires a non-empty platform env-var name, e.g. envSecret('STRIPE_SECRET_KEY').\");\n\tif (name.startsWith(RESERVED_SECRET_PREFIX)) throw new Error(`envSecret name \"${name}\" may not start with \"${RESERVED_SECRET_PREFIX}\" — that prefix is reserved for the framework's own generated config keys.`);\n\tif (POISONED_SECRET_NAMES.has(name)) throw new Error(`envSecret name \"${name}\" is reserved — ${[...POISONED_SECRET_NAMES].join(\" and \")} are poisoned at project provision and cannot back a secret.`);\n\treturn secretSource({\n\t\t[PRISMA_CLOUD_SECRET_SOURCE]: true,\n\t\tname\n\t});\n}\n/** True only for a payload that `envSecret` built — i.e. one carrying the brand. */\nfunction isEnvSecretPayload(payload) {\n\treturn typeof payload === \"object\" && payload !== null && blindCast(payload)[PRISMA_CLOUD_SECRET_SOURCE] === true;\n}\n/**\n* Reads the Prisma Cloud env-var name back out of a secret binding's opaque\n* source. A source not built by `envSecret` (a raw `secretSource(...)` or\n* another target's source) carries no name — reject it here. `secretName` runs\n* in preflight before any provisioning, so a foreign source fails early and\n* clearly rather than producing a broken deploy with an undefined name.\n*/\nfunction secretName(binding) {\n\tconst payload = binding.source.payload;\n\tif (!isEnvSecretPayload(payload)) throw new Error(`secret slot \"${binding.slot}\" of service \"${binding.serviceAddress}\" is bound to a source not created by envSecret() — bind secrets with envSecret('NAME') from @prisma/composer-prisma-cloud.`);\n\treturn payload.name;\n}\n//#endregion\n//#region src/serializer.ts\n/**\n* Walks a node's own params, then each dependency input's connection params —\n* the same enumeration order `configOf` uses, but carrying the raw\n* `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data\n* projection.\n*/\nfunction paramEntries(node) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(node.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tconst params = blindCast(value).connection.params;\n\t\tfor (const [name, param] of Object.entries(params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tparam\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(node.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tparam\n\t});\n\treturn entries;\n}\nconst configKey = (address, d) => {\n\tconst segments = address.split(\".\").filter((s) => s.length > 0);\n\tconst owner = d.owner === \"service\" ? [] : [d.owner.input];\n\treturn [\n\t\t\"COMPOSER\",\n\t\t...segments,\n\t\t...owner,\n\t\td.name\n\t].join(\"_\").toUpperCase();\n};\n/**\n* Typed value → its stored string. Service-own literals are JSON-encoded; a\n* dependency-input value is a provisioning ref at deploy (and a resolved\n* string at boot) and passes through untouched — LANDMINE: JSON-encoding it\n* would break the ordering edge Alchemy resolves through it.\n*/\nfunction encode(owner, value) {\n\treturn owner === \"service\" ? JSON.stringify(value) : blindCast(value);\n}\n/** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */\nfunction decode(owner, raw) {\n\treturn owner === \"service\" ? JSON.parse(raw) : raw;\n}\nconst PARAM_POINTER_PREFIX = \"@composer-param-pointer:\";\n/** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */\nconst isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);\n/** Builds a param pointer row's stored value from the platform var NAME it points to. */\nconst encodeParamPointer = (name) => `${PARAM_POINTER_PREFIX}${name}`;\n/** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */\nconst decodeParamPointer = (raw) => raw.slice(24);\nfunction coerce(raw, d, key) {\n\tif (!(raw !== void 0 && raw !== \"\")) {\n\t\tif (d.param.default !== void 0) return d.param.default;\n\t\tif (d.param.optional === true) return void 0;\n\t\tthrow new Error(`missing required config param \"${d.name}\" (env ${key})`);\n\t}\n\tif (d.owner === \"service\" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);\n\ttry {\n\t\treturn standardValidateSync(d.param.schema, decode(d.owner, raw));\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`invalid value for config param \"${d.name}\" (env ${key}): ${message}`);\n\t}\n}\n/**\n* Boot resolution for an env-sourced param: double-lookup (pointer → platform\n* var), then the param's own schema on the raw string — no JSON decode, and\n* no redaction (it's config, not a secret). An UNSET platform var is a loud\n* boot failure naming both the param and the platform var; an EMPTY string is\n* not special-cased here — it reaches the schema like any other value, so it\n* passes iff the schema accepts it (deliberately unlike a literal param's own\n* \"\"-means-absent rule, and unlike a secret's non-empty requirement).\n*/\nfunction coerceEnvSourcedParam(raw, d, key) {\n\tconst platformVar = decodeParamPointer(raw);\n\tconst value = process.env[platformVar];\n\tif (value === void 0) throw new Error(`env-sourced config param \"${d.name}\" (env ${key} → ${platformVar}) is unset: the platform variable \"${platformVar}\" was not injected — the deploy did not provision it.`);\n\ttry {\n\t\treturn standardValidateSync(d.param.schema, value);\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`invalid value for env-sourced config param \"${d.name}\" (env ${key} → ${platformVar}): ${message}`);\n\t}\n}\n/**\n* Boot: read each declared param from env by its key, reverse the param's own\n* serialization (missing/invalid fails loudly), assemble the typed Config.\n* Secrets ride a separate channel (deserializeSecrets), not this one.\n*/\nconst deserialize = (node, address) => {\n\tconst service = {};\n\tconst inputs = {};\n\tfor (const d of paramEntries(node)) {\n\t\tconst key = configKey(address, d);\n\t\tconst value = coerce(process.env[key], d, key);\n\t\tif (d.owner === \"service\") service[d.name] = value;\n\t\telse {\n\t\t\tlet bucket = inputs[d.owner.input];\n\t\t\tif (bucket === void 0) {\n\t\t\t\tbucket = {};\n\t\t\t\tinputs[d.owner.input] = bucket;\n\t\t\t}\n\t\t\tbucket[d.name] = value;\n\t\t}\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n};\n/**\n* run()'s setup step: write the resolved config to the environment under\n* address-free keys (configKey(\"\", d) + each serialize suffix), which load()\n* reads back with no address. Uses env, not a module variable, because a\n* framework may fork worker processes that inherit env but not memory.\n* Writes only these keys; nothing else is touched.\n*/\nconst stash = (node, config) => {\n\tfor (const d of paramEntries(node)) {\n\t\tconst value = d.owner === \"service\" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];\n\t\tif (value === void 0) continue;\n\t\tprocess.env[configKey(\"\", d)] = encode(d.owner, value);\n\t}\n};\n/** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */\nconst secretKey = (address, slot) => configKey(address, {\n\towner: \"service\",\n\tname: slot\n});\n/**\n* Deploy: the pointer rows for a node's secret slots — each slot's key mapped to\n* the platform NAME the root bound it to (looked up in `graph.secrets`). Never a\n* value. A declared slot with no binding is a Load-invariant violation (Load\n* binds every slot), surfaced loudly here rather than written as a blank row.\n*/\nfunction secretPointerRows(node, address, bindings) {\n\tconst rows = [];\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst binding = bindings.find((b) => b.serviceAddress === address && b.slot === slot);\n\t\tif (binding === void 0) throw new Error(`secret slot \"${slot}\" of \"${address}\" has no bound platform name — Load should have bound it (ADR-0029).`);\n\t\trows.push({\n\t\t\tkey: secretKey(address, slot),\n\t\t\tname: secretName(binding)\n\t\t});\n\t}\n\treturn rows;\n}\n/**\n* Boot: resolve every secret slot to its value by double-lookup — read the\n* pointer key (the platform NAME), then read that platform var. A missing\n* pointer or a missing/empty platform value is a loud failure naming both keys.\n* Returns a plain Record for core's `hydrateSecrets` to box.\n*/\nconst deserializeSecrets = (node, address) => {\n\tconst values = {};\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst key = secretKey(address, slot);\n\t\tconst name = process.env[key];\n\t\tif (name === void 0 || name === \"\") throw new Error(`missing secret pointer for slot \"${slot}\" (env ${key}) — the deploy did not write it.`);\n\t\tconst value = process.env[name];\n\t\tif (value === void 0 || value === \"\") throw new Error(`secret \"${slot}\" is not provisioned (env ${key} → ${name}): the platform var \"${name}\" is unset or empty.`);\n\t\tvalues[slot] = value;\n\t}\n\treturn values;\n};\n/**\n* run()'s setup step for secrets: re-emit each slot's pointer NAME under its\n* address-free key, so the address-free `deserializeSecrets` double-looks-up\n* identically. Never the value — the value stays only in the platform var.\n*/\nconst stashSecrets = (node, address) => {\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst name = process.env[secretKey(address, slot)];\n\t\tif (name === void 0) continue;\n\t\tprocess.env[secretKey(\"\", slot)] = name;\n\t}\n};\n/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */\nfunction standardValidateSync(schema, value) {\n\tconst result = schema[\"~standard\"].validate(value);\n\tif (result instanceof Promise) throw new Error(\"config param schema validation must be synchronous — async Standard Schema validators are not supported for config params\");\n\tif (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join(\"; \")}`);\n\treturn result.value;\n}\n//#endregion\nexport { encodeParamPointer as a, stash as c, secretName as d, encode as i, stashSecrets as l, deserialize as n, paramEntries as o, deserializeSecrets as r, secretPointerRows as s, configKey as t, envSecret as u };\n\n//# sourceMappingURL=serializer-DAEWRfnm.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,6BAA6B,UAAU,OAAO,IAAI,mCAAmC,CAAC;AAC5F,MAAM,yBAAyB;AAC/B,MAAM,wCAAwC,IAAI,IAAI,CAAC,gBAAgB,qBAAqB,CAAC;;;;;;;AAO7F,SAAS,UAAU,MAAM;CACxB,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG,MAAM,IAAI,MAAM,8FAA8F;CACjK,IAAI,KAAK,WAAW,sBAAsB,GAAG,MAAM,IAAI,MAAM,mBAAmB,KAAK,wBAAwB,uBAAuB,2EAA2E;CAC/M,IAAI,sBAAsB,IAAI,IAAI,GAAG,MAAM,IAAI,MAAM,mBAAmB,KAAK,kBAAkB,CAAC,GAAG,qBAAqB,CAAC,CAAC,KAAK,OAAO,EAAE,6DAA6D;CACrM,OAAO,aAAa;GAClB,6BAA6B;EAC9B;CACD,CAAC;AACF;;AAEA,SAAS,mBAAmB,SAAS;CACpC,OAAO,OAAO,YAAY,YAAY,YAAY,QAAQ,UAAU,OAAO,CAAC,CAAC,gC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W,GAAG;EACjD,MAAM,MAAM,UAAU,SAAS,IAAI;EACnC,MAAM,OAAO,QAAQ,IAAI;EACzB,IAAI,SAAS,KAAK,KAAK,SAAS,IAAI,MAAM,IAAI,MAAM,oCAAoC,KAAK,SAAS,IAAI,iCAAiC;EAC3I,MAAM,QAAQ,QAAQ,IAAI;EAC1B,IAAI,UAAU,KAAK,KAAK,UAAU,IAAI,MAAM,IAAI,MAAM,WAAW,KAAK,4BAA4B,IAAI,KAAK,KAAK,uBAAuB,KAAK,qBAAqB;EACjK,OAAO,QAAQ;CAChB;CACA,OAAO;AACR;;;;;;AAMA,MAAM,gBAAgB,MAAM,YAAY;CACvC,KAAK,MAAM,QAAQ,OAAO,KAAK,KAAK,WAAW,GAAG;EACjD,MAAM,OAAO,QAAQ,IAAI,UAAU,SAAS,IAAI;EAChD,IAAI,SAAS,KAAK,GAAG;EACrB,QAAQ,IAAI,UAAU,IAAI,IAAI,KAAK;CACpC;AACD;;AAEA,SAAS,qBAAqB,QAAQ,OAAO;CAC5C,MAAM,SAAS,OAAO,YAAY,CAAC,SAAS,KAAK;CACjD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,2HAA2H;CAC1K,IAAI,OAAO,WAAW,KAAK,GAAG,MAAM,IAAI,MAAM,mCAAmC,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI,GAAG;CACzI,OAAO,OAAO;AACf"}
@@ -0,0 +1,55 @@
1
+ import { Contract, DependencyEnd, ModuleNode } from "@prisma/composer";
2
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/index.d.mts
3
+ //#endregion
4
+ //#region src/postgres.d.ts
5
+ interface PostgresConfig {
6
+ readonly url: string;
7
+ }
8
+ //#endregion
9
+ //#region src/s3-credentials.d.ts
10
+ interface CredentialsConfig {
11
+ readonly accessKeyId: string;
12
+ readonly secretAccessKey: string;
13
+ }
14
+ //#endregion
15
+ //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-CTRaaF2H.d.mts
16
+ //#region src/contract.d.ts
17
+ interface S3Config {
18
+ readonly url: string;
19
+ readonly bucket: string;
20
+ readonly accessKeyId: string;
21
+ readonly secretAccessKey: string;
22
+ }
23
+ declare const s3Contract: Contract<'s3', S3Config>;
24
+ type S3Contract = typeof s3Contract;
25
+ /**
26
+ * A consumer's dependency on an S3-compatible store. No `region` in the
27
+ * binding — the server accepts whatever region string the client signed.
28
+ */
29
+ declare function s3(): DependencyEnd<S3Config, typeof s3Contract>;
30
+ //#endregion
31
+ //#region src/storage-service.d.ts
32
+ declare function storageService(opts: {
33
+ bucket: string;
34
+ }): import("@prisma/composer").RunnableServiceNode<{
35
+ db: import("@prisma/composer").DependencyEnd<PostgresConfig, import("@prisma/composer").Contract<"postgres", PostgresConfig>>;
36
+ credentials: import("@prisma/composer").DependencyEnd<CredentialsConfig, import("@prisma/composer").Contract<"credentials", CredentialsConfig>>;
37
+ }, {
38
+ bucket: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<string, string>>;
39
+ } & {
40
+ readonly port: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<number, number>>;
41
+ }, {
42
+ store: import("@prisma/composer").Contract<"s3", S3Config>;
43
+ }, Record<never, never>>;
44
+ //#endregion
45
+ //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/index.d.mts
46
+ //#region src/storage-module.d.ts
47
+ declare function storage(opts?: {
48
+ name?: string;
49
+ bucket?: string;
50
+ }): ModuleNode<Record<never, never>, {
51
+ store: typeof s3Contract;
52
+ }, Record<never, never>>;
53
+ //#endregion
54
+ export { type S3Config, type S3Contract, s3, s3Contract, storage, storageService };
55
+ //# sourceMappingURL=index.d.mts.map