@prisma/composer-prisma-cloud 0.3.0-dev.6 → 0.3.0-dev.7

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 (64) hide show
  1. package/dist/control.d.mts +1 -1
  2. package/dist/control.mjs +28 -17
  3. package/dist/control.mjs.map +1 -1
  4. package/dist/cron/index.d.mts +33 -26
  5. package/dist/cron/index.d.mts.map +1 -1
  6. package/dist/cron/index.mjs +202 -77
  7. package/dist/cron/index.mjs.map +1 -1
  8. package/dist/cron/scheduler-entrypoint.mjs +133 -114
  9. package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
  10. package/dist/cron/scheduler-service.mjs +200 -76
  11. package/dist/cron/scheduler-service.mjs.map +1 -1
  12. package/dist/email/email-entrypoint.mjs +162 -126
  13. package/dist/email/email-entrypoint.mjs.map +1 -1
  14. package/dist/email/email-service.mjs +230 -79
  15. package/dist/email/email-service.mjs.map +1 -1
  16. package/dist/email/index.d.mts +33 -29
  17. package/dist/email/index.d.mts.map +1 -1
  18. package/dist/email/index.mjs +236 -84
  19. package/dist/email/index.mjs.map +1 -1
  20. package/dist/email/testing.mjs +112 -89
  21. package/dist/email/testing.mjs.map +1 -1
  22. package/dist/index.d.mts +51 -43
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +47 -51
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/local-target.mjs +1 -1
  27. package/dist/local-target.mjs.map +1 -1
  28. package/dist/{preflight-names-BPL-qsZF-BfoRgbgb.mjs → preflight-names-CpJUd9ZA-BCU-W3cT.mjs} +30 -14
  29. package/dist/{preflight-names-BPL-qsZF-BfoRgbgb.mjs.map → preflight-names-CpJUd9ZA-BCU-W3cT.mjs.map} +1 -1
  30. package/dist/{provisioned-edges-C1wSO3cx-YC5C19f9.mjs → provisioned-edges-Cxy18aoh-CUnaY96r.mjs} +3 -3
  31. package/dist/{provisioned-edges-C1wSO3cx-YC5C19f9.mjs.map → provisioned-edges-Cxy18aoh-CUnaY96r.mjs.map} +1 -1
  32. package/dist/{param-BTzY0ne5-CW6ojZ3E.mjs → secret-BVGxqHxY-DYDfiULl.mjs} +45 -4
  33. package/dist/secret-BVGxqHxY-DYDfiULl.mjs.map +1 -0
  34. package/dist/{serializer-Cx5slrV4-xJfH6EWS.d.mts → serializer-BD_6nkr4-DWn5NNTC.d.mts} +2 -2
  35. package/dist/serializer-BD_6nkr4-DWn5NNTC.d.mts.map +1 -0
  36. package/dist/serializer-sVE4UAmg-CikRngbR.mjs +475 -0
  37. package/dist/serializer-sVE4UAmg-CikRngbR.mjs.map +1 -0
  38. package/dist/storage/index.d.mts +31 -26
  39. package/dist/storage/index.d.mts.map +1 -1
  40. package/dist/storage/index.mjs +215 -89
  41. package/dist/storage/index.mjs.map +1 -1
  42. package/dist/storage/storage-entrypoint.mjs +147 -122
  43. package/dist/storage/storage-entrypoint.mjs.map +1 -1
  44. package/dist/storage/storage-service.mjs +212 -87
  45. package/dist/storage/storage-service.mjs.map +1 -1
  46. package/dist/streams/index.d.mts +29 -22
  47. package/dist/streams/index.d.mts.map +1 -1
  48. package/dist/streams/index.mjs +213 -88
  49. package/dist/streams/index.mjs.map +1 -1
  50. package/dist/streams/streams-entrypoint.mjs +139 -118
  51. package/dist/streams/streams-entrypoint.mjs.map +1 -1
  52. package/dist/streams/streams-service.mjs +212 -87
  53. package/dist/streams/streams-service.mjs.map +1 -1
  54. package/dist/testing.d.mts +19 -5
  55. package/dist/testing.d.mts.map +1 -1
  56. package/dist/testing.mjs +11 -3
  57. package/dist/testing.mjs.map +1 -1
  58. package/package.json +17 -17
  59. package/dist/param-BTzY0ne5-CW6ojZ3E.mjs.map +0 -1
  60. package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs +0 -47
  61. package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs.map +0 -1
  62. package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs +0 -251
  63. package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs.map +0 -1
  64. package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer-sVE4UAmg-CikRngbR.mjs","names":["blindCast","blindCast","#value"],"sources":["../../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs","../../../0-framework/0-foundation/foundation/dist/secret-DoWGmN7m.mjs","../../../1-prisma-cloud/1-extensions/target/dist/serializer-sVE4UAmg.mjs"],"sourcesContent":["//#region src/casts.ts\n/**\n* **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**\n*\n* Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes\n* unnecessary**: tighten an input type, add a runtime check that narrows via a type\n* predicate, restructure a generic so the compiler can see the relationship you're\n* asserting, or use {@link castAs} when the value already satisfies the target type.\n* Only when no rewrite is feasible does `blindCast` become the right answer — and at\n* that point, the `Reason` literal you supply must articulate the compromise in\n* language a reviewer can evaluate.\n*\n* The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,\n* that is not a signal to soften the reason; it is a signal to go back and solve the\n* underlying type-system problem properly. An unconvincing justification is rework,\n* not a free pass.\n*\n* `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses\n* the compiler's checks (the input type is `unknown`, the output type is whatever the\n* caller asks for), but it forces the unsafety to be named at the call site instead of\n* smuggled in via a bare `as`. The `Reason` type parameter exists only at compile\n* time — it is not present in the emitted JavaScript — but it is grep-able and\n* visible to future readers.\n*\n* @example\n* ```typescript\n* const stringValue = blindCast<\n* string,\n* \"JSON.parse returns `unknown`; this field is documented to be a string in the API contract\"\n* >(parsed[key]);\n* ```\n*\n* @typeParam TargetType - The type the caller is asserting the input has.\n* @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.\n* Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.\n*/\nfunction blindCast(input) {\n\treturn input;\n}\n/**\n* Type-checked, runtime pass-through alternative to a bare `as Type` cast.\n*\n* Use `castAs` when the value already satisfies the target type but you want to make\n* the type assertion explicit at the call site — for example, when an inferred type is\n* wider than the type you want to publish, or when a literal object should be tagged\n* with its nominal interface. Unlike {@link blindCast}, the compiler still checks that\n* the value is assignable to the target type, so this helper cannot smuggle in an\n* unsafe assertion.\n*\n* `castAs` exists alongside `blindCast` so authors pick the right name at the call\n* site: a `castAs` is type-checked and benign; a `blindCast` is the unsafe escape\n* hatch. The split makes review faster — readers know which casts to scrutinize and\n* which are pure annotations.\n*\n* @example\n* ```typescript\n* interface FancyObject {\n* key: string;\n* keyTwo: {\n* subKey: string;\n* subKeyTwo: number;\n* };\n* }\n*\n* const typedObject = castAs<FancyObject>({\n* key: 'Chookede',\n* keyTwo: {\n* subKey: 'Choookeeeee',\n* subKeyTwo: 2,\n* },\n* });\n* ```\n*\n* @typeParam Type - The type to constrain and tag the value with. The value must be assignable to `Type`.\n*/\nfunction castAs(value) {\n\treturn value;\n}\n//#endregion\nexport { castAs as n, blindCast as t };\n\n//# sourceMappingURL=casts-DpaahrlC.mjs.map","import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\n//#region src/secret.ts\n/**\n* A value wrapper that redacts everywhere except the one explicit reader,\n* `expose()`. Sensitivity is carried by the TYPE (`SecretBox<T>`), not a flag a\n* sink must remember to check: `String(box)`, template interpolation,\n* `JSON.stringify`, and `console.log`/`util.inspect` all print `[REDACTED]`, so\n* a secret can't leak through an accidental log or serialization.\n*\n* Every box carries a brand property keyed by the registered symbol\n* `Symbol.for('prisma:secret-box')`, which is what `isSecretString` checks. A\n* symbol key is invisible to `JSON.stringify` and `Object.keys`, so the box's\n* public shape still matches the platform's own `secrecy` type\n* (pdp-control-plane).\n*/\nconst REDACTED = \"[REDACTED]\";\nconst SECRET_BOX = blindCast(Symbol.for(\"prisma:secret-box\"));\nvar SecretBox = class {\n\t[SECRET_BOX] = true;\n\t#value;\n\tconstructor(value) {\n\t\tthis.#value = value;\n\t}\n\t/** The sole explicit door to the wrapped value. */\n\texpose() {\n\t\treturn this.#value;\n\t}\n\ttoString() {\n\t\treturn REDACTED;\n\t}\n\ttoJSON() {\n\t\treturn REDACTED;\n\t}\n\tvalueOf() {\n\t\treturn REDACTED;\n\t}\n\t[Symbol.toPrimitive]() {\n\t\treturn REDACTED;\n\t}\n\t[Symbol.for(\"nodejs.util.inspect.custom\")]() {\n\t\treturn REDACTED;\n\t}\n};\n/**\n* True for a redacting secret box — what a schema's secret leaf checks\n* (ADR-0042). Reads the brand rather than `instanceof`, so a box from a\n* duplicated module copy in a bundle counts and a look-alike does not.\n*/\nfunction isSecretString(value) {\n\treturn typeof value === \"object\" && value !== null && blindCast(value)[SECRET_BOX] === true;\n}\n//#endregion\nexport { isSecretString as n, SecretBox as t };\n\n//# sourceMappingURL=secret-DoWGmN7m.mjs.map","import { i as isEnvParamSource, n as secretName } from \"./secret-BVGxqHxY.mjs\";\nimport { isParamSource, isSecretSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { type } from \"arktype\";\nimport { SecretBox } from \"@internal/foundation/secret\";\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* The input document rides its own channel (readInput), 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 input document's own row name; its full key is COMPOSER_<addr>_INPUT. */\nconst INPUT_KEY_NAME = \"INPUT\";\n/** The input document row's key for a service address. */\nconst inputKey = (address) => configKey(address, {\n\towner: \"service\",\n\tname: INPUT_KEY_NAME\n});\nconst SECRET_MARKER = \"$secret\";\nconst ESCAPABLE_KEY = /^\\$+secret$/;\nconst ESCAPED_KEY = /^\\$\\$+secret$/;\n/** True for the framework's secret pointer: `{ \"$secret\": \"<PLATFORM_VAR>\" }` and nothing else. */\nfunction isSecretPointer(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value) && Object.keys(value).length === 1 && SECRET_MARKER in value && typeof value[SECRET_MARKER] === \"string\";\n}\n/** A plain data object (not an array, not a class instance) — the only object shape a binding/document may nest. */\nfunction isPlainObject(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nconst ABSENT = Symbol(\"composer-input-absent\");\n/**\n* Deploy: recursive descent over the provision-time binding (plain data).\n* `envSecret` leaves become empty sentinel `SecretBox`es (the value never\n* enters the deploy); `envParam` leaves read the deploy shell — unset or\n* empty means the enclosing object key is OMITTED, and the schema arbitrates\n* whether that absence is legal (ADR-0042). Everything non-plain (a class\n* instance, a function, a raw SecretBox holding a value) is rejected loudly.\n*/\nfunction resolveInputBinding(binding, env) {\n\tconst sentinels = /* @__PURE__ */ new Map();\n\tconst absent = [];\n\tconst walk = (value, path) => {\n\t\tif (isSecretSource(value)) {\n\t\t\tconst name = secretName(value, path === \"\" ? \"the input binding root\" : `input key \"${path}\"`);\n\t\t\tconst sentinel = new SecretBox(\"\");\n\t\t\tsentinels.set(sentinel, name);\n\t\t\treturn sentinel;\n\t\t}\n\t\tif (isParamSource(value)) {\n\t\t\tif (!isEnvParamSource(value)) throw new Error(`input binding${path === \"\" ? \"\" : ` key \"${path}\"`} is bound to a param source not created by envParam() — bind env-sourced input values with envParam('NAME') from @prisma/composer-prisma-cloud.`);\n\t\t\tconst raw = env[value.payload.name];\n\t\t\tif (raw === void 0 || raw === \"\") {\n\t\t\t\tabsent.push(path === \"\" ? `(root) → ${value.payload.name}` : `${path} → ${value.payload.name}`);\n\t\t\t\treturn ABSENT;\n\t\t\t}\n\t\t\treturn raw;\n\t\t}\n\t\tif (Array.isArray(value)) return value.map((member, index) => {\n\t\t\tconst resolvedMember = walk(member, path === \"\" ? String(index) : `${path}.${index}`);\n\t\t\tif (resolvedMember === ABSENT) throw new Error(`input binding key \"${path}[${index}]\" is an env-bound array element whose variable is unset — an array position cannot be omitted; bind a literal or provision the variable.`);\n\t\t\treturn resolvedMember;\n\t\t});\n\t\tif (isPlainObject(value)) {\n\t\t\tconst out = {};\n\t\t\tfor (const [key, member] of Object.entries(value)) {\n\t\t\t\tconst resolvedMember = walk(member, path === \"\" ? key : `${path}.${key}`);\n\t\t\t\tif (resolvedMember === ABSENT) continue;\n\t\t\t\tout[key] = resolvedMember;\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\tif (value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") return value;\n\t\tthrow new Error(`input binding${path === \"\" ? \"\" : ` key \"${path}\"`} holds a value that is not plain data (${typeof value === \"object\" ? \"a non-plain object\" : `a ${typeof value}`}) — a binding's leaves are literals, envParam(...), or envSecret(...) (ADR-0042). A secret VALUE (e.g. a SecretBox) never belongs in a binding — bind envSecret('NAME') instead.`);\n\t};\n\tconst resolved = walk(binding, \"\");\n\treturn {\n\t\tresolved: resolved === ABSENT ? void 0 : resolved,\n\t\tsentinels,\n\t\tabsent\n\t};\n}\n/**\n* Deploy: resolve the binding, judge it with the service's own schema\n* (secrets as opaque sentinel boxes), and serialize the defaults-applied\n* VALIDATED output — pointers substituted back where the sentinels sit — into\n* one JSON row. Returns `undefined` for a service with no input schema.\n* A validation failure that mentions a secret leaf means either a\n* misclassified binding (a literal where the schema wants a `SecretString`,\n* or vice versa) or a schema refining on secret CONTENT — deploy-time\n* validation sees only empty boxes, and the ADR forbids content refinements.\n*/\nfunction serializeInput(node, address, binding, env = process.env) {\n\tconst schema = node.inputSchema;\n\tif (schema === void 0) {\n\t\tif (binding !== void 0) throw new Error(`service \"${address}\" has an input binding but declares no input schema — Load should have rejected it (ADR-0042).`);\n\t\treturn;\n\t}\n\tif (binding === void 0) throw new Error(`service \"${address}\" declares an input schema but has no recorded input binding — Load should have required it (ADR-0042).`);\n\tconst { resolved, sentinels, absent } = resolveInputBinding(binding, env);\n\tlet validated;\n\ttry {\n\t\tvalidated = standardValidateSync(schema, resolved);\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`invalid input for service \"${address}\": ${message}\\n(Deploy-time validation sees each envSecret leaf as an opaque, empty SecretString box. A failure naming a secret field means the binding and schema disagree about its secretness, or the schema refines on secret content — which ADR-0042 forbids.)`);\n\t}\n\tconst document = substituteSecretPointers(validated, sentinels, address);\n\treturn {\n\t\tkey: inputKey(address),\n\t\tvalue: JSON.stringify(document),\n\t\tabsent\n\t};\n}\n/**\n* Walks the VALIDATED output, mapping each sentinel box (by identity) back to\n* its `{ \"$secret\": name }` pointer and escaping any user key that matches\n* the reserved marker. A `SecretString` the walk does not recognize came from\n* the schema itself (a default or transform minting a box) — there is no\n* platform var behind it, so it is rejected rather than serialized.\n*/\nfunction substituteSecretPointers(value, sentinels, address) {\n\tconst walk = (v, path) => {\n\t\tif (v instanceof SecretBox) {\n\t\t\tconst name = sentinels.get(v);\n\t\t\tif (name === void 0) throw new Error(`input key \"${path}\" of service \"${address}\" validated to a SecretString the binding did not supply — a schema must not mint secret boxes (a default/transform cannot name a platform variable); bind the field with envSecret('NAME') instead.`);\n\t\t\treturn { [SECRET_MARKER]: name };\n\t\t}\n\t\tif (Array.isArray(v)) return v.map((m, i) => walk(m, `${path}[${i}]`));\n\t\tif (isPlainObject(v)) {\n\t\t\tconst out = {};\n\t\t\tfor (const [key, member] of Object.entries(v)) {\n\t\t\t\tif (member === void 0) continue;\n\t\t\t\tconst written = ESCAPABLE_KEY.test(key) ? `$${key}` : key;\n\t\t\t\tout[written] = walk(member, path === \"\" ? key : `${path}.${key}`);\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\tif (v === null || v === void 0 || typeof v === \"string\" || typeof v === \"number\" || typeof v === \"boolean\") return v;\n\t\tthrow new Error(`input key \"${path}\" of service \"${address}\" validated to a value that cannot be serialized (a ${typeof v === \"object\" ? \"non-plain object\" : typeof v}) — the input document is plain JSON (ADR-0042).`);\n\t};\n\treturn walk(value, \"\");\n}\n/**\n* Boot: read the one input document row (address-free after run()'s\n* re-stash), swap each `$secret` pointer for a redacting box over the named\n* platform var, unescape reserved keys, validate with the service's own\n* schema, and return the typed object. A missing row is a loud failure naming\n* the env var — a deployed environment always writes it; a local harness must\n* supply it (set the row to the serialized input document).\n*/\nfunction readInput(node, address) {\n\tconst schema = node.inputSchema;\n\tif (schema === void 0) throw new Error(`input() called on service \"${node.name}\", which declares no input schema — declare \\`input: <schema>\\` on compute() to use it (ADR-0042).`);\n\tconst key = inputKey(address);\n\tconst raw = process.env[key];\n\tif (raw === void 0 || raw === \"\") throw new Error(`this service's input is not available (env ${key} is unset) — a deployed environment writes it automatically; a local harness must supply it like any other config value (set ${key} to the serialized input document).`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`this service's input document is not valid JSON (env ${key}): ${message} — a deployed environment writes it automatically; a local harness must supply the serialized input document (set ${key} to it).`);\n\t}\n\tconst hydrated = hydrateInputDocument(parsed, key);\n\ttry {\n\t\treturn standardValidateSync(schema, hydrated);\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`invalid input document (env ${key}): ${message}`);\n\t}\n}\n/** Reverses the document encoding: `$secret` pointers become redacting boxes over the named platform vars; escaped reserved keys drop one \"$\". */\nfunction hydrateInputDocument(value, key) {\n\tif (isSecretPointer(value)) {\n\t\tconst name = value[SECRET_MARKER];\n\t\tconst secret = process.env[name];\n\t\tif (secret === void 0 || secret === \"\") throw new Error(`secret input is not provisioned (env ${key} → ${name}): the platform var \"${name}\" is unset or empty.`);\n\t\treturn new SecretBox(secret);\n\t}\n\tif (Array.isArray(value)) return value.map((member) => hydrateInputDocument(member, key));\n\tif (isPlainObject(value)) {\n\t\tconst out = {};\n\t\tfor (const [k, member] of Object.entries(value)) {\n\t\t\tconst read = ESCAPED_KEY.test(k) ? k.slice(1) : k;\n\t\t\tout[read] = hydrateInputDocument(member, key);\n\t\t}\n\t\treturn out;\n\t}\n\treturn value;\n}\n/**\n* run()'s setup step for the input document: re-emit the row under its\n* address-free key, so the address-free `readInput` reads identically. The\n* document carries pointers, never values — the values stay only in their\n* platform vars.\n*/\nconst stashInput = (node, address) => {\n\tif (node.inputSchema === void 0) return;\n\tconst raw = process.env[inputKey(address)];\n\tif (raw === void 0) return;\n\tprocess.env[inputKey(\"\")] = raw;\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 { encodeParamPointer as a, readOrigin as c, stashInput as d, stashProviderParams as f, encode as i, serializeInput as l, configKey as n, paramEntries as o, deserialize as r, readInput as s, ORIGIN_KEY_NAME as t, stash as u };\n\n//# sourceMappingURL=serializer-sVE4UAmg.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAASA,YAAU,OAAO;CACzB,OAAO;AACR;;;;;;;;;;;;;;;;ACvBA,MAAM,WAAW;AACjB,MAAM,aAAaC,YAAU,OAAO,IAAI,mBAAmB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C,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"}
@@ -1,34 +1,38 @@
1
- import { BuildAdapter, Contract, DependencyEnd, Deps, Expose, HydratedDeps, ModuleNode, NODE, Params, RunnableServiceNode, SecretValues, Secrets, ServiceNode, Values } from "@prisma/composer";
2
- import "@standard-schema/spec";
1
+ import { BuildAdapter, Contract, DependencyEnd, Deps, Expose, HydratedDeps, InputValueOf, ModuleNode, NODE, RunnableServiceNode, ServiceNode } from "@prisma/composer";
2
+ import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region ../../1-prisma-cloud/1-extensions/target/dist/index.d.mts
4
4
  //#endregion
5
5
  //#region src/compute.d.ts
6
6
  declare const reservedParams: {
7
- readonly port: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<number, number>>;
7
+ readonly port: import("@prisma/composer").ConfigParam<StandardSchemaV1<number, number>>;
8
8
  };
9
9
  type ReservedParams = typeof reservedParams;
10
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.
11
+ * A Prisma Compute service — declarations only (deps + one input schema +
12
+ * build + the ports it exposes), no descriptor. The reserved `port` param
13
+ * rides its own channel (ADR-0042 leaves it untouched); a dependency named
14
+ * like it fails at authoring.
15
15
  *
16
16
  * · run(address, boot) — the process controller: deserialize the platform
17
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).
18
+ * typed Config, re-emit it (and the input document row) under address-free
19
+ * process-local stash keys, then call boot() to start the app's entry.
20
+ * · load() / input() — called from inside the app's entry: read the stash;
21
+ * load() hydrates + memoizes the deps, input() parses the input document,
22
+ * replaces each `$secret` pointer with a redacting box over the named
23
+ * platform var, validates with the declared schema, and memoizes (ADR-0042).
23
24
  * · origin() — this service's platform-assigned public origin, read from the
24
25
  * stash `run()` populates; memoized per process.
26
+ * · port() — this service's resolved reserved port (the value `run()` routes
27
+ * to and exports as PORT), read from that same stash via #processConfig();
28
+ * defaults to 3000 when the platform binds none.
25
29
  *
26
30
  * The underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
27
31
  * the control-plane registry key `prisma-composer deploy` resolves through the
28
32
  * app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
29
33
  * deploy time; nodes are pure data until run() or load() is called.
30
34
  */
31
- declare class ComputeService<D extends Deps, P extends Params, E extends Expose, S extends Secrets> implements RunnableServiceNode<D, P & ReservedParams, E, S> {
35
+ declare class ComputeService<D extends Deps, I extends StandardSchemaV1 | undefined, E extends Expose> implements RunnableServiceNode<D, ReservedParams, E, I> {
32
36
  #private;
33
37
  readonly [NODE]: true;
34
38
  readonly kind: 'service';
@@ -36,19 +40,22 @@ declare class ComputeService<D extends Deps, P extends Params, E extends Expose,
36
40
  readonly extension: string;
37
41
  readonly type: string;
38
42
  readonly inputs: D;
39
- readonly params: P & ReservedParams;
40
- readonly secretSlots: S;
43
+ readonly params: ReservedParams;
44
+ readonly inputSchema: I;
41
45
  readonly build: BuildAdapter;
42
46
  readonly expose: E | undefined;
43
- constructor(node: ServiceNode<D, P & ReservedParams, E, S>);
47
+ constructor(node: ServiceNode<D, ReservedParams, E, I>);
44
48
  run(address: string, boot: () => Promise<unknown>): Promise<unknown>;
45
49
  load(): HydratedDeps<D>;
46
- config(): Values<P & ReservedParams>;
47
- secrets(): SecretValues<S>;
50
+ input(): InputValueOf<I>;
48
51
  /** This service's platform-assigned public origin — read from the stash
49
52
  * run() populates and memoized per process. Throws if called before run()
50
53
  * has stashed it (readOrigin's pinned message). */
51
54
  origin(): string;
55
+ /** This service's resolved reserved port — the value run() routes to and
56
+ * exports as PORT — read the same way load() reads the stash. Defaults to
57
+ * 3000 when the platform binds none. */
58
+ port(): number;
52
59
  }
53
60
  //#endregion
54
61
  //#region src/postgres.d.ts
@@ -62,7 +69,7 @@ interface CredentialsConfig {
62
69
  readonly secretAccessKey: string;
63
70
  }
64
71
  //#endregion
65
- //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-CVf6j3HC.d.mts
72
+ //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-zDshPwCj.d.mts
66
73
  //#region src/contract.d.ts
67
74
  interface S3Config {
68
75
  readonly url: string;
@@ -79,16 +86,14 @@ type S3Contract = typeof s3Contract;
79
86
  declare function s3(): DependencyEnd<S3Config, typeof s3Contract>;
80
87
  //#endregion
81
88
  //#region src/storage-service.d.ts
82
- declare function storageService(opts: {
83
- bucket: string;
84
- }): ComputeService<{
89
+ declare function storageService(): ComputeService<{
85
90
  db: import("@prisma/composer").DependencyEnd<PostgresConfig, import("@prisma/composer").Contract<"postgres", PostgresConfig>>;
86
91
  credentials: import("@prisma/composer").DependencyEnd<CredentialsConfig, import("@prisma/composer").Contract<"credentials", CredentialsConfig>>;
87
- }, {
88
- bucket: import("@prisma/composer").ConfigParam<import("@standard-schema/spec").StandardSchemaV1<string, string>>;
89
- }, {
92
+ }, import("arktype/internal/variants/object.ts").ObjectType<{
93
+ bucket: string;
94
+ }, {}>, {
90
95
  store: import("@prisma/composer").Contract<"s3", S3Config>;
91
- }, Record<never, never>>;
96
+ }>;
92
97
  //#endregion
93
98
  //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/index.d.mts
94
99
  //#region src/storage-module.d.ts
@@ -1 +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"}
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-zDshPwCj.d.mts","../../../../1-prisma-cloud/2-shared-modules/storage/dist/index.d.mts"],"mappings":";;;;;cA2Cc;WACH,+BAA+B,YAAY;;KAEjD,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;cA0Bf,eAAe,UAAU,MAAM,UAAU,8BAA8B,UAAU,mBAAmB,oBAAoB,GAAG,gBAAgB,GAAG;;YAEhJ;WACD;WACA;WACA;WACA;WACA,QAAQ;WACR,QAAQ;WACR,aAAa;WACb,OAAO;WACP,QAAQ;EACjB,YAAY,MAAM,YAAY,GAAG,gBAAgB,GAAG;EACpD,IAAI,iBAAiB,YAAY,mBAAmB;EACpD,QAAQ,aAAa;EACrB,SAAS,aAAa;;;;EAItB;;;;EAIA;;;;UA8DQ;WACC;;;;UAiDD;WACC;WACA;;;;;UC/MD;WACC;WACA;WACA;WACA;;cAEG,YAAY,eAAe;KACpC,oBAAoB;;;;;iBAKR,MAAM,cAAc,iBAAiB;;;iBAGrC,kBAMgC;EAL/C,6BAA6B,cADd,yCACsG,qBAAzC;EAC5E,sCAAsC,cADqI,4CAC1C,wBAA5C;iDACtC;EAC/C;;EAEA,gCAAgC,eAAe;;;;;iBCpBhC,QAAQ;EACvB;EACA;IACE,WAAW;EACb,cAAc;GACb"}
@@ -1,9 +1,92 @@
1
- import { dependency, hydrateSecrets, hydrateSync, module, number, resource, service, string } from "@prisma/composer";
1
+ import { dependency, hydrateSync, module, number, resource, service, string } from "@prisma/composer";
2
2
  import { blindCast } from "@prisma/composer/casts";
3
3
  import { type } from "arktype";
4
4
  import { RPC_PEER_KEY } from "@prisma/composer/service-rpc";
5
5
  import node from "@prisma/composer/node";
6
- //#region ../../1-prisma-cloud/1-extensions/target/dist/serializer-CJiOhF2d.mjs
6
+ //#region ../../0-framework/0-foundation/foundation/dist/casts-DpaahrlC.mjs
7
+ /**
8
+ * **Last-resort escape hatch for unsafe type assertions. Not a sanctioned tool to reach for.**
9
+ *
10
+ * Before reaching for `blindCast`, **rewrite the surrounding code so the cast becomes
11
+ * unnecessary**: tighten an input type, add a runtime check that narrows via a type
12
+ * predicate, restructure a generic so the compiler can see the relationship you're
13
+ * asserting, or use {@link castAs} when the value already satisfies the target type.
14
+ * Only when no rewrite is feasible does `blindCast` become the right answer — and at
15
+ * that point, the `Reason` literal you supply must articulate the compromise in
16
+ * language a reviewer can evaluate.
17
+ *
18
+ * The reviewer **will** validate the `Reason`. If it doesn't hold up under scrutiny,
19
+ * that is not a signal to soften the reason; it is a signal to go back and solve the
20
+ * underlying type-system problem properly. An unconvincing justification is rework,
21
+ * not a free pass.
22
+ *
23
+ * `blindCast` is the auditable form of `as Foo` / `as unknown as Foo`: it bypasses
24
+ * the compiler's checks (the input type is `unknown`, the output type is whatever the
25
+ * caller asks for), but it forces the unsafety to be named at the call site instead of
26
+ * smuggled in via a bare `as`. The `Reason` type parameter exists only at compile
27
+ * time — it is not present in the emitted JavaScript — but it is grep-able and
28
+ * visible to future readers.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const stringValue = blindCast<
33
+ * string,
34
+ * "JSON.parse returns `unknown`; this field is documented to be a string in the API contract"
35
+ * >(parsed[key]);
36
+ * ```
37
+ *
38
+ * @typeParam TargetType - The type the caller is asserting the input has.
39
+ * @typeParam _Reason - A string literal describing why bypassing the type system is necessary here.
40
+ * Only meaningful at compile time. The reviewer evaluates whether it justifies the unsafety.
41
+ */
42
+ function blindCast$1(input) {
43
+ return input;
44
+ }
45
+ //#endregion
46
+ //#region ../../0-framework/0-foundation/foundation/dist/secret-DoWGmN7m.mjs
47
+ /**
48
+ * A value wrapper that redacts everywhere except the one explicit reader,
49
+ * `expose()`. Sensitivity is carried by the TYPE (`SecretBox<T>`), not a flag a
50
+ * sink must remember to check: `String(box)`, template interpolation,
51
+ * `JSON.stringify`, and `console.log`/`util.inspect` all print `[REDACTED]`, so
52
+ * a secret can't leak through an accidental log or serialization.
53
+ *
54
+ * Every box carries a brand property keyed by the registered symbol
55
+ * `Symbol.for('prisma:secret-box')`, which is what `isSecretString` checks. A
56
+ * symbol key is invisible to `JSON.stringify` and `Object.keys`, so the box's
57
+ * public shape still matches the platform's own `secrecy` type
58
+ * (pdp-control-plane).
59
+ */
60
+ const REDACTED = "[REDACTED]";
61
+ const SECRET_BOX = blindCast$1(Symbol.for("prisma:secret-box"));
62
+ var SecretBox = class {
63
+ [SECRET_BOX] = true;
64
+ #value;
65
+ constructor(value) {
66
+ this.#value = value;
67
+ }
68
+ /** The sole explicit door to the wrapped value. */
69
+ expose() {
70
+ return this.#value;
71
+ }
72
+ toString() {
73
+ return REDACTED;
74
+ }
75
+ toJSON() {
76
+ return REDACTED;
77
+ }
78
+ valueOf() {
79
+ return REDACTED;
80
+ }
81
+ [Symbol.toPrimitive]() {
82
+ return REDACTED;
83
+ }
84
+ [Symbol.for("nodejs.util.inspect.custom")]() {
85
+ return REDACTED;
86
+ }
87
+ };
88
+ //#endregion
89
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/serializer-sVE4UAmg.mjs
7
90
  /**
8
91
  * Walks a node's own params, then each dependency input's connection params —
9
92
  * the same enumeration order `configOf` uses, but carrying the raw
@@ -93,7 +176,7 @@ function coerceEnvSourcedParam(raw, d, key) {
93
176
  /**
94
177
  * Boot: read each declared param from env by its key, reverse the param's own
95
178
  * serialization (missing/invalid fails loudly), assemble the typed Config.
96
- * Secrets ride a separate channel (deserializeSecrets), not this one.
179
+ * The input document rides its own channel (readInput), not this one.
97
180
  */
98
181
  const deserialize = (node, address) => {
99
182
  const service = {};
@@ -130,40 +213,84 @@ const stash = (node, config) => {
130
213
  process.env[configKey("", d)] = encode(d.owner, value);
131
214
  }
132
215
  };
133
- /** The pointer-row key for a secret slot: COMPOSER_<addr>_<slot> (secrets are service-level). */
134
- const secretKey = (address, slot) => configKey(address, {
216
+ /** The input document's own row name; its full key is COMPOSER_<addr>_INPUT. */
217
+ const INPUT_KEY_NAME = "INPUT";
218
+ /** The input document row's key for a service address. */
219
+ const inputKey = (address) => configKey(address, {
135
220
  owner: "service",
136
- name: slot
221
+ name: INPUT_KEY_NAME
137
222
  });
223
+ const SECRET_MARKER = "$secret";
224
+ const ESCAPED_KEY = /^\$\$+secret$/;
225
+ /** True for the framework's secret pointer: `{ "$secret": "<PLATFORM_VAR>" }` and nothing else. */
226
+ function isSecretPointer(value) {
227
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 1 && SECRET_MARKER in value && typeof value[SECRET_MARKER] === "string";
228
+ }
229
+ /** A plain data object (not an array, not a class instance) — the only object shape a binding/document may nest. */
230
+ function isPlainObject(value) {
231
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
232
+ const proto = Object.getPrototypeOf(value);
233
+ return proto === Object.prototype || proto === null;
234
+ }
138
235
  /**
139
- * Boot: resolve every secret slot to its value by double-lookup read the
140
- * pointer key (the platform NAME), then read that platform var. A missing
141
- * pointer or a missing/empty platform value is a loud failure naming both keys.
142
- * Returns a plain Record for core's `hydrateSecrets` to box.
236
+ * Boot: read the one input document row (address-free after run()'s
237
+ * re-stash), swap each `$secret` pointer for a redacting box over the named
238
+ * platform var, unescape reserved keys, validate with the service's own
239
+ * schema, and return the typed object. A missing row is a loud failure naming
240
+ * the env var — a deployed environment always writes it; a local harness must
241
+ * supply it (set the row to the serialized input document).
143
242
  */
144
- const deserializeSecrets = (node, address) => {
145
- const values = {};
146
- for (const slot of Object.keys(node.secretSlots)) {
147
- const key = secretKey(address, slot);
148
- const name = process.env[key];
149
- if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
150
- const value = process.env[name];
151
- if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
152
- values[slot] = value;
243
+ function readInput(node, address) {
244
+ const schema = node.inputSchema;
245
+ if (schema === void 0) throw new Error(`input() called on service "${node.name}", which declares no input schema — declare \`input: <schema>\` on compute() to use it (ADR-0042).`);
246
+ const key = inputKey(address);
247
+ const raw = process.env[key];
248
+ if (raw === void 0 || raw === "") throw new Error(`this service's input is not available (env ${key} is unset) — a deployed environment writes it automatically; a local harness must supply it like any other config value (set ${key} to the serialized input document).`);
249
+ let parsed;
250
+ try {
251
+ parsed = JSON.parse(raw);
252
+ } catch (cause) {
253
+ const message = cause instanceof Error ? cause.message : String(cause);
254
+ throw new Error(`this service's input document is not valid JSON (env ${key}): ${message} — a deployed environment writes it automatically; a local harness must supply the serialized input document (set ${key} to it).`);
153
255
  }
154
- return values;
155
- };
256
+ const hydrated = hydrateInputDocument(parsed, key);
257
+ try {
258
+ return standardValidateSync(schema, hydrated);
259
+ } catch (cause) {
260
+ const message = cause instanceof Error ? cause.message : String(cause);
261
+ throw new Error(`invalid input document (env ${key}): ${message}`);
262
+ }
263
+ }
264
+ /** Reverses the document encoding: `$secret` pointers become redacting boxes over the named platform vars; escaped reserved keys drop one "$". */
265
+ function hydrateInputDocument(value, key) {
266
+ if (isSecretPointer(value)) {
267
+ const name = value[SECRET_MARKER];
268
+ const secret = process.env[name];
269
+ if (secret === void 0 || secret === "") throw new Error(`secret input is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
270
+ return new SecretBox(secret);
271
+ }
272
+ if (Array.isArray(value)) return value.map((member) => hydrateInputDocument(member, key));
273
+ if (isPlainObject(value)) {
274
+ const out = {};
275
+ for (const [k, member] of Object.entries(value)) {
276
+ const read = ESCAPED_KEY.test(k) ? k.slice(1) : k;
277
+ out[read] = hydrateInputDocument(member, key);
278
+ }
279
+ return out;
280
+ }
281
+ return value;
282
+ }
156
283
  /**
157
- * run()'s setup step for secrets: re-emit each slot's pointer NAME under its
158
- * address-free key, so the address-free `deserializeSecrets` double-looks-up
159
- * identically. Never the value — the value stays only in the platform var.
284
+ * run()'s setup step for the input document: re-emit the row under its
285
+ * address-free key, so the address-free `readInput` reads identically. The
286
+ * document carries pointers, never values — the values stay only in their
287
+ * platform vars.
160
288
  */
161
- const stashSecrets = (node, address) => {
162
- for (const slot of Object.keys(node.secretSlots)) {
163
- const name = process.env[secretKey(address, slot)];
164
- if (name === void 0) continue;
165
- process.env[secretKey("", slot)] = name;
166
- }
289
+ const stashInput = (node, address) => {
290
+ if (node.inputSchema === void 0) return;
291
+ const raw = process.env[inputKey(address)];
292
+ if (raw === void 0) return;
293
+ process.env[inputKey("")] = raw;
167
294
  };
168
295
  /**
169
296
  * Boot: for each reserved provider param, read its address-scoped row through
@@ -228,7 +355,7 @@ function standardValidateSync(schema, value) {
228
355
  return result.value;
229
356
  }
230
357
  //#endregion
231
- //#region ../../1-prisma-cloud/1-extensions/target/dist/provisioned-edges-C1wSO3cx.mjs
358
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/provisioned-edges-Cxy18aoh.mjs
232
359
  /**
233
360
  * The service's own origin as a reserved provider param (ADR-0031): the ONE
234
361
  * brand and the ONE entry — shared by control.ts (which registers the
@@ -346,20 +473,24 @@ Object.freeze({
346
473
  });
347
474
  const reservedParams = { port: number({ default: 3e3 }) };
348
475
  /**
349
- * A Prisma Compute service — declarations only (deps + params + build + the
350
- * ports it exposes), no descriptor. `params` merges with the reserved
351
- * `ReservedParams` (`port`); a user param whose name collides with a reserved
352
- * one fails at authoring, the same way a colliding dependency name does.
476
+ * A Prisma Compute service — declarations only (deps + one input schema +
477
+ * build + the ports it exposes), no descriptor. The reserved `port` param
478
+ * rides its own channel (ADR-0042 leaves it untouched); a dependency named
479
+ * like it fails at authoring.
353
480
  *
354
481
  * · run(address, boot) — the process controller: deserialize the platform
355
482
  * environment (keyed off `address`, the extension's ONE env read) into a
356
- * typed Config, re-emit it under address-free process-local stash keys,
357
- * then call boot() to start the app's entry.
358
- * · load() / config() — called from inside the app's entry: read the stash;
359
- * load() hydrates + memoizes the deps, config() returns the typed params.
360
- * Separate accessors so a dep and a param never share a namespace (ADR-0021).
483
+ * typed Config, re-emit it (and the input document row) under address-free
484
+ * process-local stash keys, then call boot() to start the app's entry.
485
+ * · load() / input() — called from inside the app's entry: read the stash;
486
+ * load() hydrates + memoizes the deps, input() parses the input document,
487
+ * replaces each `$secret` pointer with a redacting box over the named
488
+ * platform var, validates with the declared schema, and memoizes (ADR-0042).
361
489
  * · origin() — this service's platform-assigned public origin, read from the
362
490
  * stash `run()` populates; memoized per process.
491
+ * · port() — this service's resolved reserved port (the value `run()` routes
492
+ * to and exports as PORT), read from that same stash via #processConfig();
493
+ * defaults to 3000 when the platform binds none.
363
494
  *
364
495
  * The underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
365
496
  * the control-plane registry key `prisma-composer deploy` resolves through the
@@ -369,8 +500,7 @@ const reservedParams = { port: number({ default: 3e3 }) };
369
500
  var ComputeService = class {
370
501
  #resolved;
371
502
  #loadedDeps;
372
- #loadedParams;
373
- #loadedSecrets;
503
+ #loadedInput;
374
504
  #origin;
375
505
  constructor(node) {
376
506
  Object.assign(this, node);
@@ -383,7 +513,7 @@ var ComputeService = class {
383
513
  const config = deserialize(this, address);
384
514
  stash(this, config);
385
515
  stashProviderParams(RESERVED_PROVIDER_PARAMS, address);
386
- stashSecrets(this, address);
516
+ stashInput(this, address);
387
517
  const port = config.service["port"];
388
518
  if (typeof port === "number") process.env["PORT"] = String(port);
389
519
  return boot();
@@ -392,13 +522,9 @@ var ComputeService = class {
392
522
  if (this.#loadedDeps === void 0) this.#loadedDeps = blindCast(hydrateSync(this, this.#processConfig()));
393
523
  return this.#loadedDeps;
394
524
  }
395
- config() {
396
- if (this.#loadedParams === void 0) this.#loadedParams = blindCast(this.#processConfig().service);
397
- return this.#loadedParams;
398
- }
399
- secrets() {
400
- if (this.#loadedSecrets === void 0) this.#loadedSecrets = blindCast(hydrateSecrets(this, deserializeSecrets(this, "")));
401
- return this.#loadedSecrets;
525
+ input() {
526
+ if (this.#loadedInput === void 0) this.#loadedInput = blindCast(readInput(this, ""));
527
+ return this.#loadedInput;
402
528
  }
403
529
  /** This service's platform-assigned public origin — read from the stash
404
530
  * run() populates and memoized per process. Throws if called before run()
@@ -407,26 +533,24 @@ var ComputeService = class {
407
533
  this.#origin ??= readOrigin();
408
534
  return this.#origin;
409
535
  }
536
+ /** This service's resolved reserved port — the value run() routes to and
537
+ * exports as PORT — read the same way load() reads the stash. Defaults to
538
+ * 3000 when the platform binds none. */
539
+ port() {
540
+ const port = this.#processConfig().service["port"];
541
+ if (typeof port !== "number") throw new Error(`service "${this.name}" resolved a non-numeric port — the reserved port param is number({ default: 3000 }), so a stashed config always carries a number here.`);
542
+ return port;
543
+ }
410
544
  };
411
545
  const compute = (def) => {
412
- const userParams = def.params ?? blindCast({});
413
- for (const reserved of Object.keys(reservedParams)) {
414
- if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
415
- if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
416
- }
417
- 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.`);
418
- 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.`);
419
- const params = blindCast({
420
- ...userParams,
421
- ...reservedParams
422
- });
546
+ for (const reserved of Object.keys(reservedParams)) if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
423
547
  const instance = new ComputeService(service({
424
548
  name: def.name,
425
549
  extension: "@prisma/composer-prisma-cloud",
426
550
  type: "compute",
427
551
  inputs: def.deps,
428
- params,
429
- ...def.secrets !== void 0 ? { secrets: def.secrets } : {},
552
+ params: reservedParams,
553
+ ...def.input !== void 0 ? { input: def.input } : {},
430
554
  build: def.build,
431
555
  ...def.expose !== void 0 ? { expose: def.expose } : {}
432
556
  }));
@@ -494,21 +618,21 @@ function s3Credentials(opts) {
494
618
  /**
495
619
  * The storage service authoring factory — a `compute` service routed to the
496
620
  * `s3-store` lowering instead of `compute`'s. It is exactly `compute`'s
497
- * runnable (run/load/config, deps, params, build, expose) with the routing
498
- * `type` overridden to `'s3-store'`: nothing at runtime keys off `type` (the
499
- * serializer keys off the deployment address and each param's owner/name, and
500
- * `load`/`config` off deps/params), so only the deploy-time descriptor lookup
501
- * sees the override and routes to the extended-output lowering (§ 5). The
502
- * return type is compute's exactly (including the reserved `port` param). The
503
- * storage module (D4b) calls this with its `db`/`credentials` deps, a `bucket`
504
- * param, and `expose: { store: s3Contract }`.
621
+ * runnable (run/load/input, deps, input schema, build, expose) with the
622
+ * routing `type` overridden to `'s3-store'`: nothing at runtime keys off
623
+ * `type` (the serializer keys off the deployment address and each param's
624
+ * owner/name, and `load`/`input` off deps/the input schema), so only the
625
+ * deploy-time descriptor lookup sees the override and routes to the
626
+ * extended-output lowering (§ 5). The return type is compute's exactly
627
+ * (including the reserved `port` param). The storage module (D4b) calls this
628
+ * with its `db`/`credentials` deps and `expose: { store: s3Contract }`.
505
629
  *
506
- * `compute()`'s result is a `ComputeService` instance — its run/load/config/
507
- * secrets/origin methods live on the class prototype, not as the instance's
508
- * own properties, so a plain object spread (`{ ...node }`) would silently
509
- * drop them. Building a fresh `ComputeService` from the same data fields
510
- * (which `{ ...node }` DOES copy — they're the node's own enumerable
511
- * properties) with `type` overridden keeps every method intact.
630
+ * `compute()`'s result is a `ComputeService` instance — its run/load/input/
631
+ * origin methods live on the class prototype, not as the instance's own
632
+ * properties, so a plain object spread (`{ ...node }`) would silently drop
633
+ * them. Building a fresh `ComputeService` from the same data fields (which
634
+ * `{ ...node }` DOES copy — they're the node's own enumerable properties)
635
+ * with `type` overridden keeps every method intact.
512
636
  */
513
637
  function s3StoreService(def) {
514
638
  const instance = new ComputeService({
@@ -519,7 +643,7 @@ function s3StoreService(def) {
519
643
  return instance;
520
644
  }
521
645
  //#endregion
522
- //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-DSaZsAC4.mjs
646
+ //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/storage-service-DQmgu7v3.mjs
523
647
  const s3Contract = Object.freeze({
524
648
  kind: "s3",
525
649
  __cmp: {
@@ -552,21 +676,22 @@ function s3() {
552
676
  /**
553
677
  * The storage service node (like cron's `scheduler.ts` + `scheduler-service.ts`
554
678
  * combined): `storageService` builds the `s3-store` service — a Postgres `db`
555
- * dependency, a minted `credentials` dependency, a `bucket` param, and the
556
- * `store` port exposing `s3Contract`. The deploy bootstrap runs the
557
- * default-exported bare node (`main.run(address, boot)`); the real bucket comes
558
- * from serialized config at runtime, so the default's `bucket` is only a
559
- * placeholder — exactly like `scheduler-service.ts` default-exports
560
- * `cronScheduler({ jobs: [] })`.
679
+ * dependency, a minted `credentials` dependency, a `bucket` input key
680
+ * (bound at provision by `storage()`, ADR-0042), and the `store` port exposing
681
+ * `s3Contract`. The deploy bootstrap runs the default-exported bare node
682
+ * (`main.run(address, boot)`); the real bucket comes from the stashed input
683
+ * document at runtime — exactly like `scheduler-service.ts` default-exports a
684
+ * schedule-free `cronScheduler()`.
561
685
  */
562
- function storageService(opts) {
686
+ const storageInputSchema = type({ bucket: "string" });
687
+ function storageService() {
563
688
  return s3StoreService({
564
689
  name: "storage",
565
690
  deps: {
566
691
  db: postgres(),
567
692
  credentials: s3Credentials()
568
693
  },
569
- params: { bucket: string({ default: opts.bucket }) },
694
+ input: storageInputSchema,
570
695
  build: node({
571
696
  module: new URL("./storage-service.mjs", import.meta.url).href,
572
697
  entry: "./storage-entrypoint.mjs"
@@ -574,19 +699,20 @@ function storageService(opts) {
574
699
  expose: { store: s3Contract }
575
700
  });
576
701
  }
577
- storageService({ bucket: "storage" });
702
+ storageService();
578
703
  //#endregion
579
704
  //#region ../../1-prisma-cloud/2-shared-modules/storage/dist/index.mjs
580
705
  function storage(opts) {
581
706
  return module(opts?.name ?? "storage", { expose: { store: s3Contract } }, ({ provision }) => {
582
707
  const db = provision(postgres({ name: "db" }), { id: "db" });
583
708
  const credentials = provision(s3Credentials({ name: "credentials" }), { id: "credentials" });
584
- return { store: provision(storageService({ bucket: opts?.bucket ?? "storage" }), {
709
+ return { store: provision(storageService(), {
585
710
  id: "service",
586
711
  deps: {
587
712
  db,
588
713
  credentials
589
- }
714
+ },
715
+ input: { bucket: opts?.bucket ?? "storage" }
590
716
  }).store };
591
717
  });
592
718
  }