@prisma/composer-prisma-cloud 0.1.0 → 0.2.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.
- package/dist/control.d.mts +79 -36
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +1074 -330
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.d.mts +63 -10
- package/dist/cron/index.d.mts.map +1 -0
- package/dist/cron/index.mjs +255 -42
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +578 -300
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +255 -42
- package/dist/cron/scheduler-service.mjs.map +1 -1
- package/dist/email/email-entrypoint.mjs +19738 -0
- package/dist/email/email-entrypoint.mjs.map +1 -0
- package/dist/email/email-service.mjs +566 -0
- package/dist/email/email-service.mjs.map +1 -0
- package/dist/email/index.d.mts +282 -0
- package/dist/email/index.d.mts.map +1 -0
- package/dist/email/index.mjs +653 -0
- package/dist/email/index.mjs.map +1 -0
- package/dist/email/testing.d.mts +22 -0
- package/dist/email/testing.d.mts.map +1 -0
- package/dist/email/testing.mjs +1321 -0
- package/dist/email/testing.mjs.map +1 -0
- package/dist/index.d.mts +152 -26
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +108 -43
- package/dist/index.mjs.map +1 -1
- package/dist/{prisma-next-COrwlg3N.mjs → prisma-next-BvBwGCIt-CSauMX4l.mjs} +20 -4
- package/dist/prisma-next-BvBwGCIt-CSauMX4l.mjs.map +1 -0
- package/dist/prisma-next.d.mts +14 -6
- package/dist/prisma-next.d.mts.map +1 -0
- package/dist/prisma-next.mjs +1 -1
- package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs +211 -0
- package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs.map +1 -0
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts +36 -0
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
- package/dist/{serializer-C2CsA7xm-29Eg2Tjl.mjs → serializer-D8_84XWO-DA2B6YbX.mjs} +91 -7
- package/dist/serializer-D8_84XWO-DA2B6YbX.mjs.map +1 -0
- package/dist/storage/index.d.mts +56 -20
- package/dist/storage/index.d.mts.map +1 -0
- package/dist/storage/index.mjs +267 -44
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +7501 -155
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +267 -44
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/storage/testing.d.mts +7 -4
- package/dist/storage/testing.d.mts.map +1 -0
- package/dist/storage/testing.mjs.map +1 -1
- package/dist/streams/index.d.mts +222 -0
- package/dist/streams/index.d.mts.map +1 -0
- package/dist/streams/index.mjs +4170 -0
- package/dist/streams/index.mjs.map +1 -0
- package/dist/streams/streams-entrypoint.mjs +48211 -0
- package/dist/streams/streams-entrypoint.mjs.map +1 -0
- package/dist/streams/streams-service.mjs +923 -0
- package/dist/streams/streams-service.mjs.map +1 -0
- package/dist/streams/testing.d.mts +33 -0
- package/dist/streams/testing.d.mts.map +1 -0
- package/dist/streams/testing.mjs +31335 -0
- package/dist/streams/testing.mjs.map +1 -0
- package/dist/testing.d.mts +1 -2
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +35 -23
- package/src/exports/control.ts +1 -0
- package/src/exports/cron.ts +1 -0
- package/src/exports/email-testing.ts +1 -0
- package/src/exports/email.ts +1 -0
- package/src/exports/index.ts +1 -0
- package/src/exports/prisma-next.ts +1 -0
- package/src/exports/storage-testing.ts +1 -0
- package/src/exports/storage.ts +1 -0
- package/src/exports/streams-testing.ts +1 -0
- package/src/exports/streams.ts +1 -0
- package/src/exports/testing.ts +1 -0
- package/dist/prisma-next-COrwlg3N.mjs.map +0 -1
- package/dist/serializer-C2CsA7xm-29Eg2Tjl.mjs.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ConfigParam } from "@prisma/composer";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
//#region ../../1-prisma-cloud/1-extensions/target/dist/serializer-Cx5slrV4.d.mts
|
|
4
|
+
//#region src/serializer.d.ts
|
|
5
|
+
/** One declared param, paired with its owner and the raw ConfigParam (functions included). */
|
|
6
|
+
interface ParamEntry {
|
|
7
|
+
readonly owner: 'service' | {
|
|
8
|
+
readonly input: string;
|
|
9
|
+
};
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly param: ConfigParam;
|
|
12
|
+
}
|
|
13
|
+
declare const configKey: (address: string, d: {
|
|
14
|
+
owner: ParamEntry["owner"];
|
|
15
|
+
name: string;
|
|
16
|
+
}) => string;
|
|
17
|
+
/**
|
|
18
|
+
* One reserved provider param's declaration: the boot-relevant half (name +
|
|
19
|
+
* schema) of a `ProviderParam` — the half the target's runtime side needs,
|
|
20
|
+
* without the deploy-only `value(refs)` function control.ts adds on top.
|
|
21
|
+
*
|
|
22
|
+
* `brand` is the ADR-0031 need brand this param answers for (e.g.
|
|
23
|
+
* `RPC_PEER_KEY`, `STREAMS_API_KEY`). control.ts's `PROVIDER_PARAMS` is built
|
|
24
|
+
* by mapping over the boot-side list of these entries (`provider-params.ts`'s
|
|
25
|
+
* `RESERVED_PROVIDER_PARAMS`) and looking up each brand's `value(refs)` by
|
|
26
|
+
* this field — so a param can exist on the deploy side only if it already
|
|
27
|
+
* exists here.
|
|
28
|
+
*/
|
|
29
|
+
interface ProviderParamEntry {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly schema: StandardSchemaV1;
|
|
32
|
+
readonly brand: symbol;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { configKey as n, ProviderParamEntry as t };
|
|
36
|
+
//# sourceMappingURL=serializer-Cx5slrV4-xJfH6EWS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-Cx5slrV4-xJfH6EWS.d.mts","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/serializer-Cx5slrV4.d.mts"],"mappings":";;;;;UAIU;WACC;aACE;;WAEF;WACA,OAAO;;cAEJ,YAAY,iBAAiB;EACzC,OAAO;EACP;;;;;;;;;;;;;;UAcQ;WACC;WACA,QAAQ;WACR"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { secretSource } from "@prisma/composer";
|
|
2
2
|
import { blindCast } from "@prisma/composer/casts";
|
|
3
|
-
|
|
3
|
+
import { type } from "arktype";
|
|
4
|
+
//#region ../../1-prisma-cloud/1-extensions/target/dist/serializer-D8_84XWO.mjs
|
|
4
5
|
/**
|
|
5
6
|
* Brands the payload `envSecret` builds. Core's `secretSource()` is a public
|
|
6
7
|
* SPI, so a user could bypass `envSecret` and bind a raw `secretSource('x')`;
|
|
@@ -8,12 +9,12 @@ import { blindCast } from "@prisma/composer/casts";
|
|
|
8
9
|
* clear error instead of reading an absent `.name`.
|
|
9
10
|
*/
|
|
10
11
|
const PRISMA_CLOUD_SECRET_SOURCE = blindCast(Symbol.for("prisma:prisma-cloud-secret-source"));
|
|
11
|
-
const RESERVED_SECRET_PREFIX = "
|
|
12
|
+
const RESERVED_SECRET_PREFIX = "COMPOSER_";
|
|
12
13
|
const POISONED_SECRET_NAMES = /* @__PURE__ */ new Set(["DATABASE_URL", "DATABASE_URL_POOLED"]);
|
|
13
14
|
/**
|
|
14
15
|
* Binds a secret slot to a named Prisma Cloud platform env var (ADR-0029). The
|
|
15
16
|
* value is provisioned out-of-band; only the name is carried. The name may not
|
|
16
|
-
* use the framework's reserved `
|
|
17
|
+
* use the framework's reserved `COMPOSER_` prefix or the poisoned
|
|
17
18
|
* `DATABASE_URL(_POOLED)` keys.
|
|
18
19
|
*/
|
|
19
20
|
function envSecret(name) {
|
|
@@ -69,7 +70,7 @@ const configKey = (address, d) => {
|
|
|
69
70
|
const segments = address.split(".").filter((s) => s.length > 0);
|
|
70
71
|
const owner = d.owner === "service" ? [] : [d.owner.input];
|
|
71
72
|
return [
|
|
72
|
-
"
|
|
73
|
+
"COMPOSER",
|
|
73
74
|
...segments,
|
|
74
75
|
...owner,
|
|
75
76
|
d.name
|
|
@@ -88,12 +89,20 @@ function encode(owner, value) {
|
|
|
88
89
|
function decode(owner, raw) {
|
|
89
90
|
return owner === "service" ? JSON.parse(raw) : raw;
|
|
90
91
|
}
|
|
92
|
+
const PARAM_POINTER_PREFIX = "@composer-param-pointer:";
|
|
93
|
+
/** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */
|
|
94
|
+
const isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);
|
|
95
|
+
/** Builds a param pointer row's stored value from the platform var NAME it points to. */
|
|
96
|
+
const encodeParamPointer = (name) => `${PARAM_POINTER_PREFIX}${name}`;
|
|
97
|
+
/** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */
|
|
98
|
+
const decodeParamPointer = (raw) => raw.slice(24);
|
|
91
99
|
function coerce(raw, d, key) {
|
|
92
100
|
if (!(raw !== void 0 && raw !== "")) {
|
|
93
101
|
if (d.param.default !== void 0) return d.param.default;
|
|
94
102
|
if (d.param.optional === true) return void 0;
|
|
95
103
|
throw new Error(`missing required config param "${d.name}" (env ${key})`);
|
|
96
104
|
}
|
|
105
|
+
if (d.owner === "service" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);
|
|
97
106
|
try {
|
|
98
107
|
return standardValidateSync(d.param.schema, decode(d.owner, raw));
|
|
99
108
|
} catch (cause) {
|
|
@@ -102,6 +111,26 @@ function coerce(raw, d, key) {
|
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
/**
|
|
114
|
+
* Boot resolution for an env-sourced param: double-lookup (pointer → platform
|
|
115
|
+
* var), then the param's own schema on the raw string — no JSON decode, and
|
|
116
|
+
* no redaction (it's config, not a secret). An UNSET platform var is a loud
|
|
117
|
+
* boot failure naming both the param and the platform var; an EMPTY string is
|
|
118
|
+
* not special-cased here — it reaches the schema like any other value, so it
|
|
119
|
+
* passes iff the schema accepts it (deliberately unlike a literal param's own
|
|
120
|
+
* ""-means-absent rule, and unlike a secret's non-empty requirement).
|
|
121
|
+
*/
|
|
122
|
+
function coerceEnvSourcedParam(raw, d, key) {
|
|
123
|
+
const platformVar = decodeParamPointer(raw);
|
|
124
|
+
const value = process.env[platformVar];
|
|
125
|
+
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.`);
|
|
126
|
+
try {
|
|
127
|
+
return standardValidateSync(d.param.schema, value);
|
|
128
|
+
} catch (cause) {
|
|
129
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
130
|
+
throw new Error(`invalid value for env-sourced config param "${d.name}" (env ${key} → ${platformVar}): ${message}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
105
134
|
* Boot: read each declared param from env by its key, reverse the param's own
|
|
106
135
|
* serialization (missing/invalid fails loudly), assemble the typed Config.
|
|
107
136
|
* Secrets ride a separate channel (deserializeSecrets), not this one.
|
|
@@ -141,7 +170,7 @@ const stash = (node, config) => {
|
|
|
141
170
|
process.env[configKey("", d)] = encode(d.owner, value);
|
|
142
171
|
}
|
|
143
172
|
};
|
|
144
|
-
/** The pointer-row key for a secret slot:
|
|
173
|
+
/** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
|
|
145
174
|
const secretKey = (address, slot) => configKey(address, {
|
|
146
175
|
owner: "service",
|
|
147
176
|
name: slot
|
|
@@ -194,6 +223,61 @@ const stashSecrets = (node, address) => {
|
|
|
194
223
|
process.env[secretKey("", slot)] = name;
|
|
195
224
|
}
|
|
196
225
|
};
|
|
226
|
+
/**
|
|
227
|
+
* Boot: for each reserved provider param, read its address-scoped row through
|
|
228
|
+
* the same `coerce` a declared param uses (JSON-decode, schema-validate), and
|
|
229
|
+
* re-emit it address-free — `stash`'s counterpart for this separate
|
|
230
|
+
* declaration space. A param is declared optional here unconditionally: an
|
|
231
|
+
* absent row means "never provisioned" (local dev, tests, a provider with no
|
|
232
|
+
* registered value for this deploy), never a boot failure, so nothing is
|
|
233
|
+
* stashed and the runtime reader that owns this slot falls back to its own
|
|
234
|
+
* pass-through behavior.
|
|
235
|
+
*/
|
|
236
|
+
function stashProviderParams(entries, address) {
|
|
237
|
+
for (const entry of entries) {
|
|
238
|
+
const d = {
|
|
239
|
+
owner: "service",
|
|
240
|
+
name: entry.name,
|
|
241
|
+
param: {
|
|
242
|
+
schema: entry.schema,
|
|
243
|
+
optional: true
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const key = configKey(address, d);
|
|
247
|
+
const value = coerce(process.env[key], d, key);
|
|
248
|
+
if (value === void 0) continue;
|
|
249
|
+
process.env[configKey("", d)] = encode("service", value);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/** The framework-resolved origin row: COMPOSER_<addr>_ORIGIN. Written per
|
|
253
|
+
* compute service at serialize — the service's own provisioned endpoint URL,
|
|
254
|
+
* riding the reserved-provider-param machinery (`origin-key.ts`'s
|
|
255
|
+
* `ORIGIN_PARAM`); never a declared param, never in config(). A harness with
|
|
256
|
+
* no deploy behind it supplies it by setting `COMPOSER_ORIGIN` to the
|
|
257
|
+
* JSON-encoded origin URL — exactly how the existing entrypoint tests supply
|
|
258
|
+
* their other `COMPOSER_*` rows. */
|
|
259
|
+
const ORIGIN_KEY_NAME = "ORIGIN";
|
|
260
|
+
/**
|
|
261
|
+
* Reads this service's origin back out of the address-free stash
|
|
262
|
+
* `stashProviderParams` wrote for the ORIGIN entry. `COMPOSER_ORIGIN` unset is
|
|
263
|
+
* a loud failure — a deployed environment always writes it, so an unset row
|
|
264
|
+
* means either a local harness that hasn't supplied it or a boot() called
|
|
265
|
+
* before run().
|
|
266
|
+
*/
|
|
267
|
+
function readOrigin() {
|
|
268
|
+
const d = {
|
|
269
|
+
owner: "service",
|
|
270
|
+
name: ORIGIN_KEY_NAME,
|
|
271
|
+
param: {
|
|
272
|
+
schema: type("string"),
|
|
273
|
+
optional: true
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const key = configKey("", d);
|
|
277
|
+
const value = coerce(process.env[key], d, key);
|
|
278
|
+
if (value === void 0) throw new Error("this service's origin is not available (env COMPOSER_ORIGIN is unset) — a deployed environment writes it automatically; a local harness must supply it like any other config value (set COMPOSER_ORIGIN to the JSON-encoded origin URL).");
|
|
279
|
+
return blindCast(value);
|
|
280
|
+
}
|
|
197
281
|
/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
|
|
198
282
|
function standardValidateSync(schema, value) {
|
|
199
283
|
const result = schema["~standard"].validate(value);
|
|
@@ -202,6 +286,6 @@ function standardValidateSync(schema, value) {
|
|
|
202
286
|
return result.value;
|
|
203
287
|
}
|
|
204
288
|
//#endregion
|
|
205
|
-
export {
|
|
289
|
+
export { encode as a, paramEntries as c, secretPointerRows as d, stash as f, deserializeSecrets as i, readOrigin as l, stashSecrets as m, configKey as n, encodeParamPointer as o, stashProviderParams as p, deserialize as r, envSecret as s, ORIGIN_KEY_NAME as t, secretName as u };
|
|
206
290
|
|
|
207
|
-
//# sourceMappingURL=serializer-
|
|
291
|
+
//# sourceMappingURL=serializer-D8_84XWO-DA2B6YbX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-D8_84XWO-DA2B6YbX.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/serializer-D8_84XWO.mjs"],"sourcesContent":["import { secretSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { type } from \"arktype\";\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/**\n* Boot: for each reserved provider param, read its address-scoped row through\n* the same `coerce` a declared param uses (JSON-decode, schema-validate), and\n* re-emit it address-free — `stash`'s counterpart for this separate\n* declaration space. A param is declared optional here unconditionally: an\n* absent row means \"never provisioned\" (local dev, tests, a provider with no\n* registered value for this deploy), never a boot failure, so nothing is\n* stashed and the runtime reader that owns this slot falls back to its own\n* pass-through behavior.\n*/\nfunction stashProviderParams(entries, address) {\n\tfor (const entry of entries) {\n\t\tconst d = {\n\t\t\towner: \"service\",\n\t\t\tname: entry.name,\n\t\t\tparam: {\n\t\t\t\tschema: entry.schema,\n\t\t\t\toptional: true\n\t\t\t}\n\t\t};\n\t\tconst key = configKey(address, d);\n\t\tconst value = coerce(process.env[key], d, key);\n\t\tif (value === void 0) continue;\n\t\tprocess.env[configKey(\"\", d)] = encode(\"service\", value);\n\t}\n}\n/** The framework-resolved origin row: COMPOSER_<addr>_ORIGIN. Written per\n* compute service at serialize — the service's own provisioned endpoint URL,\n* riding the reserved-provider-param machinery (`origin-key.ts`'s\n* `ORIGIN_PARAM`); never a declared param, never in config(). A harness with\n* no deploy behind it supplies it by setting `COMPOSER_ORIGIN` to the\n* JSON-encoded origin URL — exactly how the existing entrypoint tests supply\n* their other `COMPOSER_*` rows. */\nconst ORIGIN_KEY_NAME = \"ORIGIN\";\n/**\n* Reads this service's origin back out of the address-free stash\n* `stashProviderParams` wrote for the ORIGIN entry. `COMPOSER_ORIGIN` unset is\n* a loud failure — a deployed environment always writes it, so an unset row\n* means either a local harness that hasn't supplied it or a boot() called\n* before run().\n*/\nfunction readOrigin() {\n\tconst d = {\n\t\towner: \"service\",\n\t\tname: ORIGIN_KEY_NAME,\n\t\tparam: {\n\t\t\tschema: type(\"string\"),\n\t\t\toptional: true\n\t\t}\n\t};\n\tconst key = configKey(\"\", d);\n\tconst value = coerce(process.env[key], d, key);\n\tif (value === void 0) throw new Error(\"this service's origin is not available (env COMPOSER_ORIGIN is unset) — a deployed environment writes it automatically; a local harness must supply it like any other config value (set COMPOSER_ORIGIN to the JSON-encoded origin URL).\");\n\treturn blindCast(value);\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 { encode as a, readOrigin as c, stashProviderParams as d, stashSecrets as f, deserializeSecrets as i, secretPointerRows as l, secretName as m, configKey as n, encodeParamPointer as o, envSecret as p, deserialize as r, paramEntries as s, ORIGIN_KEY_NAME as t, stash as u };\n\n//# sourceMappingURL=serializer-D8_84XWO.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,6BAA6B,UAAU,OAAO,IAAI,mCAAmC,CAAC;AAC5F,MAAM,yBAAyB;AAC/B,MAAM,wCAAwC,IAAI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;GACP,MAAM,MAAM;GACZ,OAAO;IACN,QAAQ,MAAM;IACd,UAAU;GACX;EACD;EACA,MAAM,MAAM,UAAU,SAAS,CAAC;EAChC,MAAM,QAAQ,OAAO,QAAQ,IAAI,MAAM,GAAG,GAAG;EAC7C,IAAI,UAAU,KAAK,GAAG;EACtB,QAAQ,IAAI,UAAU,IAAI,CAAC,KAAK,OAAO,WAAW,KAAK;CACxD;AACD;;;;;;;;AAQA,MAAM,kBAAkB;;;;;;;;AAQxB,SAAS,aAAa;CACrB,MAAM,IAAI;EACT,OAAO;EACP,MAAM;EACN,OAAO;GACN,QAAQ,KAAK,QAAQ;GACrB,UAAU;EACX;CACD;CACA,MAAM,MAAM,UAAU,IAAI,CAAC;CAC3B,MAAM,QAAQ,OAAO,QAAQ,IAAI,MAAM,GAAG,GAAG;CAC7C,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,0OAA0O;CAChR,OAAO,UAAU,KAAK;AACvB;;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"}
|
package/dist/storage/index.d.mts
CHANGED
|
@@ -1,31 +1,68 @@
|
|
|
1
|
-
import { Contract, DependencyEnd, ModuleNode } from "@prisma/composer";
|
|
2
|
-
|
|
1
|
+
import { BuildAdapter, Contract, DependencyEnd, Deps, Expose, HydratedDeps, ModuleNode, NODE, Params, RunnableServiceNode, SecretValues, Secrets, ServiceNode, Values } from "@prisma/composer";
|
|
2
|
+
import "@standard-schema/spec";
|
|
3
3
|
//#region ../../1-prisma-cloud/1-extensions/target/dist/index.d.mts
|
|
4
4
|
//#endregion
|
|
5
|
+
//#region src/compute.d.ts
|
|
6
|
+
declare const reservedParams: {
|
|
7
|
+
readonly port: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<number, number>>;
|
|
8
|
+
};
|
|
9
|
+
type ReservedParams = typeof reservedParams;
|
|
10
|
+
/**
|
|
11
|
+
* A Prisma Compute service — declarations only (deps + params + build + the
|
|
12
|
+
* ports it exposes), no descriptor. `params` merges with the reserved
|
|
13
|
+
* `ReservedParams` (`port`); a user param whose name collides with a reserved
|
|
14
|
+
* one fails at authoring, the same way a colliding dependency name does.
|
|
15
|
+
*
|
|
16
|
+
* · run(address, boot) — the process controller: deserialize the platform
|
|
17
|
+
* environment (keyed off `address`, the extension's ONE env read) into a
|
|
18
|
+
* typed Config, re-emit it under address-free process-local stash keys,
|
|
19
|
+
* then call boot() to start the app's entry.
|
|
20
|
+
* · load() / config() — called from inside the app's entry: read the stash;
|
|
21
|
+
* load() hydrates + memoizes the deps, config() returns the typed params.
|
|
22
|
+
* Separate accessors so a dep and a param never share a namespace (ADR-0021).
|
|
23
|
+
* · origin() — this service's platform-assigned public origin, read from the
|
|
24
|
+
* stash `run()` populates; memoized per process.
|
|
25
|
+
*
|
|
26
|
+
* The underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
|
|
27
|
+
* the control-plane registry key `prisma-composer deploy` resolves through the
|
|
28
|
+
* app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
|
|
29
|
+
* deploy time; nodes are pure data until run() or load() is called.
|
|
30
|
+
*/
|
|
31
|
+
declare class ComputeService<D extends Deps, P extends Params, E extends Expose, S extends Secrets> implements RunnableServiceNode<D, P & ReservedParams, E, S> {
|
|
32
|
+
#private;
|
|
33
|
+
readonly [NODE]: true;
|
|
34
|
+
readonly kind: 'service';
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly extension: string;
|
|
37
|
+
readonly type: string;
|
|
38
|
+
readonly inputs: D;
|
|
39
|
+
readonly params: P & ReservedParams;
|
|
40
|
+
readonly secretSlots: S;
|
|
41
|
+
readonly build: BuildAdapter;
|
|
42
|
+
readonly expose: E | undefined;
|
|
43
|
+
constructor(node: ServiceNode<D, P & ReservedParams, E, S>);
|
|
44
|
+
run(address: string, boot: () => Promise<unknown>): Promise<unknown>;
|
|
45
|
+
load(): HydratedDeps<D>;
|
|
46
|
+
config(): Values<P & ReservedParams>;
|
|
47
|
+
secrets(): SecretValues<S>;
|
|
48
|
+
/** This service's platform-assigned public origin — read from the stash
|
|
49
|
+
* run() populates and memoized per process. Throws if called before run()
|
|
50
|
+
* has stashed it (readOrigin's pinned message). */
|
|
51
|
+
origin(): string;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
5
54
|
//#region src/postgres.d.ts
|
|
6
55
|
interface PostgresConfig {
|
|
7
56
|
readonly url: string;
|
|
8
57
|
}
|
|
9
|
-
/**
|
|
10
|
-
* The contract a Postgres provides — and the contract its consumers require.
|
|
11
|
-
* `satisfies` compares KIND, not identity: an extension module can be duplicated
|
|
12
|
-
* across a workspace (same rationale as the Symbol.for node brand), and every
|
|
13
|
-
* duplicate's contract must still satisfy. `__cmp` is the connection config a
|
|
14
|
-
* postgres offers; core never inspects it.
|
|
15
|
-
*/
|
|
16
58
|
//#endregion
|
|
17
59
|
//#region src/s3-credentials.d.ts
|
|
18
60
|
interface CredentialsConfig {
|
|
19
61
|
readonly accessKeyId: string;
|
|
20
62
|
readonly secretAccessKey: string;
|
|
21
63
|
}
|
|
22
|
-
/**
|
|
23
|
-
* The contract the `s3-credentials` resource provides — a minted SigV4 key
|
|
24
|
-
* pair. `satisfies` compares KIND only (mirrors `postgresContract`); `__cmp` is
|
|
25
|
-
* the config the resource offers, which core never inspects.
|
|
26
|
-
*/
|
|
27
64
|
//#endregion
|
|
28
|
-
//#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-
|
|
65
|
+
//#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-CVf6j3HC.d.mts
|
|
29
66
|
//#region src/contract.d.ts
|
|
30
67
|
interface S3Config {
|
|
31
68
|
readonly url: string;
|
|
@@ -39,17 +76,16 @@ type S3Contract = typeof s3Contract;
|
|
|
39
76
|
* A consumer's dependency on an S3-compatible store. No `region` in the
|
|
40
77
|
* binding — the server accepts whatever region string the client signed.
|
|
41
78
|
*/
|
|
42
|
-
declare function s3(): DependencyEnd<S3Config, typeof s3Contract>;
|
|
79
|
+
declare function s3(): DependencyEnd<S3Config, typeof s3Contract>;
|
|
80
|
+
//#endregion
|
|
43
81
|
//#region src/storage-service.d.ts
|
|
44
82
|
declare function storageService(opts: {
|
|
45
83
|
bucket: string;
|
|
46
|
-
}):
|
|
84
|
+
}): ComputeService<{
|
|
47
85
|
db: import("@prisma/composer").DependencyEnd<PostgresConfig, import("@prisma/composer").Contract<"postgres", PostgresConfig>>;
|
|
48
86
|
credentials: import("@prisma/composer").DependencyEnd<CredentialsConfig, import("@prisma/composer").Contract<"credentials", CredentialsConfig>>;
|
|
49
87
|
}, {
|
|
50
88
|
bucket: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<string, string>>;
|
|
51
|
-
} & {
|
|
52
|
-
readonly port: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<number, number>>;
|
|
53
89
|
}, {
|
|
54
90
|
store: import("@prisma/composer").Contract<"s3", S3Config>;
|
|
55
91
|
}, Record<never, never>>;
|
|
@@ -61,7 +97,7 @@ declare function storage(opts?: {
|
|
|
61
97
|
bucket?: string;
|
|
62
98
|
}): ModuleNode<Record<never, never>, {
|
|
63
99
|
store: typeof s3Contract;
|
|
64
|
-
}, Record<never, never>>;
|
|
100
|
+
}, Record<never, never>>;
|
|
65
101
|
//#endregion
|
|
66
102
|
export { type S3Config, type S3Contract, s3, s3Contract, storage, storageService };
|
|
67
103
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../1-prisma-cloud/1-extensions/target/dist/index.d.mts","../../../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-CVf6j3HC.d.mts","../../../../1-prisma-cloud/2-shared-modules/storage/dist/index.d.mts"],"mappings":";;;;;cA0Cc;WACH,+BAA+B,4CAA4C;;KAEjF,wBAAwB;;;;;;;;;;;;;;;;;;;;;;cAsBf,eAAe,UAAU,MAAM,UAAU,QAAQ,UAAU,QAAQ,UAAU,oBAAoB,oBAAoB,GAAG,IAAI,gBAAgB,GAAG;;YAEjJ;WACD;WACA;WACA;WACA;WACA,QAAQ;WACR,QAAQ,IAAI;WACZ,aAAa;WACb,OAAO;WACP,QAAQ;EACjB,YAAY,MAAM,YAAY,GAAG,IAAI,gBAAgB,GAAG;EACxD,IAAI,iBAAiB,YAAY,mBAAmB;EACpD,QAAQ,aAAa;EACrB,UAAU,OAAO,IAAI;EACrB,WAAW,aAAa;;;;EAIxB;;;;UA+DQ;WACC;;;;UAiDD;WACC;WACA;;;;;UCxMD;WACC;WACA;WACA;WACA;;cAEG,YAAY,eAAe;KACpC,oBAAoB;;;;;iBAKR,MAAM,cAAc,iBAAiB;;;iBAGrC,eAAe;EAC9B;IAQC;EAND,6BAA6B,cAHd,yCAGsG,qBAAzC;EAC5E,sCAAsC,cADqI,4CAC1C,wBAA5C;;EAErF,iCAAiC,4CAA4C;;EAE7E,gCAAgC,eAAe;GAC9C;;;;iBCvBc,QAAQ;EACvB;EACA;IACE,WAAW;EACb,cAAc;GACb"}
|