@prisma/composer 0.6.0-dev.1 → 0.6.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts → app-config-CFsSXEVj-B242oUnm.d.mts} +4 -4
- package/dist/{app-config-Cbv_lA38-BHJsd1DF.d.mts.map → app-config-CFsSXEVj-B242oUnm.d.mts.map} +1 -1
- package/dist/bin.mjs +11 -3275
- package/dist/bin.mjs.map +1 -1
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +401 -0
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +1 -0
- package/dist/config-ku5b_2YD.d.mts +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +75 -0
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +1 -0
- package/dist/control.d.mts +216 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +70 -0
- package/dist/control.mjs.map +1 -0
- package/dist/deploy-ku5b_2YD.d.mts +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/deploy.mjs +312 -1
- package/dist/deploy.mjs.map +1 -0
- package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs +70 -0
- package/dist/deployment-summary-r47O6kFr-CcMYVOn5.mjs.map +1 -0
- package/dist/{dist-BdvFDCLV.mjs → dist-C5rZnr4n.mjs} +2 -2
- package/dist/{dist-BdvFDCLV.mjs.map → dist-C5rZnr4n.mjs.map} +1 -1
- package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs +24 -0
- package/dist/emulator-retry-DGonap4g-S8BNrXFD.mjs.map +1 -0
- package/dist/errors-0e8IVwzi.mjs +88 -0
- package/dist/errors-0e8IVwzi.mjs.map +1 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs +306 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +1 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs +265 -0
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +1 -0
- package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs +2009 -0
- package/dist/execute-dev-DLYyduEM-88uyvrbj.mjs.map +1 -0
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs +2006 -0
- package/dist/execute-dev-DLYyduEM-BuUGTm0g.mjs.map +1 -0
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs +157 -0
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +1 -0
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs +155 -0
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +1 -0
- package/dist/{graph-DgbALPDo-BEHF94BN.mjs → graph-BJgUfGB0-kvgFzT4q.mjs} +13 -7
- package/dist/graph-BJgUfGB0-kvgFzT4q.mjs.map +1 -0
- package/dist/{graph-DDpXh7S8-b-93BcHn.d.mts → graph-DqklX5Sf-BNS2aO1j.d.mts} +3 -3
- package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts.map +1 -0
- package/dist/{graph-types-C3FOaaXm-C6_rGzfn.d.mts → graph-types-N6brq1zY-1VMNwtkJ.d.mts} +88 -5
- package/dist/graph-types-N6brq1zY-1VMNwtkJ.d.mts.map +1 -0
- package/dist/{index-BQVrMGfe.d.mts → index-DryPyF9U.d.mts} +3 -3
- package/dist/{index-BQVrMGfe.d.mts.map → index-DryPyF9U.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs +18 -0
- package/dist/internal-error-BIc-ehme-Ck_lgxD_.mjs.map +1 -0
- package/dist/local-target-DnA2E8IN.mjs +47 -0
- package/dist/local-target-DnA2E8IN.mjs.map +1 -0
- package/dist/local-target-DuSyWeYc.mjs +68 -0
- package/dist/local-target-DuSyWeYc.mjs.map +1 -0
- package/dist/local-target.d.mts +1 -1
- package/dist/local-target.mjs +2 -46
- package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts → nextjs-DLyeRR7M-DZODs9tk.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-D47aMmfr.d.mts.map → nextjs-DLyeRR7M-DZODs9tk.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs +331 -0
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +1 -0
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs +857 -0
- package/dist/pipeline-D3QoVzAB-D_ufjg3N.mjs.map +1 -0
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +30 -0
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +1 -0
- package/dist/report.d.mts +4 -3
- package/dist/report.d.mts.map +1 -1
- package/dist/report.mjs +4 -1
- package/dist/report.mjs.map +1 -1
- package/dist/result-CFqJKiqg.mjs +106 -0
- package/dist/result-CFqJKiqg.mjs.map +1 -0
- package/dist/result-CzGChwbZ.mjs +231 -0
- package/dist/result-CzGChwbZ.mjs.map +1 -0
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +48 -0
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +1 -0
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/shared-CCaR42wo-BvegvmA_.mjs +265 -0
- package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/package.json +15 -15
- package/src/exports/control.ts +1 -0
- package/dist/config-whuqZ5xT.d.mts +0 -1
- package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs +0 -313
- package/dist/deploy-C4DxNkJ9-D73lmBqy.mjs.map +0 -1
- package/dist/deploy-whuqZ5xT.d.mts +0 -1
- package/dist/graph-DDpXh7S8-b-93BcHn.d.mts.map +0 -1
- package/dist/graph-DgbALPDo-BEHF94BN.mjs.map +0 -1
- package/dist/graph-types-C3FOaaXm-C6_rGzfn.d.mts.map +0 -1
- package/dist/local-target.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs","../../../0-framework/3-tooling/cli/dist/deployment-summary-r47O6kFr.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-IT4vGkMc.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\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\nexport { renderStackFile as n, writeStackFile as r, GENERATED_STACK_RELATIVE_PATH as t };\n\n//# sourceMappingURL=generate-stack-BL6htaQb.mjs.map","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","import { r as toStructured } from \"./shared-CCaR42wo.mjs\";\nimport { r as writeStackFile, t as GENERATED_STACK_RELATIVE_PATH } from \"./generate-stack-BL6htaQb.mjs\";\nimport { n as runAlchemy } from \"./run-alchemy-hghRtddF.mjs\";\nimport { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-r47O6kFr.mjs\";\nimport { n as runPipeline } from \"./pipeline-D3QoVzAB.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { containerEnv } from \"@internal/core/config\";\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 CliStructuredError(\"DEPLOY.STAGE_UNVALIDATABLE\", `git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (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}\").`);\n}\n//#endregion\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.stage,\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"destroy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.target.kind === \"stage\" ? input.target.stage : void 0,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipeline(action, opts) {\n\tconst { entry, name, stage, cwd, onEvent, deps } = opts;\n\tif (stage !== void 0) try {\n\t\tvalidateStageName(stage);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, cwd, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\tconfig: deps.config\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tconst { config, graph, name: resolvedName } = pipeline;\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\tstage\n\t\t\t\t}));\n\t\t\t\telse {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tstage\n\t\t\t\t\t});\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : \"\"}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tconst pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;\n\t\tif (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.\" });\n\t\talchemyStage = pinnedStage;\n\t\tif (action === \"deploy\") for (const extension of config.extensions) {\n\t\t\tif (extension.preflight === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.preflight({\n\t\t\t\t\tgraph,\n\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\tstage\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\ttry {\n\t\ttry {\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigPath: pipeline.configPath,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;\n\t\tlet status;\n\t\ttry {\n\t\t\tstatus = (deps.alchemy ?? runAlchemy)({\n\t\t\t\tcommand: action,\n\t\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\t\tcwd,\n\t\t\t\tstage: alchemyStage,\n\t\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\t\tenv: {\n\t\t\t\t\t...process.env,\n\t\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand,\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tif (status !== 0) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} exited with status ${status}.`, { meta: {\n\t\t\texitCode: status,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: status,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tstage\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(readDeploymentSummary(resultFilePath));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t} catch {}\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-IT4vGkMc.mjs.map"],"mappings":";;;;;;;;;;AAIA,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;;AAEvB,SAAS,wBAAwB,cAAc,QAAQ;CACtD,MAAM,MAAM,KAAK,SAAS,cAAc,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACxE,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,MAAM,OAAO;CACrB,OAAO,KAAK,UAAU,KAAK;AAC5B;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,MAAM,OAA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ACT,IAAI;GACH,GAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;EAC1C,QAAQ,CAAC;CACV;AACD"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
2
|
+
import { t as containerEnv } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
|
|
3
|
+
import { n as ok, o as toStructured, r as okVoid, t as notOk } from "./result-CzGChwbZ.mjs";
|
|
4
|
+
import { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-r47O6kFr-CcMYVOn5.mjs";
|
|
5
|
+
import { t as runAlchemy } from "./run-alchemy-hghRtddF-CQHOzlrW.mjs";
|
|
6
|
+
import { n as runPipeline } from "./pipeline-D3QoVzAB-Ci2aJ2mE.mjs";
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
//#region ../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs
|
|
12
|
+
/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
|
|
13
|
+
const GENERATED_DIR = ".prisma-composer";
|
|
14
|
+
const GENERATED_FILE = "alchemy.run.ts";
|
|
15
|
+
/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */
|
|
16
|
+
function relativeImportSpecifier(generatedDir, target) {
|
|
17
|
+
const rel = path.relative(generatedDir, target).split(path.sep).join("/");
|
|
18
|
+
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
19
|
+
}
|
|
20
|
+
function quote(value) {
|
|
21
|
+
return JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
function renderBundle(bundle) {
|
|
24
|
+
return `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;
|
|
25
|
+
}
|
|
26
|
+
function renderOptions(input) {
|
|
27
|
+
const lines = [];
|
|
28
|
+
lines.push(` name: ${quote(input.name)},`);
|
|
29
|
+
lines.push(" bundles: {");
|
|
30
|
+
for (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);
|
|
31
|
+
lines.push(" },");
|
|
32
|
+
lines.push(" report: deploymentReport,");
|
|
33
|
+
return lines.join("\n");
|
|
34
|
+
}
|
|
35
|
+
/** 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. */
|
|
36
|
+
function renderStackFile(input) {
|
|
37
|
+
const generatedDir = path.join(input.cwd, GENERATED_DIR);
|
|
38
|
+
const appImport = relativeImportSpecifier(generatedDir, input.entryPath);
|
|
39
|
+
const configImport = relativeImportSpecifier(generatedDir, input.configPath);
|
|
40
|
+
return `// Generated by \`prisma-composer deploy\`/\`prisma-composer destroy\` — overwritten on every
|
|
41
|
+
// run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:
|
|
42
|
+
//
|
|
43
|
+
// alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}
|
|
44
|
+
//
|
|
45
|
+
// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).
|
|
46
|
+
import { lower } from '@prisma/composer/deploy';
|
|
47
|
+
import { deploymentReport } from '@prisma/composer/report';
|
|
48
|
+
import config from ${quote(configImport)};
|
|
49
|
+
import app from ${quote(appImport)};
|
|
50
|
+
|
|
51
|
+
export default lower(app, config, {
|
|
52
|
+
${renderOptions(input)}
|
|
53
|
+
});
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
/** Writes the stack file, returning its absolute path. */
|
|
57
|
+
function writeStackFile(input) {
|
|
58
|
+
const generatedDir = path.join(input.cwd, GENERATED_DIR);
|
|
59
|
+
fs.mkdirSync(generatedDir, { recursive: true });
|
|
60
|
+
const filePath = path.join(generatedDir, GENERATED_FILE);
|
|
61
|
+
fs.writeFileSync(filePath, renderStackFile(input));
|
|
62
|
+
return filePath;
|
|
63
|
+
}
|
|
64
|
+
const GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-IT4vGkMc.mjs
|
|
67
|
+
/** 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. */
|
|
68
|
+
function validateStageName(stage) {
|
|
69
|
+
const result = spawnSync("git", ["check-ref-format", `refs/heads/${stage}`], { stdio: "ignore" });
|
|
70
|
+
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 });
|
|
71
|
+
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}").`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The deploy/destroy executor — main.ts's pipeline orchestration with argv,
|
|
75
|
+
* console, and exit codes removed: typed inputs in, structured results out.
|
|
76
|
+
* Reached only by lazy import from deploy.ts/destroy.ts — this module's
|
|
77
|
+
* static graph transitively loads alchemy's provider tree, so the control
|
|
78
|
+
* entry must never import it statically.
|
|
79
|
+
*/
|
|
80
|
+
const ALCHEMY_STATE_DIR = ".alchemy";
|
|
81
|
+
/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */
|
|
82
|
+
function hasNoLocalDeployState(cwd) {
|
|
83
|
+
const stateDir = path.join(cwd, ALCHEMY_STATE_DIR);
|
|
84
|
+
return !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);
|
|
85
|
+
}
|
|
86
|
+
async function executeDeploy(input, deps, cwd) {
|
|
87
|
+
const outcome = await runStackPipeline("deploy", {
|
|
88
|
+
entry: input.entry,
|
|
89
|
+
name: input.name,
|
|
90
|
+
stage: input.stage,
|
|
91
|
+
cwd,
|
|
92
|
+
onEvent: void 0,
|
|
93
|
+
deps
|
|
94
|
+
});
|
|
95
|
+
if (!outcome.ok) return outcome;
|
|
96
|
+
return ok({ summary: outcome.value });
|
|
97
|
+
}
|
|
98
|
+
async function executeDestroy(input, deps, cwd) {
|
|
99
|
+
const outcome = await runStackPipeline("destroy", {
|
|
100
|
+
entry: input.entry,
|
|
101
|
+
name: input.name,
|
|
102
|
+
stage: input.target.kind === "stage" ? input.target.stage : void 0,
|
|
103
|
+
cwd,
|
|
104
|
+
onEvent: input.onEvent,
|
|
105
|
+
deps
|
|
106
|
+
});
|
|
107
|
+
if (!outcome.ok) return outcome;
|
|
108
|
+
return okVoid();
|
|
109
|
+
}
|
|
110
|
+
/** The pipeline both actions share: validate, resolve containers, preflight,
|
|
111
|
+
* write the stack file, run alchemy against it, then the destroy-only
|
|
112
|
+
* teardown/removal suffix. The value is only ever a summary for deploy. */
|
|
113
|
+
async function runStackPipeline(action, opts) {
|
|
114
|
+
const { entry, name, stage, cwd, onEvent, deps } = opts;
|
|
115
|
+
if (stage !== void 0) try {
|
|
116
|
+
validateStageName(stage);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
if (CliStructuredError.is(error)) return notOk(error);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
if (action === "destroy" && hasNoLocalDeployState(cwd)) onEvent?.({
|
|
122
|
+
kind: "no-local-deploy-state",
|
|
123
|
+
cwd
|
|
124
|
+
});
|
|
125
|
+
let pipeline;
|
|
126
|
+
let containers;
|
|
127
|
+
let alchemyStage;
|
|
128
|
+
try {
|
|
129
|
+
pipeline = await runPipeline(entry, name, cwd, {
|
|
130
|
+
runAssembler: deps.runAssembler,
|
|
131
|
+
config: deps.config
|
|
132
|
+
}, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
|
|
133
|
+
why: "destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.",
|
|
134
|
+
fix: "Run the build, then retry the destroy.",
|
|
135
|
+
cause: error
|
|
136
|
+
}) : void 0);
|
|
137
|
+
const { config, graph, name: resolvedName } = pipeline;
|
|
138
|
+
containers = /* @__PURE__ */ new Map();
|
|
139
|
+
for (const extension of config.extensions) {
|
|
140
|
+
if (extension.container === void 0) continue;
|
|
141
|
+
try {
|
|
142
|
+
if (action === "deploy") containers.set(extension.id, await extension.container.ensure({
|
|
143
|
+
appName: resolvedName,
|
|
144
|
+
stage
|
|
145
|
+
}));
|
|
146
|
+
else {
|
|
147
|
+
const instance = await extension.container.locate({
|
|
148
|
+
appName: resolvedName,
|
|
149
|
+
stage
|
|
150
|
+
});
|
|
151
|
+
if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : ""}.`, { fix: "Deploy it first." });
|
|
152
|
+
containers.set(extension.id, instance);
|
|
153
|
+
}
|
|
154
|
+
} catch (error) {
|
|
155
|
+
throw toStructured("DEPLOY.CONTAINER_FAILED", error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;
|
|
159
|
+
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." });
|
|
160
|
+
alchemyStage = pinnedStage;
|
|
161
|
+
if (action === "deploy") for (const extension of config.extensions) {
|
|
162
|
+
if (extension.preflight === void 0) continue;
|
|
163
|
+
try {
|
|
164
|
+
await extension.preflight({
|
|
165
|
+
graph,
|
|
166
|
+
container: containers.get(extension.id),
|
|
167
|
+
stage
|
|
168
|
+
});
|
|
169
|
+
} catch (error) {
|
|
170
|
+
throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if (CliStructuredError.is(error)) return notOk(error);
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
let stackPath;
|
|
178
|
+
const resultFilePath = path.join(cwd, ".prisma-composer", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);
|
|
179
|
+
try {
|
|
180
|
+
try {
|
|
181
|
+
stackPath = writeStackFile({
|
|
182
|
+
entryPath: pipeline.entryModule.path,
|
|
183
|
+
cwd,
|
|
184
|
+
configPath: pipeline.configPath,
|
|
185
|
+
name: pipeline.name,
|
|
186
|
+
assembled: pipeline.assembled
|
|
187
|
+
});
|
|
188
|
+
} catch (error) {
|
|
189
|
+
return notOk(toStructured("DEPLOY.STACK_WRITE_FAILED", error));
|
|
190
|
+
}
|
|
191
|
+
const reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;
|
|
192
|
+
let status;
|
|
193
|
+
try {
|
|
194
|
+
status = (deps.alchemy ?? runAlchemy)({
|
|
195
|
+
command: action,
|
|
196
|
+
stackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,
|
|
197
|
+
cwd,
|
|
198
|
+
stage: alchemyStage,
|
|
199
|
+
containerEnv: containerEnv(containers),
|
|
200
|
+
env: {
|
|
201
|
+
...process.env,
|
|
202
|
+
[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
} catch (error) {
|
|
206
|
+
if (CliStructuredError.is(error)) return notOk(error);
|
|
207
|
+
return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", error instanceof Error ? error.message : String(error), {
|
|
208
|
+
cause: error,
|
|
209
|
+
meta: { diagnostics: {
|
|
210
|
+
exitCode: void 0,
|
|
211
|
+
stackFilePath: stackPath,
|
|
212
|
+
reproduceCommand,
|
|
213
|
+
cwd
|
|
214
|
+
} }
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
if (status !== 0) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} exited with status ${status}.`, { meta: {
|
|
218
|
+
exitCode: status,
|
|
219
|
+
diagnostics: {
|
|
220
|
+
exitCode: status,
|
|
221
|
+
stackFilePath: stackPath,
|
|
222
|
+
reproduceCommand,
|
|
223
|
+
cwd
|
|
224
|
+
}
|
|
225
|
+
} }));
|
|
226
|
+
try {
|
|
227
|
+
if (action === "destroy") {
|
|
228
|
+
for (const extension of pipeline.config.extensions) {
|
|
229
|
+
if (extension.teardown === void 0) continue;
|
|
230
|
+
try {
|
|
231
|
+
await extension.teardown({
|
|
232
|
+
container: containers.get(extension.id),
|
|
233
|
+
stage
|
|
234
|
+
});
|
|
235
|
+
} catch (error) {
|
|
236
|
+
throw toStructured("DEPLOY.TEARDOWN_FAILED", error);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
for (const extension of pipeline.config.extensions) {
|
|
240
|
+
if (extension.container === void 0) continue;
|
|
241
|
+
const instance = containers.get(extension.id);
|
|
242
|
+
if (instance === void 0) continue;
|
|
243
|
+
try {
|
|
244
|
+
await extension.container.remove(instance);
|
|
245
|
+
} catch (error) {
|
|
246
|
+
throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
} catch (error) {
|
|
251
|
+
if (CliStructuredError.is(error)) return notOk(error);
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
if (action === "deploy") return ok(readDeploymentSummary(resultFilePath));
|
|
255
|
+
return ok(void 0);
|
|
256
|
+
} finally {
|
|
257
|
+
try {
|
|
258
|
+
fs.rmSync(resultFilePath, { force: true });
|
|
259
|
+
} catch {}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
export { executeDeploy, executeDestroy };
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-IT4vGkMc.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\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\nexport { renderStackFile as n, writeStackFile as r, GENERATED_STACK_RELATIVE_PATH as t };\n\n//# sourceMappingURL=generate-stack-BL6htaQb.mjs.map","import { r as toStructured } from \"./shared-CCaR42wo.mjs\";\nimport { r as writeStackFile, t as GENERATED_STACK_RELATIVE_PATH } from \"./generate-stack-BL6htaQb.mjs\";\nimport { n as runAlchemy } from \"./run-alchemy-hghRtddF.mjs\";\nimport { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-r47O6kFr.mjs\";\nimport { n as runPipeline } from \"./pipeline-D3QoVzAB.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { containerEnv } from \"@internal/core/config\";\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 CliStructuredError(\"DEPLOY.STAGE_UNVALIDATABLE\", `git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (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}\").`);\n}\n//#endregion\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.stage,\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"destroy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.target.kind === \"stage\" ? input.target.stage : void 0,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipeline(action, opts) {\n\tconst { entry, name, stage, cwd, onEvent, deps } = opts;\n\tif (stage !== void 0) try {\n\t\tvalidateStageName(stage);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, cwd, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\tconfig: deps.config\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tconst { config, graph, name: resolvedName } = pipeline;\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\tstage\n\t\t\t\t}));\n\t\t\t\telse {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tstage\n\t\t\t\t\t});\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : \"\"}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tconst pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;\n\t\tif (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.\" });\n\t\talchemyStage = pinnedStage;\n\t\tif (action === \"deploy\") for (const extension of config.extensions) {\n\t\t\tif (extension.preflight === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.preflight({\n\t\t\t\t\tgraph,\n\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\tstage\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\ttry {\n\t\ttry {\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigPath: pipeline.configPath,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;\n\t\tlet status;\n\t\ttry {\n\t\t\tstatus = (deps.alchemy ?? runAlchemy)({\n\t\t\t\tcommand: action,\n\t\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\t\tcwd,\n\t\t\t\tstage: alchemyStage,\n\t\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\t\tenv: {\n\t\t\t\t\t...process.env,\n\t\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand,\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tif (status !== 0) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} exited with status ${status}.`, { meta: {\n\t\t\texitCode: status,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: status,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tstage\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(readDeploymentSummary(resultFilePath));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t} catch {}\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-IT4vGkMc.mjs.map"],"mappings":";;;;;;;;;;;;AAIA,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;;AAEvB,SAAS,wBAAwB,cAAc,QAAQ;CACtD,MAAM,MAAM,KAAK,SAAS,cAAc,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACxE,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,MAAM,OAAO;CACrB,OAAO,KAAK,UAAU,KAAK;AAC5B;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,MAAM,OAAO,GAAG,EAAE,WAAW,MAAM,OAAO,KAAK,EAAE;AACnE;AACA,SAAS,cAAc,OAAO;CAC7B,MAAM,QAAQ,CAAC;CACf,MAAM,KAAK,WAAW,MAAM,MAAM,IAAI,EAAE,EAAE;CAC1C,MAAM,KAAK,cAAc;CACzB,KAAK,MAAM,CAAC,IAAI,WAAW,OAAO,QAAQ,MAAM,UAAU,OAAO,GAAG,MAAM,KAAK,OAAO,MAAM,EAAE,EAAE,IAAI,aAAa,MAAM,EAAE,EAAE;CAC3H,MAAM,KAAK,MAAM;CACjB,MAAM,KAAK,6BAA6B;CACxC,OAAO,MAAM,KAAK,IAAI;AACvB;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,eAAe,KAAK,KAAK,MAAM,KAAK,aAAa;CACvD,MAAM,YAAY,wBAAwB,cAAc,MAAM,SAAS;CACvE,MAAM,eAAe,wBAAwB,cAAc,MA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