@prisma/composer-prisma-cloud 0.2.0 → 0.3.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.
- package/dist/buckets-main.mjs +795 -0
- package/dist/buckets-main.mjs.map +1 -0
- package/dist/compute-main.mjs +559 -0
- package/dist/compute-main.mjs.map +1 -0
- package/dist/control.d.mts +34 -5
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +98 -1280
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.d.mts +54 -4
- package/dist/cron/index.d.mts.map +1 -0
- package/dist/cron/index.mjs +145 -42
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +637 -529
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +145 -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 +565 -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 +652 -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/get-port-BYnpbW5H.mjs +111 -0
- package/dist/get-port-BYnpbW5H.mjs.map +1 -0
- package/dist/index.d.mts +37 -6
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +70 -45
- package/dist/index.mjs.map +1 -1
- package/dist/local-target.d.mts +12 -0
- package/dist/local-target.d.mts.map +1 -0
- package/dist/local-target.mjs +6185 -0
- package/dist/local-target.mjs.map +1 -0
- package/dist/param-BTzY0ne5-CW6ojZ3E.mjs +66 -0
- package/dist/param-BTzY0ne5-CW6ojZ3E.mjs.map +1 -0
- package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs +79 -0
- package/dist/pg-connection-CadPZuEK-CF3FsSQu.mjs.map +1 -0
- package/dist/postgres-main.mjs +602 -0
- package/dist/postgres-main.mjs.map +1 -0
- package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs +1252 -0
- package/dist/preflight-names-BPL-qsZF-BfoRgbgb.mjs.map +1 -0
- package/dist/{prisma-next-DlU01kXJ-2sP5mQb6.mjs → prisma-next-BvBwGCIt-DssgnctU.mjs} +21 -80
- package/dist/prisma-next-BvBwGCIt-DssgnctU.mjs.map +1 -0
- package/dist/prisma-next.d.mts +14 -5
- package/dist/prisma-next.d.mts.map +1 -0
- package/dist/prisma-next.mjs +1 -1
- package/dist/provisioned-edges-C1wSO3cx-YC5C19f9.mjs +151 -0
- package/dist/provisioned-edges-C1wSO3cx-YC5C19f9.mjs.map +1 -0
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs +47 -0
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs.map +1 -0
- package/dist/segments-NpKN-46R-C_LQ2urs.mjs +1454 -0
- package/dist/segments-NpKN-46R-C_LQ2urs.mjs.map +1 -0
- package/dist/{serializer-CX4VYdf_-KKGoAxfx.mjs → serializer-CJiOhF2d-DJUjQj1i.mjs} +34 -44
- package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs.map +1 -0
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
- package/dist/storage/index.d.mts +52 -5
- package/dist/storage/index.d.mts.map +1 -0
- package/dist/storage/index.mjs +158 -47
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +370 -271
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +158 -47
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/storage/testing.d.mts +7 -6
- package/dist/storage/testing.d.mts.map +1 -0
- package/dist/storage/testing.mjs +4 -21
- package/dist/storage/testing.mjs.map +1 -1
- package/dist/streams/index.d.mts +56 -84
- package/dist/streams/index.d.mts.map +1 -0
- package/dist/streams/index.mjs +158 -47
- package/dist/streams/index.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs +366 -250
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-service.mjs +158 -47
- package/dist/streams/streams-service.mjs.map +1 -1
- package/dist/streams/testing.d.mts.map +1 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +34 -20
- 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/local-target.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-DlU01kXJ-2sP5mQb6.mjs.map +0 -1
- package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs +0 -151
- package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs.map +0 -1
- package/dist/serializer-CX4VYdf_-KKGoAxfx.mjs.map +0 -1
|
@@ -111,15 +111,19 @@ function requireExtension(extension, factory) {
|
|
|
111
111
|
if (typeof extension !== "string" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
114
|
+
* Core's grammar for every name that becomes a config-key segment —
|
|
115
|
+
* addresses, input/param/secret names: ASCII letters and digits only.
|
|
116
|
+
* Conservative by design so any target medium — POSIX env-var keys
|
|
117
|
+
* included — can uppercase and "_"-join segments without escaping.
|
|
117
118
|
*/
|
|
118
|
-
function
|
|
119
|
-
|
|
119
|
+
function isConfigKeySegment(name) {
|
|
120
|
+
return /^[A-Za-z0-9]+$/.test(name);
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
122
|
+
function requireConfigKeySegmentName(name, kind, factory) {
|
|
123
|
+
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.`);
|
|
124
|
+
}
|
|
125
|
+
function requireConfigKeySegmentNames(names, kind, factory) {
|
|
126
|
+
for (const name of names) requireConfigKeySegmentName(name, kind, factory);
|
|
123
127
|
}
|
|
124
128
|
function freezeParams(params) {
|
|
125
129
|
const frozen = {};
|
|
@@ -190,9 +194,9 @@ function service$1(def) {
|
|
|
190
194
|
requireName(def.name, "service");
|
|
191
195
|
requireExtension(def.extension, "service");
|
|
192
196
|
requireType(def.type, "service");
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
requireConfigKeySegmentNames(Object.keys(def.inputs), "input", "service");
|
|
198
|
+
requireConfigKeySegmentNames(Object.keys(def.params), "param", "service");
|
|
199
|
+
requireConfigKeySegmentNames(Object.keys(def.secrets ?? {}), "secret", "service");
|
|
196
200
|
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.`);
|
|
197
201
|
return Object.freeze({
|
|
198
202
|
[NODE]: true,
|
|
@@ -214,7 +218,7 @@ function service$1(def) {
|
|
|
214
218
|
*/
|
|
215
219
|
function dependency(def) {
|
|
216
220
|
requireType(def.type, "dependency");
|
|
217
|
-
|
|
221
|
+
requireConfigKeySegmentNames(Object.keys(def.connection.params), "param", "dependency");
|
|
218
222
|
const connection = Object.freeze({
|
|
219
223
|
params: freezeParams(def.connection.params),
|
|
220
224
|
hydrate: def.connection.hydrate
|
|
@@ -323,202 +327,6 @@ function hydrateSecrets(root, values) {
|
|
|
323
327
|
}
|
|
324
328
|
return blindCast(boxed);
|
|
325
329
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Walks a node's own params, then each dependency input's connection params —
|
|
328
|
-
* the same enumeration order `configOf` uses, but carrying the raw
|
|
329
|
-
* `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
|
|
330
|
-
* projection.
|
|
331
|
-
*/
|
|
332
|
-
function paramEntries(node) {
|
|
333
|
-
const entries = [];
|
|
334
|
-
for (const [input, value] of Object.entries(node.inputs)) {
|
|
335
|
-
if (typeof value !== "object" || value === null) continue;
|
|
336
|
-
const params = blindCast(value).connection.params;
|
|
337
|
-
for (const [name, param] of Object.entries(params)) entries.push({
|
|
338
|
-
owner: { input },
|
|
339
|
-
name,
|
|
340
|
-
param
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
for (const [name, param] of Object.entries(node.params)) entries.push({
|
|
344
|
-
owner: "service",
|
|
345
|
-
name,
|
|
346
|
-
param
|
|
347
|
-
});
|
|
348
|
-
return entries;
|
|
349
|
-
}
|
|
350
|
-
const configKey = (address, d) => {
|
|
351
|
-
const segments = address.split(".").filter((s) => s.length > 0);
|
|
352
|
-
const owner = d.owner === "service" ? [] : [d.owner.input];
|
|
353
|
-
return [
|
|
354
|
-
"COMPOSER",
|
|
355
|
-
...segments,
|
|
356
|
-
...owner,
|
|
357
|
-
d.name
|
|
358
|
-
].join("_").toUpperCase();
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
* Typed value → its stored string. Service-own literals are JSON-encoded; a
|
|
362
|
-
* dependency-input value is a provisioning ref at deploy (and a resolved
|
|
363
|
-
* string at boot) and passes through untouched — LANDMINE: JSON-encoding it
|
|
364
|
-
* would break the ordering edge Alchemy resolves through it.
|
|
365
|
-
*/
|
|
366
|
-
function encode(owner, value) {
|
|
367
|
-
return owner === "service" ? JSON.stringify(value) : blindCast(value);
|
|
368
|
-
}
|
|
369
|
-
/** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
|
|
370
|
-
function decode(owner, raw) {
|
|
371
|
-
return owner === "service" ? JSON.parse(raw) : raw;
|
|
372
|
-
}
|
|
373
|
-
const PARAM_POINTER_PREFIX = "@composer-param-pointer:";
|
|
374
|
-
/** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */
|
|
375
|
-
const isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);
|
|
376
|
-
/** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */
|
|
377
|
-
const decodeParamPointer = (raw) => raw.slice(24);
|
|
378
|
-
function coerce(raw, d, key) {
|
|
379
|
-
if (!(raw !== void 0 && raw !== "")) {
|
|
380
|
-
if (d.param.default !== void 0) return d.param.default;
|
|
381
|
-
if (d.param.optional === true) return void 0;
|
|
382
|
-
throw new Error(`missing required config param "${d.name}" (env ${key})`);
|
|
383
|
-
}
|
|
384
|
-
if (d.owner === "service" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);
|
|
385
|
-
try {
|
|
386
|
-
return standardValidateSync(d.param.schema, decode(d.owner, raw));
|
|
387
|
-
} catch (cause) {
|
|
388
|
-
const message = cause instanceof Error ? cause.message : String(cause);
|
|
389
|
-
throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Boot resolution for an env-sourced param: double-lookup (pointer → platform
|
|
394
|
-
* var), then the param's own schema on the raw string — no JSON decode, and
|
|
395
|
-
* no redaction (it's config, not a secret). An UNSET platform var is a loud
|
|
396
|
-
* boot failure naming both the param and the platform var; an EMPTY string is
|
|
397
|
-
* not special-cased here — it reaches the schema like any other value, so it
|
|
398
|
-
* passes iff the schema accepts it (deliberately unlike a literal param's own
|
|
399
|
-
* ""-means-absent rule, and unlike a secret's non-empty requirement).
|
|
400
|
-
*/
|
|
401
|
-
function coerceEnvSourcedParam(raw, d, key) {
|
|
402
|
-
const platformVar = decodeParamPointer(raw);
|
|
403
|
-
const value = process.env[platformVar];
|
|
404
|
-
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.`);
|
|
405
|
-
try {
|
|
406
|
-
return standardValidateSync(d.param.schema, value);
|
|
407
|
-
} catch (cause) {
|
|
408
|
-
const message = cause instanceof Error ? cause.message : String(cause);
|
|
409
|
-
throw new Error(`invalid value for env-sourced config param "${d.name}" (env ${key} → ${platformVar}): ${message}`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Boot: read each declared param from env by its key, reverse the param's own
|
|
414
|
-
* serialization (missing/invalid fails loudly), assemble the typed Config.
|
|
415
|
-
* Secrets ride a separate channel (deserializeSecrets), not this one.
|
|
416
|
-
*/
|
|
417
|
-
const deserialize = (node, address) => {
|
|
418
|
-
const service = {};
|
|
419
|
-
const inputs = {};
|
|
420
|
-
for (const d of paramEntries(node)) {
|
|
421
|
-
const key = configKey(address, d);
|
|
422
|
-
const value = coerce(process.env[key], d, key);
|
|
423
|
-
if (d.owner === "service") service[d.name] = value;
|
|
424
|
-
else {
|
|
425
|
-
let bucket = inputs[d.owner.input];
|
|
426
|
-
if (bucket === void 0) {
|
|
427
|
-
bucket = {};
|
|
428
|
-
inputs[d.owner.input] = bucket;
|
|
429
|
-
}
|
|
430
|
-
bucket[d.name] = value;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
return {
|
|
434
|
-
service,
|
|
435
|
-
inputs
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* run()'s setup step: write the resolved config to the environment under
|
|
440
|
-
* address-free keys (configKey("", d) + each serialize suffix), which load()
|
|
441
|
-
* reads back with no address. Uses env, not a module variable, because a
|
|
442
|
-
* framework may fork worker processes that inherit env but not memory.
|
|
443
|
-
* Writes only these keys; nothing else is touched.
|
|
444
|
-
*/
|
|
445
|
-
const stash = (node, config) => {
|
|
446
|
-
for (const d of paramEntries(node)) {
|
|
447
|
-
const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
|
|
448
|
-
if (value === void 0) continue;
|
|
449
|
-
process.env[configKey("", d)] = encode(d.owner, value);
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
/** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
|
|
453
|
-
const secretKey = (address, slot) => configKey(address, {
|
|
454
|
-
owner: "service",
|
|
455
|
-
name: slot
|
|
456
|
-
});
|
|
457
|
-
/**
|
|
458
|
-
* Boot: resolve every secret slot to its value by double-lookup — read the
|
|
459
|
-
* pointer key (the platform NAME), then read that platform var. A missing
|
|
460
|
-
* pointer or a missing/empty platform value is a loud failure naming both keys.
|
|
461
|
-
* Returns a plain Record for core's `hydrateSecrets` to box.
|
|
462
|
-
*/
|
|
463
|
-
const deserializeSecrets = (node, address) => {
|
|
464
|
-
const values = {};
|
|
465
|
-
for (const slot of Object.keys(node.secretSlots)) {
|
|
466
|
-
const key = secretKey(address, slot);
|
|
467
|
-
const name = process.env[key];
|
|
468
|
-
if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
|
|
469
|
-
const value = process.env[name];
|
|
470
|
-
if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
|
|
471
|
-
values[slot] = value;
|
|
472
|
-
}
|
|
473
|
-
return values;
|
|
474
|
-
};
|
|
475
|
-
/**
|
|
476
|
-
* run()'s setup step for secrets: re-emit each slot's pointer NAME under its
|
|
477
|
-
* address-free key, so the address-free `deserializeSecrets` double-looks-up
|
|
478
|
-
* identically. Never the value — the value stays only in the platform var.
|
|
479
|
-
*/
|
|
480
|
-
const stashSecrets = (node, address) => {
|
|
481
|
-
for (const slot of Object.keys(node.secretSlots)) {
|
|
482
|
-
const name = process.env[secretKey(address, slot)];
|
|
483
|
-
if (name === void 0) continue;
|
|
484
|
-
process.env[secretKey("", slot)] = name;
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
/**
|
|
488
|
-
* Boot: for each reserved provider param, read its address-scoped row through
|
|
489
|
-
* the same `coerce` a declared param uses (JSON-decode, schema-validate), and
|
|
490
|
-
* re-emit it address-free — `stash`'s counterpart for this separate
|
|
491
|
-
* declaration space. A param is declared optional here unconditionally: an
|
|
492
|
-
* absent row means "never provisioned" (local dev, tests, a provider with no
|
|
493
|
-
* registered value for this deploy), never a boot failure, so nothing is
|
|
494
|
-
* stashed and the runtime reader that owns this slot falls back to its own
|
|
495
|
-
* pass-through behavior.
|
|
496
|
-
*/
|
|
497
|
-
function stashProviderParams(entries, address) {
|
|
498
|
-
for (const entry of entries) {
|
|
499
|
-
const d = {
|
|
500
|
-
owner: "service",
|
|
501
|
-
name: entry.name,
|
|
502
|
-
param: {
|
|
503
|
-
schema: entry.schema,
|
|
504
|
-
optional: true
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
const key = configKey(address, d);
|
|
508
|
-
const value = coerce(process.env[key], d, key);
|
|
509
|
-
if (value === void 0) continue;
|
|
510
|
-
process.env[configKey("", d)] = encode("service", value);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
|
|
514
|
-
function standardValidateSync(schema, value) {
|
|
515
|
-
const result = schema["~standard"].validate(value);
|
|
516
|
-
if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
|
|
517
|
-
if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
|
|
518
|
-
return result.value;
|
|
519
|
-
}
|
|
520
|
-
/** ADR-0031's need brand for RPC's per-binding service key — the target registers a provisioner under this. */
|
|
521
|
-
const RPC_PEER_KEY = Symbol.for("prisma:rpc/per-binding-key");
|
|
522
330
|
const liftArray = (data) => Array.isArray(data) ? data : [data];
|
|
523
331
|
/**
|
|
524
332
|
* Splits an array into two arrays based on the result of a predicate
|
|
@@ -7638,6 +7446,265 @@ ark.schema;
|
|
|
7638
7446
|
ark.define;
|
|
7639
7447
|
ark.declare;
|
|
7640
7448
|
/**
|
|
7449
|
+
* Walks a node's own params, then each dependency input's connection params —
|
|
7450
|
+
* the same enumeration order `configOf` uses, but carrying the raw
|
|
7451
|
+
* `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
|
|
7452
|
+
* projection.
|
|
7453
|
+
*/
|
|
7454
|
+
function paramEntries(node) {
|
|
7455
|
+
const entries = [];
|
|
7456
|
+
for (const [input, value] of Object.entries(node.inputs)) {
|
|
7457
|
+
if (typeof value !== "object" || value === null) continue;
|
|
7458
|
+
const params = blindCast(value).connection.params;
|
|
7459
|
+
for (const [name, param] of Object.entries(params)) entries.push({
|
|
7460
|
+
owner: { input },
|
|
7461
|
+
name,
|
|
7462
|
+
param
|
|
7463
|
+
});
|
|
7464
|
+
}
|
|
7465
|
+
for (const [name, param] of Object.entries(node.params)) entries.push({
|
|
7466
|
+
owner: "service",
|
|
7467
|
+
name,
|
|
7468
|
+
param
|
|
7469
|
+
});
|
|
7470
|
+
return entries;
|
|
7471
|
+
}
|
|
7472
|
+
const configKey = (address, d) => {
|
|
7473
|
+
const segments = address.split(".").filter((s) => s.length > 0);
|
|
7474
|
+
const owner = d.owner === "service" ? [] : [d.owner.input];
|
|
7475
|
+
return [
|
|
7476
|
+
"COMPOSER",
|
|
7477
|
+
...segments,
|
|
7478
|
+
...owner,
|
|
7479
|
+
d.name
|
|
7480
|
+
].join("_").toUpperCase();
|
|
7481
|
+
};
|
|
7482
|
+
/**
|
|
7483
|
+
* Typed value → its stored string. Service-own literals are JSON-encoded; a
|
|
7484
|
+
* dependency-input value is a provisioning ref at deploy (and a resolved
|
|
7485
|
+
* string at boot) and passes through untouched — LANDMINE: JSON-encoding it
|
|
7486
|
+
* would break the ordering edge Alchemy resolves through it.
|
|
7487
|
+
*/
|
|
7488
|
+
function encode(owner, value) {
|
|
7489
|
+
return owner === "service" ? JSON.stringify(value) : blindCast(value);
|
|
7490
|
+
}
|
|
7491
|
+
/** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
|
|
7492
|
+
function decode(owner, raw) {
|
|
7493
|
+
return owner === "service" ? JSON.parse(raw) : raw;
|
|
7494
|
+
}
|
|
7495
|
+
const PARAM_POINTER_PREFIX = "@composer-param-pointer:";
|
|
7496
|
+
/** True iff `raw` is a param pointer row (as opposed to a JSON-encoded literal). */
|
|
7497
|
+
const isParamPointerRow = (raw) => raw.startsWith(PARAM_POINTER_PREFIX);
|
|
7498
|
+
/** Reverses `encodeParamPointer`: the platform var NAME a pointer row points to. */
|
|
7499
|
+
const decodeParamPointer = (raw) => raw.slice(24);
|
|
7500
|
+
function coerce(raw, d, key) {
|
|
7501
|
+
if (!(raw !== void 0 && raw !== "")) {
|
|
7502
|
+
if (d.param.default !== void 0) return d.param.default;
|
|
7503
|
+
if (d.param.optional === true) return void 0;
|
|
7504
|
+
throw new Error(`missing required config param "${d.name}" (env ${key})`);
|
|
7505
|
+
}
|
|
7506
|
+
if (d.owner === "service" && isParamPointerRow(raw)) return coerceEnvSourcedParam(raw, d, key);
|
|
7507
|
+
try {
|
|
7508
|
+
return standardValidateSync(d.param.schema, decode(d.owner, raw));
|
|
7509
|
+
} catch (cause) {
|
|
7510
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
7511
|
+
throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
|
|
7512
|
+
}
|
|
7513
|
+
}
|
|
7514
|
+
/**
|
|
7515
|
+
* Boot resolution for an env-sourced param: double-lookup (pointer → platform
|
|
7516
|
+
* var), then the param's own schema on the raw string — no JSON decode, and
|
|
7517
|
+
* no redaction (it's config, not a secret). An UNSET platform var is a loud
|
|
7518
|
+
* boot failure naming both the param and the platform var; an EMPTY string is
|
|
7519
|
+
* not special-cased here — it reaches the schema like any other value, so it
|
|
7520
|
+
* passes iff the schema accepts it (deliberately unlike a literal param's own
|
|
7521
|
+
* ""-means-absent rule, and unlike a secret's non-empty requirement).
|
|
7522
|
+
*/
|
|
7523
|
+
function coerceEnvSourcedParam(raw, d, key) {
|
|
7524
|
+
const platformVar = decodeParamPointer(raw);
|
|
7525
|
+
const value = process.env[platformVar];
|
|
7526
|
+
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.`);
|
|
7527
|
+
try {
|
|
7528
|
+
return standardValidateSync(d.param.schema, value);
|
|
7529
|
+
} catch (cause) {
|
|
7530
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
7531
|
+
throw new Error(`invalid value for env-sourced config param "${d.name}" (env ${key} → ${platformVar}): ${message}`);
|
|
7532
|
+
}
|
|
7533
|
+
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Boot: read each declared param from env by its key, reverse the param's own
|
|
7536
|
+
* serialization (missing/invalid fails loudly), assemble the typed Config.
|
|
7537
|
+
* Secrets ride a separate channel (deserializeSecrets), not this one.
|
|
7538
|
+
*/
|
|
7539
|
+
const deserialize = (node, address) => {
|
|
7540
|
+
const service = {};
|
|
7541
|
+
const inputs = {};
|
|
7542
|
+
for (const d of paramEntries(node)) {
|
|
7543
|
+
const key = configKey(address, d);
|
|
7544
|
+
const value = coerce(process.env[key], d, key);
|
|
7545
|
+
if (d.owner === "service") service[d.name] = value;
|
|
7546
|
+
else {
|
|
7547
|
+
let bucket = inputs[d.owner.input];
|
|
7548
|
+
if (bucket === void 0) {
|
|
7549
|
+
bucket = {};
|
|
7550
|
+
inputs[d.owner.input] = bucket;
|
|
7551
|
+
}
|
|
7552
|
+
bucket[d.name] = value;
|
|
7553
|
+
}
|
|
7554
|
+
}
|
|
7555
|
+
return {
|
|
7556
|
+
service,
|
|
7557
|
+
inputs
|
|
7558
|
+
};
|
|
7559
|
+
};
|
|
7560
|
+
/**
|
|
7561
|
+
* run()'s setup step: write the resolved config to the environment under
|
|
7562
|
+
* address-free keys (configKey("", d) + each serialize suffix), which load()
|
|
7563
|
+
* reads back with no address. Uses env, not a module variable, because a
|
|
7564
|
+
* framework may fork worker processes that inherit env but not memory.
|
|
7565
|
+
* Writes only these keys; nothing else is touched.
|
|
7566
|
+
*/
|
|
7567
|
+
const stash = (node, config) => {
|
|
7568
|
+
for (const d of paramEntries(node)) {
|
|
7569
|
+
const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
|
|
7570
|
+
if (value === void 0) continue;
|
|
7571
|
+
process.env[configKey("", d)] = encode(d.owner, value);
|
|
7572
|
+
}
|
|
7573
|
+
};
|
|
7574
|
+
/** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
|
|
7575
|
+
const secretKey = (address, slot) => configKey(address, {
|
|
7576
|
+
owner: "service",
|
|
7577
|
+
name: slot
|
|
7578
|
+
});
|
|
7579
|
+
/**
|
|
7580
|
+
* Boot: resolve every secret slot to its value by double-lookup — read the
|
|
7581
|
+
* pointer key (the platform NAME), then read that platform var. A missing
|
|
7582
|
+
* pointer or a missing/empty platform value is a loud failure naming both keys.
|
|
7583
|
+
* Returns a plain Record for core's `hydrateSecrets` to box.
|
|
7584
|
+
*/
|
|
7585
|
+
const deserializeSecrets = (node, address) => {
|
|
7586
|
+
const values = {};
|
|
7587
|
+
for (const slot of Object.keys(node.secretSlots)) {
|
|
7588
|
+
const key = secretKey(address, slot);
|
|
7589
|
+
const name = process.env[key];
|
|
7590
|
+
if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
|
|
7591
|
+
const value = process.env[name];
|
|
7592
|
+
if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
|
|
7593
|
+
values[slot] = value;
|
|
7594
|
+
}
|
|
7595
|
+
return values;
|
|
7596
|
+
};
|
|
7597
|
+
/**
|
|
7598
|
+
* run()'s setup step for secrets: re-emit each slot's pointer NAME under its
|
|
7599
|
+
* address-free key, so the address-free `deserializeSecrets` double-looks-up
|
|
7600
|
+
* identically. Never the value — the value stays only in the platform var.
|
|
7601
|
+
*/
|
|
7602
|
+
const stashSecrets = (node, address) => {
|
|
7603
|
+
for (const slot of Object.keys(node.secretSlots)) {
|
|
7604
|
+
const name = process.env[secretKey(address, slot)];
|
|
7605
|
+
if (name === void 0) continue;
|
|
7606
|
+
process.env[secretKey("", slot)] = name;
|
|
7607
|
+
}
|
|
7608
|
+
};
|
|
7609
|
+
/**
|
|
7610
|
+
* Boot: for each reserved provider param, read its address-scoped row through
|
|
7611
|
+
* the same `coerce` a declared param uses (JSON-decode, schema-validate), and
|
|
7612
|
+
* re-emit it address-free — `stash`'s counterpart for this separate
|
|
7613
|
+
* declaration space. A param is declared optional here unconditionally: an
|
|
7614
|
+
* absent row means "never provisioned" (local dev, tests, a provider with no
|
|
7615
|
+
* registered value for this deploy), never a boot failure, so nothing is
|
|
7616
|
+
* stashed and the runtime reader that owns this slot falls back to its own
|
|
7617
|
+
* pass-through behavior.
|
|
7618
|
+
*/
|
|
7619
|
+
function stashProviderParams(entries, address) {
|
|
7620
|
+
for (const entry of entries) {
|
|
7621
|
+
const d = {
|
|
7622
|
+
owner: "service",
|
|
7623
|
+
name: entry.name,
|
|
7624
|
+
param: {
|
|
7625
|
+
schema: entry.schema,
|
|
7626
|
+
optional: true
|
|
7627
|
+
}
|
|
7628
|
+
};
|
|
7629
|
+
const key = configKey(address, d);
|
|
7630
|
+
const value = coerce(process.env[key], d, key);
|
|
7631
|
+
if (value === void 0) continue;
|
|
7632
|
+
process.env[configKey("", d)] = encode("service", value);
|
|
7633
|
+
}
|
|
7634
|
+
}
|
|
7635
|
+
/** The framework-resolved origin row: COMPOSER_<addr>_ORIGIN. Written per
|
|
7636
|
+
* compute service at serialize — the service's own provisioned endpoint URL,
|
|
7637
|
+
* riding the reserved-provider-param machinery (`origin-key.ts`'s
|
|
7638
|
+
* `ORIGIN_PARAM`); never a declared param, never in config(). A harness with
|
|
7639
|
+
* no deploy behind it supplies it by setting `COMPOSER_ORIGIN` to the
|
|
7640
|
+
* JSON-encoded origin URL — exactly how the existing entrypoint tests supply
|
|
7641
|
+
* their other `COMPOSER_*` rows. */
|
|
7642
|
+
const ORIGIN_KEY_NAME = "ORIGIN";
|
|
7643
|
+
/**
|
|
7644
|
+
* Reads this service's origin back out of the address-free stash
|
|
7645
|
+
* `stashProviderParams` wrote for the ORIGIN entry. `COMPOSER_ORIGIN` unset is
|
|
7646
|
+
* a loud failure — a deployed environment always writes it, so an unset row
|
|
7647
|
+
* means either a local harness that hasn't supplied it or a boot() called
|
|
7648
|
+
* before run().
|
|
7649
|
+
*/
|
|
7650
|
+
function readOrigin() {
|
|
7651
|
+
const d = {
|
|
7652
|
+
owner: "service",
|
|
7653
|
+
name: ORIGIN_KEY_NAME,
|
|
7654
|
+
param: {
|
|
7655
|
+
schema: type("string"),
|
|
7656
|
+
optional: true
|
|
7657
|
+
}
|
|
7658
|
+
};
|
|
7659
|
+
const key = configKey("", d);
|
|
7660
|
+
const value = coerce(process.env[key], d, key);
|
|
7661
|
+
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).");
|
|
7662
|
+
return blindCast(value);
|
|
7663
|
+
}
|
|
7664
|
+
/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
|
|
7665
|
+
function standardValidateSync(schema, value) {
|
|
7666
|
+
const result = schema["~standard"].validate(value);
|
|
7667
|
+
if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
|
|
7668
|
+
if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
|
|
7669
|
+
return result.value;
|
|
7670
|
+
}
|
|
7671
|
+
/** ADR-0031's need brand for RPC's per-binding service key — the target registers a provisioner under this. */
|
|
7672
|
+
const RPC_PEER_KEY = Symbol.for("prisma:rpc/per-binding-key");
|
|
7673
|
+
/**
|
|
7674
|
+
* The service's own origin as a reserved provider param (ADR-0031): the ONE
|
|
7675
|
+
* brand and the ONE entry — shared by control.ts (which registers the
|
|
7676
|
+
* deploy-side value function that resolves the provisioned service's
|
|
7677
|
+
* `endpointDomain` — see its `selfOriginValue`) and compute.ts (which
|
|
7678
|
+
* validates and stashes the row at boot through the generic
|
|
7679
|
+
* `stashProviderParams` loop), so writer and reader cannot drift.
|
|
7680
|
+
*
|
|
7681
|
+
* Unlike the key-minting brands (`service-keys.ts`, `streams-keys.ts`) this
|
|
7682
|
+
* brand has no provisioner and no consumer edges: the value derives from the
|
|
7683
|
+
* service's OWN provisioned attributes, so control.ts registers it as a
|
|
7684
|
+
* service-derived provider param (`descriptors/shared.ts`'s
|
|
7685
|
+
* `ServiceProviderParam`) and the descriptor writes it for EVERY compute
|
|
7686
|
+
* service, exposing or not.
|
|
7687
|
+
*
|
|
7688
|
+
* This module is reachable from the RUNTIME/authoring side — it must never
|
|
7689
|
+
* import `@internal/lowering` or `effect`, or those tokens leak into a user
|
|
7690
|
+
* service's bundle (the deploy-side value function lives in control.ts, the
|
|
7691
|
+
* control-plane-only entry).
|
|
7692
|
+
*/
|
|
7693
|
+
/** ADR-0031's brand for the service's own origin — control.ts registers the deploy-side value function under this. */
|
|
7694
|
+
const SELF_ORIGIN = Symbol.for("prisma:self-origin");
|
|
7695
|
+
/**
|
|
7696
|
+
* The reserved provider param for the origin row: the var name is `ORIGIN`,
|
|
7697
|
+
* derived through `configKey` at both ends (`configKey(address, …)` at
|
|
7698
|
+
* deploy, `configKey('', …)` — `COMPOSER_ORIGIN` — at boot, where
|
|
7699
|
+
* `readOrigin` reads it back). `brand` is `SELF_ORIGIN` — control.ts looks
|
|
7700
|
+
* its deploy-side value function up by this field.
|
|
7701
|
+
*/
|
|
7702
|
+
const ORIGIN_PARAM = {
|
|
7703
|
+
name: ORIGIN_KEY_NAME,
|
|
7704
|
+
schema: type("string"),
|
|
7705
|
+
brand: SELF_ORIGIN
|
|
7706
|
+
};
|
|
7707
|
+
/**
|
|
7641
7708
|
* RPC's reserved provider param (ADR-0030/ADR-0031): the declaration —
|
|
7642
7709
|
* name + schema + brand — for the accepted-keys set a provider stores, shared
|
|
7643
7710
|
* by `control.ts` (which registers the deploy-side `value(refs)` that mints
|
|
@@ -7690,7 +7757,33 @@ const STREAMS_API_KEY_ENV = configKey("", {
|
|
|
7690
7757
|
owner: "service",
|
|
7691
7758
|
name: STREAMS_API_KEY_PARAM.name
|
|
7692
7759
|
});
|
|
7693
|
-
|
|
7760
|
+
/**
|
|
7761
|
+
* The list of provider-side reserved params the boot path validates and
|
|
7762
|
+
* stashes (ADR-0031): every brand's `{name, schema, brand}` declaration,
|
|
7763
|
+
* collected from that brand's own module (`service-keys.ts`,
|
|
7764
|
+
* `streams-keys.ts`, `origin-key.ts`) so `compute.ts` names no brand itself.
|
|
7765
|
+
*
|
|
7766
|
+
* This list exists separately from `control.ts`'s deploy-side registry
|
|
7767
|
+
* (`PROVIDER_PARAMS`) because `control.ts` is deploy-only code — it imports
|
|
7768
|
+
* `@internal/lowering` and `effect` to mint values — and a booted service
|
|
7769
|
+
* must never import it. This module is reachable from a user service's
|
|
7770
|
+
* bundle through `compute.ts`, so it must never import `@internal/lowering`,
|
|
7771
|
+
* `effect`, `alchemy`, or `control.ts`.
|
|
7772
|
+
*
|
|
7773
|
+
* This is the single source of which reserved provider params exist:
|
|
7774
|
+
* control.ts builds `PROVIDER_PARAMS` by mapping over this list and looking
|
|
7775
|
+
* up each entry's deploy-side value function (edge-derived `value(refs)` or
|
|
7776
|
+
* service-derived `valueForService(provisioned, address)`) by its `brand`,
|
|
7777
|
+
* throwing at module load if one is missing. Adding a brand means adding its
|
|
7778
|
+
* entry here, plus its deploy-side value function in control.ts — a brand
|
|
7779
|
+
* registered for deploy but absent here is no longer expressible, because
|
|
7780
|
+
* deploy no longer names its own param set independently.
|
|
7781
|
+
*/
|
|
7782
|
+
const RESERVED_PROVIDER_PARAMS = [
|
|
7783
|
+
RPC_ACCEPTED_KEYS_PARAM,
|
|
7784
|
+
STREAMS_API_KEY_PARAM,
|
|
7785
|
+
ORIGIN_PARAM
|
|
7786
|
+
];
|
|
7694
7787
|
Object.freeze({
|
|
7695
7788
|
kind: "s3",
|
|
7696
7789
|
__cmp: {
|
|
@@ -7707,7 +7800,7 @@ const reservedParams = { port: number$1({ default: 3e3 }) };
|
|
|
7707
7800
|
* ports it exposes), no descriptor. `params` merges with the reserved
|
|
7708
7801
|
* `ReservedParams` (`port`); a user param whose name collides with a reserved
|
|
7709
7802
|
* one fails at authoring, the same way a colliding dependency name does.
|
|
7710
|
-
*
|
|
7803
|
+
*
|
|
7711
7804
|
* · run(address, boot) — the process controller: deserialize the platform
|
|
7712
7805
|
* environment (keyed off `address`, the extension's ONE env read) into a
|
|
7713
7806
|
* typed Config, re-emit it under address-free process-local stash keys,
|
|
@@ -7715,23 +7808,69 @@ const reservedParams = { port: number$1({ default: 3e3 }) };
|
|
|
7715
7808
|
* · load() / config() — called from inside the app's entry: read the stash;
|
|
7716
7809
|
* load() hydrates + memoizes the deps, config() returns the typed params.
|
|
7717
7810
|
* Separate accessors so a dep and a param never share a namespace (ADR-0021).
|
|
7811
|
+
* · origin() — this service's platform-assigned public origin, read from the
|
|
7812
|
+
* stash `run()` populates; memoized per process.
|
|
7718
7813
|
*
|
|
7719
|
-
*
|
|
7814
|
+
* The underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
|
|
7720
7815
|
* the control-plane registry key `prisma-composer deploy` resolves through the
|
|
7721
7816
|
* app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
|
|
7722
|
-
* deploy time; nodes are pure data.
|
|
7817
|
+
* deploy time; nodes are pure data until run() or load() is called.
|
|
7723
7818
|
*/
|
|
7819
|
+
var ComputeService = class {
|
|
7820
|
+
#resolved;
|
|
7821
|
+
#loadedDeps;
|
|
7822
|
+
#loadedParams;
|
|
7823
|
+
#loadedSecrets;
|
|
7824
|
+
#origin;
|
|
7825
|
+
constructor(node) {
|
|
7826
|
+
Object.assign(this, node);
|
|
7827
|
+
}
|
|
7828
|
+
#processConfig() {
|
|
7829
|
+
if (this.#resolved === void 0) this.#resolved = deserialize(this, "");
|
|
7830
|
+
return this.#resolved;
|
|
7831
|
+
}
|
|
7832
|
+
async run(address, boot) {
|
|
7833
|
+
const config = deserialize(this, address);
|
|
7834
|
+
stash(this, config);
|
|
7835
|
+
stashProviderParams(RESERVED_PROVIDER_PARAMS, address);
|
|
7836
|
+
stashSecrets(this, address);
|
|
7837
|
+
const port = config.service["port"];
|
|
7838
|
+
if (typeof port === "number") process.env["PORT"] = String(port);
|
|
7839
|
+
return boot();
|
|
7840
|
+
}
|
|
7841
|
+
load() {
|
|
7842
|
+
if (this.#loadedDeps === void 0) this.#loadedDeps = blindCast(hydrateSync(this, this.#processConfig()));
|
|
7843
|
+
return this.#loadedDeps;
|
|
7844
|
+
}
|
|
7845
|
+
config() {
|
|
7846
|
+
if (this.#loadedParams === void 0) this.#loadedParams = blindCast(this.#processConfig().service);
|
|
7847
|
+
return this.#loadedParams;
|
|
7848
|
+
}
|
|
7849
|
+
secrets() {
|
|
7850
|
+
if (this.#loadedSecrets === void 0) this.#loadedSecrets = blindCast(hydrateSecrets(this, deserializeSecrets(this, "")));
|
|
7851
|
+
return this.#loadedSecrets;
|
|
7852
|
+
}
|
|
7853
|
+
/** This service's platform-assigned public origin — read from the stash
|
|
7854
|
+
* run() populates and memoized per process. Throws if called before run()
|
|
7855
|
+
* has stashed it (readOrigin's pinned message). */
|
|
7856
|
+
origin() {
|
|
7857
|
+
this.#origin ??= readOrigin();
|
|
7858
|
+
return this.#origin;
|
|
7859
|
+
}
|
|
7860
|
+
};
|
|
7724
7861
|
const compute = (def) => {
|
|
7725
7862
|
const userParams = def.params ?? blindCast({});
|
|
7726
7863
|
for (const reserved of Object.keys(reservedParams)) {
|
|
7727
7864
|
if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
|
|
7728
7865
|
if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
|
|
7729
7866
|
}
|
|
7867
|
+
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.`);
|
|
7868
|
+
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.`);
|
|
7730
7869
|
const params = blindCast({
|
|
7731
7870
|
...userParams,
|
|
7732
7871
|
...reservedParams
|
|
7733
7872
|
});
|
|
7734
|
-
const
|
|
7873
|
+
const instance = new ComputeService(service$1({
|
|
7735
7874
|
name: def.name,
|
|
7736
7875
|
extension: "@prisma/composer-prisma-cloud",
|
|
7737
7876
|
type: "compute",
|
|
@@ -7740,40 +7879,9 @@ const compute = (def) => {
|
|
|
7740
7879
|
...def.secrets !== void 0 ? { secrets: def.secrets } : {},
|
|
7741
7880
|
build: def.build,
|
|
7742
7881
|
...def.expose !== void 0 ? { expose: def.expose } : {}
|
|
7743
|
-
});
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
let loadedParams;
|
|
7747
|
-
let loadedSecrets;
|
|
7748
|
-
function processConfig() {
|
|
7749
|
-
if (resolved === void 0) resolved = deserialize(node, "");
|
|
7750
|
-
return resolved;
|
|
7751
|
-
}
|
|
7752
|
-
const runnable = {
|
|
7753
|
-
...node,
|
|
7754
|
-
async run(address, boot) {
|
|
7755
|
-
const config = deserialize(node, address);
|
|
7756
|
-
stash(node, config);
|
|
7757
|
-
stashProviderParams(RESERVED_PROVIDER_PARAMS, address);
|
|
7758
|
-
stashSecrets(node, address);
|
|
7759
|
-
const port = config.service["port"];
|
|
7760
|
-
if (typeof port === "number") process.env["PORT"] = String(port);
|
|
7761
|
-
return boot();
|
|
7762
|
-
},
|
|
7763
|
-
load() {
|
|
7764
|
-
if (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));
|
|
7765
|
-
return loadedDeps;
|
|
7766
|
-
},
|
|
7767
|
-
config() {
|
|
7768
|
-
if (loadedParams === void 0) loadedParams = blindCast(processConfig().service);
|
|
7769
|
-
return loadedParams;
|
|
7770
|
-
},
|
|
7771
|
-
secrets() {
|
|
7772
|
-
if (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, "")));
|
|
7773
|
-
return loadedSecrets;
|
|
7774
|
-
}
|
|
7775
|
-
};
|
|
7776
|
-
return Object.freeze(blindCast(runnable));
|
|
7882
|
+
}));
|
|
7883
|
+
Object.freeze(instance);
|
|
7884
|
+
return instance;
|
|
7777
7885
|
};
|
|
7778
7886
|
/**
|
|
7779
7887
|
* The contract a Postgres provides — and the contract its consumers require.
|
|
@@ -7844,13 +7952,21 @@ function s3Credentials(opts) {
|
|
|
7844
7952
|
* return type is compute's exactly (including the reserved `port` param). The
|
|
7845
7953
|
* storage module (D4b) calls this with its `db`/`credentials` deps, a `bucket`
|
|
7846
7954
|
* param, and `expose: { store: s3Contract }`.
|
|
7955
|
+
*
|
|
7956
|
+
* `compute()`'s result is a `ComputeService` instance — its run/load/config/
|
|
7957
|
+
* secrets/origin methods live on the class prototype, not as the instance's
|
|
7958
|
+
* own properties, so a plain object spread (`{ ...node }`) would silently
|
|
7959
|
+
* drop them. Building a fresh `ComputeService` from the same data fields
|
|
7960
|
+
* (which `{ ...node }` DOES copy — they're the node's own enumerable
|
|
7961
|
+
* properties) with `type` overridden keeps every method intact.
|
|
7847
7962
|
*/
|
|
7848
7963
|
function s3StoreService(def) {
|
|
7849
|
-
const
|
|
7850
|
-
|
|
7851
|
-
...node,
|
|
7964
|
+
const instance = new ComputeService({
|
|
7965
|
+
...compute(def),
|
|
7852
7966
|
type: "s3-store"
|
|
7853
|
-
})
|
|
7967
|
+
});
|
|
7968
|
+
Object.freeze(instance);
|
|
7969
|
+
return instance;
|
|
7854
7970
|
}
|
|
7855
7971
|
const nodeBuild = (opts) => ({
|
|
7856
7972
|
extension: "@prisma/composer/node",
|