@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.
Files changed (80) hide show
  1. package/dist/control.d.mts +79 -36
  2. package/dist/control.d.mts.map +1 -0
  3. package/dist/control.mjs +1074 -330
  4. package/dist/control.mjs.map +1 -1
  5. package/dist/cron/index.d.mts +63 -10
  6. package/dist/cron/index.d.mts.map +1 -0
  7. package/dist/cron/index.mjs +255 -42
  8. package/dist/cron/index.mjs.map +1 -1
  9. package/dist/cron/scheduler-entrypoint.mjs +578 -300
  10. package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
  11. package/dist/cron/scheduler-service.mjs +255 -42
  12. package/dist/cron/scheduler-service.mjs.map +1 -1
  13. package/dist/email/email-entrypoint.mjs +19738 -0
  14. package/dist/email/email-entrypoint.mjs.map +1 -0
  15. package/dist/email/email-service.mjs +566 -0
  16. package/dist/email/email-service.mjs.map +1 -0
  17. package/dist/email/index.d.mts +282 -0
  18. package/dist/email/index.d.mts.map +1 -0
  19. package/dist/email/index.mjs +653 -0
  20. package/dist/email/index.mjs.map +1 -0
  21. package/dist/email/testing.d.mts +22 -0
  22. package/dist/email/testing.d.mts.map +1 -0
  23. package/dist/email/testing.mjs +1321 -0
  24. package/dist/email/testing.mjs.map +1 -0
  25. package/dist/index.d.mts +152 -26
  26. package/dist/index.d.mts.map +1 -0
  27. package/dist/index.mjs +108 -43
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/{prisma-next-COrwlg3N.mjs → prisma-next-BvBwGCIt-CSauMX4l.mjs} +20 -4
  30. package/dist/prisma-next-BvBwGCIt-CSauMX4l.mjs.map +1 -0
  31. package/dist/prisma-next.d.mts +14 -6
  32. package/dist/prisma-next.d.mts.map +1 -0
  33. package/dist/prisma-next.mjs +1 -1
  34. package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs +211 -0
  35. package/dist/provisioned-edges-B_XS1Mz--NFJgcXK7.mjs.map +1 -0
  36. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts +36 -0
  37. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
  38. package/dist/{serializer-C2CsA7xm-29Eg2Tjl.mjs → serializer-D8_84XWO-DA2B6YbX.mjs} +91 -7
  39. package/dist/serializer-D8_84XWO-DA2B6YbX.mjs.map +1 -0
  40. package/dist/storage/index.d.mts +56 -20
  41. package/dist/storage/index.d.mts.map +1 -0
  42. package/dist/storage/index.mjs +267 -44
  43. package/dist/storage/index.mjs.map +1 -1
  44. package/dist/storage/storage-entrypoint.mjs +7501 -155
  45. package/dist/storage/storage-entrypoint.mjs.map +1 -1
  46. package/dist/storage/storage-service.mjs +267 -44
  47. package/dist/storage/storage-service.mjs.map +1 -1
  48. package/dist/storage/testing.d.mts +7 -4
  49. package/dist/storage/testing.d.mts.map +1 -0
  50. package/dist/storage/testing.mjs.map +1 -1
  51. package/dist/streams/index.d.mts +222 -0
  52. package/dist/streams/index.d.mts.map +1 -0
  53. package/dist/streams/index.mjs +4170 -0
  54. package/dist/streams/index.mjs.map +1 -0
  55. package/dist/streams/streams-entrypoint.mjs +48211 -0
  56. package/dist/streams/streams-entrypoint.mjs.map +1 -0
  57. package/dist/streams/streams-service.mjs +923 -0
  58. package/dist/streams/streams-service.mjs.map +1 -0
  59. package/dist/streams/testing.d.mts +33 -0
  60. package/dist/streams/testing.d.mts.map +1 -0
  61. package/dist/streams/testing.mjs +31335 -0
  62. package/dist/streams/testing.mjs.map +1 -0
  63. package/dist/testing.d.mts +1 -2
  64. package/dist/testing.d.mts.map +1 -0
  65. package/dist/testing.mjs +1 -1
  66. package/dist/testing.mjs.map +1 -1
  67. package/package.json +35 -23
  68. package/src/exports/control.ts +1 -0
  69. package/src/exports/cron.ts +1 -0
  70. package/src/exports/email-testing.ts +1 -0
  71. package/src/exports/email.ts +1 -0
  72. package/src/exports/index.ts +1 -0
  73. package/src/exports/prisma-next.ts +1 -0
  74. package/src/exports/storage-testing.ts +1 -0
  75. package/src/exports/storage.ts +1 -0
  76. package/src/exports/streams-testing.ts +1 -0
  77. package/src/exports/streams.ts +1 -0
  78. package/src/exports/testing.ts +1 -0
  79. package/dist/prisma-next-COrwlg3N.mjs.map +0 -1
  80. package/dist/serializer-C2CsA7xm-29Eg2Tjl.mjs.map +0 -1
@@ -42,6 +42,15 @@ function blindCast(input) {
42
42
  * data objects. A node's `extension` + `type` form its deploy-time registry key (ADR-0017).
43
43
  */
44
44
  const NODE = Symbol.for("prisma:node");
45
+ const PROVISION_NEED = blindCast(Symbol.for("prisma:provision-need"));
46
+ /** Builds an opaque provisioning need — the declaring package's own brand plus whatever payload its provisioner reads back. */
47
+ function provisionNeed(brand, payload) {
48
+ return blindCast(Object.freeze({
49
+ [PROVISION_NEED]: true,
50
+ brand,
51
+ payload
52
+ }));
53
+ }
45
54
  function requireType(type, factory) {
46
55
  if (typeof type !== "string" || type.length === 0) throw new Error(`${factory}() requires a non-empty node type.`);
47
56
  }
@@ -52,15 +61,19 @@ function requireExtension(extension, factory) {
52
61
  if (typeof extension !== "string" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);
53
62
  }
54
63
  /**
55
- * Config keys join address/input/param names with "_" and uppercase an
56
- * underscore inside a name would collide with that separator (e.g. param
57
- * "db_url" vs input "db"'s param "url" both hitting env key "DB_URL").
64
+ * Core's grammar for every name that becomes a config-key segment
65
+ * addresses, input/param/secret names: ASCII letters and digits only.
66
+ * Conservative by design so any target medium POSIX env-var keys
67
+ * included — can uppercase and "_"-join segments without escaping.
58
68
  */
59
- function requireNoUnderscoreName(name, kind, factory) {
60
- if (name.includes("_")) throw new Error(`${factory}() ${kind} name "${name}" may not contain "_" — config keys join names with "_" as the separator (e.g. an input "db"'s param "url" becomes env key "DB_URL"), so an underscore inside a name would collide with that separator.`);
69
+ function isConfigKeySegment(name) {
70
+ return /^[A-Za-z0-9]+$/.test(name);
61
71
  }
62
- function requireNoUnderscoreNames(names, kind, factory) {
63
- for (const name of names) requireNoUnderscoreName(name, kind, factory);
72
+ function requireConfigKeySegmentName(name, kind, factory) {
73
+ if (!isConfigKeySegment(name)) throw new Error(`${factory}() ${kind} name "${name}" must contain only ASCII letters and digits ([A-Za-z0-9]) — declared names derive deterministic config keys, uppercased and joined with "_" (an input "db"'s param "url" becomes config key "DB_URL"), so an underscore inside a name collides with that separator and any other character has no place in a config key. "${name}" would put "${name.toUpperCase()}" inside the derived key.`);
74
+ }
75
+ function requireConfigKeySegmentNames(names, kind, factory) {
76
+ for (const name of names) requireConfigKeySegmentName(name, kind, factory);
64
77
  }
65
78
  function freezeParams(params) {
66
79
  const frozen = {};
@@ -84,10 +97,10 @@ function service$1(def) {
84
97
  requireName(def.name, "service");
85
98
  requireExtension(def.extension, "service");
86
99
  requireType(def.type, "service");
87
- requireNoUnderscoreNames(Object.keys(def.inputs), "input", "service");
88
- requireNoUnderscoreNames(Object.keys(def.params), "param", "service");
89
- requireNoUnderscoreNames(Object.keys(def.secrets ?? {}), "secret", "service");
90
- for (const slot of Object.keys(def.secrets ?? {})) if (Object.hasOwn(def.params, slot)) throw new Error(`service() secret slot "${slot}" collides with a param of the same name — a secret slot and a service param derive the same config key (COMPOSE_<addr>_${slot.toUpperCase()}); rename one.`);
100
+ requireConfigKeySegmentNames(Object.keys(def.inputs), "input", "service");
101
+ requireConfigKeySegmentNames(Object.keys(def.params), "param", "service");
102
+ requireConfigKeySegmentNames(Object.keys(def.secrets ?? {}), "secret", "service");
103
+ for (const slot of Object.keys(def.secrets ?? {})) if (Object.hasOwn(def.params, slot)) throw new Error(`service() secret slot "${slot}" collides with a param of the same name — a secret slot and a service param derive the same config key (COMPOSER_<addr>_${slot.toUpperCase()}); rename one.`);
91
104
  return Object.freeze({
92
105
  [NODE]: true,
93
106
  kind: "service",
@@ -108,7 +121,7 @@ function service$1(def) {
108
121
  */
109
122
  function dependency(def) {
110
123
  requireType(def.type, "dependency");
111
- requireNoUnderscoreNames(Object.keys(def.connection.params), "param", "dependency");
124
+ requireConfigKeySegmentNames(Object.keys(def.connection.params), "param", "dependency");
112
125
  const connection = Object.freeze({
113
126
  params: freezeParams(def.connection.params),
114
127
  hydrate: def.connection.hydrate
@@ -171,7 +184,8 @@ function withFacets(schema, opts) {
171
184
  return {
172
185
  schema,
173
186
  ...opts.optional !== void 0 ? { optional: opts.optional } : {},
174
- ...opts.default !== void 0 ? { default: opts.default } : {}
187
+ ...opts.default !== void 0 ? { default: opts.default } : {},
188
+ ...opts.provision !== void 0 ? { provision: opts.provision } : {}
175
189
  };
176
190
  }
177
191
  /** A string-valued param. */
@@ -224,294 +238,9 @@ const nodeBuild = (opts) => ({
224
238
  extension: "@prisma/composer/node",
225
239
  type: "node",
226
240
  module: opts.module,
227
- entry: opts.entry
228
- });
229
- /**
230
- * Walks a node's own params, then each dependency input's connection params —
231
- * the same enumeration order `configOf` uses, but carrying the raw
232
- * `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
233
- * projection.
234
- */
235
- function paramEntries(node) {
236
- const entries = [];
237
- for (const [input, value] of Object.entries(node.inputs)) {
238
- if (typeof value !== "object" || value === null) continue;
239
- const params = blindCast(value).connection.params;
240
- for (const [name, param] of Object.entries(params)) entries.push({
241
- owner: { input },
242
- name,
243
- param
244
- });
245
- }
246
- for (const [name, param] of Object.entries(node.params)) entries.push({
247
- owner: "service",
248
- name,
249
- param
250
- });
251
- return entries;
252
- }
253
- const configKey = (address, d) => {
254
- const segments = address.split(".").filter((s) => s.length > 0);
255
- const owner = d.owner === "service" ? [] : [d.owner.input];
256
- return [
257
- "COMPOSE",
258
- ...segments,
259
- ...owner,
260
- d.name
261
- ].join("_").toUpperCase();
262
- };
263
- /**
264
- * Typed value → its stored string. Service-own literals are JSON-encoded; a
265
- * dependency-input value is a provisioning ref at deploy (and a resolved
266
- * string at boot) and passes through untouched — LANDMINE: JSON-encoding it
267
- * would break the ordering edge Alchemy resolves through it.
268
- */
269
- function encode(owner, value) {
270
- return owner === "service" ? JSON.stringify(value) : blindCast(value);
271
- }
272
- /** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
273
- function decode(owner, raw) {
274
- return owner === "service" ? JSON.parse(raw) : raw;
275
- }
276
- function coerce(raw, d, key) {
277
- if (!(raw !== void 0 && raw !== "")) {
278
- if (d.param.default !== void 0) return d.param.default;
279
- if (d.param.optional === true) return void 0;
280
- throw new Error(`missing required config param "${d.name}" (env ${key})`);
281
- }
282
- try {
283
- return standardValidateSync(d.param.schema, decode(d.owner, raw));
284
- } catch (cause) {
285
- const message = cause instanceof Error ? cause.message : String(cause);
286
- throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
287
- }
288
- }
289
- /**
290
- * Boot: read each declared param from env by its key, reverse the param's own
291
- * serialization (missing/invalid fails loudly), assemble the typed Config.
292
- * Secrets ride a separate channel (deserializeSecrets), not this one.
293
- */
294
- const deserialize = (node, address) => {
295
- const service = {};
296
- const inputs = {};
297
- for (const d of paramEntries(node)) {
298
- const key = configKey(address, d);
299
- const value = coerce(process.env[key], d, key);
300
- if (d.owner === "service") service[d.name] = value;
301
- else {
302
- let bucket = inputs[d.owner.input];
303
- if (bucket === void 0) {
304
- bucket = {};
305
- inputs[d.owner.input] = bucket;
306
- }
307
- bucket[d.name] = value;
308
- }
309
- }
310
- return {
311
- service,
312
- inputs
313
- };
314
- };
315
- /**
316
- * run()'s setup step: write the resolved config to the environment under
317
- * address-free keys (configKey("", d) + each serialize suffix), which load()
318
- * reads back with no address. Uses env, not a module variable, because a
319
- * framework may fork worker processes that inherit env but not memory.
320
- * Writes only these keys; nothing else is touched.
321
- */
322
- const stash = (node, config) => {
323
- for (const d of paramEntries(node)) {
324
- const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
325
- if (value === void 0) continue;
326
- process.env[configKey("", d)] = encode(d.owner, value);
327
- }
328
- };
329
- /** The pointer-row key for a secret slot: COMPOSE_<addr>_<slot> (secrets are service-level). */
330
- const secretKey = (address, slot) => configKey(address, {
331
- owner: "service",
332
- name: slot
333
- });
334
- /**
335
- * Boot: resolve every secret slot to its value by double-lookup — read the
336
- * pointer key (the platform NAME), then read that platform var. A missing
337
- * pointer or a missing/empty platform value is a loud failure naming both keys.
338
- * Returns a plain Record for core's `hydrateSecrets` to box.
339
- */
340
- const deserializeSecrets = (node, address) => {
341
- const values = {};
342
- for (const slot of Object.keys(node.secretSlots)) {
343
- const key = secretKey(address, slot);
344
- const name = process.env[key];
345
- if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
346
- const value = process.env[name];
347
- if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
348
- values[slot] = value;
349
- }
350
- return values;
351
- };
352
- /**
353
- * run()'s setup step for secrets: re-emit each slot's pointer NAME under its
354
- * address-free key, so the address-free `deserializeSecrets` double-looks-up
355
- * identically. Never the value — the value stays only in the platform var.
356
- */
357
- const stashSecrets = (node, address) => {
358
- for (const slot of Object.keys(node.secretSlots)) {
359
- const name = process.env[secretKey(address, slot)];
360
- if (name === void 0) continue;
361
- process.env[secretKey("", slot)] = name;
362
- }
363
- };
364
- /** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
365
- function standardValidateSync(schema, value) {
366
- const result = schema["~standard"].validate(value);
367
- if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
368
- if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
369
- return result.value;
370
- }
371
- const reservedParams = { port: number$1({ default: 3e3 }) };
372
- /**
373
- * A Prisma Compute service — declarations only (deps + params + build + the
374
- * ports it exposes), no descriptor. `params` merges with the reserved
375
- * `ReservedParams` (`port`); a user param whose name collides with a reserved
376
- * one fails at authoring, the same way a colliding dependency name does.
377
- * Returns the extension's runnable/loadable node:
378
- * · run(address, boot) — the process controller: deserialize the platform
379
- * environment (keyed off `address`, the extension's ONE env read) into a
380
- * typed Config, re-emit it under address-free process-local stash keys,
381
- * then call boot() to start the app's entry.
382
- * · load() / config() — called from inside the app's entry: read the stash;
383
- * load() hydrates + memoizes the deps, config() returns the typed params.
384
- * Separate accessors so a dep and a param never share a namespace (ADR-0021).
385
- *
386
- * `service()`'s underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
387
- * the control-plane registry key `prisma-composer deploy` resolves through the
388
- * app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
389
- * deploy time; nodes are pure data.
390
- */
391
- const compute = (def) => {
392
- const userParams = def.params ?? blindCast({});
393
- for (const reserved of Object.keys(reservedParams)) {
394
- if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
395
- if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
396
- }
397
- const params = blindCast({
398
- ...userParams,
399
- ...reservedParams
400
- });
401
- const node = service$1({
402
- name: def.name,
403
- extension: "@prisma/composer-prisma-cloud",
404
- type: "compute",
405
- inputs: def.deps,
406
- params,
407
- ...def.secrets !== void 0 ? { secrets: def.secrets } : {},
408
- build: def.build,
409
- ...def.expose !== void 0 ? { expose: def.expose } : {}
410
- });
411
- let resolved;
412
- let loadedDeps;
413
- let loadedParams;
414
- let loadedSecrets;
415
- function processConfig() {
416
- if (resolved === void 0) resolved = deserialize(node, "");
417
- return resolved;
418
- }
419
- const runnable = {
420
- ...node,
421
- async run(address, boot) {
422
- const config = deserialize(node, address);
423
- stash(node, config);
424
- stashSecrets(node, address);
425
- const port = config.service["port"];
426
- if (typeof port === "number") process.env["PORT"] = String(port);
427
- return boot();
428
- },
429
- load() {
430
- if (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));
431
- return loadedDeps;
432
- },
433
- config() {
434
- if (loadedParams === void 0) loadedParams = blindCast(processConfig().service);
435
- return loadedParams;
436
- },
437
- secrets() {
438
- if (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, "")));
439
- return loadedSecrets;
440
- }
441
- };
442
- return Object.freeze(blindCast(runnable));
443
- };
444
- Object.freeze({
445
- kind: "postgres",
446
- __cmp: { url: "" },
447
- satisfies: (required) => required.kind === "postgres"
448
- });
449
- Object.freeze({
450
- kind: "credentials",
451
- __cmp: {
452
- accessKeyId: "",
453
- secretAccessKey: ""
454
- },
455
- satisfies: (required) => required.kind === "credentials"
241
+ entry: opts.entry,
242
+ ...opts.dir === void 0 ? {} : { dir: opts.dir }
456
243
  });
457
- async function standardValidate(schema, value) {
458
- const result = await schema["~standard"].validate(value);
459
- if (result.issues !== void 0) throw new Error(`Schema validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
460
- return result.value;
461
- }
462
- /** `<base>/rpc/<method>`, preserving a base URL's own path (e.g. a mount point). */
463
- function methodUrl(base, method) {
464
- const normalizedBase = base.endsWith("/") ? base : `${base}/`;
465
- return new URL(`rpc/${method}`, normalizedBase).toString();
466
- }
467
- /** The server's `{ error }` body, if the response has one — undefined otherwise. */
468
- async function errorDetail(res) {
469
- try {
470
- const body = await res.json();
471
- return typeof body === "object" && body !== null && "error" in body ? String(body.error) : void 0;
472
- } catch {
473
- return;
474
- }
475
- }
476
- function makeClient(contract, url, opts) {
477
- const send = opts?.fetch ?? fetch;
478
- const client = {};
479
- for (const [method, schemas] of Object.entries(blindCast(contract.__cmp))) client[method] = async (input) => {
480
- const res = await send(new Request(methodUrl(url, method), {
481
- method: "POST",
482
- headers: { "content-type": "application/json" },
483
- body: JSON.stringify(input)
484
- }));
485
- if (!res.ok) {
486
- const detail = await errorDetail(res);
487
- throw new Error(`RPC call "${method}" failed: ${res.status} ${res.statusText}` + (detail !== void 0 ? ` — ${detail}` : ""));
488
- }
489
- return standardValidate(schemas.output, await res.json());
490
- };
491
- return blindCast(client);
492
- }
493
- function contract(fns) {
494
- const value = {
495
- kind: "rpc",
496
- __cmp: fns,
497
- satisfies: (required) => value === required
498
- };
499
- return Object.freeze(value);
500
- }
501
- function rpc(arg) {
502
- if (!isRpcContract(arg)) return arg;
503
- return dependency({
504
- type: "rpc",
505
- connection: {
506
- params: { url: string$1() },
507
- hydrate: ({ url }) => makeClient(arg, url)
508
- },
509
- required: arg
510
- });
511
- }
512
- function isRpcContract(value) {
513
- return typeof value === "object" && value !== null && "kind" in value && value.kind === "rpc" && "__cmp" in value && "satisfies" in value;
514
- }
515
244
  const liftArray = (data) => Array.isArray(data) ? data : [data];
516
245
  /**
517
246
  * Splits an array into two arrays based on the result of a predicate
@@ -7631,6 +7360,555 @@ ark.schema;
7631
7360
  ark.define;
7632
7361
  ark.declare;
7633
7362
  /**
7363
+ * Walks a node's own params, then each dependency input's connection params —
7364
+ * the same enumeration order `configOf` uses, but carrying the raw
7365
+ * `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
7366
+ * projection.
7367
+ */
7368
+ function paramEntries(node) {
7369
+ const entries = [];
7370
+ for (const [input, value] of Object.entries(node.inputs)) {
7371
+ if (typeof value !== "object" || value === null) continue;
7372
+ const params = blindCast(value).connection.params;
7373
+ for (const [name, param] of Object.entries(params)) entries.push({
7374
+ owner: { input },
7375
+ name,
7376
+ param
7377
+ });
7378
+ }
7379
+ for (const [name, param] of Object.entries(node.params)) entries.push({
7380
+ owner: "service",
7381
+ name,
7382
+ param
7383
+ });
7384
+ return entries;
7385
+ }
7386
+ const configKey = (address, d) => {
7387
+ const segments = address.split(".").filter((s) => s.length > 0);
7388
+ const owner = d.owner === "service" ? [] : [d.owner.input];
7389
+ return [
7390
+ "COMPOSER",
7391
+ ...segments,
7392
+ ...owner,
7393
+ d.name
7394
+ ].join("_").toUpperCase();
7395
+ };
7396
+ /**
7397
+ * Typed value → its stored string. Service-own literals are JSON-encoded; a
7398
+ * dependency-input value is a provisioning ref at deploy (and a resolved
7399
+ * string at boot) and passes through untouched — LANDMINE: JSON-encoding it
7400
+ * would break the ordering edge Alchemy resolves through it.
7401
+ */
7402
+ function encode(owner, value) {
7403
+ return owner === "service" ? JSON.stringify(value) : blindCast(value);
7404
+ }
7405
+ /** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
7406
+ function decode(owner, raw) {
7407
+ return owner === "service" ? JSON.parse(raw) : raw;
7408
+ }
7409
+ const PARAM_POINTER_PREFIX = "@composer-param-pointer:";
7410
+ /** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */
7411
+ const isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);
7412
+ /** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */
7413
+ const decodeParamPointer = (raw) => raw.slice(24);
7414
+ function coerce(raw, d, key) {
7415
+ if (!(raw !== void 0 && raw !== "")) {
7416
+ if (d.param.default !== void 0) return d.param.default;
7417
+ if (d.param.optional === true) return void 0;
7418
+ throw new Error(`missing required config param "${d.name}" (env ${key})`);
7419
+ }
7420
+ if (d.owner === "service" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);
7421
+ try {
7422
+ return standardValidateSync(d.param.schema, decode(d.owner, raw));
7423
+ } catch (cause) {
7424
+ const message = cause instanceof Error ? cause.message : String(cause);
7425
+ throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
7426
+ }
7427
+ }
7428
+ /**
7429
+ * Boot resolution for an env-sourced param: double-lookup (pointer → platform
7430
+ * var), then the param's own schema on the raw string — no JSON decode, and
7431
+ * no redaction (it's config, not a secret). An UNSET platform var is a loud
7432
+ * boot failure naming both the param and the platform var; an EMPTY string is
7433
+ * not special-cased here — it reaches the schema like any other value, so it
7434
+ * passes iff the schema accepts it (deliberately unlike a literal param's own
7435
+ * ""-means-absent rule, and unlike a secret's non-empty requirement).
7436
+ */
7437
+ function coerceEnvSourcedParam(raw, d, key) {
7438
+ const platformVar = decodeParamPointer(raw);
7439
+ const value = process.env[platformVar];
7440
+ 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.`);
7441
+ try {
7442
+ return standardValidateSync(d.param.schema, value);
7443
+ } catch (cause) {
7444
+ const message = cause instanceof Error ? cause.message : String(cause);
7445
+ throw new Error(`invalid value for env-sourced config param "${d.name}" (env ${key} → ${platformVar}): ${message}`);
7446
+ }
7447
+ }
7448
+ /**
7449
+ * Boot: read each declared param from env by its key, reverse the param's own
7450
+ * serialization (missing/invalid fails loudly), assemble the typed Config.
7451
+ * Secrets ride a separate channel (deserializeSecrets), not this one.
7452
+ */
7453
+ const deserialize = (node, address) => {
7454
+ const service = {};
7455
+ const inputs = {};
7456
+ for (const d of paramEntries(node)) {
7457
+ const key = configKey(address, d);
7458
+ const value = coerce(process.env[key], d, key);
7459
+ if (d.owner === "service") service[d.name] = value;
7460
+ else {
7461
+ let bucket = inputs[d.owner.input];
7462
+ if (bucket === void 0) {
7463
+ bucket = {};
7464
+ inputs[d.owner.input] = bucket;
7465
+ }
7466
+ bucket[d.name] = value;
7467
+ }
7468
+ }
7469
+ return {
7470
+ service,
7471
+ inputs
7472
+ };
7473
+ };
7474
+ /**
7475
+ * run()'s setup step: write the resolved config to the environment under
7476
+ * address-free keys (configKey("", d) + each serialize suffix), which load()
7477
+ * reads back with no address. Uses env, not a module variable, because a
7478
+ * framework may fork worker processes that inherit env but not memory.
7479
+ * Writes only these keys; nothing else is touched.
7480
+ */
7481
+ const stash = (node, config) => {
7482
+ for (const d of paramEntries(node)) {
7483
+ const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
7484
+ if (value === void 0) continue;
7485
+ process.env[configKey("", d)] = encode(d.owner, value);
7486
+ }
7487
+ };
7488
+ /** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
7489
+ const secretKey = (address, slot) => configKey(address, {
7490
+ owner: "service",
7491
+ name: slot
7492
+ });
7493
+ /**
7494
+ * Boot: resolve every secret slot to its value by double-lookup — read the
7495
+ * pointer key (the platform NAME), then read that platform var. A missing
7496
+ * pointer or a missing/empty platform value is a loud failure naming both keys.
7497
+ * Returns a plain Record for core's `hydrateSecrets` to box.
7498
+ */
7499
+ const deserializeSecrets = (node, address) => {
7500
+ const values = {};
7501
+ for (const slot of Object.keys(node.secretSlots)) {
7502
+ const key = secretKey(address, slot);
7503
+ const name = process.env[key];
7504
+ if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
7505
+ const value = process.env[name];
7506
+ if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
7507
+ values[slot] = value;
7508
+ }
7509
+ return values;
7510
+ };
7511
+ /**
7512
+ * run()'s setup step for secrets: re-emit each slot's pointer NAME under its
7513
+ * address-free key, so the address-free `deserializeSecrets` double-looks-up
7514
+ * identically. Never the value — the value stays only in the platform var.
7515
+ */
7516
+ const stashSecrets = (node, address) => {
7517
+ for (const slot of Object.keys(node.secretSlots)) {
7518
+ const name = process.env[secretKey(address, slot)];
7519
+ if (name === void 0) continue;
7520
+ process.env[secretKey("", slot)] = name;
7521
+ }
7522
+ };
7523
+ /**
7524
+ * Boot: for each reserved provider param, read its address-scoped row through
7525
+ * the same `coerce` a declared param uses (JSON-decode, schema-validate), and
7526
+ * re-emit it address-free — `stash`'s counterpart for this separate
7527
+ * declaration space. A param is declared optional here unconditionally: an
7528
+ * absent row means "never provisioned" (local dev, tests, a provider with no
7529
+ * registered value for this deploy), never a boot failure, so nothing is
7530
+ * stashed and the runtime reader that owns this slot falls back to its own
7531
+ * pass-through behavior.
7532
+ */
7533
+ function stashProviderParams(entries, address) {
7534
+ for (const entry of entries) {
7535
+ const d = {
7536
+ owner: "service",
7537
+ name: entry.name,
7538
+ param: {
7539
+ schema: entry.schema,
7540
+ optional: true
7541
+ }
7542
+ };
7543
+ const key = configKey(address, d);
7544
+ const value = coerce(process.env[key], d, key);
7545
+ if (value === void 0) continue;
7546
+ process.env[configKey("", d)] = encode("service", value);
7547
+ }
7548
+ }
7549
+ /** The framework-resolved origin row: COMPOSER_<addr>_ORIGIN. Written per
7550
+ * compute service at serialize — the service's own provisioned endpoint URL,
7551
+ * riding the reserved-provider-param machinery (`origin-key.ts`'s
7552
+ * `ORIGIN_PARAM`); never a declared param, never in config(). A harness with
7553
+ * no deploy behind it supplies it by setting `COMPOSER_ORIGIN` to the
7554
+ * JSON-encoded origin URL — exactly how the existing entrypoint tests supply
7555
+ * their other `COMPOSER_*` rows. */
7556
+ const ORIGIN_KEY_NAME = "ORIGIN";
7557
+ /**
7558
+ * Reads this service's origin back out of the address-free stash
7559
+ * `stashProviderParams` wrote for the ORIGIN entry. `COMPOSER_ORIGIN` unset is
7560
+ * a loud failure — a deployed environment always writes it, so an unset row
7561
+ * means either a local harness that hasn't supplied it or a boot() called
7562
+ * before run().
7563
+ */
7564
+ function readOrigin() {
7565
+ const d = {
7566
+ owner: "service",
7567
+ name: ORIGIN_KEY_NAME,
7568
+ param: {
7569
+ schema: type("string"),
7570
+ optional: true
7571
+ }
7572
+ };
7573
+ const key = configKey("", d);
7574
+ const value = coerce(process.env[key], d, key);
7575
+ 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).");
7576
+ return blindCast(value);
7577
+ }
7578
+ /** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
7579
+ function standardValidateSync(schema, value) {
7580
+ const result = schema["~standard"].validate(value);
7581
+ if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
7582
+ if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
7583
+ return result.value;
7584
+ }
7585
+ /** Bounded jittered backoff for retrying a dropped call. `maxRetries` is retries after the first attempt. */
7586
+ const RETRY = {
7587
+ initialDelayMs: 250,
7588
+ multiplier: 2,
7589
+ maxDelayMs: 5e3,
7590
+ maxRetries: 5
7591
+ };
7592
+ const IDEMPOTENCY_KEY_HEADER$1 = "Idempotency-Key";
7593
+ function sleep(ms) {
7594
+ return new Promise((resolve) => setTimeout(resolve, ms));
7595
+ }
7596
+ /** Whether a non-OK response is safe to retry: 429 or any 5xx, never another 4xx. */
7597
+ function isRetryableStatus(status) {
7598
+ return status === 429 || status >= 500;
7599
+ }
7600
+ /** The server's `{ error }` body, if the response has one — undefined otherwise. */
7601
+ async function errorDetail(res) {
7602
+ try {
7603
+ const body = await res.json();
7604
+ return typeof body === "object" && body !== null && "error" in body ? String(body.error) : void 0;
7605
+ } catch {
7606
+ return;
7607
+ }
7608
+ }
7609
+ /** `<base>/rpc/<method>`, preserving a base URL's own path (e.g. a mount point). */
7610
+ function methodUrl(base, method) {
7611
+ const normalizedBase = base.endsWith("/") ? base : `${base}/`;
7612
+ return new URL(`rpc/${method}`, normalizedBase).toString();
7613
+ }
7614
+ /**
7615
+ * Sends one call over `send`, retrying a thrown error, 429, or 5xx with
7616
+ * full-jitter backoff. `buildRequest` runs per attempt but carries the same
7617
+ * idempotency key each time — only the transport call repeats, not the key.
7618
+ */
7619
+ async function callWithRetry(send, buildRequest, method) {
7620
+ let delay = RETRY.initialDelayMs;
7621
+ let retries = 0;
7622
+ for (;;) {
7623
+ let res;
7624
+ try {
7625
+ res = await send(buildRequest());
7626
+ } catch (err) {
7627
+ if (retries >= RETRY.maxRetries) throw err;
7628
+ retries += 1;
7629
+ await sleep(Math.random() * delay);
7630
+ delay = Math.min(delay * RETRY.multiplier, RETRY.maxDelayMs);
7631
+ continue;
7632
+ }
7633
+ if (res.ok) return res.json();
7634
+ if (!isRetryableStatus(res.status) || retries >= RETRY.maxRetries) {
7635
+ const detail = await errorDetail(res);
7636
+ throw new Error(`RPC call "${method}" failed: ${res.status} ${res.statusText}` + (detail !== void 0 ? ` — ${detail}` : ""));
7637
+ }
7638
+ retries += 1;
7639
+ await sleep(Math.random() * delay);
7640
+ delay = Math.min(delay * RETRY.multiplier, RETRY.maxDelayMs);
7641
+ }
7642
+ }
7643
+ function makeClient(contract, url, opts) {
7644
+ const send = opts?.fetch ?? fetch;
7645
+ const baseHeaders = { "content-type": "application/json" };
7646
+ if (opts?.serviceKey !== void 0) baseHeaders["Authorization"] = `Bearer ${opts.serviceKey}`;
7647
+ const client = {};
7648
+ for (const method of Object.keys(contract.__cmp)) client[method] = async (input) => {
7649
+ const idempotencyKey = crypto.randomUUID();
7650
+ const body = JSON.stringify(input);
7651
+ return callWithRetry(send, () => new Request(methodUrl(url, method), {
7652
+ method: "POST",
7653
+ headers: {
7654
+ ...baseHeaders,
7655
+ [IDEMPOTENCY_KEY_HEADER$1]: idempotencyKey
7656
+ },
7657
+ body
7658
+ }), method);
7659
+ };
7660
+ return blindCast(client);
7661
+ }
7662
+ function contract(fns) {
7663
+ const value = {
7664
+ kind: "rpc",
7665
+ __cmp: fns,
7666
+ satisfies: (required) => value === required
7667
+ };
7668
+ return Object.freeze(value);
7669
+ }
7670
+ /** ADR-0031's need brand for RPC's per-binding service key — the target registers a provisioner under this. */
7671
+ const RPC_PEER_KEY = Symbol.for("prisma:rpc/per-binding-key");
7672
+ /** The provisioning need `rpc()`'s `serviceKey` param declares (ADR-0030): a shared, unguessable value the target mints per consumer edge. */
7673
+ const perBindingToken = () => provisionNeed(RPC_PEER_KEY);
7674
+ function rpc(arg) {
7675
+ if (!isRpcContract(arg)) return arg;
7676
+ return dependency({
7677
+ type: "rpc",
7678
+ connection: {
7679
+ params: {
7680
+ url: string$1(),
7681
+ serviceKey: string$1({
7682
+ optional: true,
7683
+ provision: perBindingToken()
7684
+ })
7685
+ },
7686
+ hydrate: ({ url, serviceKey }) => makeClient(arg, url, { serviceKey })
7687
+ },
7688
+ required: arg
7689
+ });
7690
+ }
7691
+ function isRpcContract(value) {
7692
+ return typeof value === "object" && value !== null && "kind" in value && value.kind === "rpc" && "__cmp" in value && "satisfies" in value;
7693
+ }
7694
+ /**
7695
+ * The service's own origin as a reserved provider param (ADR-0031): the ONE
7696
+ * brand and the ONE entry — shared by control.ts (which registers the
7697
+ * deploy-side value function that resolves the provisioned service's
7698
+ * `endpointDomain` — see its `selfOriginValue`) and compute.ts (which
7699
+ * validates and stashes the row at boot through the generic
7700
+ * `stashProviderParams` loop), so writer and reader cannot drift.
7701
+ *
7702
+ * Unlike the key-minting brands (`service-keys.ts`, `streams-keys.ts`) this
7703
+ * brand has no provisioner and no consumer edges: the value derives from the
7704
+ * service's OWN provisioned attributes, so control.ts registers it as a
7705
+ * service-derived provider param (`descriptors/shared.ts`'s
7706
+ * `ServiceProviderParam`) and the descriptor writes it for EVERY compute
7707
+ * service, exposing or not.
7708
+ *
7709
+ * This module is reachable from the RUNTIME/authoring side — it must never
7710
+ * import `@internal/lowering` or `effect`, or those tokens leak into a user
7711
+ * service's bundle (the deploy-side value function lives in control.ts, the
7712
+ * control-plane-only entry).
7713
+ */
7714
+ /** ADR-0031's brand for the service's own origin — control.ts registers the deploy-side value function under this. */
7715
+ const SELF_ORIGIN = Symbol.for("prisma:self-origin");
7716
+ /**
7717
+ * The reserved provider param for the origin row: the var name is `ORIGIN`,
7718
+ * derived through `configKey` at both ends (`configKey(address, …)` at
7719
+ * deploy, `configKey('', …)` — `COMPOSER_ORIGIN` — at boot, where
7720
+ * `readOrigin` reads it back). `brand` is `SELF_ORIGIN` — control.ts looks
7721
+ * its deploy-side value function up by this field.
7722
+ */
7723
+ const ORIGIN_PARAM = {
7724
+ name: ORIGIN_KEY_NAME,
7725
+ schema: type("string"),
7726
+ brand: SELF_ORIGIN
7727
+ };
7728
+ /**
7729
+ * RPC's reserved provider param (ADR-0030/ADR-0031): the declaration —
7730
+ * name + schema + brand — for the accepted-keys set a provider stores, shared
7731
+ * by `control.ts` (which registers the deploy-side `value(refs)` that mints
7732
+ * and aggregates it — see its `rpcAcceptedKeysValue`) and `compute.ts` (which
7733
+ * validates and stashes it at boot), so writer and reader cannot drift.
7734
+ * Finding the edges themselves is `provisioned-edges.ts`'s generic,
7735
+ * brand-blind scan — RPC is not special-cased anywhere in this target.
7736
+ *
7737
+ * This module is reachable from the RUNTIME/authoring side — it must never
7738
+ * import `@internal/lowering` or `effect`, or those tokens leak into a user
7739
+ * service's bundle (the deploy-side `value(refs)` lives in control.ts, the
7740
+ * control-plane-only entry).
7741
+ */
7742
+ /**
7743
+ * The reserved provider param for RPC's accepted-keys set: the var name is
7744
+ * `RPC_ACCEPTED_KEYS`, derived through `configKey` at both ends
7745
+ * (`configKey(address, …)` at deploy, `configKey('', …)` at boot — the
7746
+ * address-free form is `@internal/service-rpc`'s `RPC_ACCEPTED_KEYS_ENV`). `brand` is
7747
+ * `RPC_PEER_KEY`, the same brand `perBindingToken()`'s need carries — control.ts
7748
+ * looks its `value(refs)` up by this field.
7749
+ */
7750
+ const RPC_ACCEPTED_KEYS_PARAM = {
7751
+ name: "RPC_ACCEPTED_KEYS",
7752
+ schema: type("string[]"),
7753
+ brand: RPC_PEER_KEY
7754
+ };
7755
+ /** ADR-0031's need brand for the streams module's bearer key — control.ts registers the provisioner under this. */
7756
+ const STREAMS_API_KEY = Symbol.for("prisma:streams/api-key");
7757
+ /**
7758
+ * The reserved provider param for the streams bearer key: the var name is
7759
+ * `STREAMS_API_KEY`. `brand` is `STREAMS_API_KEY` itself (the same symbol
7760
+ * `streamsApiKeyNeed()`'s need carries) — control.ts looks its `value(refs)`
7761
+ * up by this field.
7762
+ */
7763
+ const STREAMS_API_KEY_PARAM = {
7764
+ name: "STREAMS_API_KEY",
7765
+ schema: type("string"),
7766
+ brand: STREAMS_API_KEY
7767
+ };
7768
+ configKey("", {
7769
+ owner: "service",
7770
+ name: STREAMS_API_KEY_PARAM.name
7771
+ });
7772
+ /**
7773
+ * The list of provider-side reserved params the boot path validates and
7774
+ * stashes (ADR-0031): every brand's `{name, schema, brand}` declaration,
7775
+ * collected from that brand's own module (`service-keys.ts`,
7776
+ * `streams-keys.ts`, `origin-key.ts`) so `compute.ts` names no brand itself.
7777
+ *
7778
+ * This list exists separately from `control.ts`'s deploy-side registry
7779
+ * (`PROVIDER_PARAMS`) because `control.ts` is deploy-only code — it imports
7780
+ * `@internal/lowering` and `effect` to mint values — and a booted service
7781
+ * must never import it. This module is reachable from a user service's
7782
+ * bundle through `compute.ts`, so it must never import `@internal/lowering`,
7783
+ * `effect`, `alchemy`, or `control.ts`.
7784
+ *
7785
+ * This is the single source of which reserved provider params exist:
7786
+ * control.ts builds `PROVIDER_PARAMS` by mapping over this list and looking
7787
+ * up each entry's deploy-side value function (edge-derived `value(refs)` or
7788
+ * service-derived `valueForService(provisioned, address)`) by its `brand`,
7789
+ * throwing at module load if one is missing. Adding a brand means adding its
7790
+ * entry here, plus its deploy-side value function in control.ts — a brand
7791
+ * registered for deploy but absent here is no longer expressible, because
7792
+ * deploy no longer names its own param set independently.
7793
+ */
7794
+ const RESERVED_PROVIDER_PARAMS = [
7795
+ RPC_ACCEPTED_KEYS_PARAM,
7796
+ STREAMS_API_KEY_PARAM,
7797
+ ORIGIN_PARAM
7798
+ ];
7799
+ Object.freeze({
7800
+ kind: "s3",
7801
+ __cmp: {
7802
+ url: "",
7803
+ bucket: "",
7804
+ accessKeyId: "",
7805
+ secretAccessKey: ""
7806
+ },
7807
+ satisfies: (required) => required.kind === "s3"
7808
+ });
7809
+ const reservedParams = { port: number$1({ default: 3e3 }) };
7810
+ /**
7811
+ * A Prisma Compute service — declarations only (deps + params + build + the
7812
+ * ports it exposes), no descriptor. `params` merges with the reserved
7813
+ * `ReservedParams` (`port`); a user param whose name collides with a reserved
7814
+ * one fails at authoring, the same way a colliding dependency name does.
7815
+ *
7816
+ * · run(address, boot) — the process controller: deserialize the platform
7817
+ * environment (keyed off `address`, the extension's ONE env read) into a
7818
+ * typed Config, re-emit it under address-free process-local stash keys,
7819
+ * then call boot() to start the app's entry.
7820
+ * · load() / config() — called from inside the app's entry: read the stash;
7821
+ * load() hydrates + memoizes the deps, config() returns the typed params.
7822
+ * Separate accessors so a dep and a param never share a namespace (ADR-0021).
7823
+ * · origin() — this service's platform-assigned public origin, read from the
7824
+ * stash `run()` populates; memoized per process.
7825
+ *
7826
+ * The underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
7827
+ * the control-plane registry key `prisma-composer deploy` resolves through the
7828
+ * app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
7829
+ * deploy time; nodes are pure data until run() or load() is called.
7830
+ */
7831
+ var ComputeService = class {
7832
+ #resolved;
7833
+ #loadedDeps;
7834
+ #loadedParams;
7835
+ #loadedSecrets;
7836
+ #origin;
7837
+ constructor(node) {
7838
+ Object.assign(this, node);
7839
+ }
7840
+ #processConfig() {
7841
+ if (this.#resolved === void 0) this.#resolved = deserialize(this, "");
7842
+ return this.#resolved;
7843
+ }
7844
+ async run(address, boot) {
7845
+ const config = deserialize(this, address);
7846
+ stash(this, config);
7847
+ stashProviderParams(RESERVED_PROVIDER_PARAMS, address);
7848
+ stashSecrets(this, address);
7849
+ const port = config.service["port"];
7850
+ if (typeof port === "number") process.env["PORT"] = String(port);
7851
+ return boot();
7852
+ }
7853
+ load() {
7854
+ if (this.#loadedDeps === void 0) this.#loadedDeps = blindCast(hydrateSync(this, this.#processConfig()));
7855
+ return this.#loadedDeps;
7856
+ }
7857
+ config() {
7858
+ if (this.#loadedParams === void 0) this.#loadedParams = blindCast(this.#processConfig().service);
7859
+ return this.#loadedParams;
7860
+ }
7861
+ secrets() {
7862
+ if (this.#loadedSecrets === void 0) this.#loadedSecrets = blindCast(hydrateSecrets(this, deserializeSecrets(this, "")));
7863
+ return this.#loadedSecrets;
7864
+ }
7865
+ /** This service's platform-assigned public origin — read from the stash
7866
+ * run() populates and memoized per process. Throws if called before run()
7867
+ * has stashed it (readOrigin's pinned message). */
7868
+ origin() {
7869
+ this.#origin ??= readOrigin();
7870
+ return this.#origin;
7871
+ }
7872
+ };
7873
+ const compute = (def) => {
7874
+ const userParams = def.params ?? blindCast({});
7875
+ for (const reserved of Object.keys(reservedParams)) {
7876
+ if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
7877
+ if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
7878
+ }
7879
+ for (const name of Object.keys(userParams)) if (name.toUpperCase() === "ORIGIN") throw new Error(`compute(): param "${name}" collides with the framework-written origin row — rename the param.`);
7880
+ for (const name of Object.keys(def.secrets ?? {})) if (name.toUpperCase() === "ORIGIN") throw new Error(`compute(): secret "${name}" collides with the framework-written origin row — rename the secret.`);
7881
+ const params = blindCast({
7882
+ ...userParams,
7883
+ ...reservedParams
7884
+ });
7885
+ const instance = new ComputeService(service$1({
7886
+ name: def.name,
7887
+ extension: "@prisma/composer-prisma-cloud",
7888
+ type: "compute",
7889
+ inputs: def.deps,
7890
+ params,
7891
+ ...def.secrets !== void 0 ? { secrets: def.secrets } : {},
7892
+ build: def.build,
7893
+ ...def.expose !== void 0 ? { expose: def.expose } : {}
7894
+ }));
7895
+ Object.freeze(instance);
7896
+ return instance;
7897
+ };
7898
+ Object.freeze({
7899
+ kind: "postgres",
7900
+ __cmp: { url: "" },
7901
+ satisfies: (required) => required.kind === "postgres"
7902
+ });
7903
+ Object.freeze({
7904
+ kind: "credentials",
7905
+ __cmp: {
7906
+ accessKeyId: "",
7907
+ secretAccessKey: ""
7908
+ },
7909
+ satisfies: (required) => required.kind === "credentials"
7910
+ });
7911
+ /**
7634
7912
  * The one call edge between the scheduler and the app's runner: `trigger(jobId)`.
7635
7913
  * The scheduler depends on it (`rpc(triggerContract)`); the runner exposes it
7636
7914
  * (`expose: { trigger: triggerContract }`). `jobId` travels as data through this