@prisma/composer 0.1.0 → 0.2.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/app-config-BPb3LCdH-CH7b8Khi.d.mts +411 -0
  2. package/dist/app-config-BPb3LCdH-CH7b8Khi.d.mts.map +1 -0
  3. package/dist/assertions.d.mts +1 -1
  4. package/dist/assertions.d.mts.map +1 -0
  5. package/dist/bin.mjs +166 -256
  6. package/dist/bin.mjs.map +1 -1
  7. package/dist/casts.d.mts +1 -1
  8. package/dist/casts.d.mts.map +1 -0
  9. package/dist/config-Cqu_-Hna.d.mts +1 -0
  10. package/dist/config.d.mts +3 -2
  11. package/dist/config.mjs +2 -1
  12. package/dist/config.mjs.map +1 -1
  13. package/dist/container-transport-DKmKg5JQ-DKWs0ubK.mjs +45 -0
  14. package/dist/container-transport-DKmKg5JQ-DKWs0ubK.mjs.map +1 -0
  15. package/dist/deploy-Cqu_-Hna.d.mts +1 -0
  16. package/dist/deploy.d.mts +3 -2
  17. package/dist/deploy.mjs +181 -23
  18. package/dist/deploy.mjs.map +1 -1
  19. package/dist/{dist-zBU8ASQW.mjs → dist-B0axxnBf.mjs} +16 -4
  20. package/dist/dist-B0axxnBf.mjs.map +1 -0
  21. package/dist/{graph-BYdCQKya-BI0njTow.mjs → graph-BmrUEdo9-6Oq1hSmS.mjs} +102 -9
  22. package/dist/graph-BmrUEdo9-6Oq1hSmS.mjs.map +1 -0
  23. package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts +18 -0
  24. package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts.map +1 -0
  25. package/dist/{config-ob5OhCSP-sP3GW3uu.d.mts → graph-types-BcbVhojU-C3fhxjPK.d.mts} +205 -114
  26. package/dist/graph-types-BcbVhojU-C3fhxjPK.d.mts.map +1 -0
  27. package/dist/{index-CZSc9drz.d.mts → index-BFBNz7Aw.d.mts} +5 -20
  28. package/dist/index-BFBNz7Aw.d.mts.map +1 -0
  29. package/dist/index.d.mts +4 -3
  30. package/dist/index.mjs +3 -3
  31. package/dist/{index-Dh4Zro0y.d.mts → nextjs-DLyeRR7M-DwnBjryZ.d.mts} +6 -5
  32. package/dist/nextjs-DLyeRR7M-DwnBjryZ.d.mts.map +1 -0
  33. package/dist/nextjs-control.d.mts +6 -5
  34. package/dist/nextjs-control.d.mts.map +1 -0
  35. package/dist/nextjs-control.mjs +7 -10
  36. package/dist/nextjs-control.mjs.map +1 -1
  37. package/dist/nextjs.d.mts +2 -2
  38. package/dist/nextjs.mjs.map +1 -1
  39. package/dist/node-control.d.mts +5 -3
  40. package/dist/node-control.d.mts.map +1 -0
  41. package/dist/node-control.mjs +96 -24
  42. package/dist/node-control.mjs.map +1 -1
  43. package/dist/node.d.mts +18 -5
  44. package/dist/node.d.mts.map +1 -0
  45. package/dist/node.mjs +2 -1
  46. package/dist/node.mjs.map +1 -1
  47. package/dist/report.d.mts +17 -0
  48. package/dist/report.d.mts.map +1 -0
  49. package/dist/report.mjs +79 -0
  50. package/dist/report.mjs.map +1 -0
  51. package/dist/service-rpc.d.mts +61 -0
  52. package/dist/service-rpc.d.mts.map +1 -0
  53. package/dist/service-rpc.mjs +353 -0
  54. package/dist/service-rpc.mjs.map +1 -0
  55. package/dist/testing.d.mts +2 -3
  56. package/dist/testing.d.mts.map +1 -0
  57. package/package.json +20 -18
  58. package/src/exports/assertions.ts +1 -0
  59. package/src/exports/casts.ts +1 -0
  60. package/src/exports/config.ts +1 -0
  61. package/src/exports/deploy.ts +1 -0
  62. package/src/exports/index.ts +1 -0
  63. package/src/exports/nextjs-control.ts +1 -0
  64. package/src/exports/nextjs.ts +2 -0
  65. package/src/exports/node-control.ts +1 -0
  66. package/src/exports/node.ts +2 -0
  67. package/src/exports/report.ts +1 -0
  68. package/src/exports/service-rpc.ts +1 -0
  69. package/src/exports/testing.ts +1 -0
  70. package/dist/app-config-BUqyK6N6-CVq3uvHF.d.mts +0 -188
  71. package/dist/config-BVVgDSdq.d.mts +0 -1
  72. package/dist/deploy-BVVgDSdq.d.mts +0 -1
  73. package/dist/dist-zBU8ASQW.mjs.map +0 -1
  74. package/dist/graph-BYdCQKya-BI0njTow.mjs.map +0 -1
  75. package/dist/rpc.d.mts +0 -43
  76. package/dist/rpc.mjs +0 -132
  77. package/dist/rpc.mjs.map +0 -1
  78. package/dist/tsdown.d.mts +0 -9
  79. package/dist/tsdown.mjs +0 -35
  80. package/dist/tsdown.mjs.map +0 -1
package/dist/bin.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.mjs","names":["managementClientLayer"],"sources":["../../../0-framework/3-tooling/assemble/dist/index.mjs","../../../0-framework/0-foundation/foundation/dist/casts.mjs","../../../0-framework/1-core/core/dist/graph-BYdCQKya.mjs","../../../0-framework/1-core/core/dist/index.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/http-CxGdfSAP.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/compute/index.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/postgres/index.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/index.mjs","../../../0-framework/3-tooling/cli/dist/cli-BGF4efRK.mjs","../../../0-framework/3-tooling/cli/dist/bin.mjs"],"sourcesContent":["//#region src/assemble-error.ts\n/**\n* A user-facing assembly failure with a message that already names the fix\n* (mirrors @internal/cli's CliError contract). This package must not import\n* CliError — its second consumer is the future programmatic deploy API, not\n* just the CLI — so it throws its own typed error; the CLI maps it (or lets\n* it propagate, since bin.ts already treats every Error uniformly: print the\n* message, exit nonzero).\n*/\nvar AssembleError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"AssembleError\";\n\t}\n};\n//#endregion\n//#region src/wrapper-inline.ts\n/**\n* The wrapper-inlining decision (S2's open question — see the project's\n* design-notes.md and this slice's final report for the write-up).\n*\n* The CLI has no config file, so it can't take per-app `wrapperNoExternal`\n* patterns — it needs one general rule for what an assembler inlines into\n* the wrapper build besides `@prisma/*` (already the assemblers' own\n* default).\n*\n* The rule: inline everything except the runtime's own modules — `bun`,\n* `bun:*` (e.g. bun:sqlite), and `node:*` builtins — which resolve inside\n* the deploy VM at runtime and must never be bundled. Verified (both\n* `@prisma/composer/node/control` and `@prisma/composer/nextjs/control` set\n* `external: ['bun']` ahead of `noExternal` in their tsdown call, and tsdown/\n* rolldown's explicit `external` wins over a `noExternal` match — proven by\n* building an app's wrapper with this exact pattern: the\n* `bun` import stays external while everything else, including the app's own\n* workspace deps, gets inlined) — see this slice's final report for the\n* storefront-auth wrapper proof (arktype + `@storefront-auth/auth/contract`\n* inlined with no other file changes there).\n*/\nconst INLINE_EVERYTHING_EXCEPT_RUNTIME_BUILTINS = [/^(?!bun$)(?!bun:)(?!node:).+/];\n//#endregion\n//#region src/assemble-services.ts\n/**\n* The registry route for one service's build: descriptor by\n* `build.extension`, control by `build.type`, kind must be \"build\". The CLI's\n* coverage validation reports the same misses earlier with the config fix;\n* these errors are the backstop for programmatic callers.\n*/\nfunction buildControlAssemble(config, node, address, cwd) {\n\tconst { extension, type } = node.build;\n\tconst descriptor = config.extensions.find((candidate) => candidate.id === extension);\n\tif (descriptor === void 0) throw new AssembleError(`No extension \"${extension}\" is configured (needed by service \"${node.name}\"'s build) — add it to prisma-composer.config.ts's \\`extensions\\`.`);\n\tconst control = descriptor.nodes[type];\n\tif (control === void 0) throw new AssembleError(`Extension \"${extension}\" has no control for build type \"${type}\" (known: ${Object.keys(descriptor.nodes).join(\", \")}).`);\n\tif (control.kind !== \"build\") throw new AssembleError(`Extension \"${extension}\"'s control for type \"${type}\" is a \"${control.kind}\" control — a service build descriptor needs a \"build\" control.`);\n\treturn control.assemble({\n\t\tbuild: node.build,\n\t\twrapperNoExternal: INLINE_EVERYTHING_EXCEPT_RUNTIME_BUILTINS,\n\t\taddress,\n\t\tcwd\n\t});\n}\nasync function assembleServices(graph, config, cwd, run) {\n\tconst runAssembler = run ?? ((node, address, nodeCwd) => buildControlAssemble(config, node, address, nodeCwd));\n\tconst serviceNodes = graph.nodes.filter((n) => n.node.kind === \"service\");\n\tif (serviceNodes.length === 0) throw new AssembleError(\"The loaded graph has no service to assemble.\");\n\tconst bundles = {};\n\tfor (const { id, node } of serviceNodes) bundles[id] = await runAssembler(node, id, cwd);\n\treturn { bundles };\n}\n//#endregion\nexport { AssembleError, assembleServices };\n\n//# sourceMappingURL=index.mjs.map","//#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 { blindCast, castAs };\n\n//# sourceMappingURL=casts.mjs.map","import { blindCast } from \"@internal/foundation/casts\";\n//#region src/graph-types.ts\n/** Thrown by Load when the graph is malformed. */\nvar LoadError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LoadError\";\n\t}\n};\n//#endregion\n//#region src/node.ts\n/**\n* Core model: node types and the factories that construct them, plain frozen\n* data objects. A node's `extension` + `type` form its deploy-time registry key (ADR-0017).\n*/\nconst NODE = Symbol.for(\"prisma:node\");\nconst SECRET_NEED = blindCast(Symbol.for(\"prisma:secret-need\"));\nconst SECRET_SOURCE = blindCast(Symbol.for(\"prisma:secret-source\"));\n/** Declares a secret NEED. Nameless — the platform name is bound at the root via `envSecret`. */\nfunction secret() {\n\treturn Object.freeze({\n\t\t[SECRET_NEED]: true,\n\t\tkind: \"secret\"\n\t});\n}\n/** Builds an opaque secret source from a target-defined payload — the SPI a deploy target's own source constructor (e.g. `envSecret`) calls. Core forwards the source and never inspects the payload. */\nfunction secretSource(payload) {\n\treturn Object.freeze({\n\t\t[SECRET_SOURCE]: true,\n\t\tpayload\n\t});\n}\n/** True if `value` is a secret source (an `envSecret` result or a forwarded ctx.secrets ref). */\nfunction isSecretSource(value) {\n\treturn typeof value === \"object\" && value !== null && blindCast(value)[SECRET_SOURCE] === true;\n}\nfunction requireType(type, factory) {\n\tif (typeof type !== \"string\" || type.length === 0) throw new Error(`${factory}() requires a non-empty node type.`);\n}\nfunction requireName(name, factory) {\n\tif (typeof name !== \"string\" || name.length === 0) throw new Error(`${factory}() requires a non-empty name.`);\n}\nfunction requireExtension(extension, factory) {\n\tif (typeof extension !== \"string\" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);\n}\n/**\n* Config keys join address/input/param names with \"_\" and uppercase — an\n* underscore inside a name would collide with that separator (e.g. param\n* \"db_url\" vs input \"db\"'s param \"url\" both hitting env key \"DB_URL\").\n*/\nfunction requireNoUnderscoreName(name, kind, factory) {\n\tif (name.includes(\"_\")) throw new Error(`${factory}() ${kind} name \"${name}\" may not contain \"_\" — config keys join names with \"_\" as the separator (e.g. an input \"db\"'s param \"url\" becomes env key \"DB_URL\"), so an underscore inside a name would collide with that separator.`);\n}\nfunction requireNoUnderscoreNames(names, kind, factory) {\n\tfor (const name of names) requireNoUnderscoreName(name, kind, factory);\n}\nfunction freezeParams(params) {\n\tconst frozen = {};\n\tfor (const [name, param] of Object.entries(params)) frozen[name] = Object.freeze({ ...param });\n\treturn Object.freeze(frozen);\n}\nfunction freezeSecrets(secrets) {\n\tconst frozen = {};\n\tfor (const [name, need] of Object.entries(secrets)) frozen[name] = Object.freeze({ ...need });\n\treturn blindCast(Object.freeze(frozen));\n}\n/** A frozen shallow copy that keeps the caller's declared type. */\nfunction frozenShallowCopy(obj) {\n\treturn blindCast(Object.freeze({ ...obj }));\n}\n/**\n* Seals a node instance after its constructor has assigned all fields — the\n* last statement of a concrete node class's constructor. A free function, not\n* a base-class method, so an instance stays structurally a plain frozen node.\n*/\nfunction freezeNode(node) {\n\tObject.freeze(node);\n\treturn node;\n}\n/**\n* Everything `resource()` establishes, minus the freeze — an extension\n* whose resource node carries extra fields extends this, assigns them, and\n* calls `freezeNode(this)` as its constructor's last statement.\n*/\nvar ResourceNodeBase = class {\n\t[NODE] = true;\n\tkind = \"resource\";\n\tname;\n\textension;\n\ttype;\n\tprovides;\n\tconstructor(def) {\n\t\trequireName(def.name, \"resource\");\n\t\trequireExtension(def.extension, \"resource\");\n\t\tconst provides = def.provides;\n\t\tif (typeof provides !== \"object\" || provides === null || typeof provides.kind !== \"string\" || provides.kind.length === 0 || typeof provides.satisfies !== \"function\") throw new Error(\"resource() requires `provides` — the Contract this resource offers (a non-empty `kind` plus its `satisfies()`).\");\n\t\tthis.name = def.name;\n\t\tthis.extension = def.extension;\n\t\tthis.type = provides.kind;\n\t\tthis.provides = provides;\n\t}\n};\n/** The core leaf: exactly the base, frozen. */\nvar FrozenResourceNode = class extends ResourceNodeBase {\n\tconstructor(def) {\n\t\tsuper(def);\n\t\tfreezeNode(this);\n\t}\n};\n/**\n* Constructs a branded, frozen Resource node — an identity plus the Contract\n* it provides; the routing `type` is the contract's `kind`. Pure — nothing\n* is provisioned until a module provisions it.\n*/\nfunction resource(def) {\n\treturn new FrozenResourceNode(def);\n}\n/**\n* Constructs a branded, frozen Service node — declarations only (inputs,\n* params, build adapter, and the ports it exposes). Pure; carries no runtime behavior.\n*/\nfunction service(def) {\n\trequireName(def.name, \"service\");\n\trequireExtension(def.extension, \"service\");\n\trequireType(def.type, \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.inputs), \"input\", \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.params), \"param\", \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.secrets ?? {}), \"secret\", \"service\");\n\tfor (const slot of Object.keys(def.secrets ?? {})) if (Object.hasOwn(def.params, slot)) throw new Error(`service() secret slot \"${slot}\" collides with a param of the same name — a secret slot and a service param derive the same config key (COMPOSE_<addr>_${slot.toUpperCase()}); rename one.`);\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"service\",\n\t\tname: def.name,\n\t\textension: def.extension,\n\t\ttype: def.type,\n\t\tinputs: frozenShallowCopy(def.inputs),\n\t\tparams: freezeParams(def.params),\n\t\tsecretSlots: freezeSecrets(def.secrets ?? blindCast({})),\n\t\tbuild: Object.freeze({ ...def.build }),\n\t\texpose: def.expose !== void 0 ? frozenShallowCopy(def.expose) : void 0\n\t});\n}\n/**\n* Constructs a branded, frozen DependencyEnd. `required` (if given) is the\n* contract Load compares a wired ref against via `satisfies()`; an unnamed\n* end's diagnostic `name` falls back to its `type`.\n*/\nfunction dependency(def) {\n\trequireType(def.type, \"dependency\");\n\trequireNoUnderscoreNames(Object.keys(def.connection.params), \"param\", \"dependency\");\n\tconst connection = Object.freeze({\n\t\tparams: freezeParams(def.connection.params),\n\t\thydrate: def.connection.hydrate\n\t});\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"dependency\",\n\t\tname: def.name !== void 0 && def.name.length > 0 ? def.name : def.type,\n\t\ttype: def.type,\n\t\tconnection,\n\t\trequired: def.required\n\t});\n}\n/**\n* Constructs a branded, frozen Module node. Construction is INERT — the body is\n* wiring, not user code, and runs only when the module is Loaded.\n*/\nfunction module(name, boundaryOrBody, maybeBody) {\n\trequireName(name, \"module\");\n\tconst closedRoot = typeof boundaryOrBody === \"function\";\n\tconst boundary = closedRoot ? {} : boundaryOrBody;\n\tconst deps = frozenShallowCopy(boundary.deps ?? {});\n\tconst secretSlots = frozenShallowCopy(boundary.secrets ?? {});\n\tconst expose = frozenShallowCopy(boundary.expose ?? {});\n\tconst body = closedRoot ? (ctx) => {\n\t\tboundaryOrBody(ctx);\n\t\treturn {};\n\t} : maybeBody;\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"module\",\n\t\tname,\n\t\tdeps,\n\t\tsecretSlots,\n\t\texpose,\n\t\tbody\n\t});\n}\n/**\n* True if `value` was constructed by this module's factories. Checks the\n* brand only, never a prototype — a graph may mix nodes from a different\n* installed copy of core (dual-package hazard).\n*/\nfunction isNode(value) {\n\treturn typeof value === \"object\" && value !== null && value[NODE] === true;\n}\n//#endregion\n//#region src/toposort.ts\n/**\n* Stable topological sort: every edge's `from` precedes its `to` in the\n* result. Ties (nodes with no ordering constraint between them) keep their\n* relative order from `nodes` — so a graph already authored producer-first\n* comes out byte-identical to its pre-sort layout; only a graph that\n* genuinely needs reordering (e.g. a module wired via a forged ref pointing at a\n* not-yet-provisioned producer) actually moves. A Kahn's-algorithm variant\n* that always picks the ready node with the smallest original index. Edges\n* whose endpoint falls outside `nodes` (e.g. a service-root's input edges\n* targeting the root, which is appended separately) are ignored. Cycles\n* cannot reach here: `assertDependencyDag` already rejects them for\n* dependency edges, and input edges never cycle.\n*/\nfunction topoSort(nodes, edges) {\n\tconst byId = new Map(nodes.map((n) => [n.id, n]));\n\tconst indexOf = new Map(nodes.map((n, i) => [n.id, i]));\n\tconst indegree = new Map(nodes.map((n) => [n.id, 0]));\n\tconst successors = /* @__PURE__ */ new Map();\n\tfor (const edge of edges) {\n\t\tif (!byId.has(edge.from) || !byId.has(edge.to)) continue;\n\t\tconst targets = successors.get(edge.from) ?? [];\n\t\ttargets.push(edge.to);\n\t\tsuccessors.set(edge.from, targets);\n\t\tindegree.set(edge.to, (indegree.get(edge.to) ?? 0) + 1);\n\t}\n\tconst ready = new Set(nodes.filter((n) => indegree.get(n.id) === 0).map((n) => n.id));\n\tconst order = [];\n\twhile (ready.size > 0) {\n\t\tlet next;\n\t\tlet bestIndex = Number.POSITIVE_INFINITY;\n\t\tfor (const id of ready) {\n\t\t\tconst index = indexOf.get(id) ?? Number.POSITIVE_INFINITY;\n\t\t\tif (index < bestIndex) {\n\t\t\t\tbestIndex = index;\n\t\t\t\tnext = id;\n\t\t\t}\n\t\t}\n\t\tif (next === void 0) break;\n\t\tready.delete(next);\n\t\torder.push(next);\n\t\tfor (const target of successors.get(next) ?? []) {\n\t\t\tconst remaining = (indegree.get(target) ?? 0) - 1;\n\t\t\tindegree.set(target, remaining);\n\t\t\tif (remaining === 0) ready.add(target);\n\t\t}\n\t}\n\tif (order.length !== nodes.length) throw new LoadError(`topological sort processed ${order.length} of ${nodes.length} nodes — the graph contains a cycle that slipped past the DAG validation.`);\n\treturn order.map((id) => byId.get(id)).filter((n) => n !== void 0);\n}\n//#endregion\n//#region src/load-service.ts\nfunction serviceInputs(service, serviceId) {\n\tif (typeof service.inputs !== \"object\" || service.inputs === null) throw new LoadError(`Service \"${serviceId}\" has no inputs map.`);\n\tconst nodes = [];\n\tconst edges = [];\n\tfor (const [input, value] of Object.entries(service.inputs)) {\n\t\tconst kind = isNode(value) ? value.kind : void 0;\n\t\tif (kind === \"resource\") throw new LoadError(`Input \"${input}\" of \"${serviceId}\" is a resource node — a resource is provisioned by the composing module, never created for a service that mentions it. Declare the input as a dependency (the pack's dependency factory) and wire the module-provisioned resource's ref into it.`);\n\t\tif (kind !== \"dependency\") throw new LoadError(`Input \"${input}\" of \"${serviceId}\" is not a branded dependency end (construct it with the dependency() factory).`);\n\t\tif (value.type.length === 0) throw new LoadError(`Input \"${input}\" of \"${serviceId}\" has an empty node type.`);\n\t\tconst id = `${serviceId}.${input}`;\n\t\tnodes.push({\n\t\t\tid,\n\t\t\tnode: value\n\t\t});\n\t\tedges.push({\n\t\t\tfrom: id,\n\t\t\tto: serviceId,\n\t\t\tinput,\n\t\t\tkind: \"input\"\n\t\t});\n\t}\n\treturn {\n\t\tnodes,\n\t\tedges\n\t};\n}\nfunction loadService(root, rootId) {\n\tfor (const [input, value] of Object.entries(root.inputs)) if (isNode(value) && value.kind === \"dependency\") throw new LoadError(`Service \"${rootId}\" has an unwired dependency input \"${input}\" — this service is composed by a module; deploy the module instead of loading \"${rootId}\" directly.`);\n\tconst secretSlots = Object.keys(root.secretSlots);\n\tif (secretSlots.length > 0) {\n\t\tconst names = secretSlots.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Service \"${rootId}\" declares secret slot${secretSlots.length > 1 ? \"s\" : \"\"} ${names} but is being loaded directly — a lone service has no enclosing scope to bind them. Compose it inside a module that binds each with envSecret('NAME').`);\n\t}\n\tconst rootGraphNode = {\n\t\tid: rootId,\n\t\tnode: root\n\t};\n\tconst { nodes, edges } = serviceInputs(root, rootId);\n\treturn {\n\t\troot: rootGraphNode,\n\t\tnodes: [...topoSort(nodes, edges), rootGraphNode],\n\t\tedges,\n\t\tsecrets: []\n\t};\n}\n//#endregion\n//#region src/load-module.ts\n/**\n* Builds the ref a provision() call hands back: the id (so a producer with no\n* exposed ports — or an untyped slot — can still be wired wholesale) plus one\n* ref-port per exposed contract, each the contract's own runtime value (so\n* its `satisfies()` still works) tagged with the provider's id.\n*/\nfunction refFor(id, service) {\n\tconst ports = {};\n\tfor (const [port, contract] of Object.entries(service.expose ?? {})) ports[port] = {\n\t\t...contract,\n\t\t__providerId: id\n\t};\n\treturn blindCast({\n\t\tid,\n\t\t...ports\n\t});\n}\n/**\n* The resource variant of refFor: a resource has exactly one port — the\n* contract it provides — flattened onto the ref itself, tagged with the\n* provider id. `id` is written last so a hostile contract value cannot\n* clobber it.\n*/\nfunction refForResource(id, resource) {\n\treturn blindCast({\n\t\t...resource.provides,\n\t\t__providerId: id,\n\t\tid\n\t});\n}\n/** A wired value's producer id: a ref-port's `__providerId`, or a bare ref's `id`. */\nfunction producerIdOf(ref) {\n\tif (typeof ref !== \"object\" || ref === null) return void 0;\n\tif (\"__providerId\" in ref && typeof ref.__providerId === \"string\") return ref.__providerId;\n\tif (\"id\" in ref && typeof ref.id === \"string\") return ref.id;\n}\n/**\n* Brands each `ctx.inputs` entry with the input key it stands for (see\n* flatten): diagnostic only — usage attribution relies on the per-key object\n* identity the branding copy creates, never on reading this back.\n*/\nconst MODULE_INPUT_KEY = Symbol(\"prisma:module-input-key\");\n/** Same per-key identity trick as MODULE_INPUT_KEY, for the parallel `ctx.secrets` forwarding channel. */\nconst MODULE_SECRET_KEY = Symbol(\"prisma:module-secret-key\");\n/** Whether `ref` carries a callable `satisfies` that accepts `required` truthily. */\nfunction satisfiesRequired(ref, required) {\n\treturn typeof ref === \"object\" && ref !== null && \"satisfies\" in ref && typeof ref.satisfies === \"function\" && ref.satisfies(required);\n}\n/**\n* Checks one recorded `wiring` object against the Deps it was wired against:\n* every named input exists and is a dependency slot, every referenced\n* producer is a real (by-now-provisioned) address, and a wired ref whose\n* slot declares a required contract must satisfy() it — no producer-kind\n* branching, the contract alone determines validity, whether the producer is\n* a service port or a resource. Shared by both provisioned kinds so a\n* module-as-child gets exactly the checks a service gets, and run once per\n* entry against the one `byId` shared by the whole recursive flatten, so a\n* forwarded ref resolves through to its real producer address regardless of\n* which ancestor scope provisioned it.\n*/\nfunction validateWiring(pending, byId) {\n\tconst { deps, wiring, targetId, targetKind, enclosingModuleName } = pending;\n\tfor (const [input, ref] of Object.entries(wiring)) {\n\t\tconst declared = blindCast(deps[input]);\n\t\tif (declared === void 0 || !isNode(declared) || declared.kind !== \"dependency\") throw new LoadError(`The deps for \"${targetId}\" name \"${input}\", which is not a dependency slot of that ${targetKind}.`);\n\t\tconst producerId = producerIdOf(ref);\n\t\tconst producer = producerId !== void 0 ? byId.get(producerId) : void 0;\n\t\tif (producerId === void 0 || producer === void 0) throw new LoadError(`The deps for \"${targetId}.${input}\" reference \"${String(producerId)}\", which is not provisioned in module \"${enclosingModuleName}\".`);\n\t\tconst required = declared.required;\n\t\tif (required !== void 0 && !satisfiesRequired(ref, required)) throw new LoadError(`The deps for \"${targetId}.${input}\" do not satisfy the slot's required contract.`);\n\t}\n\tfor (const [input, rawValue] of Object.entries(deps)) {\n\t\tconst value = blindCast(rawValue);\n\t\tif (!isNode(value) || wiring[input] !== void 0) continue;\n\t\tif (value.kind === \"dependency\") throw new LoadError(`Dependency input \"${input}\" of provisioned ${targetKind} \"${targetId}\" is not wired to a producer (module \"${enclosingModuleName}\").`);\n\t}\n}\n/** The (unvalidated) edges a `wiring` object implies — one dependency edge per entry; `validateWiring` does the real checking. */\nfunction wiringEdges(wiring, targetId) {\n\treturn Object.entries(wiring).map(([input, ref]) => ({\n\t\tfrom: producerIdOf(ref) ?? \"\",\n\t\tto: targetId,\n\t\tinput,\n\t\tkind: \"dependency\"\n\t}));\n}\n/**\n* Checks the secrets wired into one provisioned child: every declared slot is\n* bound to a real secret source (an `envSecret` or a forwarded ctx.secrets\n* ref), and no wired key names a slot the child doesn't declare — the secret\n* analog of `validateWiring`'s per-input checks, but resolved inline (a source\n* carries its own name, so no whole-graph pass is needed).\n*/\nfunction validateSecretBinding(child, id, secretWiring, enclosingModuleName) {\n\tconst { kind } = child;\n\tfor (const slot of Object.keys(child.secretSlots)) {\n\t\tconst bound = secretWiring[slot];\n\t\tif (bound === void 0) throw new LoadError(`Secret slot \"${slot}\" of provisioned ${kind} \"${id}\" is not bound (module \"${enclosingModuleName}\") — bind it with envSecret('NAME') or forward ctx.secrets.`);\n\t\tif (!isSecretSource(bound)) throw new LoadError(`Secret slot \"${slot}\" of \"${id}\" (module \"${enclosingModuleName}\") was wired with a non-secret value — use envSecret('NAME') or a forwarded ctx.secrets ref.`);\n\t}\n\tfor (const slot of Object.keys(secretWiring)) if (!Object.hasOwn(child.secretSlots, slot)) throw new LoadError(`The secrets for \"${id}\" name \"${slot}\", which is not a secret slot of that ${kind} (module \"${enclosingModuleName}\").`);\n}\n/**\n* Recursively flattens one module's body into the shared graph state and\n* returns its resolved ModuleOutputs (one ref-port per expose key) for the\n* caller (the enclosing provision() call, or Load itself for the root) to\n* use. `address` is this module's OWN full address, or `undefined` for the root\n* scope — its direct children then get bare (unprefixed) addresses, keeping\n* a single-level module identical to before nesting existed. `wiring` supplies a\n* resolved producer ref-port for each of this module's OWN declared deps (empty\n* for the root, which may not declare any — see the root non-empty-deps\n* check in loadModule). `nodes`, `edges`, `pending`, and `byId` are shared\n* across the ENTIRE recursive flatten, not per scope — a nested module may\n* forward in a producer provisioned by an ancestor scope, and it is the\n* shared `byId` (keyed by full address) that lets that resolve.\n*/\nfunction flatten(moduleNode, address, wiring, secretWiring, nodes, edges, pending, secretBindings, byId) {\n\tconst localIds = /* @__PURE__ */ new Set();\n\tconst used = /* @__PURE__ */ new Set();\n\tconst usedSecrets = /* @__PURE__ */ new Set();\n\tconst ctxInputs = {};\n\tfor (const key of Object.keys(moduleNode.deps)) {\n\t\tconst wired = wiring[key];\n\t\tctxInputs[key] = typeof wired === \"object\" && wired !== null ? {\n\t\t\t...wired,\n\t\t\t[MODULE_INPUT_KEY]: key\n\t\t} : wired;\n\t}\n\tconst markUsed = (values) => {\n\t\tfor (const value of Object.values(values)) for (const key of Object.keys(ctxInputs)) if (value === ctxInputs[key]) used.add(key);\n\t};\n\tconst ctxSecrets = {};\n\tfor (const key of Object.keys(moduleNode.secretSlots)) {\n\t\tconst bound = secretWiring[key];\n\t\tctxSecrets[key] = typeof bound === \"object\" && bound !== null ? {\n\t\t\t...bound,\n\t\t\t[MODULE_SECRET_KEY]: key\n\t\t} : bound;\n\t}\n\tconst markSecretsUsed = (values) => {\n\t\tfor (const value of Object.values(values)) for (const key of Object.keys(ctxSecrets)) if (value === ctxSecrets[key]) usedSecrets.add(key);\n\t};\n\tconst provision = (child, opts) => {\n\t\tconst id = opts?.id ?? child.name;\n\t\tconst provisionWiring = opts?.deps;\n\t\tconst provisionSecrets = opts?.secrets;\n\t\tif (typeof id !== \"string\" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module \"${moduleNode.name}\").`);\n\t\tif (id.includes(\"_\") || id.includes(\".\")) throw new LoadError(`provision() id \"${id}\" (module \"${moduleNode.name}\") may not contain \"_\" or \".\" — \"_\" is the config-key separator and \".\" the node-id path separator; either inside an id collides with the joined form of other names.`);\n\t\tif (localIds.has(id)) throw new LoadError(`Duplicate provision id \"${id}\" in module \"${moduleNode.name}\".`);\n\t\tconst untrusted = child;\n\t\tif (!isNode(untrusted) || untrusted.kind !== \"service\" && untrusted.kind !== \"resource\" && untrusted.kind !== \"module\") throw new LoadError(`provision(\"${id}\") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);\n\t\tlocalIds.add(id);\n\t\tconst fullAddress = address === void 0 ? id : `${address}.${id}`;\n\t\tif (child.kind === \"resource\") {\n\t\t\tif (provisionWiring !== void 0) throw new LoadError(`provision(\"${id}\") received deps for a resource — a resource has no dependency slots to satisfy.`);\n\t\t\tif (provisionSecrets !== void 0) throw new LoadError(`provision(\"${id}\") received secrets for a resource — a resource has no secret slots to satisfy.`);\n\t\t\tif (child.type.length === 0) throw new LoadError(`provision(\"${id}\") received a resource with an empty node type.`);\n\t\t\tbyId.set(fullAddress, child);\n\t\t\tnodes.push({\n\t\t\t\tid: fullAddress,\n\t\t\t\tnode: child\n\t\t\t});\n\t\t\treturn refForResource(fullAddress, child);\n\t\t}\n\t\tconst localWiring = { ...provisionWiring ?? {} };\n\t\tmarkUsed(localWiring);\n\t\tconst localSecrets = { ...provisionSecrets ?? {} };\n\t\tmarkSecretsUsed(localSecrets);\n\t\tvalidateSecretBinding(child, id, localSecrets, moduleNode.name);\n\t\tif (child.kind === \"service\") {\n\t\t\tfor (const slot of Object.keys(child.secretSlots)) {\n\t\t\t\tconst bound = localSecrets[slot];\n\t\t\t\tif (isSecretSource(bound)) secretBindings.push({\n\t\t\t\t\tserviceAddress: fullAddress,\n\t\t\t\t\tslot,\n\t\t\t\t\tsource: bound\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst inputs = serviceInputs(child, fullAddress);\n\t\t\tnodes.push(...inputs.nodes, {\n\t\t\t\tid: fullAddress,\n\t\t\t\tnode: child\n\t\t\t});\n\t\t\tedges.push(...inputs.edges, ...wiringEdges(localWiring, fullAddress));\n\t\t\tpending.push({\n\t\t\t\tdeps: child.inputs,\n\t\t\t\twiring: localWiring,\n\t\t\t\ttargetId: fullAddress,\n\t\t\t\ttargetKind: \"service\",\n\t\t\t\tenclosingModuleName: moduleNode.name\n\t\t\t});\n\t\t\tbyId.set(fullAddress, child);\n\t\t\treturn refFor(fullAddress, child);\n\t\t}\n\t\tedges.push(...wiringEdges(localWiring, fullAddress));\n\t\tpending.push({\n\t\t\tdeps: child.deps,\n\t\t\twiring: localWiring,\n\t\t\ttargetId: fullAddress,\n\t\t\ttargetKind: \"module\",\n\t\t\tenclosingModuleName: moduleNode.name\n\t\t});\n\t\tconst childOutputs = flatten(child, fullAddress, localWiring, localSecrets, nodes, edges, pending, secretBindings, byId);\n\t\tnodes.push({\n\t\t\tid: fullAddress,\n\t\t\tnode: child\n\t\t});\n\t\tbyId.set(fullAddress, child);\n\t\treturn blindCast({\n\t\t\tid: fullAddress,\n\t\t\t...childOutputs\n\t\t});\n\t};\n\tconst ctx = blindCast({\n\t\tinputs: ctxInputs,\n\t\tsecrets: ctxSecrets,\n\t\tprovision: blindCast(provision)\n\t});\n\tconst outputs = blindCast(moduleNode.body(ctx) ?? {});\n\tmarkUsed(outputs);\n\tfor (const key of Object.keys(moduleNode.deps)) if (!used.has(key)) throw new LoadError(`Module \"${moduleNode.name}\" declares input \"${key}\" but never forwards it into a provision nor returns it as an output.`);\n\tfor (const key of Object.keys(moduleNode.secretSlots)) if (!usedSecrets.has(key)) throw new LoadError(`Module \"${moduleNode.name}\" declares secret \"${key}\" but never forwards it into a provision.`);\n\tfor (const [key, contract] of Object.entries(moduleNode.expose)) {\n\t\tconst port = outputs[key];\n\t\tif (port === void 0) throw new LoadError(`Module \"${moduleNode.name}\" declares expose \"${key}\" but its body did not return a port for it.`);\n\t\tif (!satisfiesRequired(port, contract)) throw new LoadError(`Module \"${moduleNode.name}\"'s returned port for expose \"${key}\" does not satisfy its declared contract.`);\n\t}\n\treturn outputs;\n}\nfunction loadModule(root, opts) {\n\tconst rootId = opts?.id ?? root.name;\n\tconst rootDepKeys = Object.keys(root.deps);\n\tif (rootDepKeys.length > 0) {\n\t\tconst names = rootDepKeys.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Module \"${root.name}\" declares input${rootDepKeys.length > 1 ? \"s\" : \"\"} ${names} but is being deployed as the root — a root has no enclosing scope to wire them; compose \"${root.name}\" from another module that provisions and wires it instead.`);\n\t}\n\tconst rootSecretKeys = Object.keys(root.secretSlots);\n\tif (rootSecretKeys.length > 0) {\n\t\tconst names = rootSecretKeys.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Module \"${root.name}\" declares secret${rootSecretKeys.length > 1 ? \"s\" : \"\"} ${names} but is being deployed as the root — a root has no enclosing scope to bind them; the root binds secrets with envSecret('NAME'), it does not declare secret slots of its own.`);\n\t}\n\tconst nodes = [];\n\tconst edges = [];\n\tconst pending = [];\n\tconst secretBindings = [];\n\tconst byId = /* @__PURE__ */ new Map();\n\tflatten(root, void 0, {}, {}, nodes, edges, pending, secretBindings, byId);\n\tfor (const entry of pending) validateWiring(entry, byId);\n\tassertDependencyDag(edges);\n\tconst rootGraphNode = {\n\t\tid: rootId,\n\t\tnode: root\n\t};\n\treturn {\n\t\troot: rootGraphNode,\n\t\tnodes: [...topoSort(nodes, edges), rootGraphNode],\n\t\tedges,\n\t\tsecrets: secretBindings\n\t};\n}\n/**\n* The dependency edges must form a DAG — a cycle means neither producer can\n* deploy first. Resources take no wiring, so only service/module-to-service/module\n* edges can ever participate in a cycle; no special-casing needed.\n*/\nfunction assertDependencyDag(edges) {\n\tconst adjacency = /* @__PURE__ */ new Map();\n\tfor (const edge of edges) {\n\t\tif (edge.kind !== \"dependency\") continue;\n\t\tconst targets = adjacency.get(edge.from) ?? [];\n\t\ttargets.push(edge.to);\n\t\tadjacency.set(edge.from, targets);\n\t}\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst done = /* @__PURE__ */ new Set();\n\tconst stack = [];\n\tconst visit = (id) => {\n\t\tif (done.has(id)) return;\n\t\tif (visiting.has(id)) throw new LoadError(`Dependency cycle: ${[...stack.slice(stack.indexOf(id)), id].join(\" → \")} — no deploy order exists.`);\n\t\tvisiting.add(id);\n\t\tstack.push(id);\n\t\tfor (const next of adjacency.get(id) ?? []) visit(next);\n\t\tstack.pop();\n\t\tvisiting.delete(id);\n\t\tdone.add(id);\n\t};\n\tfor (const id of adjacency.keys()) visit(id);\n}\n//#endregion\n//#region src/graph.ts\n/**\n* Builds the in-memory graph from a root node. A service root walks its own\n* `inputs`; a module root executes its body (wiring, not user code — the\n* designed exception to imports-run-nothing) and recursively flattens every\n* module it provisions into one graph of hierarchical addresses. A malformed\n* graph is a `LoadError` that names its fix; the individual validation rules\n* live with `loadService` / `loadModule` and are covered by name in the Load\n* tests. Executes nothing of the user's own code beyond module bodies.\n*/\nfunction Load(root, opts) {\n\tif (!isNode(root)) throw new LoadError(\"Load expects a branded service or module node (construct it with the service()/module() factories).\");\n\tif (root.kind === \"module\") return loadModule(root, opts);\n\tif (root.kind === \"service\") return loadService(root, opts?.id ?? \"root\");\n\tthrow new LoadError(\"Load expects a service or module root (received another node kind).\");\n}\n//#endregion\nexport { isNode as a, resource as c, service as d, LoadError as f, freezeNode as i, secret as l, ResourceNodeBase as n, isSecretSource as o, dependency as r, module as s, Load as t, secretSource as u };\n\n//# sourceMappingURL=graph-BYdCQKya.mjs.map","import { a as isNode, c as resource, d as service, f as LoadError, i as freezeNode, l as secret, n as ResourceNodeBase, o as isSecretSource, r as dependency, s as module, t as Load, u as secretSource } from \"./graph-BYdCQKya.mjs\";\nimport { SecretBox, SecretBox as SecretBox$1 } from \"@internal/foundation/secret\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's provision manifest: every secret binding the root resolved across\n* the graph (ADR-0029) — an opaque, target-defined source per service secret\n* slot; a deploy target's preflight reads its own payload. Pure graph\n* introspection, TARGET-AGNOSTIC — the target consumes it to verify each secret\n* exists on the platform before deploy. The values are provisioned out-of-band.\n*/\nfunction provisionManifest(graph) {\n\treturn graph.secrets;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* The boot-side half of the runtime split (see core-model.md § Runtime:\n* booting a service). Core's job at boot is structural only: turn a\n* concrete, typed Config into hydrated deps by calling each input's\n* connection.hydrate with its value slice. No environment read, no\n* validation, no strings — the pack's `load()` already read the process-local\n* stash into a typed Config before calling this.\n*/\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n/**\n* Wraps each of a service's resolved secret values in a redacting `SecretBox`\n* — what the node's `secrets()` accessor returns (ADR-0021, sibling to\n* `load()`/`config()`). The RESOLUTION of a secret's value (the boot\n* double-lookup that reads the platform var the pointer names) is the target\n* pack's job; core is handed the already-resolved strings and only boxes them,\n* so a secret is redacted by TYPE from here on. A declared slot missing from\n* `values` is a target contract violation, named loudly.\n*/\nfunction hydrateSecrets(root, values) {\n\tconst boxed = {};\n\tfor (const slot of Object.keys(root.secretSlots)) {\n\t\tconst value = values[slot];\n\t\tif (value === void 0) throw new Error(`secret slot \"${slot}\" has no resolved value — the target must resolve every declared secret before hydrateSecrets().`);\n\t\tboxed[slot] = new SecretBox$1(value);\n\t}\n\treturn blindCast(boxed);\n}\n//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSecrets, hydrateSync, isNode, isSecretSource, module, number, param, provisionManifest, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map","import * as Layer from \"effect/Layer\";\nimport { createManagementApiClient } from \"@prisma/management-api-sdk\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\n//#region src/credentials.ts\n/**\n* The Prisma service token used to authenticate Management API calls. Kept\n* as a Redacted value so it never lands in logs or error output.\n*/\nvar PrismaCredentials = class extends Context.Service()(\"PrismaCredentials\") {};\n/** Resolve the token from the `PRISMA_SERVICE_TOKEN` environment variable. */\nconst fromEnv = () => Layer.effect(PrismaCredentials, Effect.gen(function* () {\n\treturn { token: yield* Config.redacted(\"PRISMA_SERVICE_TOKEN\") };\n}));\n//#endregion\n//#region src/client.ts\n/**\n* The typed Prisma Management API client, built once from the resolved\n* credentials. Providers yield this in their outer Effect and call it inside\n* `reconcile` / `delete`.\n*/\nvar ManagementClient = class extends Context.Service()(\"PrismaManagementClient\") {};\nconst layer = () => Layer.effect(ManagementClient, Effect.gen(function* () {\n\tconst { token } = yield* PrismaCredentials;\n\treturn createManagementApiClient({ token: Redacted.value(token) });\n}));\n//#endregion\n//#region src/http.ts\n/** A non-2xx response from the Management API (or a transport failure). */\nvar PrismaApiError = class extends Data.TaggedError(\"PrismaApiError\") {};\nconst attempt = (f) => Effect.tryPromise({\n\ttry: f,\n\tcatch: (cause) => new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: String(cause)\n\t})\n});\nconst fail = (r) => Effect.fail(new PrismaApiError({\n\tstatus: r.response.status,\n\tmessage: JSON.stringify(r.error)\n}));\n/** Unwrap `data`, failing on any API error. Preserves the SDK's response type. */\nconst call = (f) => attempt(f).pipe(Effect.flatMap((r) => r.error !== void 0 || r.data === void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Unwrap `data`, mapping a 404 to `undefined` (resource gone / not found). */\nconst callOptional = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 ? Effect.succeed(void 0) : r.error !== void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Fire-and-forget a call, tolerating a 404 (already deleted). */\nconst callVoid = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 || r.error === void 0 ? Effect.void : fail(r)));\n//#endregion\nexport { ManagementClient as a, fromEnv as c, callVoid as i, call as n, layer as o, callOptional as r, PrismaCredentials as s, PrismaApiError as t };\n\n//# sourceMappingURL=http-CxGdfSAP.mjs.map","import { a as ManagementClient, i as callVoid, n as call, r as callOptional, t as PrismaApiError } from \"../http-CxGdfSAP.mjs\";\nimport * as Provider from \"alchemy/Provider\";\nimport * as Effect from \"effect/Effect\";\nimport { Resource } from \"alchemy\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as fs from \"node:fs\";\nimport * as crypto from \"node:crypto\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport * as zlib from \"node:zlib\";\n//#region src/compute/ComputeService.ts\n/**\n* Stopping a deployment before the compute service that owns it can be\n* deleted is asynchronous on the platform's side: DELETE can 409 with this\n* message while the deployment is still winding down. Retrying blindly on\n* every API error would mask real failures (bad auth, a genuinely conflicting\n* state, etc.), so this only matches the platform's specific \"not delete-safe\n* yet\" wording — everything else fails immediately, as before.\n*/\nconst isDeleteNotSafeYet = (error) => error.message.includes(\"did not reach a delete-safe state\");\n/**\n* Backs off exponentially from 2s, capped at 5 minutes total — long enough\n* for the platform to finish stopping the deployment, short enough to still\n* fail loudly (rather than hang forever) if it never does.\n*/\nconst deleteSafeRetrySchedule = Schedule.both(Schedule.exponential(\"2 seconds\", 2), Schedule.during(\"5 minutes\"));\n/** Every region Prisma Compute serves — the runtime source of truth; `ComputeRegion` is derived from it so the two can never drift. */\nconst COMPUTE_REGIONS = [\n\t\"us-east-1\",\n\t\"us-west-1\",\n\t\"eu-west-3\",\n\t\"eu-central-1\",\n\t\"ap-northeast-1\",\n\t\"ap-southeast-1\"\n];\n/** A Prisma **Compute service** — the stable app identity behind a project. */\nconst ComputeService = Resource(\"Prisma.ComputeService\");\nconst ComputeServiceProvider = () => Provider.effect(ComputeService, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/compute-services/{computeServiceId}\", { params: { path: { computeServiceId: output.id } } })) : void 0;\n\t\t\tif (observed) return {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name,\n\t\t\t\tendpointDomain: observed.data.serviceEndpointDomain\n\t\t\t};\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/projects/{projectId}/compute-services\", {\n\t\t\t\tparams: { path: { projectId: news.projectId } },\n\t\t\t\tbody: {\n\t\t\t\t\tdisplayName: news.name,\n\t\t\t\t\t...news.region && { regionId: news.region },\n\t\t\t\t\t...news.branchId !== void 0 && { branchId: news.branchId }\n\t\t\t\t}\n\t\t\t}));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tname: created.data.name,\n\t\t\t\tendpointDomain: created.data.serviceEndpointDomain\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/compute-services/{computeServiceId}\", { params: { path: { computeServiceId: output.id } } })).pipe(Effect.retry({\n\t\t\t\tschedule: deleteSafeRetrySchedule,\n\t\t\t\twhile: isDeleteNotSafeYet\n\t\t\t}));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst s = yield* callOptional(() => client.GET(\"/v1/compute-services/{computeServiceId}\", { params: { path: { computeServiceId: output.id } } }));\n\t\t\treturn s ? {\n\t\t\t\tid: s.data.id,\n\t\t\t\tname: s.data.name,\n\t\t\t\tendpointDomain: s.data.serviceEndpointDomain\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/compute/Deployment.ts\n/**\n* A **deployment** of a Prisma Compute service — creates a version, uploads\n* its artifact, starts the VM, waits for it to run, then promotes it to the\n* service's stable endpoint.\n*/\nconst Deployment = Resource(\"Prisma.Deployment\");\nconst DeploymentProvider = () => Provider.effect(Deployment, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst waitForRunning = (versionId) => call(() => client.GET(\"/v1/compute-services/versions/{versionId}\", { params: { path: { versionId } } })).pipe(Effect.flatMap((v) => v.data.status === \"running\" ? Effect.void : Effect.fail(new PrismaApiError({\n\t\tstatus: 409,\n\t\tmessage: `compute version ${versionId} is ${v.data.status}, not running`\n\t}))), Effect.retry(Schedule.both(Schedule.spaced(\"2 seconds\"), Schedule.during(\"2 minutes\"))));\n\treturn {\n\t\tstables: [],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news }) {\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/compute-services/{computeServiceId}/versions\", {\n\t\t\t\tparams: { path: { computeServiceId: news.computeServiceId } },\n\t\t\t\tbody: news.port !== void 0 ? { portMapping: { http: news.port } } : {}\n\t\t\t}));\n\t\t\tconst versionId = created.data.id;\n\t\t\tif (created.data.uploadUrl) {\n\t\t\t\tconst uploadUrl = created.data.uploadUrl;\n\t\t\t\tconst artifact = yield* Effect.try({\n\t\t\t\t\ttry: () => fs.readFileSync(news.artifactPath),\n\t\t\t\t\tcatch: (cause) => new PrismaApiError({\n\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\tmessage: `failed to read artifact ${news.artifactPath}: ${String(cause)}`\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\tconst res = await fetch(uploadUrl, {\n\t\t\t\t\t\t\tmethod: \"PUT\",\n\t\t\t\t\t\t\tbody: artifact\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (!res.ok) throw new PrismaApiError({\n\t\t\t\t\t\t\tstatus: res.status,\n\t\t\t\t\t\t\tmessage: `artifact upload failed: ${res.status} ${res.statusText}`\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tcatch: (cause) => cause instanceof PrismaApiError ? cause : new PrismaApiError({\n\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\tmessage: String(cause)\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t\tyield* call(() => client.POST(\"/v1/compute-services/versions/{versionId}/start\", { params: { path: { versionId } } }));\n\t\t\tyield* waitForRunning(versionId);\n\t\t\tyield* call(() => client.POST(\"/v1/compute-services/{computeServiceId}/promote\", {\n\t\t\t\tparams: { path: { computeServiceId: news.computeServiceId } },\n\t\t\t\tbody: { versionId }\n\t\t\t}));\n\t\t\tconst deployedUrl = (yield* call(() => client.GET(\"/v1/compute-services/{computeServiceId}\", { params: { path: { computeServiceId: news.computeServiceId } } }))).data.serviceEndpointDomain;\n\t\t\treturn {\n\t\t\t\tversionId,\n\t\t\t\t...deployedUrl !== void 0 && { deployedUrl }\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* () {}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.versionId) return void 0;\n\t\t\tconst v = yield* callOptional(() => client.GET(\"/v1/compute-services/versions/{versionId}\", { params: { path: { versionId: output.versionId } } }));\n\t\t\treturn v ? {\n\t\t\t\tversionId: v.data.id,\n\t\t\t\t...v.data.previewDomain && { deployedUrl: v.data.previewDomain }\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/compute/EnvironmentVariable.ts\n/**\n* A project-scoped **environment variable** that Compute injects into the\n* project's services from their attached branch (e.g. wiring one module's URL into\n* another).\n*/\nconst EnvironmentVariable = Resource(\"Prisma.EnvironmentVariable\");\nconst EnvironmentVariableProvider = () => Provider.effect(EnvironmentVariable, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst cls = news.class ?? \"production\";\n\t\t\tlet id = output?.id;\n\t\t\tif (id !== void 0) {\n\t\t\t\tconst priorId = id;\n\t\t\t\tif (!(yield* callOptional(() => client.GET(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: priorId } } })))) id = void 0;\n\t\t\t}\n\t\t\tif (id === void 0) {\n\t\t\t\tconst matchId = (yield* call(() => client.GET(\"/v1/environment-variables\", { params: { query: {\n\t\t\t\t\tprojectId: news.projectId,\n\t\t\t\t\tclass: cls,\n\t\t\t\t\tkey: news.key\n\t\t\t\t} } }))).data?.[0]?.id;\n\t\t\t\tif (matchId !== void 0) {\n\t\t\t\t\tif (!(news.key === \"DATABASE_URL\" || news.key === \"DATABASE_URL_POOLED\")) throw new Error(`EnvironmentVariable \"${news.key}\" (project \"${news.projectId}\", class \"${cls}\") exists but is untracked in this deploy state — refusing to overwrite a reserved COMPOSE_ key. Restore this deploy's hosted state, or remove the variable to let this deploy recreate it.`);\n\t\t\t\t\tid = matchId;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (id !== void 0) {\n\t\t\t\tconst targetId = id;\n\t\t\t\tyield* call(() => client.PATCH(\"/v1/environment-variables/{envVarId}\", {\n\t\t\t\t\tparams: { path: { envVarId: targetId } },\n\t\t\t\t\tbody: { value: news.value }\n\t\t\t\t}));\n\t\t\t\treturn {\n\t\t\t\t\tid,\n\t\t\t\t\tkey: news.key\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/environment-variables\", { body: {\n\t\t\t\tprojectId: news.projectId,\n\t\t\t\tclass: cls,\n\t\t\t\tkey: news.key,\n\t\t\t\tvalue: news.value,\n\t\t\t\t...news.branchId ? { branchId: news.branchId } : {}\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tkey: created.data.key\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst v = yield* callOptional(() => client.GET(\"/v1/environment-variables/{envVarId}\", { params: { path: { envVarId: output.id } } }));\n\t\t\treturn v ? {\n\t\t\t\tid: v.data.id,\n\t\t\t\tkey: v.data.key\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/compute/artifact.ts\n/**\n* Assembles a Prisma Compute artifact: the app-built bundle plus the\n* extension-printed bootstrap and manifest, tarred and gzipped deterministically\n* (fixed mtimes, sorted entry order) so an unchanged service noops on\n* redeploy — a rebuild is the only thing that changes the hash. Lives here\n* (not in @prisma/composer-prisma-cloud/control) because it needs node:fs/node:zlib,\n* which the extension's shipped src may never import (invariant 5).\n*/\nconst MANIFEST_VERSION = \"1\";\n/** Finds main.js/main.mjs in a bundle dir when no explicit entry is given. */\nfunction resolveEntry(bundleDir, entry) {\n\tif (entry !== void 0) return entry;\n\tconst found = fs.readdirSync(bundleDir).find((f) => /^main\\.m?js$/.test(f));\n\tif (found === void 0) throw new Error(`no main.js/main.mjs found in bundle dir ${bundleDir}`);\n\treturn found;\n}\n/** All files under `dir`, as dir-relative POSIX paths, in sorted order. A\n* symlink is a hard error: deploy bundles must be flat (ADR-0005), and the\n* user's build owns flattening — dereferencing here would relink the tree and\n* risk packaging files from outside it. */\nfunction walkFiles(dir) {\n\tconst out = [];\n\tconst visit = (sub) => {\n\t\tfor (const entry of fs.readdirSync(path.join(dir, sub), { withFileTypes: true })) {\n\t\t\tconst rel = sub.length > 0 ? `${sub}/${entry.name}` : entry.name;\n\t\t\tif (entry.isSymbolicLink()) throw new Error(`bundle contains a symlink at ${rel} — deploy bundles must be flat; materialize links in your build (e.g. cp -RL) so the tree is self-contained.`);\n\t\t\tif (entry.isDirectory()) visit(rel);\n\t\t\telse out.push(rel);\n\t\t}\n\t};\n\tvisit(\"\");\n\treturn out.sort();\n}\nfunction octal(value, length) {\n\treturn `${value.toString(8).padStart(length - 1, \"0\")}\\0`;\n}\n/** Splits a path into ustar's name (<=100 bytes) + prefix (<=155 bytes) fields. */\nfunction splitUstarPath(relPath) {\n\tif (Buffer.byteLength(relPath, \"utf8\") <= 100) return {\n\t\tname: relPath,\n\t\tprefix: \"\"\n\t};\n\tfor (let i = relPath.length - 1; i >= 0; i--) {\n\t\tif (relPath[i] !== \"/\") continue;\n\t\tconst prefix = relPath.slice(0, i);\n\t\tconst name = relPath.slice(i + 1);\n\t\tif (Buffer.byteLength(prefix, \"utf8\") <= 155 && Buffer.byteLength(name, \"utf8\") <= 100) return {\n\t\t\tname,\n\t\t\tprefix\n\t\t};\n\t}\n\tthrow new Error(`path too long for a ustar tar entry: ${relPath}`);\n}\nfunction ustarHeader(relPath, size) {\n\tconst { name, prefix } = splitUstarPath(relPath);\n\tconst buf = Buffer.alloc(512);\n\tbuf.write(name, 0, 100, \"utf8\");\n\tbuf.write(octal(420, 8), 100, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 108, 8, \"utf8\");\n\tbuf.write(octal(0, 8), 116, 8, \"utf8\");\n\tbuf.write(octal(size, 12), 124, 12, \"utf8\");\n\tbuf.write(octal(0, 12), 136, 12, \"utf8\");\n\tbuf.write(\" \", 148, 8, \"utf8\");\n\tbuf.write(\"0\", 156, 1, \"utf8\");\n\tbuf.write(\"ustar\\0\", 257, 6, \"utf8\");\n\tbuf.write(\"00\", 263, 2, \"utf8\");\n\tbuf.write(prefix, 345, 155, \"utf8\");\n\tlet sum = 0;\n\tfor (const b of buf) sum += b;\n\tbuf.write(`${sum.toString(8).padStart(6, \"0\")}\\0 `, 148, 8, \"utf8\");\n\treturn buf;\n}\nfunction createDeterministicTarGz(entries) {\n\tconst sorted = [...entries].sort((a, b) => a.relPath.localeCompare(b.relPath));\n\tconst chunks = [];\n\tfor (const entry of sorted) {\n\t\tchunks.push(ustarHeader(entry.relPath, entry.content.length));\n\t\tchunks.push(entry.content);\n\t\tconst pad = (512 - entry.content.length % 512) % 512;\n\t\tif (pad > 0) chunks.push(Buffer.alloc(pad));\n\t}\n\tchunks.push(Buffer.alloc(1024));\n\treturn zlib.gzipSync(Buffer.concat(chunks));\n}\n/**\n* Prints the bootstrap + manifest and tars them with the bundle into a\n* deterministic artifact. If bundleDir doesn't exist (e.g. `alchemy destroy`\n* run before any build), returns a placeholder rather than throwing — the\n* artifact is never read on destroy.\n*/\nfunction packageComputeArtifact(opts) {\n\tif (!fs.existsSync(opts.bundleDir)) return {\n\t\tpath: \"\",\n\t\tsha256: \"absent\"\n\t};\n\tconst bootstrap = `import main from \"./${resolveEntry(opts.bundleDir, opts.bundleEntry)}\";\\nawait main.run(${JSON.stringify(opts.address)}, () => import(${JSON.stringify(`./${opts.appEntry}`)}));\\n`;\n\tconst manifest = `${JSON.stringify({\n\t\tmanifestVersion: MANIFEST_VERSION,\n\t\tentrypoint: \"bootstrap.js\"\n\t}, null, 2)}\\n`;\n\tconst files = walkFiles(opts.bundleDir).map((relPath) => ({\n\t\trelPath,\n\t\tcontent: fs.readFileSync(path.join(opts.bundleDir, relPath))\n\t}));\n\tfiles.push({\n\t\trelPath: \"bootstrap.js\",\n\t\tcontent: Buffer.from(bootstrap, \"utf8\")\n\t});\n\tfiles.push({\n\t\trelPath: \"compute.manifest.json\",\n\t\tcontent: Buffer.from(manifest, \"utf8\")\n\t});\n\tfiles.push({\n\t\trelPath: \"bunfig.toml\",\n\t\tcontent: Buffer.from(\"[install]\\nauto = \\\"disable\\\"\\n\", \"utf8\")\n\t});\n\tconst gz = createDeterministicTarGz(files);\n\tconst sha256 = crypto.createHash(\"sha256\").update(gz).digest(\"hex\");\n\tconst outDir = path.join(os.tmpdir(), `prisma-composer-compute-${String(os.userInfo().uid)}`, sha256.slice(0, 16));\n\tfs.mkdirSync(outDir, { recursive: true });\n\tconst outPath = path.join(outDir, `${opts.id}.tar.gz`);\n\tconst tmpPath = path.join(outDir, `.${opts.id}.${crypto.randomUUID()}.tmp`);\n\tfs.writeFileSync(tmpPath, gz);\n\tfs.renameSync(tmpPath, outPath);\n\treturn {\n\t\tpath: outPath,\n\t\tsha256\n\t};\n}\n//#endregion\nexport { COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, deleteSafeRetrySchedule, isDeleteNotSafeYet, packageComputeArtifact };\n\n//# sourceMappingURL=index.mjs.map","import { a as ManagementClient, i as callVoid, n as call, r as callOptional, t as PrismaApiError } from \"../http-CxGdfSAP.mjs\";\nimport * as Provider from \"alchemy/Provider\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport { Resource } from \"alchemy\";\n//#region src/postgres/Connection.ts\n/** A **connection** to a Prisma Postgres database — yields the connection string. */\nconst Connection = Resource(\"Prisma.Connection\");\nconst ConnectionProvider = () => Provider.effect(Connection, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\", \"connectionString\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tif (output?.id) return output;\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/databases/{databaseId}/connections\", {\n\t\t\t\tparams: { path: { databaseId: news.databaseId } },\n\t\t\t\tbody: { name: news.name }\n\t\t\t}));\n\t\t\tconst endpoints = created.data.endpoints;\n\t\t\tconst dsn = endpoints?.direct?.connectionString ?? endpoints?.pooled?.connectionString;\n\t\t\tif (dsn === void 0) return yield* Effect.fail(new PrismaApiError({\n\t\t\t\tstatus: 0,\n\t\t\t\tmessage: `connection ${created.data.id} returned no direct/pooled connection string`\n\t\t\t}));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tconnectionString: Redacted.make(dsn)\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/connections/{id}\", { params: { path: { id: output.id } } }));\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/postgres/Database.ts\n/** A Prisma **Postgres database** inside a project. */\nconst Database = Resource(\"Prisma.Database\");\nconst DatabaseProvider = () => Provider.effect(Database, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } })) : void 0;\n\t\t\tlet result;\n\t\t\tif (observed) result = {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name\n\t\t\t};\n\t\t\telse {\n\t\t\t\tconst created = yield* call(() => client.POST(\"/v1/projects/{projectId}/databases\", {\n\t\t\t\t\tparams: { path: { projectId: news.projectId } },\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tname: news.name,\n\t\t\t\t\t\tregion: news.region,\n\t\t\t\t\t\t...news.isDefault !== void 0 && { isDefault: news.isDefault }\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\tresult = {\n\t\t\t\t\tid: created.data.id,\n\t\t\t\t\tname: created.data.name\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (news.branchId !== void 0) {\n\t\t\t\tconst branchId = news.branchId;\n\t\t\t\tyield* call(() => client.PATCH(\"/v1/databases/{databaseId}\", {\n\t\t\t\t\tparams: { path: { databaseId: result.id } },\n\t\t\t\t\tbody: { branchId }\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn result;\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst d = yield* callOptional(() => client.GET(\"/v1/databases/{databaseId}\", { params: { path: { databaseId: output.id } } }));\n\t\t\treturn d ? {\n\t\t\t\tid: d.data.id,\n\t\t\t\tname: d.data.name\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\n//#region src/postgres/Project.ts\n/** A Prisma Developer Platform **Project** — the container for databases and compute services. */\nconst Project = Resource(\"Prisma.Project\");\nconst ProjectProvider = () => Provider.effect(Project, Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\treturn {\n\t\tstables: [\"id\"],\n\t\tlist: () => Effect.succeed([]),\n\t\treconcile: Effect.fn(function* ({ news, output }) {\n\t\t\tconst observed = output?.id ? yield* callOptional(() => client.GET(\"/v1/projects/{id}\", { params: { path: { id: output.id } } })) : void 0;\n\t\t\tif (observed) return {\n\t\t\t\tid: observed.data.id,\n\t\t\t\tname: observed.data.name\n\t\t\t};\n\t\t\tconst created = yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\t\t\tname: news.name,\n\t\t\t\tworkspaceId: news.workspaceId\n\t\t\t} }));\n\t\t\treturn {\n\t\t\t\tid: created.data.id,\n\t\t\t\tname: created.data.name\n\t\t\t};\n\t\t}),\n\t\tdelete: Effect.fn(function* ({ output }) {\n\t\t\tyield* callVoid(() => client.DELETE(\"/v1/projects/{id}\", { params: { path: { id: output.id } } }));\n\t\t}),\n\t\tread: Effect.fn(function* ({ output }) {\n\t\t\tif (!output?.id) return void 0;\n\t\t\tconst p = yield* callOptional(() => client.GET(\"/v1/projects/{id}\", { params: { path: { id: output.id } } }));\n\t\t\treturn p ? {\n\t\t\t\tid: p.data.id,\n\t\t\t\tname: p.data.name\n\t\t\t} : void 0;\n\t\t})\n\t};\n}));\n//#endregion\nexport { Connection, ConnectionProvider, Database, DatabaseProvider, Project, ProjectProvider };\n\n//# sourceMappingURL=index.mjs.map","import { a as ManagementClient, c as fromEnv, i as callVoid, n as call, o as layer, s as PrismaCredentials } from \"./http-CxGdfSAP.mjs\";\nimport { COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, deleteSafeRetrySchedule, isDeleteNotSafeYet, packageComputeArtifact } from \"./compute/index.mjs\";\nimport { Connection, ConnectionProvider, Database, DatabaseProvider, Project, ProjectProvider } from \"./postgres/index.mjs\";\nimport * as Provider from \"alchemy/Provider\";\nimport * as Layer from \"effect/Layer\";\nimport * as Effect from \"effect/Effect\";\nimport * as Data from \"effect/Data\";\n//#region src/container.ts\n/** Raised with `ensure: false` when the app's Project (or a named stage's Branch) doesn't exist. */\nvar ContainerNotFoundError = class extends Data.TaggedError(\"ContainerNotFoundError\") {};\nconst listAllProjects = (client) => Effect.gen(function* () {\n\tconst projects = [];\n\tlet cursor;\n\tfor (;;) {\n\t\tconst query = cursor === void 0 ? {} : { cursor };\n\t\tconst page = yield* call(() => client.GET(\"/v1/projects\", { params: { query } }));\n\t\tprojects.push(...page.data);\n\t\tif (!page.pagination.hasMore || page.pagination.nextCursor === null) break;\n\t\tcursor = page.pagination.nextCursor;\n\t}\n\treturn projects;\n});\n/**\n* Workspace ids circulate in two shapes: `wksp_`-prefixed and bare. Compare\n* bare-to-bare so a `wksp_`-prefixed API id still matches a bare configured\n* one (the same normalization `state/bootstrap.ts` applies to the same\n* `/v1/projects` listing).\n*/\nconst bareWorkspaceId = (id) => id.startsWith(\"wksp_\") ? id.slice(5) : id;\n/**\n* Finds the app's Project by name in the workspace — PDP allows duplicate\n* project names, so more than one can match; the oldest wins. Creates one\n* if none match, unless `ensure` is `false` (find-only — `destroy`), in\n* which case an absent Project fails with `ContainerNotFoundError`. No\n* ownership marker and no `--project` override (both deferred — see\n* ADR-0019).\n*/\nconst resolveProject = (client, workspaceId, appName, ensure) => Effect.gen(function* () {\n\tconst oldest = (yield* listAllProjects(client)).filter((p) => bareWorkspaceId(p.workspace.id) === bareWorkspaceId(workspaceId) && p.name === appName).sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];\n\tif (oldest !== void 0) return oldest.id;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({ appName }));\n\treturn (yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\tname: appName,\n\t\tworkspaceId\n\t} }))).data.id;\n});\nconst findBranchId = (client, projectId, gitName) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\tpath: { projectId },\n\tquery: { gitName }\n} })).pipe(Effect.map((page) => page.data[0]?.id));\n/**\n* Finds the stage's Branch by its exact `gitName`, creating it if absent\n* unless `ensure` is `false` (find-only — `destroy`), in which case an\n* absent Branch fails with `ContainerNotFoundError`. The Management API has\n* no server-side \"create-or-return\" idempotency (`POST\n* /v1/projects/:id/branches` 409s on a duplicate `gitName`, with no request\n* field to make that a no-op), so idempotency is client-side: observe\n* first, and on a racing 409 from create, re-observe rather than fail.\n*/\nconst resolveBranch = (client, projectId, gitName, appName, ensure) => Effect.gen(function* () {\n\tconst existing = yield* findBranchId(client, projectId, gitName);\n\tif (existing !== void 0) return existing;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({\n\t\tappName,\n\t\tstage: gitName\n\t}));\n\treturn yield* call(() => client.POST(\"/v1/projects/{projectId}/branches\", {\n\t\tparams: { path: { projectId } },\n\t\tbody: { gitName }\n\t})).pipe(Effect.map((r) => r.data.id), Effect.catch((err) => err.status === 409 ? findBranchId(client, projectId, gitName).pipe(Effect.flatMap((id) => id === void 0 ? Effect.fail(err) : Effect.succeed(id))) : Effect.fail(err)));\n});\n/**\n* Resolves the two containers a stage's deploy runs into (ADR-0019): the\n* app's **Project**, found-or-created by name, and — for a named stage\n* only — its **Branch**, found-or-created by `gitName`. The default stage\n* (no `stage`) creates no Branch; `branchId` is omitted. With `ensure:\n* false` (`destroy`), nothing is created — an absent Project or Branch\n* fails with `ContainerNotFoundError` instead.\n*/\nconst resolveContainer = (opts) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst ensure = opts.ensure ?? true;\n\tconst projectId = yield* resolveProject(client, opts.workspaceId, opts.appName, ensure);\n\tif (opts.stage === void 0) return { projectId };\n\treturn {\n\t\tprojectId,\n\t\tbranchId: yield* resolveBranch(client, projectId, opts.stage, opts.appName, ensure)\n\t};\n});\n/**\n* Soft-deletes a Branch. Tolerates a 404 (already gone). The API refuses if\n* the Branch still has live members or is the production/default Branch —\n* that surfaces as a `PrismaApiError`.\n*/\nconst deleteBranch = (branchId) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tyield* callVoid(() => client.DELETE(\"/v1/branches/{branchId}\", { params: { path: { branchId } } }));\n});\n//#endregion\n//#region src/index.ts\n/** The collection of Prisma resource providers. */\nvar Providers = class extends Provider.ProviderCollection()(\"Prisma\") {};\n/**\n* The Prisma provider bundle: every resource provider, the Management API\n* client, and env-based credentials. Plug into a stack with\n* `{ providers: Prisma.providers() }`.\n*/\nconst providers = () => Layer.effect(Providers, Provider.collection([\n\tProject,\n\tDatabase,\n\tConnection,\n\tComputeService,\n\tDeployment,\n\tEnvironmentVariable\n])).pipe(Layer.provide(Layer.mergeAll(ProjectProvider(), DatabaseProvider(), ConnectionProvider(), ComputeServiceProvider(), DeploymentProvider(), EnvironmentVariableProvider())), Layer.provideMerge(layer()), Layer.provideMerge(fromEnv()), Layer.orDie);\n//#endregion\nexport { COMPUTE_REGIONS, ComputeService, ComputeServiceProvider, Connection, ConnectionProvider, ContainerNotFoundError, Database, DatabaseProvider, Deployment, DeploymentProvider, EnvironmentVariable, EnvironmentVariableProvider, ManagementClient, PrismaCredentials, Project, ProjectProvider, Providers, deleteBranch, deleteSafeRetrySchedule, fromEnv, isDeleteNotSafeYet, layer as managementClientLayer, packageComputeArtifact, providers, resolveContainer };\n\n//# sourceMappingURL=index.mjs.map","import { Cli, Command, Option, UsageError } from \"clipanion\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { assembleServices } from \"@internal/assemble\";\nimport { Load, isNode } from \"@internal/core\";\nimport { spawnSync } from \"node:child_process\";\nimport { ManagementClient, deleteBranch, fromEnv, managementClientLayer, resolveContainer } from \"@internal/lowering\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as c12 from \"c12\";\nimport { pathToFileURL } from \"node:url\";\n//#region src/cli-error.ts\n/**\n* A user-facing failure with a message that already names the fix (deploy-cli.md\n* § Error surface). `bin.ts` catches this — and any other Error, including\n* core's LoadError/LowerError — uniformly: print the message, exit nonzero.\n*/\nvar CliError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"CliError\";\n\t}\n};\n//#endregion\n//#region src/ensure-containers.ts\n/**\n* Pipeline pre-stack step: resolves the app's Project + (named stage) Branch\n* via `@internal/lowering`'s `resolveContainer`, before the generated stack file\n* runs — `deploy` creates-if-absent, `destroy` finds only.\n*/\n/** Validates `stage` as a git ref name via `git check-ref-format` — no silent normalization. */\nfunction validateStageName(stage) {\n\tconst result = spawnSync(\"git\", [\"check-ref-format\", `refs/heads/${stage}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliError(`git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`);\n\tif (result.status !== 0) throw new CliError(`Invalid --stage \"${stage}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${stage}\").`);\n}\nasync function ensureContainers(input, deps) {\n\tconst env = input.env ?? process.env;\n\tconst workspaceId = env[\"PRISMA_WORKSPACE_ID\"];\n\tif (workspaceId === void 0 || workspaceId.length === 0) throw new CliError(\"environment variable PRISMA_WORKSPACE_ID is required.\");\n\tif (deps?.client === void 0 && (env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw new CliError(\"environment variable PRISMA_SERVICE_TOKEN is required.\");\n\tif (input.stage !== void 0) validateStageName(input.stage);\n\tconst program = resolveContainer({\n\t\tworkspaceId,\n\t\tappName: input.appName,\n\t\t...input.stage !== void 0 ? { stage: input.stage } : {},\n\t\tensure: input.command === \"deploy\"\n\t}).pipe(Effect.map((c) => ({\n\t\tok: true,\n\t\tcontainer: c\n\t})), Effect.catchTag(\"ContainerNotFoundError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\tmessage: `Nothing deployed for ${e.appName}${e.stage ? `/${e.stage}` : \"\"} — deploy it first.`\n\t})), Effect.catchTag(\"PrismaApiError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\tmessage: `Prisma Management API error resolving containers: ${e.message}.`\n\t})));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (!outcome.ok) throw new CliError(outcome.message);\n\treturn outcome.container;\n}\n/**\n* Soft-deletes a named stage's Branch after a successful `alchemy destroy`\n* has removed its members (spec §10) — the Management API refuses to delete\n* a Branch that still has live members.\n*/\nasync function deleteStageBranch(input, deps) {\n\tconst env = input.env ?? process.env;\n\tif (deps?.client === void 0 && (env[\"PRISMA_SERVICE_TOKEN\"] ?? \"\").length === 0) throw new CliError(\"environment variable PRISMA_SERVICE_TOKEN is required.\");\n\tconst program = deleteBranch(input.branchId).pipe(Effect.map(() => ({ ok: true })), Effect.catchTag(\"PrismaApiError\", (e) => Effect.succeed({\n\t\tok: false,\n\t\tmessage: `Failed to delete the stage Branch: ${e.message}.`\n\t})));\n\tconst provided = deps?.client !== void 0 ? program.pipe(Effect.provideService(ManagementClient, deps.client)) : program.pipe(Effect.provide(managementClientLayer().pipe(Layer.provide(fromEnv()))));\n\tconst outcome = await Effect.runPromise(provided);\n\tif (!outcome.ok) throw new CliError(outcome.message);\n}\n//#endregion\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configPath);\n\treturn `// Generated by \\`prisma-composer deploy\\`/\\`prisma-composer destroy\\` — overwritten on every\n// run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:\n//\n// alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\nimport { lower } from '@prisma/composer/deploy';\nimport config from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/load-config.ts\n/**\n* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE\n* file that imports control-plane code. Discovery is the standard walk-up\n* from the deploy entry's directory (mirrors prisma-next's config-loader);\n* loading is c12 with that explicit path (rc/global/package.json lookups\n* disabled), so the config file's own static imports resolve from the app\n* root by whatever package manager runs — no specifier construction, no\n* anchoring. The loaded shape is validated field-by-field with CliErrors\n* naming the field.\n*/\nconst CONFIG_FILENAME = \"prisma-composer.config.ts\";\n/** Walks UP from the entry file's directory looking for the literal CONFIG_FILENAME; undefined when the walk hits the filesystem root. */\nfunction findConfigPathForEntry(entryPath) {\n\tlet current = path.dirname(path.resolve(entryPath));\n\twhile (true) {\n\t\tconst candidate = path.join(current, CONFIG_FILENAME);\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(current);\n\t\tif (parent === current) return void 0;\n\t\tcurrent = parent;\n\t}\n}\nfunction missingConfigError(entryPath) {\n\treturn new CliError(`No ${CONFIG_FILENAME} found walking up from \"${path.dirname(path.resolve(entryPath))}\" — the deploy needs the app's config file. Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.`);\n}\nfunction fieldError(field, requirement) {\n\treturn new CliError(`${CONFIG_FILENAME}: \\`${field}\\` ${requirement} — see defineConfig() in '@prisma/composer/config'.`);\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Field-by-field validation of the loaded default export — deliberately no\n* schema library: each check is a CliError naming the offending field.\n* Returns the same object, typed.\n*/\nfunction validateConfigShape(loaded, configPath) {\n\tif (!isRecord(loaded) || Object.keys(loaded).length === 0) throw new CliError(`\"${configPath}\" exported no config — it must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.`);\n\tconst extensions = loaded[\"extensions\"];\n\tif (!Array.isArray(extensions)) throw fieldError(\"extensions\", \"must be an array\");\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of extensions.entries()) {\n\t\tif (!isRecord(entry)) throw fieldError(`extensions[${index}]`, \"must be an extension descriptor object\");\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) throw fieldError(`extensions[${index}].id`, \"must be a non-empty string (the extension package name)\");\n\t\tif (!isRecord(entry[\"nodes\"])) throw fieldError(`extensions[${index}].nodes`, \"must be an object (the node-ID → control registry)\");\n\t\tif (seen.has(id)) throw new CliError(`${CONFIG_FILENAME}: extension \"${id}\" is listed more than once in \\`extensions\\`.`);\n\t\tseen.add(id);\n\t}\n\tif (typeof loaded[\"state\"] !== \"function\") throw fieldError(\"state\", \"must be a function returning the deploy state layer (e.g. () => prismaState())\");\n\treturn blindCast(loaded);\n}\n/**\n* Loads + validates the config at `configPath` via c12 (explicit file; rc /\n* global-rc / package.json lookups disabled — discovery already happened in\n* findConfigPathForEntry).\n*/\nasync function loadAppConfig(configPath) {\n\tconst result = await c12.loadConfig({\n\t\tname: \"prisma-composer\",\n\t\tconfigFile: configPath,\n\t\tcwd: path.dirname(configPath),\n\t\trcFile: false,\n\t\tglobalRc: false,\n\t\tpackageJson: false\n\t});\n\tconst loadedFile = result.configFile;\n\tif (typeof loadedFile !== \"string\" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath)) throw new CliError(`Config loading resolved \"${String(loadedFile)}\" instead of the discovered \"${configPath}\" — refusing to deploy against a different file.`);\n\treturn {\n\t\tpath: configPath,\n\t\tconfig: validateConfigShape(result.config, configPath)\n\t};\n}\n//#endregion\n//#region src/load-entry.ts\n/**\n* Pipeline step 1 (deploy-cli.md § The pipeline): import the entry module\n* (resolved against cwd) and require its default export to be a node — a\n* service or module, branded by core's factories. Whatever this module exports\n* IS the application; nothing else marks a root (ADR-0003).\n*/\nasync function loadEntry(entryArg, cwd) {\n\tconst resolvedPath = path.resolve(cwd, entryArg);\n\tconst root = (await import(pathToFileURL(resolvedPath).href)).default;\n\tif (!isNode(root) || root.kind === \"dependency\" || root.kind === \"resource\") throw new CliError(`Entry module \"${resolvedPath}\" must default-export a node (a service or a module) — construct it with service() or module() from @prisma/composer.`);\n\treturn {\n\t\tpath: resolvedPath,\n\t\troot: blindCast(root)\n\t};\n}\n//#endregion\n//#region src/run-alchemy.ts\n/**\n* Pipeline step 7 (deploy-cli.md § The pipeline; design-notes.md's \"Driving\n* Alchemy\" call): shell out to the generated stack file. Resolves the\n* workspace's own installed `alchemy` bin (walking up `node_modules/.bin`\n* from the generated file's package dir) rather than going through\n* `bunx`/`npx`, so this works the same under node and bun — the resolved\n* bin's own launcher (`alchemy/bin/cli.js`) does its own node/bun dispatch\n* from there, driven by the env it inherits.\n*/\n/** Walks up from `startDir` looking for `node_modules/.bin/alchemy`. */\nfunction resolveAlchemyBin(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \".bin\", \"alchemy\");\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) throw new CliError(`Could not find an installed \\`alchemy\\` bin above \"${startDir}\" — add \"alchemy\" as a dependency of your app.`);\n\t\tdir = parent;\n\t}\n}\n/** Runs `alchemy deploy|destroy <stack file> --yes [--stage <stage>]`, inheriting stdio + env, plus the resolved Project/Branch ids. */\nfunction runAlchemy(input) {\n\tconst bin = resolveAlchemyBin(input.cwd);\n\tconst args = [\n\t\tinput.command,\n\t\tinput.stackFileRelativePath,\n\t\t\"--yes\"\n\t];\n\tif (input.stage !== void 0) args.push(\"--stage\", input.stage);\n\tconst result = spawnSync(bin, args, {\n\t\tcwd: input.cwd,\n\t\tstdio: \"inherit\",\n\t\tenv: {\n\t\t\t...input.env ?? process.env,\n\t\t\tPRISMA_PROJECT_ID: input.projectId,\n\t\t\t...input.branchId !== void 0 ? { PRISMA_BRANCH_ID: input.branchId } : {}\n\t\t}\n\t});\n\tif (result.error !== void 0) throw result.error;\n\treturn result.status ?? 1;\n}\n//#endregion\n//#region src/validate-coverage.ts\nfunction lookup(extensions, extension, type, expectedKind, what) {\n\tconst ext = extensions.get(extension);\n\tif (ext === void 0) throw new CliError(`No extension \"${extension}\" is configured (needed by ${what}) — add it to ${CONFIG_FILENAME}'s \\`extensions\\` (import its /control entry and list its descriptor).`);\n\tconst descriptor = ext.nodes[type];\n\tif (descriptor === void 0) throw new CliError(`Extension \"${extension}\" has no descriptor for node type \"${type}\" (needed by ${what}; known: ${Object.keys(ext.nodes).join(\", \")}).`);\n\tif (descriptor.kind !== expectedKind) throw new CliError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${descriptor.kind}\" descriptor — ${what} needs a \"${expectedKind}\" descriptor.`);\n}\n/** Throws a CliError on the first uncovered `(extension, type)`; silent when the config covers the whole graph. */\nfunction validateRegistryCoverage(graph, config) {\n\tconst extensions = new Map(config.extensions.map((descriptor) => [descriptor.id, descriptor]));\n\tfor (const { id, node } of graph.nodes) {\n\t\tif (node.kind === \"resource\") {\n\t\t\tlookup(extensions, node.extension, node.type, \"resource\", `resource node \"${id}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (node.kind !== \"service\") continue;\n\t\tlookup(extensions, node.extension, node.type, \"service\", `service node \"${id}\"`);\n\t\tlookup(extensions, node.build.extension, node.build.type, \"build\", `service node \"${id}\"'s build descriptor`);\n\t}\n}\n//#endregion\n//#region src/main.ts\n/**\n* Argument parsing (clipanion — prisma-next's CLI idiom, see\n* prisma-next/packages/1-framework/3-tooling/cli/src/migration-cli.ts) +\n* orchestration of deploy-cli.md § The pipeline.\n*/\nconst BINARY_NAME = \"prisma-composer\";\n/** The <entry>/--name/--stage surface shared by deploy and destroy; execute() is unused — run() drives the pipeline directly so error handling stays under this module's control. */\nvar DeployCliCommand = class extends Command {\n\tentry = Option.String({ name: \"entry\" });\n\tname = Option.String(\"--name\", { description: \"Override the root node's name — the deploy's application name.\" });\n\tstage = Option.String(\"--stage\", { description: \"Alchemy stage to target.\" });\n\tproduction = Option.Boolean(\"--production\", false, { description: \"destroy: tear down the project-level production environment (required to destroy production).\" });\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\nvar DeployCommand = class extends DeployCliCommand {\n\tstatic paths = [[\"deploy\"]];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Deploy the application whose root node is <entry>'s default export.\",\n\t\texamples: [[\"Deploy an app\", \"$0 deploy src/service.ts\"]]\n\t});\n\taction = \"deploy\";\n};\nvar DestroyCommand = class extends DeployCliCommand {\n\tstatic paths = [[\"destroy\"]];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Tear down the application whose root node is <entry>'s default export — same derivation as deploy, Alchemy destroy.\",\n\t\texamples: [[\"Destroy an app\", \"$0 destroy src/service.ts\"]]\n\t});\n\taction = \"destroy\";\n};\nfunction buildCli() {\n\treturn Cli.from([DeployCommand, DestroyCommand], {\n\t\tbinaryName: BINARY_NAME,\n\t\tbinaryLabel: \"The prisma-composer deploy CLI\"\n\t});\n}\n/** Thrown internally when the user explicitly asked for `--help`/`-h` — run() prints it to stdout and exits 0; not a usage error. */\nvar HelpRequested = class extends Error {};\n/** Duck-typed: clipanion's UnknownSyntaxError isn't re-exported, so match its name + clipanion.type discriminator (mirrors prisma-next's migration-cli.ts). */\nfunction isUnknownSyntaxError(error) {\n\tif (!(error instanceof Error) || error.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = error.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/** Exported for direct testing (main.test.ts) — not part of the package's public barrel (see index.ts). */\nfunction parseArgs(argv) {\n\tconst cli = buildCli();\n\tlet command;\n\ttry {\n\t\tcommand = cli.process([...argv]);\n\t} catch (error) {\n\t\tif (isUnknownSyntaxError(error) || error instanceof UsageError) throw new UsageError(cli.usage(null, { detailed: true }));\n\t\tthrow error;\n\t}\n\tif (command instanceof DeployCommand || command instanceof DestroyCommand) return {\n\t\tcommand: command.action,\n\t\tentry: command.entry,\n\t\tname: command.name,\n\t\tstage: command.stage,\n\t\tproduction: command.production\n\t};\n\tif (argv.includes(\"--help\") || argv.includes(\"-h\")) throw new HelpRequested(cli.usage(null, { detailed: true }));\n\tthrow new UsageError(cli.usage(null, { detailed: true }));\n}\n/** Destroy must name its target explicitly — no silent default to production (spec §10). */\nfunction effectiveStage(args) {\n\tif (args.command === \"deploy\") {\n\t\tif (args.production) throw new CliError(\"--production is only valid with `destroy`; `deploy` targets production by default (omit --stage).\");\n\t\treturn args.stage;\n\t}\n\tif (args.stage !== void 0 && args.production) throw new CliError(\"Pass either --stage <name> or --production to `destroy`, not both.\");\n\tif (args.stage === void 0 && !args.production) throw new CliError(\"`destroy` requires an explicit target: --stage <name> to tear down a branch environment, or --production to tear down the production environment.\");\n\treturn args.production ? void 0 : args.stage;\n}\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Warns (doesn't fail) when destroy finds no local deploy state under cwd — likely wrong directory or nothing deployed yet. */\nfunction warnIfNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\tif (!(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0)) console.warn(`\\nNo prior deploy state under ${cwd} — if you deployed from a different directory, run destroy from there; otherwise this is a no-op.`);\n}\n/** Runs the full pipeline; returns the process exit code. */\nasync function run(argv, deps = {}) {\n\tlet args;\n\ttry {\n\t\targs = parseArgs(argv);\n\t} catch (error) {\n\t\tif (error instanceof HelpRequested) {\n\t\t\tconsole.log(error.message);\n\t\t\treturn 0;\n\t\t}\n\t\tthrow error;\n\t}\n\tconst stage = effectiveStage(args);\n\tconst cwd = process.cwd();\n\tif (args.command === \"destroy\") warnIfNoLocalDeployState(cwd);\n\tconst resolvedEntryPath = path.resolve(cwd, args.entry);\n\tconst configPath = findConfigPathForEntry(resolvedEntryPath);\n\tif (configPath === void 0) throw missingConfigError(resolvedEntryPath);\n\tconst config = deps.config ?? (await loadAppConfig(configPath)).config;\n\tconst entryModule = await loadEntry(args.entry, cwd);\n\tconst graph = Load(entryModule.root);\n\tif (graph.root.node.kind !== \"module\") throw new CliError(\"The deploy root must be a module — wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); }).\");\n\tvalidateRegistryCoverage(graph, config);\n\tconst name = args.name ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliError(\"The root node has no name — name it at authoring, or pass --name.\");\n\tlet assembled;\n\ttry {\n\t\tassembled = await assembleServices(graph, config, cwd, deps.runAssembler);\n\t} catch (error) {\n\t\tif (args.command === \"destroy\" && error instanceof Error) throw new CliError(`${error.message}\\n\\ndestroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first. Run the build, then retry the destroy.`);\n\t\tthrow error;\n\t}\n\tconst { projectId, branchId } = await (deps.ensureContainers ?? ensureContainers)({\n\t\tcommand: args.command,\n\t\tappName: name,\n\t\tstage\n\t});\n\tif (args.command === \"deploy\") for (const extension of config.extensions) {\n\t\tif (extension.preflight === void 0) continue;\n\t\ttry {\n\t\t\tawait extension.preflight({\n\t\t\t\tgraph,\n\t\t\t\tprojectId,\n\t\t\t\tbranchId,\n\t\t\t\tstage\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthrow error instanceof CliError ? error : new CliError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst stackPath = writeStackFile({\n\t\tentryPath: entryModule.path,\n\t\tcwd,\n\t\tconfigPath,\n\t\tname,\n\t\tassembled\n\t});\n\ttry {\n\t\tconst status = (deps.alchemy ?? runAlchemy)({\n\t\t\tcommand: args.command,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage,\n\t\t\tprojectId,\n\t\t\t...branchId !== void 0 ? { branchId } : {}\n\t\t});\n\t\tif (status !== 0) {\n\t\t\tconsole.error(`\\nGenerated stack file: ${stackPath}`);\n\t\t\tconsole.error(`Run \\`alchemy ${args.command} ${GENERATED_STACK_RELATIVE_PATH} --yes\\` from ${cwd} to reproduce this directly.`);\n\t\t\treturn status;\n\t\t}\n\t\tif (args.command === \"destroy\" && branchId !== void 0) await (deps.deleteBranch ?? ((input) => deleteStageBranch(input)))({ branchId });\n\t\treturn status;\n\t} catch (error) {\n\t\tconsole.error(`\\nGenerated stack file: ${stackPath}`);\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/cli.ts\n/**\n* Run the `prisma-composer` CLI end to end: dispatch `argv`, map errors to exit\n* codes. Shared by this package's `bin` and the unscoped `prisma-composer` launcher.\n*/\nasync function cli(argv = process.argv.slice(2)) {\n\ttry {\n\t\tprocess.exitCode = await run(argv);\n\t} catch (error) {\n\t\tif (error instanceof UsageError) {\n\t\t\tconsole.error(error.message);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\t\tconsole.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n\t\tprocess.exitCode = 1;\n\t}\n}\n//#endregion\nexport { loadEntry as a, CliError as c, runAlchemy as i, run as n, renderStackFile as o, resolveAlchemyBin as r, writeStackFile as s, cli as t };\n\n//# sourceMappingURL=cli-BGF4efRK.mjs.map","#!/usr/bin/env node\nimport { t as cli } from \"./cli-BGF4efRK.mjs\";\n//#region src/bin.ts\ncli();\n//#endregion\nexport {};\n\n//# sourceMappingURL=bin.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAI,gBAAgB,cAAc,MAAM;CACvC,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,4CAA4C,CAAC,8BAA8B;;;;;;;AASjF,SAAS,qBAAqB,QAA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O;CACR,SAAS,OAAO;EACf,QAAQ,MAAM,2BAA2B,WAAW;EACpD,MAAM;CACP;AACD;;;;;AAOA,eAAe,IAAI,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG;CAChD,IAAI;EACH,QAAQ,WAAW,MAAM,IAAI,IAAI;CAClC,SAAS,OAAO;EACf,IAAI,iBAAiB,YAAY;GAChC,QAAQ,MAAM,MAAM,OAAO;GAC3B,QAAQ,WAAW;GACnB;EACD;EACA,QAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;EAChF,QAAQ,WAAW;CACpB;AACD;;;ACldA,IAAI"}
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../../../0-framework/3-tooling/assemble/dist/index.mjs","../../../0-framework/0-foundation/foundation/dist/casts.mjs","../../../0-framework/1-core/core/dist/graph-BmrUEdo9.mjs","../../../0-framework/1-core/core/dist/index.mjs","../../../0-framework/1-core/core/dist/container-transport-DKmKg5JQ.mjs","../../../0-framework/3-tooling/cli/dist/cli-Bc6_i0ls.mjs","../../../0-framework/3-tooling/cli/dist/bin.mjs"],"sourcesContent":["//#region src/assemble-error.ts\n/**\n* A user-facing assembly failure with a message that already names the fix\n* (mirrors @internal/cli's CliError contract). This package must not import\n* CliError — its second consumer is the future programmatic deploy API, not\n* just the CLI — so it throws its own typed error; the CLI maps it (or lets\n* it propagate, since bin.ts already treats every Error uniformly: print the\n* message, exit nonzero).\n*/\nvar AssembleError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"AssembleError\";\n\t}\n};\n//#endregion\n//#region src/assemble-services.ts\n/**\n* The registry route for one service's build: extension by\n* `build.extension`, node descriptor by `build.type`, kind must be \"build\".\n* The CLI's coverage validation reports the same misses earlier with the\n* config fix; these errors are the backstop for programmatic callers.\n*/\nfunction buildDescriptorAssemble(config, node, address, cwd) {\n\tconst { extension, type } = node.build;\n\tconst extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);\n\tif (extensionDescriptor === void 0) throw new AssembleError(`No extension \"${extension}\" is configured (needed by service \"${node.name}\"'s build) — add it to prisma-composer.config.ts's \\`extensions\\`.`);\n\tconst nodeDescriptor = extensionDescriptor.nodes[type];\n\tif (nodeDescriptor === void 0) throw new AssembleError(`Extension \"${extension}\" has no descriptor for build type \"${type}\" (known: ${Object.keys(extensionDescriptor.nodes).join(\", \")}).`);\n\tif (nodeDescriptor.kind !== \"build\") throw new AssembleError(`Extension \"${extension}\"'s descriptor for type \"${type}\" is a \"${nodeDescriptor.kind}\" descriptor — assembling a service build needs a \"build\" descriptor.`);\n\treturn nodeDescriptor.assemble({\n\t\tbuild: node.build,\n\t\taddress,\n\t\tcwd\n\t});\n}\nasync function assembleServices(graph, config, cwd, run) {\n\tconst runAssembler = run ?? ((node, address, nodeCwd) => buildDescriptorAssemble(config, node, address, nodeCwd));\n\tconst serviceNodes = graph.nodes.filter((n) => n.node.kind === \"service\");\n\tif (serviceNodes.length === 0) throw new AssembleError(\"The loaded graph has no service to assemble.\");\n\tconst bundles = {};\n\tfor (const { id, node } of serviceNodes) bundles[id] = await runAssembler(node, id, cwd);\n\treturn { bundles };\n}\n//#endregion\nexport { AssembleError, assembleServices };\n\n//# sourceMappingURL=index.mjs.map","//#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 { blindCast, castAs };\n\n//# sourceMappingURL=casts.mjs.map","import { blindCast } from \"@internal/foundation/casts\";\n//#region src/graph-types.ts\n/** Thrown by Load when the graph is malformed. */\nvar LoadError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LoadError\";\n\t}\n};\n//#endregion\n//#region src/node.ts\n/**\n* Core model: node types and the factories that construct them, plain frozen\n* data objects. A node's `extension` + `type` form its deploy-time registry key (ADR-0017).\n*/\nconst NODE = Symbol.for(\"prisma:node\");\nconst SECRET_NEED = blindCast(Symbol.for(\"prisma:secret-need\"));\nconst SECRET_SOURCE = blindCast(Symbol.for(\"prisma:secret-source\"));\n/** Declares a secret NEED. Nameless — the platform name is bound at the root via `envSecret`. */\nfunction secret() {\n\treturn Object.freeze({\n\t\t[SECRET_NEED]: true,\n\t\tkind: \"secret\"\n\t});\n}\n/** Builds an opaque secret source from a target-defined payload — the SPI a deploy target's own source constructor (e.g. `envSecret`) calls. Core forwards the source and never inspects the payload. */\nfunction secretSource(payload) {\n\treturn Object.freeze({\n\t\t[SECRET_SOURCE]: true,\n\t\tpayload\n\t});\n}\n/** True if `value` is a secret source (an `envSecret` result or a forwarded ctx.secrets ref). */\nfunction isSecretSource(value) {\n\treturn typeof value === \"object\" && value !== null && blindCast(value)[SECRET_SOURCE] === true;\n}\nconst PROVISION_NEED = blindCast(Symbol.for(\"prisma:provision-need\"));\n/** Builds an opaque provisioning need — the declaring package's own brand plus whatever payload its provisioner reads back. */\nfunction provisionNeed(brand, payload) {\n\treturn blindCast(Object.freeze({\n\t\t[PROVISION_NEED]: true,\n\t\tbrand,\n\t\tpayload\n\t}));\n}\n/** True if `value` is a provisioning need (a `provisionNeed()` result). */\nfunction isProvisionNeed(value) {\n\treturn typeof value === \"object\" && value !== null && blindCast(value)[PROVISION_NEED] === true;\n}\nconst PARAM_SOURCE = blindCast(Symbol.for(\"prisma:param-source\"));\nconst PARAM_NEED = blindCast(Symbol.for(\"prisma:param-need\"));\n/** Builds an opaque param source from a target-defined payload — the SPI a deploy target's own source constructor (e.g. `envParam`) calls. Core forwards the source and never inspects the payload. */\nfunction paramSource(payload) {\n\treturn Object.freeze({\n\t\t[PARAM_SOURCE]: true,\n\t\tpayload\n\t});\n}\n/** True if `value` is a param source (an `envParam` result or a forwarded ctx.params ref). */\nfunction isParamSource(value) {\n\treturn typeof value === \"object\" && value !== null && blindCast(value)[PARAM_SOURCE] === true;\n}\n/** Declares a module param-forwarding NEED. Nameless — bound to a `ParamSource` by an enclosing scope and forwarded into a child's real param. */\nfunction paramNeed() {\n\treturn Object.freeze({\n\t\t[PARAM_NEED]: true,\n\t\tkind: \"param\"\n\t});\n}\nfunction requireType(type, factory) {\n\tif (typeof type !== \"string\" || type.length === 0) throw new Error(`${factory}() requires a non-empty node type.`);\n}\nfunction requireName(name, factory) {\n\tif (typeof name !== \"string\" || name.length === 0) throw new Error(`${factory}() requires a non-empty name.`);\n}\nfunction requireExtension(extension, factory) {\n\tif (typeof extension !== \"string\" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);\n}\n/**\n* Config keys join address/input/param names with \"_\" and uppercase — an\n* underscore inside a name would collide with that separator (e.g. param\n* \"db_url\" vs input \"db\"'s param \"url\" both hitting env key \"DB_URL\").\n*/\nfunction requireNoUnderscoreName(name, kind, factory) {\n\tif (name.includes(\"_\")) throw new Error(`${factory}() ${kind} name \"${name}\" may not contain \"_\" — config keys join names with \"_\" as the separator (e.g. an input \"db\"'s param \"url\" becomes env key \"DB_URL\"), so an underscore inside a name would collide with that separator.`);\n}\nfunction requireNoUnderscoreNames(names, kind, factory) {\n\tfor (const name of names) requireNoUnderscoreName(name, kind, factory);\n}\nfunction freezeParams(params) {\n\tconst frozen = {};\n\tfor (const [name, param] of Object.entries(params)) frozen[name] = Object.freeze({ ...param });\n\treturn Object.freeze(frozen);\n}\nfunction freezeSecrets(secrets) {\n\tconst frozen = {};\n\tfor (const [name, need] of Object.entries(secrets)) frozen[name] = Object.freeze({ ...need });\n\treturn blindCast(Object.freeze(frozen));\n}\n/** A frozen shallow copy that keeps the caller's declared type. */\nfunction frozenShallowCopy(obj) {\n\treturn blindCast(Object.freeze({ ...obj }));\n}\n/**\n* Seals a node instance after its constructor has assigned all fields — the\n* last statement of a concrete node class's constructor. A free function, not\n* a base-class method, so an instance stays structurally a plain frozen node.\n*/\nfunction freezeNode(node) {\n\tObject.freeze(node);\n\treturn node;\n}\n/**\n* Everything `resource()` establishes, minus the freeze — an extension\n* whose resource node carries extra fields extends this, assigns them, and\n* calls `freezeNode(this)` as its constructor's last statement.\n*/\nvar ResourceNodeBase = class {\n\t[NODE] = true;\n\tkind = \"resource\";\n\tname;\n\textension;\n\ttype;\n\tprovides;\n\tconstructor(def) {\n\t\trequireName(def.name, \"resource\");\n\t\trequireExtension(def.extension, \"resource\");\n\t\tconst provides = def.provides;\n\t\tif (typeof provides !== \"object\" || provides === null || typeof provides.kind !== \"string\" || provides.kind.length === 0 || typeof provides.satisfies !== \"function\") throw new Error(\"resource() requires `provides` — the Contract this resource offers (a non-empty `kind` plus its `satisfies()`).\");\n\t\tthis.name = def.name;\n\t\tthis.extension = def.extension;\n\t\tthis.type = provides.kind;\n\t\tthis.provides = provides;\n\t}\n};\n/** The core leaf: exactly the base, frozen. */\nvar FrozenResourceNode = class extends ResourceNodeBase {\n\tconstructor(def) {\n\t\tsuper(def);\n\t\tfreezeNode(this);\n\t}\n};\n/**\n* Constructs a branded, frozen Resource node — an identity plus the Contract\n* it provides; the routing `type` is the contract's `kind`. Pure — nothing\n* is provisioned until a module provisions it.\n*/\nfunction resource(def) {\n\treturn new FrozenResourceNode(def);\n}\n/**\n* Constructs a branded, frozen Service node — declarations only (inputs,\n* params, build adapter, and the ports it exposes). Pure; carries no runtime behavior.\n*/\nfunction service(def) {\n\trequireName(def.name, \"service\");\n\trequireExtension(def.extension, \"service\");\n\trequireType(def.type, \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.inputs), \"input\", \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.params), \"param\", \"service\");\n\trequireNoUnderscoreNames(Object.keys(def.secrets ?? {}), \"secret\", \"service\");\n\tfor (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.`);\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"service\",\n\t\tname: def.name,\n\t\textension: def.extension,\n\t\ttype: def.type,\n\t\tinputs: frozenShallowCopy(def.inputs),\n\t\tparams: freezeParams(def.params),\n\t\tsecretSlots: freezeSecrets(def.secrets ?? blindCast({})),\n\t\tbuild: Object.freeze({ ...def.build }),\n\t\texpose: def.expose !== void 0 ? frozenShallowCopy(def.expose) : void 0\n\t});\n}\n/**\n* Constructs a branded, frozen DependencyEnd. `required` (if given) is the\n* contract Load compares a wired ref against via `satisfies()`; an unnamed\n* end's diagnostic `name` falls back to its `type`.\n*/\nfunction dependency(def) {\n\trequireType(def.type, \"dependency\");\n\trequireNoUnderscoreNames(Object.keys(def.connection.params), \"param\", \"dependency\");\n\tconst connection = Object.freeze({\n\t\tparams: freezeParams(def.connection.params),\n\t\thydrate: def.connection.hydrate\n\t});\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"dependency\",\n\t\tname: def.name !== void 0 && def.name.length > 0 ? def.name : def.type,\n\t\ttype: def.type,\n\t\tconnection,\n\t\trequired: def.required\n\t});\n}\n/**\n* Constructs a branded, frozen Module node. Construction is INERT — the body is\n* wiring, not user code, and runs only when the module is Loaded.\n*/\nfunction module(name, boundaryOrBody, maybeBody) {\n\trequireName(name, \"module\");\n\tconst closedRoot = typeof boundaryOrBody === \"function\";\n\tconst boundary = closedRoot ? {} : boundaryOrBody;\n\tconst deps = frozenShallowCopy(boundary.deps ?? {});\n\tconst secretSlots = frozenShallowCopy(boundary.secrets ?? {});\n\tconst paramSlots = frozenShallowCopy(boundary.params ?? {});\n\tconst expose = frozenShallowCopy(boundary.expose ?? {});\n\tconst body = closedRoot ? (ctx) => {\n\t\tboundaryOrBody(ctx);\n\t\treturn {};\n\t} : maybeBody;\n\treturn Object.freeze({\n\t\t[NODE]: true,\n\t\tkind: \"module\",\n\t\tname,\n\t\tdeps,\n\t\tsecretSlots,\n\t\tparamSlots,\n\t\texpose,\n\t\tbody\n\t});\n}\n/**\n* True if `value` was constructed by this module's factories. Checks the\n* brand only, never a prototype — a graph may mix nodes from a different\n* installed copy of core (dual-package hazard).\n*/\nfunction isNode(value) {\n\treturn typeof value === \"object\" && value !== null && value[NODE] === true;\n}\n//#endregion\n//#region src/toposort.ts\n/**\n* Stable topological sort: every edge's `from` precedes its `to` in the\n* result. Ties (nodes with no ordering constraint between them) keep their\n* relative order from `nodes` — so a graph already authored producer-first\n* comes out byte-identical to its pre-sort layout; only a graph that\n* genuinely needs reordering (e.g. a module wired via a forged ref pointing at a\n* not-yet-provisioned producer) actually moves. A Kahn's-algorithm variant\n* that always picks the ready node with the smallest original index. Edges\n* whose endpoint falls outside `nodes` (e.g. a service-root's input edges\n* targeting the root, which is appended separately) are ignored. Cycles\n* cannot reach here: `assertDependencyDag` already rejects them for\n* dependency edges, and input edges never cycle.\n*/\nfunction topoSort(nodes, edges) {\n\tconst byId = new Map(nodes.map((n) => [n.id, n]));\n\tconst indexOf = new Map(nodes.map((n, i) => [n.id, i]));\n\tconst indegree = new Map(nodes.map((n) => [n.id, 0]));\n\tconst successors = /* @__PURE__ */ new Map();\n\tfor (const edge of edges) {\n\t\tif (!byId.has(edge.from) || !byId.has(edge.to)) continue;\n\t\tconst targets = successors.get(edge.from) ?? [];\n\t\ttargets.push(edge.to);\n\t\tsuccessors.set(edge.from, targets);\n\t\tindegree.set(edge.to, (indegree.get(edge.to) ?? 0) + 1);\n\t}\n\tconst ready = new Set(nodes.filter((n) => indegree.get(n.id) === 0).map((n) => n.id));\n\tconst order = [];\n\twhile (ready.size > 0) {\n\t\tlet next;\n\t\tlet bestIndex = Number.POSITIVE_INFINITY;\n\t\tfor (const id of ready) {\n\t\t\tconst index = indexOf.get(id) ?? Number.POSITIVE_INFINITY;\n\t\t\tif (index < bestIndex) {\n\t\t\t\tbestIndex = index;\n\t\t\t\tnext = id;\n\t\t\t}\n\t\t}\n\t\tif (next === void 0) break;\n\t\tready.delete(next);\n\t\torder.push(next);\n\t\tfor (const target of successors.get(next) ?? []) {\n\t\t\tconst remaining = (indegree.get(target) ?? 0) - 1;\n\t\t\tindegree.set(target, remaining);\n\t\t\tif (remaining === 0) ready.add(target);\n\t\t}\n\t}\n\tif (order.length !== nodes.length) throw new LoadError(`topological sort processed ${order.length} of ${nodes.length} nodes — the graph contains a cycle that slipped past the DAG validation.`);\n\treturn order.map((id) => byId.get(id)).filter((n) => n !== void 0);\n}\n//#endregion\n//#region src/load-service.ts\nfunction serviceInputs(service, serviceId) {\n\tif (typeof service.inputs !== \"object\" || service.inputs === null) throw new LoadError(`Service \"${serviceId}\" has no inputs map.`);\n\tconst nodes = [];\n\tconst edges = [];\n\tfor (const [input, value] of Object.entries(service.inputs)) {\n\t\tconst kind = isNode(value) ? value.kind : void 0;\n\t\tif (kind === \"resource\") throw new LoadError(`Input \"${input}\" of \"${serviceId}\" is a resource node — a resource is provisioned by the composing module, never created for a service that mentions it. Declare the input as a dependency (the pack's dependency factory) and wire the module-provisioned resource's ref into it.`);\n\t\tif (kind !== \"dependency\") throw new LoadError(`Input \"${input}\" of \"${serviceId}\" is not a branded dependency end (construct it with the dependency() factory).`);\n\t\tif (value.type.length === 0) throw new LoadError(`Input \"${input}\" of \"${serviceId}\" has an empty node type.`);\n\t\tconst id = `${serviceId}.${input}`;\n\t\tnodes.push({\n\t\t\tid,\n\t\t\tnode: value\n\t\t});\n\t\tedges.push({\n\t\t\tfrom: id,\n\t\t\tto: serviceId,\n\t\t\tinput,\n\t\t\tkind: \"input\"\n\t\t});\n\t}\n\treturn {\n\t\tnodes,\n\t\tedges\n\t};\n}\nfunction loadService(root, rootId) {\n\tfor (const [input, value] of Object.entries(root.inputs)) if (isNode(value) && value.kind === \"dependency\") throw new LoadError(`Service \"${rootId}\" has an unwired dependency input \"${input}\" — this service is composed by a module; deploy the module instead of loading \"${rootId}\" directly.`);\n\tconst secretSlots = Object.keys(root.secretSlots);\n\tif (secretSlots.length > 0) {\n\t\tconst names = secretSlots.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Service \"${rootId}\" declares secret slot${secretSlots.length > 1 ? \"s\" : \"\"} ${names} but is being loaded directly — a lone service has no enclosing scope to bind them. Compose it inside a module that binds each with envSecret('NAME').`);\n\t}\n\tconst rootGraphNode = {\n\t\tid: rootId,\n\t\tnode: root\n\t};\n\tconst { nodes, edges } = serviceInputs(root, rootId);\n\treturn {\n\t\troot: rootGraphNode,\n\t\tnodes: [...topoSort(nodes, edges), rootGraphNode],\n\t\tedges,\n\t\tsecrets: [],\n\t\tparams: []\n\t};\n}\n//#endregion\n//#region src/load-module.ts\n/**\n* Builds the ref a provision() call hands back: the id (so a producer with no\n* exposed ports — or an untyped slot — can still be wired wholesale) plus one\n* ref-port per exposed contract, each the contract's own runtime value (so\n* its `satisfies()` still works) tagged with the provider's id.\n*/\nfunction refFor(id, service) {\n\tconst ports = {};\n\tfor (const [port, contract] of Object.entries(service.expose ?? {})) ports[port] = {\n\t\t...contract,\n\t\t__providerId: id\n\t};\n\treturn blindCast({\n\t\tid,\n\t\t...ports\n\t});\n}\n/**\n* The resource variant of refFor: a resource has exactly one port — the\n* contract it provides — flattened onto the ref itself, tagged with the\n* provider id. `id` is written last so a hostile contract value cannot\n* clobber it.\n*/\nfunction refForResource(id, resource) {\n\treturn blindCast({\n\t\t...resource.provides,\n\t\t__providerId: id,\n\t\tid\n\t});\n}\n/** A wired value's producer id: a ref-port's `__providerId`, or a bare ref's `id`. */\nfunction producerIdOf(ref) {\n\tif (typeof ref !== \"object\" || ref === null) return void 0;\n\tif (\"__providerId\" in ref && typeof ref.__providerId === \"string\") return ref.__providerId;\n\tif (\"id\" in ref && typeof ref.id === \"string\") return ref.id;\n}\n/**\n* Brands each `ctx.inputs` entry with the input key it stands for (see\n* flatten): diagnostic only — usage attribution relies on the per-key object\n* identity the branding copy creates, never on reading this back.\n*/\nconst MODULE_INPUT_KEY = Symbol(\"prisma:module-input-key\");\n/** Same per-key identity trick as MODULE_INPUT_KEY, for the parallel `ctx.secrets` forwarding channel. */\nconst MODULE_SECRET_KEY = Symbol(\"prisma:module-secret-key\");\n/** Same per-key identity trick as MODULE_INPUT_KEY, for the parallel `ctx.params` forwarding channel. */\nconst MODULE_PARAM_KEY = Symbol(\"prisma:module-param-key\");\n/** Whether `ref` carries a callable `satisfies` that accepts `required` truthily. */\nfunction satisfiesRequired(ref, required) {\n\treturn typeof ref === \"object\" && ref !== null && \"satisfies\" in ref && typeof ref.satisfies === \"function\" && ref.satisfies(required);\n}\n/**\n* Checks one recorded `wiring` object against the Deps it was wired against:\n* every named input exists and is a dependency slot, every referenced\n* producer is a real (by-now-provisioned) address, and a wired ref whose\n* slot declares a required contract must satisfy() it — no producer-kind\n* branching, the contract alone determines validity, whether the producer is\n* a service port or a resource. Shared by both provisioned kinds so a\n* module-as-child gets exactly the checks a service gets, and run once per\n* entry against the one `byId` shared by the whole recursive flatten, so a\n* forwarded ref resolves through to its real producer address regardless of\n* which ancestor scope provisioned it.\n*/\nfunction validateWiring(pending, byId) {\n\tconst { deps, wiring, targetId, targetKind, enclosingModuleName } = pending;\n\tfor (const [input, ref] of Object.entries(wiring)) {\n\t\tconst declared = blindCast(deps[input]);\n\t\tif (declared === void 0 || !isNode(declared) || declared.kind !== \"dependency\") throw new LoadError(`The deps for \"${targetId}\" name \"${input}\", which is not a dependency slot of that ${targetKind}.`);\n\t\tconst producerId = producerIdOf(ref);\n\t\tconst producer = producerId !== void 0 ? byId.get(producerId) : void 0;\n\t\tif (producerId === void 0 || producer === void 0) throw new LoadError(`The deps for \"${targetId}.${input}\" reference \"${String(producerId)}\", which is not provisioned in module \"${enclosingModuleName}\".`);\n\t\tconst required = declared.required;\n\t\tif (required !== void 0 && !satisfiesRequired(ref, required)) throw new LoadError(`The deps for \"${targetId}.${input}\" do not satisfy the slot's required contract.`);\n\t}\n\tfor (const [input, rawValue] of Object.entries(deps)) {\n\t\tconst value = blindCast(rawValue);\n\t\tif (!isNode(value) || wiring[input] !== void 0) continue;\n\t\tif (value.kind === \"dependency\") throw new LoadError(`Dependency input \"${input}\" of provisioned ${targetKind} \"${targetId}\" is not wired to a producer (module \"${enclosingModuleName}\").`);\n\t}\n}\n/** The (unvalidated) edges a `wiring` object implies — one dependency edge per entry; `validateWiring` does the real checking. */\nfunction wiringEdges(wiring, targetId) {\n\treturn Object.entries(wiring).map(([input, ref]) => ({\n\t\tfrom: producerIdOf(ref) ?? \"\",\n\t\tto: targetId,\n\t\tinput,\n\t\tkind: \"dependency\"\n\t}));\n}\n/**\n* Checks the secrets wired into one provisioned child: every declared slot is\n* bound to a real secret source (an `envSecret` or a forwarded ctx.secrets\n* ref), and no wired key names a slot the child doesn't declare — the secret\n* analog of `validateWiring`'s per-input checks, but resolved inline (a source\n* carries its own name, so no whole-graph pass is needed).\n*/\nfunction validateSecretBinding(child, id, secretWiring, enclosingModuleName) {\n\tconst { kind } = child;\n\tfor (const slot of Object.keys(child.secretSlots)) {\n\t\tconst bound = secretWiring[slot];\n\t\tif (bound === void 0) throw new LoadError(`Secret slot \"${slot}\" of provisioned ${kind} \"${id}\" is not bound (module \"${enclosingModuleName}\") — bind it with envSecret('NAME') or forward ctx.secrets.`);\n\t\tif (!isSecretSource(bound)) throw new LoadError(`Secret slot \"${slot}\" of \"${id}\" (module \"${enclosingModuleName}\") was wired with a non-secret value — use envSecret('NAME') or a forwarded ctx.secrets ref.`);\n\t}\n\tfor (const slot of Object.keys(secretWiring)) if (!Object.hasOwn(child.secretSlots, slot)) throw new LoadError(`The secrets for \"${id}\" name \"${slot}\", which is not a secret slot of that ${kind} (module \"${enclosingModuleName}\").`);\n}\n/**\n* Checks the params wired into a provisioned SERVICE: unlike a secret slot, a\n* declared param is never required to be bound here — it may fall back to its\n* own `default` (checked later, at `buildConfig`) — so this only rejects a\n* wired key that names something other than a real declared param.\n*/\nfunction validateServiceParamBinding(child, id, paramWiring, enclosingModuleName) {\n\tfor (const slot of Object.keys(paramWiring)) if (!Object.hasOwn(child.params, slot)) throw new LoadError(`The params for \"${id}\" name \"${slot}\", which is not a param of that service (module \"${enclosingModuleName}\").`);\n}\n/**\n* Checks the params wired into a provisioned MODULE: every declared\n* param-forwarding slot must be bound to a real `ParamSource` — a slot has no\n* schema of its own, so (unlike a service param) it cannot fall back to a\n* literal or a default; the param analog of `validateSecretBinding`.\n*/\nfunction validateParamNeedBinding(child, id, paramWiring, enclosingModuleName) {\n\tfor (const slot of Object.keys(child.paramSlots)) {\n\t\tconst bound = paramWiring[slot];\n\t\tif (bound === void 0) throw new LoadError(`Param slot \"${slot}\" of provisioned module \"${id}\" is not bound (module \"${enclosingModuleName}\") — bind it with a param source (e.g. envParam('NAME')) or forward ctx.params.`);\n\t\tif (!isParamSource(bound)) throw new LoadError(`Param slot \"${slot}\" of \"${id}\" (module \"${enclosingModuleName}\") was wired with a non-source value — a module param-forwarding slot carries no schema to validate a literal against; use envParam('NAME') or a forwarded ctx.params ref.`);\n\t}\n\tfor (const slot of Object.keys(paramWiring)) if (!Object.hasOwn(child.paramSlots, slot)) throw new LoadError(`The params for \"${id}\" name \"${slot}\", which is not a param slot of that module (module \"${enclosingModuleName}\").`);\n}\n/**\n* Recursively flattens one module's body into the shared graph state and\n* returns its resolved ModuleOutputs (one ref-port per expose key) for the\n* caller (the enclosing provision() call, or Load itself for the root) to\n* use. `address` is this module's OWN full address, or `undefined` for the root\n* scope — its direct children then get bare (unprefixed) addresses, keeping\n* a single-level module identical to before nesting existed. `wiring` supplies a\n* resolved producer ref-port for each of this module's OWN declared deps (empty\n* for the root, which may not declare any — see the root non-empty-deps\n* check in loadModule). `nodes`, `edges`, `pending`, and `byId` are shared\n* across the ENTIRE recursive flatten, not per scope — a nested module may\n* forward in a producer provisioned by an ancestor scope, and it is the\n* shared `byId` (keyed by full address) that lets that resolve.\n*/\nfunction flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes, edges, pending, secretBindings, paramBindings, byId) {\n\tconst localIds = /* @__PURE__ */ new Set();\n\tconst used = /* @__PURE__ */ new Set();\n\tconst usedSecrets = /* @__PURE__ */ new Set();\n\tconst usedParams = /* @__PURE__ */ new Set();\n\tconst ctxInputs = {};\n\tfor (const key of Object.keys(moduleNode.deps)) {\n\t\tconst wired = wiring[key];\n\t\tctxInputs[key] = typeof wired === \"object\" && wired !== null ? {\n\t\t\t...wired,\n\t\t\t[MODULE_INPUT_KEY]: key\n\t\t} : wired;\n\t}\n\tconst markUsed = (values) => {\n\t\tfor (const value of Object.values(values)) for (const key of Object.keys(ctxInputs)) if (value === ctxInputs[key]) used.add(key);\n\t};\n\tconst ctxSecrets = {};\n\tfor (const key of Object.keys(moduleNode.secretSlots)) {\n\t\tconst bound = secretWiring[key];\n\t\tctxSecrets[key] = typeof bound === \"object\" && bound !== null ? {\n\t\t\t...bound,\n\t\t\t[MODULE_SECRET_KEY]: key\n\t\t} : bound;\n\t}\n\tconst markSecretsUsed = (values) => {\n\t\tfor (const value of Object.values(values)) for (const key of Object.keys(ctxSecrets)) if (value === ctxSecrets[key]) usedSecrets.add(key);\n\t};\n\tconst ctxParams = {};\n\tfor (const key of Object.keys(moduleNode.paramSlots)) {\n\t\tconst bound = paramWiring[key];\n\t\tctxParams[key] = typeof bound === \"object\" && bound !== null ? {\n\t\t\t...bound,\n\t\t\t[MODULE_PARAM_KEY]: key\n\t\t} : bound;\n\t}\n\tconst markParamsUsed = (values) => {\n\t\tfor (const value of Object.values(values)) for (const key of Object.keys(ctxParams)) if (value === ctxParams[key]) usedParams.add(key);\n\t};\n\tconst provision = (child, opts) => {\n\t\tconst id = opts?.id ?? child.name;\n\t\tconst provisionWiring = opts?.deps;\n\t\tconst provisionSecrets = opts?.secrets;\n\t\tconst provisionParams = opts?.params;\n\t\tif (typeof id !== \"string\" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module \"${moduleNode.name}\").`);\n\t\tif (id.includes(\"_\") || id.includes(\".\")) throw new LoadError(`provision() id \"${id}\" (module \"${moduleNode.name}\") may not contain \"_\" or \".\" — \"_\" is the config-key separator and \".\" the node-id path separator; either inside an id collides with the joined form of other names.`);\n\t\tif (localIds.has(id)) throw new LoadError(`Duplicate provision id \"${id}\" in module \"${moduleNode.name}\".`);\n\t\tconst untrusted = child;\n\t\tif (!isNode(untrusted) || untrusted.kind !== \"service\" && untrusted.kind !== \"resource\" && untrusted.kind !== \"module\") throw new LoadError(`provision(\"${id}\") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);\n\t\tlocalIds.add(id);\n\t\tconst fullAddress = address === void 0 ? id : `${address}.${id}`;\n\t\tif (child.kind === \"resource\") {\n\t\t\tif (provisionWiring !== void 0) throw new LoadError(`provision(\"${id}\") received deps for a resource — a resource has no dependency slots to satisfy.`);\n\t\t\tif (provisionSecrets !== void 0) throw new LoadError(`provision(\"${id}\") received secrets for a resource — a resource has no secret slots to satisfy.`);\n\t\t\tif (provisionParams !== void 0) throw new LoadError(`provision(\"${id}\") received params for a resource — a resource has no params to satisfy.`);\n\t\t\tif (child.type.length === 0) throw new LoadError(`provision(\"${id}\") received a resource with an empty node type.`);\n\t\t\tbyId.set(fullAddress, child);\n\t\t\tnodes.push({\n\t\t\t\tid: fullAddress,\n\t\t\t\tnode: child\n\t\t\t});\n\t\t\treturn refForResource(fullAddress, child);\n\t\t}\n\t\tconst localWiring = { ...provisionWiring ?? {} };\n\t\tmarkUsed(localWiring);\n\t\tconst localSecrets = { ...provisionSecrets ?? {} };\n\t\tmarkSecretsUsed(localSecrets);\n\t\tvalidateSecretBinding(child, id, localSecrets, moduleNode.name);\n\t\tconst localParams = { ...provisionParams ?? {} };\n\t\tmarkParamsUsed(localParams);\n\t\tif (child.kind === \"service\") {\n\t\t\tfor (const slot of Object.keys(child.secretSlots)) {\n\t\t\t\tconst bound = localSecrets[slot];\n\t\t\t\tif (isSecretSource(bound)) secretBindings.push({\n\t\t\t\t\tserviceAddress: fullAddress,\n\t\t\t\t\tslot,\n\t\t\t\t\tsource: bound\n\t\t\t\t});\n\t\t\t}\n\t\t\tvalidateServiceParamBinding(child, id, localParams, moduleNode.name);\n\t\t\tfor (const [slot, binding] of Object.entries(localParams)) paramBindings.push({\n\t\t\t\tserviceAddress: fullAddress,\n\t\t\t\tslot,\n\t\t\t\tbinding\n\t\t\t});\n\t\t\tconst inputs = serviceInputs(child, fullAddress);\n\t\t\tnodes.push(...inputs.nodes, {\n\t\t\t\tid: fullAddress,\n\t\t\t\tnode: child\n\t\t\t});\n\t\t\tedges.push(...inputs.edges, ...wiringEdges(localWiring, fullAddress));\n\t\t\tpending.push({\n\t\t\t\tdeps: child.inputs,\n\t\t\t\twiring: localWiring,\n\t\t\t\ttargetId: fullAddress,\n\t\t\t\ttargetKind: \"service\",\n\t\t\t\tenclosingModuleName: moduleNode.name\n\t\t\t});\n\t\t\tbyId.set(fullAddress, child);\n\t\t\treturn refFor(fullAddress, child);\n\t\t}\n\t\tvalidateParamNeedBinding(child, id, localParams, moduleNode.name);\n\t\tedges.push(...wiringEdges(localWiring, fullAddress));\n\t\tpending.push({\n\t\t\tdeps: child.deps,\n\t\t\twiring: localWiring,\n\t\t\ttargetId: fullAddress,\n\t\t\ttargetKind: \"module\",\n\t\t\tenclosingModuleName: moduleNode.name\n\t\t});\n\t\tconst childOutputs = flatten(child, fullAddress, localWiring, localSecrets, localParams, nodes, edges, pending, secretBindings, paramBindings, byId);\n\t\tnodes.push({\n\t\t\tid: fullAddress,\n\t\t\tnode: child\n\t\t});\n\t\tbyId.set(fullAddress, child);\n\t\treturn blindCast({\n\t\t\tid: fullAddress,\n\t\t\t...childOutputs\n\t\t});\n\t};\n\tconst ctx = blindCast({\n\t\tinputs: ctxInputs,\n\t\tsecrets: ctxSecrets,\n\t\tparams: ctxParams,\n\t\tprovision: blindCast(provision)\n\t});\n\tconst outputs = blindCast(moduleNode.body(ctx) ?? {});\n\tmarkUsed(outputs);\n\tfor (const key of Object.keys(moduleNode.deps)) if (!used.has(key)) throw new LoadError(`Module \"${moduleNode.name}\" declares input \"${key}\" but never forwards it into a provision nor returns it as an output.`);\n\tfor (const key of Object.keys(moduleNode.secretSlots)) if (!usedSecrets.has(key)) throw new LoadError(`Module \"${moduleNode.name}\" declares secret \"${key}\" but never forwards it into a provision.`);\n\tfor (const key of Object.keys(moduleNode.paramSlots)) if (!usedParams.has(key)) throw new LoadError(`Module \"${moduleNode.name}\" declares param \"${key}\" but never forwards it into a provision.`);\n\tfor (const [key, contract] of Object.entries(moduleNode.expose)) {\n\t\tconst port = outputs[key];\n\t\tif (port === void 0) throw new LoadError(`Module \"${moduleNode.name}\" declares expose \"${key}\" but its body did not return a port for it.`);\n\t\tif (!satisfiesRequired(port, contract)) throw new LoadError(`Module \"${moduleNode.name}\"'s returned port for expose \"${key}\" does not satisfy its declared contract.`);\n\t}\n\treturn outputs;\n}\nfunction loadModule(root, opts) {\n\tconst rootId = opts?.id ?? root.name;\n\tconst rootDepKeys = Object.keys(root.deps);\n\tif (rootDepKeys.length > 0) {\n\t\tconst names = rootDepKeys.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Module \"${root.name}\" declares input${rootDepKeys.length > 1 ? \"s\" : \"\"} ${names} but is being deployed as the root — a root has no enclosing scope to wire them; compose \"${root.name}\" from another module that provisions and wires it instead.`);\n\t}\n\tconst rootSecretKeys = Object.keys(root.secretSlots);\n\tif (rootSecretKeys.length > 0) {\n\t\tconst names = rootSecretKeys.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Module \"${root.name}\" declares secret${rootSecretKeys.length > 1 ? \"s\" : \"\"} ${names} but is being deployed as the root — a root has no enclosing scope to bind them; the root binds secrets with envSecret('NAME'), it does not declare secret slots of its own.`);\n\t}\n\tconst rootParamKeys = Object.keys(root.paramSlots);\n\tif (rootParamKeys.length > 0) {\n\t\tconst names = rootParamKeys.map((k) => `\"${k}\"`).join(\", \");\n\t\tthrow new LoadError(`Module \"${root.name}\" declares param${rootParamKeys.length > 1 ? \"s\" : \"\"} ${names} but is being deployed as the root — a root has no enclosing scope to bind them; the root binds params directly on each provision() call, it does not declare param-forwarding slots of its own.`);\n\t}\n\tconst nodes = [];\n\tconst edges = [];\n\tconst pending = [];\n\tconst secretBindings = [];\n\tconst paramBindings = [];\n\tconst byId = /* @__PURE__ */ new Map();\n\tflatten(root, void 0, {}, {}, {}, nodes, edges, pending, secretBindings, paramBindings, byId);\n\tfor (const entry of pending) validateWiring(entry, byId);\n\tassertDependencyDag(edges);\n\tconst rootGraphNode = {\n\t\tid: rootId,\n\t\tnode: root\n\t};\n\treturn {\n\t\troot: rootGraphNode,\n\t\tnodes: [...topoSort(nodes, edges), rootGraphNode],\n\t\tedges,\n\t\tsecrets: secretBindings,\n\t\tparams: paramBindings\n\t};\n}\n/**\n* The dependency edges must form a DAG — a cycle means neither producer can\n* deploy first. Resources take no wiring, so only service/module-to-service/module\n* edges can ever participate in a cycle; no special-casing needed.\n*/\nfunction assertDependencyDag(edges) {\n\tconst adjacency = /* @__PURE__ */ new Map();\n\tfor (const edge of edges) {\n\t\tif (edge.kind !== \"dependency\") continue;\n\t\tconst targets = adjacency.get(edge.from) ?? [];\n\t\ttargets.push(edge.to);\n\t\tadjacency.set(edge.from, targets);\n\t}\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst done = /* @__PURE__ */ new Set();\n\tconst stack = [];\n\tconst visit = (id) => {\n\t\tif (done.has(id)) return;\n\t\tif (visiting.has(id)) throw new LoadError(`Dependency cycle: ${[...stack.slice(stack.indexOf(id)), id].join(\" → \")} — no deploy order exists.`);\n\t\tvisiting.add(id);\n\t\tstack.push(id);\n\t\tfor (const next of adjacency.get(id) ?? []) visit(next);\n\t\tstack.pop();\n\t\tvisiting.delete(id);\n\t\tdone.add(id);\n\t};\n\tfor (const id of adjacency.keys()) visit(id);\n}\n//#endregion\n//#region src/graph.ts\n/**\n* Builds the in-memory graph from a root node. A service root walks its own\n* `inputs`; a module root executes its body (wiring, not user code — the\n* designed exception to imports-run-nothing) and recursively flattens every\n* module it provisions into one graph of hierarchical addresses. A malformed\n* graph is a `LoadError` that names its fix; the individual validation rules\n* live with `loadService` / `loadModule` and are covered by name in the Load\n* tests. Executes nothing of the user's own code beyond module bodies.\n*/\nfunction Load(root, opts) {\n\tif (!isNode(root)) throw new LoadError(\"Load expects a branded service or module node (construct it with the service()/module() factories).\");\n\tif (root.kind === \"module\") return loadModule(root, opts);\n\tif (root.kind === \"service\") return loadService(root, opts?.id ?? \"root\");\n\tthrow new LoadError(\"Load expects a service or module root (received another node kind).\");\n}\n//#endregion\nexport { LoadError as _, isNode as a, isSecretSource as c, paramSource as d, provisionNeed as f, service as g, secretSource as h, freezeNode as i, module as l, secret as m, ResourceNodeBase as n, isParamSource as o, resource as p, dependency as r, isProvisionNeed as s, Load as t, paramNeed as u };\n\n//# sourceMappingURL=graph-BmrUEdo9.mjs.map","import { _ as LoadError, a as isNode, c as isSecretSource, d as paramSource, f as provisionNeed, g as service, h as secretSource, i as freezeNode, l as module, m as secret, n as ResourceNodeBase, o as isParamSource, p as resource, r as dependency, s as isProvisionNeed, t as Load, u as paramNeed } from \"./graph-BmrUEdo9.mjs\";\nimport { SecretBox, SecretBox as SecretBox$1 } from \"@internal/foundation/secret\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/config.ts\n/**\n* A data-only descriptor of a param's schema for introspection — the\n* validator's vendor tag, never the schema's own `validate`. `configOf`\n* reports it where the old model reported `type: 'string' | 'number'`, so the\n* config surface stays enumerable without leaking a function. Nothing consumes\n* more than the vendor tag yet; a richer projection (e.g. a JSON-Schema export\n* when the vendor offers one) is an additive change if a consumer needs it.\n*/\nfunction projectSchema(schema) {\n\treturn { vendor: schema[\"~standard\"].vendor };\n}\n/**\n* Enumerates every config param the service declares: each input's connection\n* params, then the service's own params. Pure — reads `root.inputs`/`params`\n* directly, executes nothing but the (also pure) schema projection. Deliberately\n* does not go through `Load`: a service's connection-end inputs are legitimately\n* unwired from its own point of view (wiring is an enclosing module's concern),\n* and this introspects one service's declared shape regardless of how — or\n* whether — it composes into a larger graph.\n*/\nfunction configOf(root) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(root.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tfor (const [name, param] of Object.entries(value.connection.params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tschema: projectSchema(param.schema),\n\t\t\toptional: param.optional === true,\n\t\t\tdefault: param.default\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(root.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tschema: projectSchema(param.schema),\n\t\toptional: param.optional === true,\n\t\tdefault: param.default\n\t});\n\treturn entries;\n}\n/**\n* The app's provision manifest: every secret binding the root resolved across\n* the graph (ADR-0029) — an opaque, target-defined source per service secret\n* slot; a deploy target's preflight reads its own payload. Pure graph\n* introspection, TARGET-AGNOSTIC — the target consumes it to verify each secret\n* exists on the platform before deploy. The values are provisioned out-of-band.\n*/\nfunction provisionManifest(graph) {\n\treturn graph.secrets;\n}\n/**\n* The app's param-binding manifest: every param a `provision()` call bound —\n* literal or an opaque, target-defined `ParamSource` — at the address that\n* declared it. The param sibling of `provisionManifest`, for a deploy\n* target's own preflight to consume (D2). Pure graph introspection,\n* TARGET-AGNOSTIC; a param this manifest omits simply falls back to its own\n* `default` at `buildConfig`.\n*/\nfunction paramManifest(graph) {\n\treturn graph.params;\n}\nfunction scalarSchema(name, check) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@prisma/composer\",\n\t\tvalidate: (value) => check(value) ? { value } : { issues: [{ message: `expected ${name}, got ${typeof value}` }] }\n\t} };\n}\nconst stringSchema = scalarSchema(\"string\", (v) => typeof v === \"string\");\nconst numberSchema = scalarSchema(\"number\", (v) => typeof v === \"number\" && Number.isFinite(v));\nfunction withFacets(schema, opts) {\n\treturn {\n\t\tschema,\n\t\t...opts.optional !== void 0 ? { optional: opts.optional } : {},\n\t\t...opts.default !== void 0 ? { default: opts.default } : {},\n\t\t...opts.provision !== void 0 ? { provision: opts.provision } : {}\n\t};\n}\n/** A string-valued param. */\nfunction string(opts = {}) {\n\treturn withFacets(stringSchema, opts);\n}\n/** A number-valued param. */\nfunction number(opts = {}) {\n\treturn withFacets(numberSchema, opts);\n}\n/** A param over any caller-supplied Standard Schema — a structured `jobs`, say. */\nfunction param(schema, opts = {}) {\n\treturn withFacets(schema, opts);\n}\n//#endregion\n//#region src/hydrate.ts\n/**\n* The boot-side half of the runtime split (see core-model.md § Runtime:\n* booting a service). Core's job at boot is structural only: turn a\n* concrete, typed Config into hydrated deps by calling each input's\n* connection.hydrate with its value slice. No environment read, no\n* validation, no strings — the pack's `load()` already read the process-local\n* stash into a typed Config before calling this.\n*/\n/**\n* Given a service and a concrete typed Config, hydrate every input\n* (connection.hydrate with its typed value slice). A resource dep and a\n* connection dep hydrate through identical machinery — the loaded client is\n* indistinguishable. The service's own params ride alongside in\n* `config.service`; the node's `load()` merges the two.\n*/\nasync function hydrate(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tdeps[name] = await inputNode.connection.hydrate(values);\n\t}\n\treturn deps;\n}\n/**\n* Synchronous hydrate — what the node's `load()` uses so\n* `const { db } = service.load()` reads without `await`. Requires every\n* connection.hydrate to return synchronously; a Promise return is a loud error\n* naming the input (an async client factory must use the async `hydrate` path).\n*/\nfunction hydrateSync(root, config) {\n\tconst deps = {};\n\tfor (const [name, inputNode] of Object.entries(root.inputs)) {\n\t\tconst values = config.inputs[name] ?? {};\n\t\tconst client = inputNode.connection.hydrate(values);\n\t\tif (client instanceof Promise) throw new Error(`Connection hydrate for input \"${name}\" returned a Promise; load() requires a synchronous client factory.`);\n\t\tdeps[name] = client;\n\t}\n\treturn deps;\n}\n/**\n* Wraps each of a service's resolved secret values in a redacting `SecretBox`\n* — what the node's `secrets()` accessor returns (ADR-0021, sibling to\n* `load()`/`config()`). The RESOLUTION of a secret's value (the boot\n* double-lookup that reads the platform var the pointer names) is the target\n* pack's job; core is handed the already-resolved strings and only boxes them,\n* so a secret is redacted by TYPE from here on. A declared slot missing from\n* `values` is a target contract violation, named loudly.\n*/\nfunction hydrateSecrets(root, values) {\n\tconst boxed = {};\n\tfor (const slot of Object.keys(root.secretSlots)) {\n\t\tconst value = values[slot];\n\t\tif (value === void 0) throw new Error(`secret slot \"${slot}\" has no resolved value — the target must resolve every declared secret before hydrateSecrets().`);\n\t\tboxed[slot] = new SecretBox$1(value);\n\t}\n\treturn blindCast(boxed);\n}\n//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSecrets, hydrateSync, isNode, isParamSource, isProvisionNeed, isSecretSource, module, number, param, paramManifest, paramNeed, paramSource, provisionManifest, provisionNeed, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map","//#region src/container-transport.ts\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction containerEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_CONTAINER_${extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\").replace(/^_+|_+$/g, \"\")}`;\n}\nfunction collisionError(a, b, varName) {\n\treturn /* @__PURE__ */ new Error(`Extension ids \"${a}\" and \"${b}\" both mangle to the container transport variable \"${varName}\" — rename one of the extensions.`);\n}\nfunction emptySerializeError(extensionId) {\n\treturn /* @__PURE__ */ new Error(`Extension \"${extensionId}\"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);\n}\n/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */\nfunction containerEnv(instances) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, instance] of instances) {\n\t\tconst varName = containerEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw collisionError(owner, extensionId, varName);\n\t\townerByVarName.set(varName, extensionId);\n\t\tconst serialized = instance.serialize();\n\t\tif (serialized.length === 0) throw emptySerializeError(extensionId);\n\t\tenv[varName] = serialized;\n\t}\n\treturn env;\n}\n/**\n* The alchemy-process side: for each extension with a container descriptor\n* whose var is present in `env`, call its deserialize. Absent var → no entry.\n*/\nfunction deserializeContainers(extensions, env) {\n\tconst instances = /* @__PURE__ */ new Map();\n\tfor (const extension of extensions) {\n\t\tconst descriptor = extension.container;\n\t\tif (descriptor === void 0) continue;\n\t\tconst serialized = env[containerEnvVarName(extension.id)];\n\t\tif (serialized === void 0) continue;\n\t\tinstances.set(extension.id, descriptor.deserialize(serialized));\n\t}\n\treturn instances;\n}\n//#endregion\nexport { containerEnvVarName as n, deserializeContainers as r, containerEnv as t };\n\n//# sourceMappingURL=container-transport-DKmKg5JQ.mjs.map","import { Cli, Command, Option, UsageError } from \"clipanion\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { assembleServices } from \"@internal/assemble\";\nimport { Load, isNode } from \"@internal/core\";\nimport { containerEnv } from \"@internal/core/config\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as c12 from \"c12\";\nimport { pathToFileURL } from \"node:url\";\nimport { spawnSync } from \"node:child_process\";\n//#region src/cli-error.ts\n/**\n* A user-facing failure with a message that already names the fix (deploy-cli.md\n* § Error surface). `bin.ts` catches this — and any other Error, including\n* core's LoadError/LowerError — uniformly: print the message, exit nonzero.\n*/\nvar CliError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"CliError\";\n\t}\n};\n//#endregion\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configPath);\n\treturn `// Generated by \\`prisma-composer deploy\\`/\\`prisma-composer destroy\\` — overwritten on every\n// run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:\n//\n// alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\nimport { lower } from '@prisma/composer/deploy';\nimport { deploymentReport } from '@prisma/composer/report';\nimport config from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/load-config.ts\n/**\n* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE\n* file that imports control-plane code. Discovery is the standard walk-up\n* from the deploy entry's directory (mirrors prisma-next's config-loader);\n* loading is c12 with that explicit path (rc/global/package.json lookups\n* disabled), so the config file's own static imports resolve from the app\n* root by whatever package manager runs — no specifier construction, no\n* anchoring. The loaded shape is validated field-by-field with CliErrors\n* naming the field.\n*/\nconst CONFIG_FILENAME = \"prisma-composer.config.ts\";\n/** Walks UP from the entry file's directory looking for the literal CONFIG_FILENAME; undefined when the walk hits the filesystem root. */\nfunction findConfigPathForEntry(entryPath) {\n\tlet current = path.dirname(path.resolve(entryPath));\n\twhile (true) {\n\t\tconst candidate = path.join(current, CONFIG_FILENAME);\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(current);\n\t\tif (parent === current) return void 0;\n\t\tcurrent = parent;\n\t}\n}\nfunction missingConfigError(entryPath) {\n\treturn new CliError(`No ${CONFIG_FILENAME} found walking up from \"${path.dirname(path.resolve(entryPath))}\" — the deploy needs the app's config file. Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.`);\n}\nfunction fieldError(field, requirement) {\n\treturn new CliError(`${CONFIG_FILENAME}: \\`${field}\\` ${requirement} — see defineConfig() in '@prisma/composer/config'.`);\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Field-by-field validation of the loaded default export — deliberately no\n* schema library: each check is a CliError naming the offending field.\n* Returns the same object, typed.\n*/\nfunction validateConfigShape(loaded, configPath) {\n\tif (!isRecord(loaded) || Object.keys(loaded).length === 0) throw new CliError(`\"${configPath}\" exported no config — it must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.`);\n\tconst extensions = loaded[\"extensions\"];\n\tif (!Array.isArray(extensions)) throw fieldError(\"extensions\", \"must be an array\");\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of extensions.entries()) {\n\t\tif (!isRecord(entry)) throw fieldError(`extensions[${index}]`, \"must be an extension descriptor object\");\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) throw fieldError(`extensions[${index}].id`, \"must be a non-empty string (the extension package name)\");\n\t\tif (!isRecord(entry[\"nodes\"])) throw fieldError(`extensions[${index}].nodes`, \"must be an object (the node-ID → control registry)\");\n\t\tif (seen.has(id)) throw new CliError(`${CONFIG_FILENAME}: extension \"${id}\" is listed more than once in \\`extensions\\`.`);\n\t\tseen.add(id);\n\t}\n\tconst state = loaded[\"state\"];\n\tif (!isRecord(state) || typeof state[\"extension\"] !== \"string\" || typeof state[\"create\"] !== \"function\") throw fieldError(\"state\", \"must be a state descriptor (e.g. prismaState())\");\n\treturn blindCast(loaded);\n}\n/**\n* Loads + validates the config at `configPath` via c12 (explicit file; rc /\n* global-rc / package.json lookups disabled — discovery already happened in\n* findConfigPathForEntry).\n*/\nasync function loadAppConfig(configPath) {\n\tconst result = await c12.loadConfig({\n\t\tname: \"prisma-composer\",\n\t\tconfigFile: configPath,\n\t\tcwd: path.dirname(configPath),\n\t\trcFile: false,\n\t\tglobalRc: false,\n\t\tpackageJson: false\n\t});\n\tconst loadedFile = result.configFile;\n\tif (typeof loadedFile !== \"string\" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath)) throw new CliError(`Config loading resolved \"${String(loadedFile)}\" instead of the discovered \"${configPath}\" — refusing to deploy against a different file.`);\n\treturn {\n\t\tpath: configPath,\n\t\tconfig: validateConfigShape(result.config, configPath)\n\t};\n}\n//#endregion\n//#region src/load-entry.ts\n/**\n* Pipeline step 1 (deploy-cli.md § The pipeline): import the entry module\n* (resolved against cwd) and require its default export to be a node — a\n* service or module, branded by core's factories. Whatever this module exports\n* IS the application; nothing else marks a root (ADR-0003).\n*/\nasync function loadEntry(entryArg, cwd) {\n\tconst resolvedPath = path.resolve(cwd, entryArg);\n\tconst root = (await import(pathToFileURL(resolvedPath).href)).default;\n\tif (!isNode(root) || root.kind === \"dependency\" || root.kind === \"resource\") throw new CliError(`Entry module \"${resolvedPath}\" must default-export a node (a service or a module) — construct it with service() or module() from @prisma/composer.`);\n\treturn {\n\t\tpath: resolvedPath,\n\t\troot: blindCast(root)\n\t};\n}\n//#endregion\n//#region src/run-alchemy.ts\n/**\n* Pipeline step 7 (deploy-cli.md § The pipeline; design-notes.md's \"Driving\n* Alchemy\" call): shell out to the generated stack file. Resolves the\n* workspace's own installed `alchemy` bin (walking up `node_modules/.bin`\n* from the generated file's package dir) rather than going through\n* `bunx`/`npx`, so this works the same under node and bun — the resolved\n* bin's own launcher (`alchemy/bin/cli.js`) does its own node/bun dispatch\n* from there, driven by the env it inherits.\n*/\n/** Walks up from `startDir` looking for `node_modules/.bin/alchemy`. */\nfunction resolveAlchemyBin(startDir) {\n\tlet dir = startDir;\n\twhile (true) {\n\t\tconst candidate = path.join(dir, \"node_modules\", \".bin\", \"alchemy\");\n\t\tif (fs.existsSync(candidate)) return candidate;\n\t\tconst parent = path.dirname(dir);\n\t\tif (parent === dir) throw new CliError(`Could not find an installed \\`alchemy\\` bin above \"${startDir}\" — add \"alchemy\" as a dependency of your app.`);\n\t\tdir = parent;\n\t}\n}\n/** Runs `alchemy deploy|destroy <stack file> --yes [--stage <stage>]`, inheriting stdio + env, plus every extension's resolved container. */\nfunction runAlchemy(input) {\n\tconst bin = resolveAlchemyBin(input.cwd);\n\tconst args = [\n\t\tinput.command,\n\t\tinput.stackFileRelativePath,\n\t\t\"--yes\"\n\t];\n\tif (input.stage !== void 0) args.push(\"--stage\", input.stage);\n\tconst result = spawnSync(bin, args, {\n\t\tcwd: input.cwd,\n\t\tstdio: \"inherit\",\n\t\tenv: {\n\t\t\t...input.env ?? process.env,\n\t\t\t...input.containerEnv\n\t\t}\n\t});\n\tif (result.error !== void 0) throw result.error;\n\treturn result.status ?? 1;\n}\n//#endregion\n//#region src/validate-coverage.ts\nfunction lookup(extensions, extension, type, expectedKind, what) {\n\tconst ext = extensions.get(extension);\n\tif (ext === void 0) throw new CliError(`No extension \"${extension}\" is configured (needed by ${what}) — add it to ${CONFIG_FILENAME}'s \\`extensions\\` (import its /control entry and list its descriptor).`);\n\tconst descriptor = ext.nodes[type];\n\tif (descriptor === void 0) throw new CliError(`Extension \"${extension}\" has no descriptor for node type \"${type}\" (needed by ${what}; known: ${Object.keys(ext.nodes).join(\", \")}).`);\n\tif (descriptor.kind !== expectedKind) throw new CliError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${descriptor.kind}\" descriptor — ${what} needs a \"${expectedKind}\" descriptor.`);\n}\n/** Throws a CliError on the first uncovered `(extension, type)`; silent when the config covers the whole graph. */\nfunction validateRegistryCoverage(graph, config) {\n\tconst extensions = new Map(config.extensions.map((descriptor) => [descriptor.id, descriptor]));\n\tfor (const { id, node } of graph.nodes) {\n\t\tif (node.kind === \"resource\") {\n\t\t\tlookup(extensions, node.extension, node.type, \"resource\", `resource node \"${id}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (node.kind !== \"service\") continue;\n\t\tlookup(extensions, node.extension, node.type, \"service\", `service node \"${id}\"`);\n\t\tlookup(extensions, node.build.extension, node.build.type, \"build\", `service node \"${id}\"'s build descriptor`);\n\t}\n}\n//#endregion\n//#region src/validate-stage.ts\n/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */\nfunction validateStageName(stage) {\n\tconst result = spawnSync(\"git\", [\"check-ref-format\", `refs/heads/${stage}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliError(`git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`);\n\tif (result.status !== 0) throw new CliError(`Invalid --stage \"${stage}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${stage}\").`);\n}\n//#endregion\n//#region src/main.ts\n/**\n* Argument parsing (clipanion — prisma-next's CLI idiom, see\n* prisma-next/packages/1-framework/3-tooling/cli/src/migration-cli.ts) +\n* orchestration of deploy-cli.md § The pipeline.\n*/\nconst BINARY_NAME = \"prisma-composer\";\n/** The <entry>/--name/--stage surface shared by deploy and destroy; execute() is unused — run() drives the pipeline directly so error handling stays under this module's control. */\nvar DeployCliCommand = class extends Command {\n\tentry = Option.String({ name: \"entry\" });\n\tname = Option.String(\"--name\", { description: \"Override the root node's name — the deploy's application name.\" });\n\tstage = Option.String(\"--stage\", { description: \"Alchemy stage to target.\" });\n\tproduction = Option.Boolean(\"--production\", false, { description: \"destroy: tear down the project-level production environment (required to destroy production).\" });\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\nvar DeployCommand = class extends DeployCliCommand {\n\tstatic paths = [[\"deploy\"]];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Deploy the application whose root node is <entry>'s default export.\",\n\t\texamples: [[\"Deploy an app\", \"$0 deploy src/service.ts\"]]\n\t});\n\taction = \"deploy\";\n};\nvar DestroyCommand = class extends DeployCliCommand {\n\tstatic paths = [[\"destroy\"]];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Tear down the application whose root node is <entry>'s default export — same derivation as deploy, Alchemy destroy.\",\n\t\texamples: [[\"Destroy an app\", \"$0 destroy src/service.ts\"]]\n\t});\n\taction = \"destroy\";\n};\nfunction buildCli() {\n\treturn Cli.from([DeployCommand, DestroyCommand], {\n\t\tbinaryName: BINARY_NAME,\n\t\tbinaryLabel: \"The prisma-composer deploy CLI\"\n\t});\n}\n/** Thrown internally when the user explicitly asked for `--help`/`-h` — run() prints it to stdout and exits 0; not a usage error. */\nvar HelpRequested = class extends Error {};\n/** Duck-typed: clipanion's UnknownSyntaxError isn't re-exported, so match its name + clipanion.type discriminator (mirrors prisma-next's migration-cli.ts). */\nfunction isUnknownSyntaxError(error) {\n\tif (!(error instanceof Error) || error.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = error.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/** Exported for direct testing (main.test.ts) — not part of the package's public barrel (see index.ts). */\nfunction parseArgs(argv) {\n\tconst cli = buildCli();\n\tlet command;\n\ttry {\n\t\tcommand = cli.process([...argv]);\n\t} catch (error) {\n\t\tif (isUnknownSyntaxError(error) || error instanceof UsageError) throw new UsageError(cli.usage(null, { detailed: true }));\n\t\tthrow error;\n\t}\n\tif (command instanceof DeployCommand || command instanceof DestroyCommand) return {\n\t\tcommand: command.action,\n\t\tentry: command.entry,\n\t\tname: command.name,\n\t\tstage: command.stage,\n\t\tproduction: command.production\n\t};\n\tif (argv.includes(\"--help\") || argv.includes(\"-h\")) throw new HelpRequested(cli.usage(null, { detailed: true }));\n\tthrow new UsageError(cli.usage(null, { detailed: true }));\n}\n/** Destroy must name its target explicitly — no silent default to production (spec §10). */\nfunction effectiveStage(args) {\n\tif (args.command === \"deploy\") {\n\t\tif (args.production) throw new CliError(\"--production is only valid with `destroy`; `deploy` targets production by default (omit --stage).\");\n\t\treturn args.stage;\n\t}\n\tif (args.stage !== void 0 && args.production) throw new CliError(\"Pass either --stage <name> or --production to `destroy`, not both.\");\n\tif (args.stage === void 0 && !args.production) throw new CliError(\"`destroy` requires an explicit target: --stage <name> to tear down a branch environment, or --production to tear down the production environment.\");\n\treturn args.production ? void 0 : args.stage;\n}\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Warns (doesn't fail) when destroy finds no local deploy state under cwd — likely wrong directory or nothing deployed yet. */\nfunction warnIfNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\tif (!(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0)) console.warn(`\\nNo prior deploy state under ${cwd} — if you deployed from a different directory, run destroy from there; otherwise this is a no-op.`);\n}\n/** Runs the full pipeline; returns the process exit code. */\nasync function run(argv, deps = {}) {\n\tlet args;\n\ttry {\n\t\targs = parseArgs(argv);\n\t} catch (error) {\n\t\tif (error instanceof HelpRequested) {\n\t\t\tconsole.log(error.message);\n\t\t\treturn 0;\n\t\t}\n\t\tthrow error;\n\t}\n\tconst stage = effectiveStage(args);\n\tif (stage !== void 0) validateStageName(stage);\n\tconst cwd = process.cwd();\n\tif (args.command === \"destroy\") warnIfNoLocalDeployState(cwd);\n\tconst resolvedEntryPath = path.resolve(cwd, args.entry);\n\tconst configPath = findConfigPathForEntry(resolvedEntryPath);\n\tif (configPath === void 0) throw missingConfigError(resolvedEntryPath);\n\tconst config = deps.config ?? (await loadAppConfig(configPath)).config;\n\tconst entryModule = await loadEntry(args.entry, cwd);\n\tconst graph = Load(entryModule.root);\n\tif (graph.root.node.kind !== \"module\") throw new CliError(\"The deploy root must be a module — wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); }).\");\n\tvalidateRegistryCoverage(graph, config);\n\tconst name = args.name ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliError(\"The root node has no name — name it at authoring, or pass --name.\");\n\tlet assembled;\n\ttry {\n\t\tassembled = await assembleServices(graph, config, cwd, deps.runAssembler);\n\t} catch (error) {\n\t\tif (args.command === \"destroy\" && error instanceof Error) throw new CliError(`${error.message}\\n\\ndestroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first. Run the build, then retry the destroy.`);\n\t\tthrow error;\n\t}\n\tconst containers = /* @__PURE__ */ new Map();\n\tfor (const extension of config.extensions) {\n\t\tif (extension.container === void 0) continue;\n\t\ttry {\n\t\t\tif (args.command === \"deploy\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\tappName: name,\n\t\t\t\tstage\n\t\t\t}));\n\t\t\telse {\n\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\tappName: name,\n\t\t\t\t\tstage\n\t\t\t\t});\n\t\t\t\tif (instance === void 0) throw new CliError(`Nothing deployed for ${name}${stage !== void 0 ? `/${stage}` : \"\"} — deploy it first.`);\n\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow error instanceof CliError ? error : new CliError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tif (args.command === \"deploy\") for (const extension of config.extensions) {\n\t\tif (extension.preflight === void 0) continue;\n\t\ttry {\n\t\t\tawait extension.preflight({\n\t\t\t\tgraph,\n\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\tstage\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthrow error instanceof CliError ? error : new CliError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\tconst stackPath = writeStackFile({\n\t\tentryPath: entryModule.path,\n\t\tcwd,\n\t\tconfigPath,\n\t\tname,\n\t\tassembled\n\t});\n\ttry {\n\t\tconst status = (deps.alchemy ?? runAlchemy)({\n\t\t\tcommand: args.command,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage,\n\t\t\tcontainerEnv: containerEnv(containers)\n\t\t});\n\t\tif (status !== 0) {\n\t\t\tconsole.error(`\\nGenerated stack file: ${stackPath}`);\n\t\t\tconsole.error(`Run \\`alchemy ${args.command} ${GENERATED_STACK_RELATIVE_PATH} --yes\\` from ${cwd} to reproduce this directly.`);\n\t\t\treturn status;\n\t\t}\n\t\tif (args.command === \"destroy\") {\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tstage\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow error instanceof CliError ? error : new CliError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\tif (instance === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tawait extension.container.remove(instance);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow error instanceof CliError ? error : new CliError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn status;\n\t} catch (error) {\n\t\tconsole.error(`\\nGenerated stack file: ${stackPath}`);\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/cli.ts\n/**\n* Run the `prisma-composer` CLI end to end: dispatch `argv`, map errors to exit\n* codes. Shared by this package's `bin` and the unscoped `prisma-composer` launcher.\n*/\nasync function cli(argv = process.argv.slice(2)) {\n\ttry {\n\t\tprocess.exitCode = await run(argv);\n\t} catch (error) {\n\t\tif (error instanceof UsageError) {\n\t\t\tconsole.error(error.message);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\t\tconsole.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n\t\tprocess.exitCode = 1;\n\t}\n}\n//#endregion\nexport { loadEntry as a, CliError as c, runAlchemy as i, run as n, renderStackFile as o, resolveAlchemyBin as r, writeStackFile as s, cli as t };\n\n//# sourceMappingURL=cli-Bc6_i0ls.mjs.map","#!/usr/bin/env node\nimport { t as cli } from \"./cli-Bc6_i0ls.mjs\";\n//#region src/bin.ts\ncli();\n//#endregion\nexport {};\n\n//# sourceMappingURL=bin.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAI,gBAAgB,cAAc,MAAM;CACvC,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;AASA,SAAS,wBAAwB,QAAQ,MAAM,SAAS,KAAK;CAC5D,MAAM,EAAE,WAAW,SAAS,KAAK;CACjC,MAAM,sBAAsB,OAAO,WAAW,MAAM,cAAc,UAAU,OAAO,SAAS;CAC5F,IAAI,wBAAwB,KAAK,GAAG,MAAM,IAAI,cAAc,iBAAiB,UAAU,sCAAsC,KAAK,KAAK,mEAAmE;CAC1M,MAAM,iBAAiB,oBAAoB,MAAM;CACjD,IAAI,mBAAmB,KAAK,GAAG,MAAM,IAAI,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,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAC9G;GACD;GACA,KAAK,MAAM,aAAa,OAAO,YAAY;IAC1C,IAAI,UAAU,cAAc,KAAK,GAAG;IACpC,MAAM,WAAW,WAAW,IAAI,UAAU,EAAE;IAC5C,IAAI,aAAa,KAAK,GAAG;IACzB,IAAI;KACH,MAAM,UAAU,UAAU,OAAO,QAAQ;IAC1C,SAAS,OAAO;KACf,MAAM,iBAAiB,WAAW,QAAQ,IAAI,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAC9G;GACD;EACD;EACA,OAAO;CACR,SAAS,OAAO;EACf,QAAQ,MAAM,2BAA2B,WAAW;EACpD,MAAM;CACP;AACD;;;;;AAOA,eAAe,IAAI,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG;CAChD,IAAI;EACH,QAAQ,WAAW,MAAM,IAAI,IAAI;CAClC,SAAS,OAAO;EACf,IAAI,iBAAiB,YAAY;GAChC,QAAQ,MAAM,MAAM,OAAO;GAC3B,QAAQ,WAAW;GACnB;EACD;EACA,QAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;EAChF,QAAQ,WAAW;CACpB;AACD;;;ACvcA,IAAI"}
package/dist/casts.d.mts CHANGED
@@ -72,7 +72,7 @@ declare function blindCast<TargetType, _Reason extends string>(input: unknown):
72
72
  *
73
73
  * @typeParam Type - The type to constrain and tag the value with. The value must be assignable to `Type`.
74
74
  */
75
- declare function castAs<Type>(value: Type): Type; //#endregion
75
+ declare function castAs<Type>(value: Type): Type;
76
76
  //#endregion
77
77
  export { blindCast, castAs };
78
78
  //# sourceMappingURL=casts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"casts.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/casts.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoCiB,UAAU,YAAY,wBAAwB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqC/D,OAAO,MAAM,OAAO,OAAO"}
@@ -0,0 +1 @@
1
+ import "./app-config-BPb3LCdH-CH7b8Khi.mjs";
package/dist/config.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- import { f as NodeDescriptor, h as PrismaAppConfig, m as PreflightInput, o as ExtensionDescriptor, v as defineConfig } from "./app-config-BUqyK6N6-CVq3uvHF.mjs";
2
- export { ExtensionDescriptor, NodeDescriptor, PreflightInput, PrismaAppConfig, defineConfig };
1
+ import { A as containerEnvVarName, D as TeardownInput, E as StateDescriptor, M as deserializeContainers, S as PrismaAppConfig, d as ExtensionDescriptor, f as LocateContainerInput, j as defineConfig, k as containerEnv, o as ContainerDescriptor, s as ContainerInstance, v as NodeDescriptor, x as PreflightInput } from "./app-config-BPb3LCdH-CH7b8Khi.mjs";
2
+ import "./config-Cqu_-Hna.mjs";
3
+ export { type ContainerDescriptor, type ContainerInstance, ExtensionDescriptor, type LocateContainerInput, NodeDescriptor, PreflightInput, PrismaAppConfig, StateDescriptor, TeardownInput, containerEnv, containerEnvVarName, defineConfig, deserializeContainers };
package/dist/config.mjs CHANGED
@@ -1,9 +1,10 @@
1
+ import { n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
1
2
  //#region ../../0-framework/1-core/core/dist/config.mjs
2
3
  /** Typed identity — exists so `prisma-composer.config.ts` gets checked against PrismaAppConfig where it is written. */
3
4
  function defineConfig(config) {
4
5
  return config;
5
6
  }
6
7
  //#endregion
7
- export { defineConfig };
8
+ export { containerEnv, containerEnvVarName, defineConfig, deserializeContainers };
8
9
 
9
10
  //# sourceMappingURL=config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/config.mjs"],"sourcesContent":["//#region src/app-config.ts\n/** Typed identity — exists so `prisma-composer.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { defineConfig };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;AAEA,SAAS,aAAa,QAAQ;CAC7B,OAAO;AACR"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/config.mjs"],"sourcesContent":["import { n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from \"./container-transport-DKmKg5JQ.mjs\";\n//#region src/control/app-config.ts\n/** Typed identity — exists so `prisma-composer.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { containerEnv, containerEnvVarName, defineConfig, deserializeContainers };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;AAGA,SAAS,aAAa,QAAQ;CAC7B,OAAO;AACR"}