@prisma/composer 0.6.0-dev.1 → 0.6.0-dev.11

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 (93) hide show
  1. package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts → app-config-CFsSXEVj-B242oUnm.d.mts} +4 -4
  2. package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts.map → app-config-CFsSXEVj-B242oUnm.d.mts.map} +1 -1
  3. package/dist/bin.mjs +11 -3275
  4. package/dist/bin.mjs.map +1 -1
  5. package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +401 -0
  6. package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +1 -0
  7. package/dist/config-ku5b_2YD.d.mts +1 -0
  8. package/dist/config.d.mts +2 -2
  9. package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +75 -0
  10. package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +1 -0
  11. package/dist/control.d.mts +216 -0
  12. package/dist/control.d.mts.map +1 -0
  13. package/dist/control.mjs +70 -0
  14. package/dist/control.mjs.map +1 -0
  15. package/dist/deploy-ku5b_2YD.d.mts +1 -0
  16. package/dist/deploy.d.mts +2 -2
  17. package/dist/deploy.mjs +312 -1
  18. package/dist/deploy.mjs.map +1 -0
  19. package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs +70 -0
  20. package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs.map +1 -0
  21. package/dist/{dist-BdvFDCLV.mjs → dist-C5rZnr4n.mjs} +2 -2
  22. package/dist/{dist-BdvFDCLV.mjs.map → dist-C5rZnr4n.mjs.map} +1 -1
  23. package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs +24 -0
  24. package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs.map +1 -0
  25. package/dist/errors-0e8IVwzi.mjs +88 -0
  26. package/dist/errors-0e8IVwzi.mjs.map +1 -0
  27. package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs +306 -0
  28. package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +1 -0
  29. package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs +265 -0
  30. package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +1 -0
  31. package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs +2009 -0
  32. package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs.map +1 -0
  33. package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs +2006 -0
  34. package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs.map +1 -0
  35. package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs +157 -0
  36. package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +1 -0
  37. package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs +155 -0
  38. package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +1 -0
  39. package/dist/{graph-DgbALPDo-BEHF94BN.mjs → graph-BJgUfGB0-kvgFzT4q.mjs} +13 -7
  40. package/dist/graph-BJgUfGB0-kvgFzT4q.mjs.map +1 -0
  41. package/dist/{graph-DDpXh7S8-b-93BcHn.d.mts → graph-DqklX5Sf-BNS2aO1j.d.mts} +3 -3
  42. package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts.map +1 -0
  43. package/dist/{graph-types-C3FOaaXm-C6_rGzfn.d.mts → graph-types-N6brq1zY-1VMNwtkJ.d.mts} +88 -5
  44. package/dist/graph-types-N6brq1zY-1VMNwtkJ.d.mts.map +1 -0
  45. package/dist/{index-BQVrMGfe.d.mts → index-DryPyF9U.d.mts} +3 -3
  46. package/dist/{index-BQVrMGfe.d.mts.map → index-DryPyF9U.d.mts.map} +1 -1
  47. package/dist/index.d.mts +3 -3
  48. package/dist/index.mjs +2 -2
  49. package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs +18 -0
  50. package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs.map +1 -0
  51. package/dist/local-target-DnA2E8IN.mjs +47 -0
  52. package/dist/local-target-DnA2E8IN.mjs.map +1 -0
  53. package/dist/local-target-DuSyWeYc.mjs +68 -0
  54. package/dist/local-target-DuSyWeYc.mjs.map +1 -0
  55. package/dist/local-target.d.mts +1 -1
  56. package/dist/local-target.mjs +2 -46
  57. package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts → nextjs-DLyeRR7M-DZODs9tk.d.mts} +3 -3
  58. package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts.map → nextjs-DLyeRR7M-DZODs9tk.d.mts.map} +1 -1
  59. package/dist/nextjs-control.d.mts +4 -4
  60. package/dist/nextjs.d.mts +1 -1
  61. package/dist/node-control.d.mts +3 -3
  62. package/dist/node.d.mts +2 -2
  63. package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs +331 -0
  64. package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +1 -0
  65. package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs +857 -0
  66. package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs.map +1 -0
  67. package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +30 -0
  68. package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +1 -0
  69. package/dist/report.d.mts +4 -3
  70. package/dist/report.d.mts.map +1 -1
  71. package/dist/report.mjs +4 -1
  72. package/dist/report.mjs.map +1 -1
  73. package/dist/result-CFqJKiqg.mjs +106 -0
  74. package/dist/result-CFqJKiqg.mjs.map +1 -0
  75. package/dist/result-CzGChwbZ.mjs +231 -0
  76. package/dist/result-CzGChwbZ.mjs.map +1 -0
  77. package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +48 -0
  78. package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +1 -0
  79. package/dist/service-rpc.d.mts +2 -2
  80. package/dist/service-rpc.mjs +2 -2
  81. package/dist/shared-CCaR42wo-BvegvmA_.mjs +265 -0
  82. package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +1 -0
  83. package/dist/testing.d.mts +1 -1
  84. package/package.json +15 -15
  85. package/src/exports/control.ts +1 -0
  86. package/dist/config-whuqZ5xT.d.mts +0 -1
  87. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs +0 -313
  88. package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs.map +0 -1
  89. package/dist/deploy-whuqZ5xT.d.mts +0 -1
  90. package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +0 -1
  91. package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +0 -1
  92. package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +0 -1
  93. package/dist/local-target.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy.mjs"],"sourcesContent":["import { o as isParamSource, t as Load } from \"./graph-BJgUfGB0.mjs\";\nimport { r as deserializeContainers } from \"./container-transport-DKmKg5JQ.mjs\";\nimport * as Alchemy from \"alchemy\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n//#region src/control/deploy.ts\nvar LowerError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LowerError\";\n\t}\n};\n/**\n* Resolves one SERVICE-OWN param to its config value. The full resolution\n* order across both value channels:\n*\n* 1. A param claiming BOTH a provision-time binding and a `provision` need\n* (ADR-0031) is a loud error — two sources for one value.\n* 2. A provision-time binding (a schema-validated literal, or an opaque\n* `ParamSource` the target resolves at boot per ADR-0019) beats the\n* declared `default`.\n* 3. A framework-minted `provision` need is resolved per dependency EDGE\n* against the consumer extension's registry — that path fills CONNECTION\n* params in `buildConfig`'s inputs loop, never this function. A\n* service-own param has no edge to mint against, so an unbound need here\n* falls through like any unbound param.\n* 4. The `default`, else absent (only legal when `optional`), else a loud\n* error naming the param, the service, and the fix.\n*/\nfunction resolveParam(node, serviceId, name, param, bound) {\n\tif (bound !== void 0) {\n\t\tif (param.provision !== void 0) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has two sources claiming one value: a provision-time binding (${isParamSource(bound) ? \"a param source\" : \"a literal value\"}) AND a framework provision need (\"${String(param.provision.brand)}\") on its declaration — remove the binding or drop the \\`provision\\` facet.`);\n\t\tif (isParamSource(bound)) return bound;\n\t\tconst result = param.schema[\"~standard\"].validate(bound);\n\t\tif (result instanceof Promise) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") uses an async Standard Schema — a provision-time literal value requires a synchronous validator.`);\n\t\tif (result.issues !== void 0) {\n\t\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\t\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") received an invalid provision-time value: ${messages}`);\n\t\t}\n\t\treturn result.value;\n\t}\n\tif (param.default !== void 0) return param.default;\n\tif (param.optional === true) return void 0;\n\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has no default, is not optional, and was not bound at provision — bind it with a literal value or a param source (e.g. envParam('NAME')) on its provision() call, or give it a default.`);\n}\n/**\n* Assembles a service's typed Config. Connection params come from the\n* dependency edge's lowered outputs — or, for a param carrying a `provision`\n* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints\n* it, the producer hands nothing over. The service's own params resolve via\n* `resolveParam` (provision-time binding, then default, then loud\n* unbound-required failure).\n*\n* This is also where the connection contract is enforced: a producer that fails to\n* supply a required param its consumer's connection declares fails the deploy\n* here, naming the edge, rather than reaching the consumer as `undefined`.\n*/\nfunction buildConfig(node, id, graph, lowered, provisioned) {\n\tconst inputs = {};\n\tfor (const [inputName, inputNode] of Object.entries(node.inputs)) {\n\t\tconst edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === \"dependency\");\n\t\tconst producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};\n\t\tconst values = {};\n\t\tfor (const [name, param] of Object.entries(inputNode.connection.params)) {\n\t\t\tif (param.provision !== void 0) {\n\t\t\t\tvalues[name] = provisioned.get(`${id}.${inputName}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst value = producedOutputs[name];\n\t\t\tif (value === void 0 && param.optional !== true && edge !== void 0) throw new LowerError(`Connection input \"${id}.${inputName}\" declares param \"${name}\", but its producer \"${edge.from}\" did not supply it — the producer's outputs carry [${Object.keys(producedOutputs).join(\", \") || \"nothing\"}]. Add \"${name}\" to the outputs the producer returns from its lowering, or declare the param optional on the connection.`);\n\t\t\tvalues[name] = value;\n\t\t}\n\t\tinputs[inputName] = values;\n\t}\n\tconst boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));\n\tconst service = {};\n\tfor (const [name, param] of Object.entries(node.params)) {\n\t\tconst value = resolveParam(node, id, name, param, boundParams.get(name));\n\t\tif (value !== void 0) service[name] = value;\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n}\n/**\n* Joins resolved report entries back to their graph nodes — the last step of a\n* deploy report, run inside the Action with apply's resolved values.\n*\n* The entries cross Alchemy's action-input boundary, so they carry addresses\n* and plain entities only; the graph is held by closure on this side. That\n* split is why this join exists at all, and it is what keeps functions and\n* Standard Schemas (which a node carries, and which the plan's input hash\n* would have to serialize) out of the input.\n*\n* Skips an address the graph no longer holds: entries are data, the graph is\n* truth.\n*/\nfunction joinDeployment(graph, entries) {\n\tconst nodes = [];\n\tfor (const entry of entries) {\n\t\tconst node = graph.nodes.find((n) => n.id === entry.address)?.node;\n\t\tif (node === void 0 || node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tnodes.push({\n\t\t\taddress: entry.address,\n\t\t\tnode,\n\t\t\tentities: entry.entities\n\t\t});\n\t}\n\treturn nodes;\n}\nfunction missingBundleError(id) {\n\treturn new LowerError(`No bundle provided for service \"${id}\" (opts.bundles[\"${id}\"] is required).`);\n}\nfunction duplicateExtensionError(id) {\n\treturn new LowerError(`Extension \"${id}\" is listed more than once in \\`extensions\\` — each extension id must be unique.`);\n}\n/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */\nfunction extensionsById(config) {\n\tconst map = /* @__PURE__ */ new Map();\n\tfor (const extension of config.extensions) {\n\t\tif (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));\n\t\tmap.set(extension.id, extension);\n\t}\n\treturn Effect.succeed(map);\n}\nfunction unknownExtensionError(extension, id) {\n\treturn new LowerError(`No extension \"${extension}\" is configured (needed by node \"${id}\") — add it to prisma-composer.config.ts's \\`extensions\\` (import its /control entry and list its descriptor).`);\n}\nfunction unknownNodeTypeError(extension, type) {\n\treturn new LowerError(`Extension \"${extension.id}\" has no descriptor for node type \"${type}\" (known: ${Object.keys(extension.nodes).join(\", \")}).`);\n}\n/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */\nfunction unknownProvisionerError(extension, brand, edgeId) {\n\tconst known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(\", \") : \"(none registered)\";\n\treturn new LowerError(`Extension \"${extension.id}\" has no provisioner for need \"${String(brand)}\" (needed by edge \"${edgeId}\") (known: ${known}).`);\n}\n/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */\nfunction crossExtensionProvisionError(edgeId) {\n\treturn new LowerError(`Provisioned edge \"${edgeId}\" spans two extensions — cross-extension provisioned edges aren't supported yet.`);\n}\n/**\n* More than one provisioned param on one connection (ADR-0031). One edge mints\n* ONE value, keyed by edge id, so a second need on the same connection would\n* silently receive the first's value under the first's brand.\n*/\nfunction multipleProvisionedParamsError(edgeId, names) {\n\treturn new LowerError(`Connection input \"${edgeId}\" declares more than one provisioned param (${names.join(\", \")}) — only one provisioned param per connection is supported.`);\n}\nfunction wrongKindError(extension, type, expected, got) {\n\treturn new LowerError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${got}\" descriptor — this node needs a \"${expected}\" descriptor.`);\n}\n/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */\nfunction descriptorFor(extensions, node, id) {\n\tconst extension = extensions.get(node.extension);\n\tif (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));\n\tconst descriptor = extension.nodes[node.type];\n\tif (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));\n\tif (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\treturn Effect.succeed(descriptor);\n}\n/**\n* The state-layer precedence a deploy resolves to: an explicit opts.state\n* always wins; failing that, the config's own (required) state descriptor,\n* created with its owning extension's resolved container (`undefined` when\n* that extension declared none). A pure function so the precedence is\n* testable without booting Alchemy.\n*/\nfunction resolveStateLayer(opts, config, containers) {\n\treturn opts.state ?? config.state.create(containers.get(config.state.extension));\n}\n/**\n* All configured extensions' providers merged, config array order — an\n* extension without `providers` is skipped; no used-extensions-only\n* filtering (ADR-0017's pinned providers rule).\n*/\nfunction mergedProviders(config) {\n\tconst [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/**\n* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.\n* Fails with LowerError or whatever an extension's lowering raises — the error type is open.\n*/\nfunction lowering(root, config, opts) {\n\treturn Effect.gen(function* () {\n\t\tconst graph = Load(root, { id: opts.name });\n\t\tconst extensions = yield* extensionsById(config);\n\t\tconst containers = deserializeContainers(config.extensions, process.env);\n\t\tconst lowered = /* @__PURE__ */ new Map();\n\t\tconst entries = [];\n\t\tconst provisioned = /* @__PURE__ */ new Map();\n\t\tconst applications = /* @__PURE__ */ new Map();\n\t\tfor (const descriptor of config.extensions) {\n\t\t\tif (descriptor.application === void 0) continue;\n\t\t\tconst appCtx = {\n\t\t\t\tid: graph.root.id,\n\t\t\t\taddress: \"\",\n\t\t\t\tnode: graph.root.node,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: void 0,\n\t\t\t\tcontainer: containers.get(descriptor.id),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tapplications.set(descriptor.id, yield* descriptor.application.provision(appCtx));\n\t\t}\n\t\tfor (const edge of graph.edges) {\n\t\t\tif (edge.kind !== \"dependency\") continue;\n\t\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\t\tconst slot = consumer.inputs[edge.input];\n\t\t\tif (slot === void 0) continue;\n\t\t\tconst provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);\n\t\t\tif (provisionedParams.length === 0) continue;\n\t\t\tconst edgeId = `${edge.to}.${edge.input}`;\n\t\t\tif (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));\n\t\t\tconst need = provisionedParams[0]?.[1].provision;\n\t\t\tif (need === void 0) continue;\n\t\t\tconst provider = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\t\tif (provider === void 0 || provider.kind !== \"service\" && provider.kind !== \"resource\") continue;\n\t\t\tif (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));\n\t\t\tconst extension = extensions.get(consumer.extension);\n\t\t\tif (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));\n\t\t\tconst provisioner = extension.provisions?.get(need.brand);\n\t\t\tif (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));\n\t\t\tconst ref = yield* provisioner.provision({\n\t\t\t\tedgeId,\n\t\t\t\tconsumerAddress: edge.to,\n\t\t\t\tproviderAddress: edge.from,\n\t\t\t\tinput: edge.input,\n\t\t\t\tneed\n\t\t\t});\n\t\t\tprovisioned.set(edgeId, ref);\n\t\t}\n\t\tfor (const { id, node } of graph.nodes) {\n\t\t\tif (node.kind === \"module\") continue;\n\t\t\tif (node.kind === \"dependency\") continue;\n\t\t\tconst ctx = {\n\t\t\t\tid,\n\t\t\t\taddress: id,\n\t\t\t\tnode,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: applications.get(node.extension),\n\t\t\t\tcontainer: containers.get(node.extension),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tconst descriptor = yield* descriptorFor(extensions, node, id);\n\t\t\tif (descriptor.kind === \"resource\") {\n\t\t\t\tconst result = yield* descriptor(ctx);\n\t\t\t\tlowered.set(id, result.outputs);\n\t\t\t\tentries.push({\n\t\t\t\t\taddress: id,\n\t\t\t\t\tentities: result.entities\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (descriptor.kind !== \"service\") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\t\t\tconst service = node;\n\t\t\tconst provisionedNode = yield* descriptor.provision(ctx);\n\t\t\tconst typedConfig = buildConfig(service, id, graph, lowered, provisioned);\n\t\t\tconst serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);\n\t\t\tconst bundle = opts.bundles[id];\n\t\t\tif (bundle === void 0) return yield* Effect.fail(missingBundleError(id));\n\t\t\tconst artifact = yield* descriptor.package(ctx, {\n\t\t\t\tassembled: {\n\t\t\t\t\tdir: bundle.dir,\n\t\t\t\t\tentry: bundle.entry\n\t\t\t\t},\n\t\t\t\taddress: id\n\t\t\t});\n\t\t\tconst result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);\n\t\t\tlowered.set(id, result.outputs);\n\t\t\tentries.push({\n\t\t\t\taddress: id,\n\t\t\t\tentities: result.entities\n\t\t\t});\n\t\t}\n\t\tif (opts.report !== void 0) {\n\t\t\tconst report = opts.report;\n\t\t\tyield* Alchemy.Action(\"composer-deployment-report\", (input) => Effect.sync(() => {\n\t\t\t\treport({\n\t\t\t\t\tapp: opts.name,\n\t\t\t\t\tnodes: joinDeployment(graph, input.entries)\n\t\t\t\t});\n\t\t\t}))({\n\t\t\t\tnonce: Date.now(),\n\t\t\t\tentries\n\t\t\t});\n\t\t}\n\t});\n}\n/**\n* The whole-stack wrapper: Load → route each node through the config's\n* extension registries → an Alchemy Stack (the default export the alchemy\n* CLI consumes).\n*/\nfunction lower(root, config, opts) {\n\tconst stackEffect = Effect.orDie(lowering(root, config, opts));\n\tconst containers = deserializeContainers(config.extensions, process.env);\n\tconst providers = opts.providers ?? mergedProviders(config);\n\treturn Alchemy.Stack(opts.name, {\n\t\tproviders,\n\t\tstate: resolveStateLayer(opts, config, containers)\n\t}, stackEffect);\n}\n//#endregion\nexport { LowerError, buildConfig, joinDeployment, lower, lowering, mergedProviders, resolveStateLayer };\n\n//# sourceMappingURL=deploy.mjs.map"],"mappings":";;;;;;AAMA,IAAI,aAAa,cAAc,MAAM;CACpC,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;;;;;AAkBA,SAAS,aAAa,MAAM,WAAW,MAAM,OAAO,OAAO;CAC1D,IAAI,UAAU,KAAK,GAAG;EACrB,IAAI,MAAM,cAAc,KAAK,GAAG,MAAM,IAAI,WAAW,UAAU,KAAK,QAAQ,UAAU,cAAc,KAAK,KAAK,mEAAmE,cAAc,KAAK,IAAI,mBAAmB,kBAAkB,qCAAqC,OAAO,MAAM,UAAU,KAAK,EAAE,4EAA4E;EAC5X,IAAI,cAAc,KAAK,GAAG,OAAO;EACjC,MAAM,SAAS,MAAM,OAAO,YAAY,CAAC,SAAS,KAAK;EACvD,IAAI,kBAAkB,SAAS,MAAM,IAAI,WAAW,UAAU,KAAK,QAAQ,UAAU,cAAc,KAAK,KAAK,oGAAoG;EACjN,IAAI,OAAO,WAAW,KAAK,GAAG;GAC7B,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,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A,SAAS,MAAM,MAAM,QAAQ,MAAM;CAClC,MAAM,cAAc,OAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,CAAC;CAC7D,MAAM,aAAa,sBAAsB,OAAO,YAAY,QAAQ,GAAG;CACvE,MAAM,YAAY,KAAK,aAAa,gBAAgB,MAAM;CAC1D,OAAO,QAAQ,MAAM,KAAK,MAAM;EAC/B;EACA,OAAO,kBAAkB,MAAM,QAAQ,UAAU;CAClD,GAAG,WAAW;AACf"}
@@ -0,0 +1,70 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import * as fs from "node:fs";
3
+ //#region ../../0-framework/3-tooling/cli/dist/deployment-summary-r47O6kFr.mjs
4
+ /**
5
+ * The deploy result's cross-process protocol, whole in one place: the
6
+ * serializable shape, the env var that names the carrier file, the writer the
7
+ * report hook calls from inside the alchemy child, and the reader the deploy
8
+ * operation runs after the child exits. `DeploymentResult` itself cannot
9
+ * cross the boundary — its `DeployedNode` entries hold live graph-node
10
+ * references (ADR-0033) — so the writer projects it down to what CAN.
11
+ *
12
+ * The summary is best-effort by contract: the writer never fails the child
13
+ * over it, and the reader maps absent or malformed to `undefined`.
14
+ */
15
+ /** Env var the deploy operation sets on the alchemy child: when present,
16
+ * the report hook also writes the JSON DeploymentSummary there. */
17
+ const DEPLOYMENT_RESULT_FILE_ENV = "PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE";
18
+ /** Pure projection: keeps app + each node's address/entities, drops the in-process `node`. */
19
+ function toDeploymentSummary(result) {
20
+ return {
21
+ app: result.app,
22
+ nodes: result.nodes.map((node) => ({
23
+ address: node.address,
24
+ entities: node.entities
25
+ }))
26
+ };
27
+ }
28
+ /**
29
+ * Writer half, called by the report hook inside the alchemy child: when the
30
+ * env var names a file, write the summary there. Best-effort — a write
31
+ * failure must not fail a deploy that already converged, so it is swallowed.
32
+ */
33
+ function writeDeploymentSummaryFile(result) {
34
+ const file = process.env[DEPLOYMENT_RESULT_FILE_ENV];
35
+ if (file === void 0 || file.length === 0) return;
36
+ try {
37
+ fs.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));
38
+ } catch {}
39
+ }
40
+ function isRecord(value) {
41
+ return typeof value === "object" && value !== null;
42
+ }
43
+ /**
44
+ * Reader half, run by the deploy operation after the child exits. Absent or
45
+ * malformed → undefined — the summary is best-effort, never a deploy failure.
46
+ */
47
+ function readDeploymentSummary(resultFilePath) {
48
+ let raw;
49
+ try {
50
+ raw = fs.readFileSync(resultFilePath, "utf8");
51
+ } catch {
52
+ return;
53
+ }
54
+ let parsed;
55
+ try {
56
+ parsed = JSON.parse(raw);
57
+ } catch {
58
+ return;
59
+ }
60
+ if (!isRecord(parsed) || typeof parsed["app"] !== "string" || !Array.isArray(parsed["nodes"])) return;
61
+ for (const node of parsed["nodes"]) {
62
+ if (!isRecord(node) || typeof node["address"] !== "string" || !Array.isArray(node["entities"])) return;
63
+ for (const entity of node["entities"]) if (!isRecord(entity) || typeof entity["kind"] !== "string" || typeof entity["id"] !== "string") return;
64
+ }
65
+ return blindCast(parsed);
66
+ }
67
+ //#endregion
68
+ export { readDeploymentSummary as n, writeDeploymentSummaryFile as r, DEPLOYMENT_RESULT_FILE_ENV as t };
69
+
70
+ //# sourceMappingURL=deployment-summary-r47O6kFr-CcMYVOn5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-summary-r47O6kFr-CcMYVOn5.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-r47O6kFr.mjs"],"sourcesContent":["import { blindCast } from \"@internal/foundation/casts\";\nimport * as fs from \"node:fs\";\n//#region src/deployment-summary.ts\n/**\n* The deploy result's cross-process protocol, whole in one place: the\n* serializable shape, the env var that names the carrier file, the writer the\n* report hook calls from inside the alchemy child, and the reader the deploy\n* operation runs after the child exits. `DeploymentResult` itself cannot\n* cross the boundary — its `DeployedNode` entries hold live graph-node\n* references (ADR-0033) — so the writer projects it down to what CAN.\n*\n* The summary is best-effort by contract: the writer never fails the child\n* over it, and the reader maps absent or malformed to `undefined`.\n*/\n/** Env var the deploy operation sets on the alchemy child: when present,\n* the report hook also writes the JSON DeploymentSummary there. */\nconst DEPLOYMENT_RESULT_FILE_ENV = \"PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE\";\n/** Pure projection: keeps app + each node's address/entities, drops the in-process `node`. */\nfunction toDeploymentSummary(result) {\n\treturn {\n\t\tapp: result.app,\n\t\tnodes: result.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities\n\t\t}))\n\t};\n}\n/**\n* Writer half, called by the report hook inside the alchemy child: when the\n* env var names a file, write the summary there. Best-effort — a write\n* failure must not fail a deploy that already converged, so it is swallowed.\n*/\nfunction writeDeploymentSummaryFile(result) {\n\tconst file = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (file === void 0 || file.length === 0) return;\n\ttry {\n\t\tfs.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));\n\t} catch {}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Reader half, run by the deploy operation after the child exits. Absent or\n* malformed → undefined — the summary is best-effort, never a deploy failure.\n*/\nfunction readDeploymentSummary(resultFilePath) {\n\tlet raw;\n\ttry {\n\t\traw = fs.readFileSync(resultFilePath, \"utf8\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tif (!isRecord(parsed) || typeof parsed[\"app\"] !== \"string\" || !Array.isArray(parsed[\"nodes\"])) return;\n\tfor (const node of parsed[\"nodes\"]) {\n\t\tif (!isRecord(node) || typeof node[\"address\"] !== \"string\" || !Array.isArray(node[\"entities\"])) return;\n\t\tfor (const entity of node[\"entities\"]) if (!isRecord(entity) || typeof entity[\"kind\"] !== \"string\" || typeof entity[\"id\"] !== \"string\") return;\n\t}\n\treturn blindCast(parsed);\n}\n//#endregion\nexport { readDeploymentSummary as n, writeDeploymentSummaryFile as r, DEPLOYMENT_RESULT_FILE_ENV as t };\n\n//# sourceMappingURL=deployment-summary-r47O6kFr.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,6BAA6B;;AAEnC,SAAS,oBAAoB,QAAQ;CACpC,OAAO;EACN,KAAK,OAAO;EACZ,OAAO,OAAO,MAAM,KAAK,UAAU;GAClC,SAAS,KAAK;GACd,UAAU,KAAK;EAChB,EAAE;CACH;AACD;;;;;;AAMA,SAAS,2BAA2B,QAAQ;CAC3C,MAAM,OAAO,QAAQ,IAAI;CACzB,IAAI,SAAS,KAAK,KAAK,KAAK,WAAW,GAAG;CAC1C,IAAI;EACH,GAAG,cAAc,MAAM,KAAK,UAAU,oBAAoB,MAAM,CAAC,CAAC;CACnE,QAAQ,CAAC;AACV;AACA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;;;;;AAKA,SAAS,sBAAsB,gBAAgB;CAC9C,IAAI;CACJ,IAAI;EACH,MAAM,GAAG,aAAa,gBAAgB,MAAM;CAC7C,QAAQ;EACP;CACD;CACA,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,GAAG;CACxB,QAAQ;EACP;CACD;CACA,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,OAAO,QAAQ,GAAG;CAC/F,KAAK,MAAM,QAAQ,OAAO,UAAU;EACnC,IAAI,CAAC,SAAS,IAAI,KAAK,OAAO,KAAK,eAAe,YAAY,CAAC,MAAM,QAAQ,KAAK,WAAW,GAAG;EAChG,KAAK,MAAM,UAAU,KAAK,aAAa,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,YAAY,YAAY,OAAO,OAAO,UAAU,UAAU;CACzI;CACA,OAAO,UAAU,MAAM;AACxB"}
@@ -1,4 +1,4 @@
1
- import "./graph-DgbALPDo-BEHF94BN.mjs";
1
+ import "./graph-BJgUfGB0-kvgFzT4q.mjs";
2
2
  import "./secret-DoWGmN7m-DO5Brq1Y.mjs";
3
3
  //#region ../../0-framework/1-core/core/dist/index.mjs
4
4
  /**
@@ -126,4 +126,4 @@ function hydrateSync(root, config) {
126
126
  //#endregion
127
127
  export { number as a, string as c, inputManifest as i, hydrate as n, param as o, hydrateSync as r, paramManifest as s, configOf as t };
128
128
 
129
- //# sourceMappingURL=dist-BdvFDCLV.mjs.map
129
+ //# sourceMappingURL=dist-C5rZnr4n.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-BdvFDCLV.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["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-DgbALPDo.mjs\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\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 input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042). Pure graph introspection, TARGET-AGNOSTIC — a deploy\n* target's recursive descent classifies the binding's leaves (its preflight\n* verifies each `envSecret` leaf's platform var exists before deploy; the\n* values are provisioned out-of-band).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\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. 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* 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//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isProvisionNeed, isSecretSource, isSecretString, module, number, param, paramManifest, paramNeed, paramSource, provisionNeed, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,O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AW,cAAc,IAAI;AACrC;;AAEA,SAAS,OAAO,OAAO,CAAC,GAAG;CAC1B,OAAO,WAAW,cAAc,IAAI;AACrC;;AAEA,SAAS,MAAM,QAAQ,OAAO,CAAC,GAAG;CACjC,OAAO,WAAW,QAAQ,IAAI;AAC/B;;;;;;;;AAUA,eAAe,QAAQ,MAAM,QAAQ;CACpC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,KAAK,QAAQ,MAAM,UAAU,WAAW,QAAQ,MAAM;CACvD;CACA,OAAO;AACR;;;;;;;AAOA,SAAS,YAAY,MAAM,QAAQ;CAClC,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,KAAK,MAAM,GAAG;EAC5D,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC;EACvC,MAAM,SAAS,UAAU,WAAW,QAAQ,MAAM;EAClD,IAAI,kBAAkB,SAAS,MAAM,IAAI,MAAM,iCAAiC,KAAK,oEAAoE;EACzJ,KAAK,QAAQ;CACd;CACA,OAAO;AACR"}
1
+ {"version":3,"file":"dist-C5rZnr4n.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/index.mjs"],"sourcesContent":["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-BJgUfGB0.mjs\";\nimport { SecretBox, isSecretString } from \"@internal/foundation/secret\";\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 input manifest: every service input binding a `provision()` call\n* supplied (ADR-0042). Pure graph introspection, TARGET-AGNOSTIC — a deploy\n* target's recursive descent classifies the binding's leaves (its preflight\n* verifies each `envSecret` leaf's platform var exists before deploy; the\n* values are provisioned out-of-band).\n*/\nfunction inputManifest(graph) {\n\treturn graph.inputBindings;\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. 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* 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//#endregion\nexport { Load, LoadError, ResourceNodeBase, SecretBox, configOf, dependency, freezeNode, hydrate, hydrateSync, inputManifest, isNode, isParamSource, isProvisionNeed, isSecretSource, isSecretString, module, number, param, paramManifest, paramNeed, paramSource, provisionNeed, resource, secret, secretSource, service, string };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,cAAc,QAAQ;CAC9B,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC,OAAO;AAC7C;;;;;;;;;;AAUA,SAAS,SAAS,MAAM;CACvB,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EACjD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,WAAW,MAAM,GAAG,QAAQ,KAAK;GACjF,OAAO,EAAE,MAAM;GACf;GACA,QAAQ,cAAc,MAAM,MAAM;GAClC,UAAU,MAAM,aAAa;GAC7B,SAAS,MAAM;EAChB,CAAC;CACF;CACA,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG,QAAQ,KAAK;EACrE,OAAO;EACP;EACA,QAAQ,cAAc,MAAM,MAAM;EAClC,UAAU,MAAM,aAAa;EAC7B,SAAS,MAAM;CAChB,CAAC;CACD,OAAO;AACR;;;;;;;;AAQA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;;;;;;;;;AASA,SAAS,cAAc,OAAO;CAC7B,OAAO,MAAM;AACd;AACA,SAAS,aAAa,MAAM,OAAO;CAClC,OAAO,EAAE,aAAa;EACrB,SAAS;EACT,QAAQ;EACR,WAAW,UAAU,MAAM,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE,QAAQ,CAAC,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;CAClH,EAAE;AACH;AACA,MAAM,eAAe,aAAa,WAAW,MAAM,OAAO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-retry-DGonap4g.mjs
2
+ /**
3
+ * An emulator admin call right after a converge that just PUT dozens of
4
+ * resources through the same daemon can hit a transient refused/reset
5
+ * connection — a brief loopback hiccup under load, not a real failure.
6
+ * Retried before giving up. Shared by the dev and log executors, which talk
7
+ * to the same daemons (`startServices`, `endpoints`, `attach`).
8
+ */
9
+ const EMULATOR_RETRY_ATTEMPTS = 5;
10
+ const EMULATOR_RETRY_DELAY_MS = 500;
11
+ async function withEmulatorRetry(call) {
12
+ let lastError;
13
+ for (let attempt = 1; attempt <= EMULATOR_RETRY_ATTEMPTS; attempt += 1) try {
14
+ return await call();
15
+ } catch (error) {
16
+ lastError = error;
17
+ if (attempt < EMULATOR_RETRY_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, EMULATOR_RETRY_DELAY_MS));
18
+ }
19
+ throw lastError instanceof Error ? lastError : new Error(String(lastError));
20
+ }
21
+ //#endregion
22
+ export { withEmulatorRetry as t };
23
+
24
+ //# sourceMappingURL=emulator-retry-DGonap4g-S8BNrXFD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emulator-retry-DGonap4g-S8BNrXFD.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/emulator-retry-DGonap4g.mjs"],"sourcesContent":["//#region src/operations/emulator-retry.ts\n/**\n* An emulator admin call right after a converge that just PUT dozens of\n* resources through the same daemon can hit a transient refused/reset\n* connection — a brief loopback hiccup under load, not a real failure.\n* Retried before giving up. Shared by the dev and log executors, which talk\n* to the same daemons (`startServices`, `endpoints`, `attach`).\n*/\nconst EMULATOR_RETRY_ATTEMPTS = 5;\nconst EMULATOR_RETRY_DELAY_MS = 500;\nasync function withEmulatorRetry(call) {\n\tlet lastError;\n\tfor (let attempt = 1; attempt <= EMULATOR_RETRY_ATTEMPTS; attempt += 1) try {\n\t\treturn await call();\n\t} catch (error) {\n\t\tlastError = error;\n\t\tif (attempt < EMULATOR_RETRY_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, EMULATOR_RETRY_DELAY_MS));\n\t}\n\tthrow lastError instanceof Error ? lastError : new Error(String(lastError));\n}\n//#endregion\nexport { withEmulatorRetry as t };\n\n//# sourceMappingURL=emulator-retry-DGonap4g.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,eAAe,kBAAkB,MAAM;CACtC,IAAI;CACJ,KAAK,IAAI,UAAU,GAAG,WAAW,yBAAyB,WAAW,GAAG,IAAI;EAC3E,OAAO,MAAM,KAAK;CACnB,SAAS,OAAO;EACf,YAAY;EACZ,IAAI,UAAU,yBAAyB,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,uBAAuB,CAAC;CACnH;CACA,MAAM,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,SAAS,CAAC;AAC3E"}
@@ -0,0 +1,88 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ //#region ../../0-framework/0-foundation/foundation/dist/errors.mjs
3
+ /**
4
+ * Returns an object with the key/value if value is defined, otherwise an empty object.
5
+ *
6
+ * Use with spread to conditionally include optional properties while satisfying
7
+ * exactOptionalPropertyTypes. This is explicit about which properties are optional
8
+ * and won't inadvertently strip other undefined values.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Instead of:
13
+ * const obj = {
14
+ * required: 'value',
15
+ * ...(optional ? { optional } : {}),
16
+ * };
17
+ *
18
+ * // Use:
19
+ * const obj = {
20
+ * required: 'value',
21
+ * ...ifDefined('optional', optional),
22
+ * };
23
+ * ```
24
+ */
25
+ function ifDefined(key, value) {
26
+ return value !== void 0 ? blindCast({ [key]: value }) : {};
27
+ }
28
+ /**
29
+ * Structured CLI error that contains all information needed for error envelopes.
30
+ * Call sites throw these errors with full context.
31
+ *
32
+ * A `CliStructuredError` is a `StructuredError` (see
33
+ * `./structured-error.ts`): `code` is a dotted
34
+ * `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's
35
+ * category — there is no separate `domain` field. See ADR 239 in
36
+ * prisma/prisma and composer's ADR-0044 for the namespace taxonomy.
37
+ */
38
+ var CliStructuredError = class extends Error {
39
+ code;
40
+ severity;
41
+ constructor(code, summary, options) {
42
+ super(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);
43
+ this.name = "CliStructuredError";
44
+ this.code = code;
45
+ this.severity = options?.severity ?? "error";
46
+ const fix = options?.fix === options?.why ? void 0 : options?.fix;
47
+ const where = options?.where ? {
48
+ ...ifDefined("path", options.where.path),
49
+ ...ifDefined("line", options.where.line)
50
+ } : void 0;
51
+ Object.assign(this, {
52
+ ...ifDefined("why", options?.why),
53
+ ...ifDefined("fix", fix),
54
+ ...ifDefined("where", where),
55
+ ...ifDefined("meta", options?.meta),
56
+ ...ifDefined("docsUrl", options?.docsUrl)
57
+ });
58
+ }
59
+ /**
60
+ * Converts this error to a CLI error envelope for output formatting.
61
+ */
62
+ toEnvelope() {
63
+ return {
64
+ ok: false,
65
+ code: this.code,
66
+ severity: this.severity,
67
+ summary: this.message,
68
+ ...ifDefined("why", this.why),
69
+ ...ifDefined("fix", this.fix),
70
+ ...ifDefined("where", this.where),
71
+ ...ifDefined("meta", this.meta),
72
+ ...ifDefined("docsUrl", this.docsUrl)
73
+ };
74
+ }
75
+ /**
76
+ * Type guard to check if an error is a CliStructuredError.
77
+ * Uses duck-typing to work across module boundaries where instanceof may fail.
78
+ */
79
+ static is(error) {
80
+ if (!(error instanceof Error)) return false;
81
+ const candidate = blindCast(error);
82
+ return candidate.name === "CliStructuredError" && typeof candidate.code === "string" && typeof candidate.toEnvelope === "function";
83
+ }
84
+ };
85
+ //#endregion
86
+ export { CliStructuredError as t };
87
+
88
+ //# sourceMappingURL=errors-0e8IVwzi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-0e8IVwzi.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-BIc-ehme.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceM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,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,eAAe;CACzH;AACD"}
@@ -0,0 +1,306 @@
1
+ import { a as CliStructuredError, i as toStructured, o as blindCast } from "./shared-CCaR42wo-BvegvmA_.mjs";
2
+ import { n as ok, r as okVoid, t as notOk } from "./result-CFqJKiqg.mjs";
3
+ import { n as runAlchemy, t as containerEnv } from "./container-transport-DKmKg5JQ-BMRhx5w-.mjs";
4
+ import { n as runPipeline } from "./pipeline-D3QoVzAB-D_ufjg3N.mjs";
5
+ import * as fs from "node:fs";
6
+ import * as path from "node:path";
7
+ import { spawnSync } from "node:child_process";
8
+ import { randomUUID } from "node:crypto";
9
+ //#region ../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs
10
+ /** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
11
+ const GENERATED_DIR = ".prisma-composer";
12
+ const GENERATED_FILE = "alchemy.run.ts";
13
+ /** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */
14
+ function relativeImportSpecifier(generatedDir, target) {
15
+ const rel = path.relative(generatedDir, target).split(path.sep).join("/");
16
+ return rel.startsWith(".") ? rel : `./${rel}`;
17
+ }
18
+ function quote(value) {
19
+ return JSON.stringify(value);
20
+ }
21
+ function renderBundle(bundle) {
22
+ return `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;
23
+ }
24
+ function renderOptions(input) {
25
+ const lines = [];
26
+ lines.push(` name: ${quote(input.name)},`);
27
+ lines.push(" bundles: {");
28
+ for (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);
29
+ lines.push(" },");
30
+ lines.push(" report: deploymentReport,");
31
+ return lines.join("\n");
32
+ }
33
+ /** 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. */
34
+ function renderStackFile(input) {
35
+ const generatedDir = path.join(input.cwd, GENERATED_DIR);
36
+ const appImport = relativeImportSpecifier(generatedDir, input.entryPath);
37
+ const configImport = relativeImportSpecifier(generatedDir, input.configPath);
38
+ return `// Generated by \`prisma-composer deploy\`/\`prisma-composer destroy\` — overwritten on every
39
+ // run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:
40
+ //
41
+ // alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}
42
+ //
43
+ // bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).
44
+ import { lower } from '@prisma/composer/deploy';
45
+ import { deploymentReport } from '@prisma/composer/report';
46
+ import config from ${quote(configImport)};
47
+ import app from ${quote(appImport)};
48
+
49
+ export default lower(app, config, {
50
+ ${renderOptions(input)}
51
+ });
52
+ `;
53
+ }
54
+ /** Writes the stack file, returning its absolute path. */
55
+ function writeStackFile(input) {
56
+ const generatedDir = path.join(input.cwd, GENERATED_DIR);
57
+ fs.mkdirSync(generatedDir, { recursive: true });
58
+ const filePath = path.join(generatedDir, GENERATED_FILE);
59
+ fs.writeFileSync(filePath, renderStackFile(input));
60
+ return filePath;
61
+ }
62
+ const GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);
63
+ //#endregion
64
+ //#region ../../0-framework/3-tooling/cli/dist/deployment-summary-r47O6kFr.mjs
65
+ /**
66
+ * The deploy result's cross-process protocol, whole in one place: the
67
+ * serializable shape, the env var that names the carrier file, the writer the
68
+ * report hook calls from inside the alchemy child, and the reader the deploy
69
+ * operation runs after the child exits. `DeploymentResult` itself cannot
70
+ * cross the boundary — its `DeployedNode` entries hold live graph-node
71
+ * references (ADR-0033) — so the writer projects it down to what CAN.
72
+ *
73
+ * The summary is best-effort by contract: the writer never fails the child
74
+ * over it, and the reader maps absent or malformed to `undefined`.
75
+ */
76
+ /** Env var the deploy operation sets on the alchemy child: when present,
77
+ * the report hook also writes the JSON DeploymentSummary there. */
78
+ const DEPLOYMENT_RESULT_FILE_ENV = "PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE";
79
+ function isRecord(value) {
80
+ return typeof value === "object" && value !== null;
81
+ }
82
+ /**
83
+ * Reader half, run by the deploy operation after the child exits. Absent or
84
+ * malformed → undefined — the summary is best-effort, never a deploy failure.
85
+ */
86
+ function readDeploymentSummary(resultFilePath) {
87
+ let raw;
88
+ try {
89
+ raw = fs.readFileSync(resultFilePath, "utf8");
90
+ } catch {
91
+ return;
92
+ }
93
+ let parsed;
94
+ try {
95
+ parsed = JSON.parse(raw);
96
+ } catch {
97
+ return;
98
+ }
99
+ if (!isRecord(parsed) || typeof parsed["app"] !== "string" || !Array.isArray(parsed["nodes"])) return;
100
+ for (const node of parsed["nodes"]) {
101
+ if (!isRecord(node) || typeof node["address"] !== "string" || !Array.isArray(node["entities"])) return;
102
+ for (const entity of node["entities"]) if (!isRecord(entity) || typeof entity["kind"] !== "string" || typeof entity["id"] !== "string") return;
103
+ }
104
+ return blindCast(parsed);
105
+ }
106
+ //#endregion
107
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-IT4vGkMc.mjs
108
+ /** 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. */
109
+ function validateStageName(stage) {
110
+ const result = spawnSync("git", ["check-ref-format", `refs/heads/${stage}`], { stdio: "ignore" });
111
+ if (result.error) throw new CliStructuredError("DEPLOY.STAGE_UNVALIDATABLE", `git is required to validate --stage "${stage}" (git check-ref-format): ${result.error.message}.`, { cause: result.error });
112
+ if (result.status !== 0) throw new CliStructuredError("DEPLOY.STAGE_INVALID", `Invalid --stage "${stage}": must be a valid git ref name (git check-ref-format rejected "refs/heads/${stage}").`);
113
+ }
114
+ /**
115
+ * The deploy/destroy executor — main.ts's pipeline orchestration with argv,
116
+ * console, and exit codes removed: typed inputs in, structured results out.
117
+ * Reached only by lazy import from deploy.ts/destroy.ts — this module's
118
+ * static graph transitively loads alchemy's provider tree, so the control
119
+ * entry must never import it statically.
120
+ */
121
+ const ALCHEMY_STATE_DIR = ".alchemy";
122
+ /** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */
123
+ function hasNoLocalDeployState(cwd) {
124
+ const stateDir = path.join(cwd, ALCHEMY_STATE_DIR);
125
+ return !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);
126
+ }
127
+ async function executeDeploy(input, deps, cwd) {
128
+ const outcome = await runStackPipeline("deploy", {
129
+ entry: input.entry,
130
+ name: input.name,
131
+ stage: input.stage,
132
+ cwd,
133
+ onEvent: void 0,
134
+ deps
135
+ });
136
+ if (!outcome.ok) return outcome;
137
+ return ok({ summary: outcome.value });
138
+ }
139
+ async function executeDestroy(input, deps, cwd) {
140
+ const outcome = await runStackPipeline("destroy", {
141
+ entry: input.entry,
142
+ name: input.name,
143
+ stage: input.target.kind === "stage" ? input.target.stage : void 0,
144
+ cwd,
145
+ onEvent: input.onEvent,
146
+ deps
147
+ });
148
+ if (!outcome.ok) return outcome;
149
+ return okVoid();
150
+ }
151
+ /** The pipeline both actions share: validate, resolve containers, preflight,
152
+ * write the stack file, run alchemy against it, then the destroy-only
153
+ * teardown/removal suffix. The value is only ever a summary for deploy. */
154
+ async function runStackPipeline(action, opts) {
155
+ const { entry, name, stage, cwd, onEvent, deps } = opts;
156
+ if (stage !== void 0) try {
157
+ validateStageName(stage);
158
+ } catch (error) {
159
+ if (CliStructuredError.is(error)) return notOk(error);
160
+ throw error;
161
+ }
162
+ if (action === "destroy" && hasNoLocalDeployState(cwd)) onEvent?.({
163
+ kind: "no-local-deploy-state",
164
+ cwd
165
+ });
166
+ let pipeline;
167
+ let containers;
168
+ let alchemyStage;
169
+ try {
170
+ pipeline = await runPipeline(entry, name, cwd, {
171
+ runAssembler: deps.runAssembler,
172
+ config: deps.config
173
+ }, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
174
+ why: "destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.",
175
+ fix: "Run the build, then retry the destroy.",
176
+ cause: error
177
+ }) : void 0);
178
+ const { config, graph, name: resolvedName } = pipeline;
179
+ containers = /* @__PURE__ */ new Map();
180
+ for (const extension of config.extensions) {
181
+ if (extension.container === void 0) continue;
182
+ try {
183
+ if (action === "deploy") containers.set(extension.id, await extension.container.ensure({
184
+ appName: resolvedName,
185
+ stage
186
+ }));
187
+ else {
188
+ const instance = await extension.container.locate({
189
+ appName: resolvedName,
190
+ stage
191
+ });
192
+ if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : ""}.`, { fix: "Deploy it first." });
193
+ containers.set(extension.id, instance);
194
+ }
195
+ } catch (error) {
196
+ throw toStructured("DEPLOY.CONTAINER_FAILED", error);
197
+ }
198
+ }
199
+ const pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;
200
+ if (pinnedStage === void 0) throw new CliStructuredError("DEPLOY.SCOPE_MISSING", "The configured deploy target supplied no deploy scope (its container defines no alchemyStage), so Alchemy has no stage to run under.", { fix: action === "deploy" ? "Pass --stage <name> to choose the deploy scope explicitly." : "destroy --production needs a target whose container supplies the production deploy scope." });
201
+ alchemyStage = pinnedStage;
202
+ if (action === "deploy") for (const extension of config.extensions) {
203
+ if (extension.preflight === void 0) continue;
204
+ try {
205
+ await extension.preflight({
206
+ graph,
207
+ container: containers.get(extension.id),
208
+ stage
209
+ });
210
+ } catch (error) {
211
+ throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
212
+ }
213
+ }
214
+ } catch (error) {
215
+ if (CliStructuredError.is(error)) return notOk(error);
216
+ throw error;
217
+ }
218
+ let stackPath;
219
+ const resultFilePath = path.join(cwd, ".prisma-composer", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);
220
+ try {
221
+ try {
222
+ stackPath = writeStackFile({
223
+ entryPath: pipeline.entryModule.path,
224
+ cwd,
225
+ configPath: pipeline.configPath,
226
+ name: pipeline.name,
227
+ assembled: pipeline.assembled
228
+ });
229
+ } catch (error) {
230
+ return notOk(toStructured("DEPLOY.STACK_WRITE_FAILED", error));
231
+ }
232
+ const reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;
233
+ let status;
234
+ try {
235
+ status = (deps.alchemy ?? runAlchemy)({
236
+ command: action,
237
+ stackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,
238
+ cwd,
239
+ stage: alchemyStage,
240
+ containerEnv: containerEnv(containers),
241
+ env: {
242
+ ...process.env,
243
+ [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
244
+ }
245
+ });
246
+ } catch (error) {
247
+ if (CliStructuredError.is(error)) return notOk(error);
248
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", error instanceof Error ? error.message : String(error), {
249
+ cause: error,
250
+ meta: { diagnostics: {
251
+ exitCode: void 0,
252
+ stackFilePath: stackPath,
253
+ reproduceCommand,
254
+ cwd
255
+ } }
256
+ }));
257
+ }
258
+ if (status !== 0) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} exited with status ${status}.`, { meta: {
259
+ exitCode: status,
260
+ diagnostics: {
261
+ exitCode: status,
262
+ stackFilePath: stackPath,
263
+ reproduceCommand,
264
+ cwd
265
+ }
266
+ } }));
267
+ try {
268
+ if (action === "destroy") {
269
+ for (const extension of pipeline.config.extensions) {
270
+ if (extension.teardown === void 0) continue;
271
+ try {
272
+ await extension.teardown({
273
+ container: containers.get(extension.id),
274
+ stage
275
+ });
276
+ } catch (error) {
277
+ throw toStructured("DEPLOY.TEARDOWN_FAILED", error);
278
+ }
279
+ }
280
+ for (const extension of pipeline.config.extensions) {
281
+ if (extension.container === void 0) continue;
282
+ const instance = containers.get(extension.id);
283
+ if (instance === void 0) continue;
284
+ try {
285
+ await extension.container.remove(instance);
286
+ } catch (error) {
287
+ throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
288
+ }
289
+ }
290
+ }
291
+ } catch (error) {
292
+ if (CliStructuredError.is(error)) return notOk(error);
293
+ throw error;
294
+ }
295
+ if (action === "deploy") return ok(readDeploymentSummary(resultFilePath));
296
+ return ok(void 0);
297
+ } finally {
298
+ try {
299
+ fs.rmSync(resultFilePath, { force: true });
300
+ } catch {}
301
+ }
302
+ }
303
+ //#endregion
304
+ export { executeDeploy, executeDestroy };
305
+
306
+ //# sourceMappingURL=execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map