@prisma/composer-cli 0.37.0 → 0.38.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{dev-current-D0Kn6Mf4-DaV3DWR6.mjs → dev-current-ByDVi5EO-iAhiHuU7.mjs} +5 -5
  2. package/dist/{dev-current-D0Kn6Mf4-DaV3DWR6.mjs.map → dev-current-ByDVi5EO-iAhiHuU7.mjs.map} +1 -1
  3. package/dist/{dist-DizJD76s.mjs → dist-BH6HQ6zZ.mjs} +2 -2
  4. package/dist/{dist-DizJD76s.mjs.map → dist-BH6HQ6zZ.mjs.map} +1 -1
  5. package/dist/{execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs → execute-deploy-destroy--N_UkK1g-YbFp_Ldb.mjs} +7 -7
  6. package/dist/execute-deploy-destroy--N_UkK1g-YbFp_Ldb.mjs.map +1 -0
  7. package/dist/{execute-dev-Bl-5Q-Av-DK5AoRw1.mjs → execute-dev-Crd7rFYA-DfLFreJv.mjs} +7 -7
  8. package/dist/{execute-dev-Bl-5Q-Av-DK5AoRw1.mjs.map → execute-dev-Crd7rFYA-DfLFreJv.mjs.map} +1 -1
  9. package/dist/{execute-dev-current-D3USgHJ4-frlaz_BC.mjs → execute-dev-current-Cj8M-VXO-CIaIGaZQ.mjs} +4 -4
  10. package/dist/{execute-dev-current-D3USgHJ4-frlaz_BC.mjs.map → execute-dev-current-Cj8M-VXO-CIaIGaZQ.mjs.map} +1 -1
  11. package/dist/family.d.mts +1 -1
  12. package/dist/family.mjs +9 -9
  13. package/dist/family.mjs.map +1 -1
  14. package/dist/{generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs → generate-dev-stack-BV_n-X9n-BDBjgphH.mjs} +3 -3
  15. package/dist/{generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs.map → generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map} +1 -1
  16. package/dist/{list-deployed-Cj37uZ6w.mjs → list-deployed-CGNtb8ly.mjs} +3 -3
  17. package/dist/list-deployed-CGNtb8ly.mjs.map +1 -0
  18. package/dist/{redaction-Bf8FvTFH-M5hYsi--.d.mts → redaction-Bf8FvTFH-Ccdv_Smp.d.mts} +29 -4
  19. package/dist/redaction-Bf8FvTFH-Ccdv_Smp.d.mts.map +1 -0
  20. package/dist/{redaction-HnbkSFrK-BjFRb2aC.mjs → redaction-HnbkSFrK-CCKJNRwi.mjs} +3 -3
  21. package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +1 -0
  22. package/dist/{run-alchemy-OS_ix5g0-BzkuReFx.mjs → run-alchemy-OS_ix5g0-DSlHsv2p.mjs} +2 -2
  23. package/dist/{run-alchemy-OS_ix5g0-BzkuReFx.mjs.map → run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map} +1 -1
  24. package/dist/testing.d.mts +1 -1
  25. package/dist/testing.mjs +3 -3
  26. package/dist/testing.mjs.map +1 -1
  27. package/dist/{validate-environment-D_dECxgO-fg8lfCME.mjs → validate-environment-CpQLC3CA-Ct-PXoKN.mjs} +25 -21
  28. package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +1 -0
  29. package/package.json +9 -9
  30. package/src/family/deploy-list.ts +2 -2
  31. package/dist/execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs.map +0 -1
  32. package/dist/list-deployed-Cj37uZ6w.mjs.map +0 -1
  33. package/dist/redaction-Bf8FvTFH-M5hYsi--.d.mts.map +0 -1
  34. package/dist/redaction-HnbkSFrK-BjFRb2aC.mjs.map +0 -1
  35. package/dist/validate-environment-D_dECxgO-fg8lfCME.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-BiBkPWlB.mjs","../../../0-framework/3-tooling/cli/dist/run-report-CmBz2-xc.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-Dh1CQ9X6.mjs"],"sourcesContent":["import { a as redactCredentialLooking } from \"./redaction-HnbkSFrK.mjs\";\nimport * as fs from \"node:fs\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { format, stripVTControlCharacters } from \"node:util\";\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`. So is the\n* failure cause the child leaves beside it when it exits non-zero.\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/** The child's failure cause rides beside the result file, so the one env var names both and the parent's cleanup removes both. */\nfunction engineFailureFilePath(resultFilePath) {\n\treturn `${resultFilePath}.failure.txt`;\n}\n/** Fits the platform's 5000-character build `errorMessage` with room for the exit-status prefix. */\nconst ENGINE_FAILURE_CAUSE_LIMIT = 1e3;\n/** Alchemy's advice to rerun its own CLI with `--adopt`, which a Composer user has no way to do. */\nconst ALCHEMY_ADOPT_ADVICE = [[/Re-run with `--adopt` \\(or wrap the effect in `adopt\\(true\\)`\\) to take it over\\./g, \"Something other than this app holds it. Remove that resource, then deploy again.\"], [/\\(re-deploy with --adopt to take ownership, then destroy\\)/g, \"(remove it by hand)\"]];\n/** Replaces Alchemy CLI advice in engine output with steps that work from Composer. */\nfunction withComposerAdvice(text) {\n\treturn ALCHEMY_ADOPT_ADVICE.reduce((current, [advice, replacement]) => current.replace(advice, replacement), text);\n}\nconst STDOUT_CONSOLE_METHODS = /* @__PURE__ */ new Set([\n\t\"log\",\n\t\"info\",\n\t\"debug\"\n]);\n/**\n* Child half of the failure protocol, called by the generated stack file.\n* Keeps a bounded tail of everything this process logs through `console`,\n* passing every call through except Alchemy's CLI advice (see\n* {@link withComposerAdvice}), and on a non-zero exit writes the\n* redacted cause beside the result file. `console`, not the output streams:\n* alchemy's logger and its error reporting both go through it, and under Bun\n* `console` does not reach `process.stdout.write`.\n*\n* When stdout is not a terminal it carries the parent's data lines, so\n* everything this process prints goes to stderr instead.\n*/\nfunction captureEngineFailure() {\n\tconst resultFile = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (resultFile === void 0 || resultFile.length === 0) return;\n\tconst stdoutToStderr = process.stdout.isTTY !== true;\n\tif (stdoutToStderr) process.stdout.write = process.stderr.write.bind(process.stderr);\n\tlet tail = \"\";\n\tfor (const method of [\n\t\t\"log\",\n\t\t\"info\",\n\t\t\"warn\",\n\t\t\"error\",\n\t\t\"debug\"\n\t]) {\n\t\tconst original = stdoutToStderr && STDOUT_CONSOLE_METHODS.has(method) ? console.error : console[method];\n\t\tconsole[method] = (...args) => {\n\t\t\tconst text = format(...args);\n\t\t\tconst shown = withComposerAdvice(text);\n\t\t\ttail = `${tail}${redactCredentialLooking(shown, process.env)}\\n`.slice(-65536);\n\t\t\tif (shown === text) original.apply(console, args);\n\t\t\telse original.call(console, shown);\n\t\t};\n\t}\n\tprocess.once(\"exit\", (code) => {\n\t\tif (code === 0) return;\n\t\tconst cause = engineFailureCause(tail, process.env);\n\t\tif (cause === void 0) return;\n\t\ttry {\n\t\t\tfs.writeFileSync(engineFailureFilePath(resultFile), cause);\n\t\t} catch {}\n\t});\n}\n/** Parent half: the cause the child recorded, passed through `redact`, or undefined when it recorded none. The child redacts only what its own environment names as a credential; the parent also knows the known secrets. */\nfunction readEngineFailureCause(resultFilePath, redact) {\n\tlet cause;\n\ttry {\n\t\tcause = fs.readFileSync(engineFailureFilePath(resultFilePath), \"utf8\");\n\t} catch {\n\t\treturn;\n\t}\n\treturn cause.length > 0 ? redact(cause) : void 0;\n}\n/** Effect's pretty log prefix, e.g. `[10:29:16.556] INFO (#53): `. */\nconst LOG_PREFIX = /^\\[[\\d:.]+\\] ([A-Z]+) \\(#\\d+\\): ?/;\n/** Alchemy's per-resource failure row, e.g. `[web] fail — UnknownError: …`. */\nconst RESOURCE_FAIL_ROW = /^\\[[^\\]]+\\] fail\\b/;\nconst STACK_FRAME = /^\\s*at /;\n/**\n* The failure the output describes: every line from the first failure line\n* (a failed resource row, an ERROR log, or an `error:` line) to the end, minus\n* blank lines, stack frames and info logs; the last five lines when there is no\n* failure line. Redacted, then capped.\n*/\nfunction engineFailureCause(output, env) {\n\tconst lines = [];\n\tfor (const raw of stripVTControlCharacters(output).split(/\\r\\n|\\r|\\n/)) {\n\t\tconst clean = raw.replace(/(?![\\t])\\p{Cc}/gu, \"\").trimEnd();\n\t\tconst prefix = LOG_PREFIX.exec(clean);\n\t\tconst text = (prefix === null ? clean : clean.slice(prefix[0].length)).trim();\n\t\tif (text.length === 0 || text === \"{\" || text === \"}\" || STACK_FRAME.test(text)) continue;\n\t\tconst level = prefix?.[1];\n\t\tconst failure = level === \"ERROR\" || level === \"FATAL\" || RESOURCE_FAIL_ROW.test(text) || /^\\W*error:/i.test(text);\n\t\tlines.push({\n\t\t\ttext,\n\t\t\tfailure,\n\t\t\tinfo: !failure && level !== void 0\n\t\t});\n\t}\n\tconst start = lines.findIndex((line) => line.failure);\n\tconst kept = start === -1 ? lines.slice(-5) : lines.slice(start).filter((line) => !line.info);\n\tif (kept.length === 0) return void 0;\n\tconst cause = redactCredentialLooking(kept.map((line) => line.text).join(\"\\n\"), env);\n\treturn cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;\n}\n//#endregion\nexport { readEngineFailureCause as a, readDeploymentSummary as i, captureEngineFailure as n, writeDeploymentSummaryFile as o, engineFailureFilePath as r, DEPLOYMENT_RESULT_FILE_ENV as t };\n\n//# sourceMappingURL=deployment-summary-BiBkPWlB.mjs.map","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/run-report.ts\n/**\n* The run report: one deploy's outcome as JSON, for tools that consume a\n* deploy rather than watch one — the Prisma GitHub Action reads it to build a\n* pull-request comment carrying preview links.\n*\n* Deliberately separate from `deployment-summary.ts`. That file is a private\n* carrier between the alchemy child and this process, written to a\n* per-run path the parent deletes in a `finally` so resource ids and URLs do\n* not accumulate on disk. This one is written where the operator asked for\n* it, survives the run, is written on the failure path too, and carries a\n* version so a consumer can depend on its shape.\n*/\n/** Bump when a change would break a consumer that reads the current shape. */\nconst RUN_REPORT_VERSION = 2;\n/** Names the file to write the run report to, when `--report` is not passed. */\nconst RUN_REPORT_FILE_ENV = \"PRISMA_COMPOSER_REPORT_FILE\";\nfunction toRunReport(input) {\n\treturn {\n\t\tversion: 2,\n\t\toutcome: input.failure === void 0 ? \"succeeded\" : \"failed\",\n\t\tapp: input.summary?.app ?? null,\n\t\tenvironment: input.environment,\n\t\tnodes: input.summary?.nodes ?? [],\n\t\tfailure: input.failure ?? null\n\t};\n}\n/**\n* The path to write to: the `--report` flag first, then the env var. Relative\n* paths resolve against the deploy's cwd. `undefined` means no report was\n* asked for, which is the common case and writes nothing.\n*/\nfunction resolveRunReportPath(flag, env, cwd) {\n\tconst requested = flag !== void 0 && flag.length > 0 ? flag : env;\n\tif (requested === void 0 || requested.length === 0) return void 0;\n\treturn path.resolve(cwd, requested);\n}\n/**\n* Writes the report, creating the parent directory if needed. A write failure\n* warns and returns false rather than failing a deploy that already\n* converged — but it is never silent, because the operator asked for this\n* file and a consumer is waiting on it.\n*/\nfunction writeRunReport(filePath, report) {\n\ttry {\n\t\tfs.mkdirSync(path.dirname(filePath), { recursive: true });\n\t\tfs.writeFileSync(filePath, `${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn true;\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not write the run report to ${filePath}: ${detail}`);\n\t\treturn false;\n\t}\n}\n//#endregion\nexport { writeRunReport as a, toRunReport as i, RUN_REPORT_VERSION as n, resolveRunReportPath as r, RUN_REPORT_FILE_ENV as t };\n\n//# sourceMappingURL=run-report-CmBz2-xc.mjs.map","import { i as runPipeline, t as validateEnvironmentName } from \"./validate-environment-D_dECxgO.mjs\";\nimport { i as noComposerExportMessage } from \"./composer-config-DO_iG0iR.mjs\";\nimport { c as redactSummary, l as redactThrown, n as SecretRedaction, s as redactError } from \"./redaction-HnbkSFrK.mjs\";\nimport { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-BiBkPWlB.mjs\";\nimport { i as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from \"./app-configuration-file-CeJvBAti.mjs\";\nimport { d as toStructured, u as requireContainerForEnvironment } from \"./dev-current-D0Kn6Mf4.mjs\";\nimport { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from \"./run-report-CmBz2-xc.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation, r as reproduceCommand } from \"./run-alchemy-OS_ix5g0.mjs\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { nodeAddresses, secretsKeys } from \"@internal/core/deploy\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { containerEnv, preflightEnv, preflightEnvVarName } from \"@internal/core/config\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { randomUUID } from \"node:crypto\";\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(` environment: ${quote(input.environment)},`);\n\tlines.push(\" appConfigurationRead: file.appConfigurationRead,\");\n\tlines.push(\" firstProcessNodeAddresses: file.nodeAddresses,\");\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: 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.configFile);\n\treturn `// Generated by Composer's deploy and destroy operations — overwritten on every\n// run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the\n// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars and the app configuration file —\n// without them lower() refuses because no container is resolved), by the\n// command Composer starts, which a failed run prints:\n//\n// <node> <bin of the alchemy @prisma/composer depends on> deploy ${GENERATED_DIR}/${GENERATED_FILE} --yes --stage <stage>\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\n// It runs no config adapter: it reads what the first process's Load read from the app configuration file named in PRISMA_COMPOSER_APP_CONFIGURATION_FILE.\nimport { lower } from '@prisma/composer/deploy';\nimport * as report from '@prisma/composer/report';\nimport { readAppConfigurationFile } from '@prisma/composer/internal/app-configuration-file';\nimport prismaConfig from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nconst config = prismaConfig.composer;\nif (config === undefined) {\n throw new Error(${quote(noComposerExportMessage(input.configFile))});\n}\n\n// The app's own @prisma/composer may predate the failure recorder.\nreport.captureEngineFailure?.();\n\nconst file = readAppConfigurationFile(process.env);\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/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}\n/**\n* Times each deploy step for the host's `onEvent`. A step still open when the\n* run fails is closed as failed, innermost first. A host `onEvent` that throws\n* is the host's bug and cannot fail the deploy.\n*/\nfunction deploySteps(onEvent) {\n\tconst open = /* @__PURE__ */ new Map();\n\tconst keyOf = (step) => step.name === \"assemble-service\" ? `${step.name}:${step.address}` : step.name;\n\tconst emit = (event) => {\n\t\ttry {\n\t\t\tonEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst finish = (step, outcome, data) => {\n\t\tconst entry = open.get(keyOf(step));\n\t\tif (entry === void 0) return;\n\t\topen.delete(keyOf(step));\n\t\tconst durationMs = Math.round(performance.now() - entry.startedAt);\n\t\temit({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\toutcome,\n\t\t\tdurationMs,\n\t\t\tdata\n\t\t});\n\t};\n\treturn {\n\t\tstart(step) {\n\t\t\topen.set(keyOf(step), {\n\t\t\t\tstep,\n\t\t\t\tstartedAt: performance.now()\n\t\t\t});\n\t\t\temit({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep\n\t\t\t});\n\t\t},\n\t\tfinish(step, data) {\n\t\t\tfinish(step, \"ok\", data);\n\t\t},\n\t\tfail(step) {\n\t\t\tfinish(step, \"failed\");\n\t\t},\n\t\tfailOpen() {\n\t\t\tfor (const { step } of [...open.values()].reverse()) finish(step, \"failed\");\n\t\t}\n\t};\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment ?? \"production\",\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps,\n\t\treportId: input.reportId,\n\t\treportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),\n\t\tsteps: deploySteps(input.onEvent),\n\t\tredaction: new SecretRedaction(process.env)\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\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps,\n\t\treportId: void 0,\n\t\treportPath: void 0,\n\t\tsteps: deploySteps(void 0),\n\t\tredaction: new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/**\n* Opens a session per extension that declares a reporter. A `begin` that\n* throws costs that extension its reporting and nothing else — the deploy\n* has not started, and refusing to run it because an observer failed would\n* invert the relationship.\n*/\nasync function beginReporters(extensions, context, redaction) {\n\treturn (await Promise.all(extensions.map(async (extension) => {\n\t\tif (extension.reporter === void 0) return void 0;\n\t\ttry {\n\t\t\tconst reporter = await extension.reporter.begin(context);\n\t\t\treturn reporter === void 0 ? void 0 : {\n\t\t\t\textensionId: extension.id,\n\t\t\t\treporter\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);\n\t\t\treturn;\n\t\t}\n\t}))).filter((entry) => entry !== void 0);\n}\n/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */\nasync function attachReporters(reporters, containers, redaction) {\n\tawait Promise.all(reporters.map(async ({ extensionId, reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.attach({ container: containers.get(extensionId) });\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/** Every session's contribution to the alchemy child's environment, so reporting that happens inside the apply can find the run. */\nfunction reporterChildEnv(reporters, redaction) {\n\tconst env = {};\n\tfor (const { extensionId, reporter } of reporters) try {\n\t\tObject.assign(env, reporter.childEnv());\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);\n\t}\n\treturn env;\n}\n/** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */\nfunction truncate(value, limit) {\n\treturn value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;\n}\n/** An interrupted converge (the engine settled a Ctrl-C) — reported as `cancelled`, never as `failed`. */\nfunction wasInterrupted(failure) {\n\treturn typeof failure.meta?.[\"signal\"] === \"string\";\n}\n/**\n* Ends every reporting session, whatever the run did. Sessions never reject\n* by contract, but a buggy one must not turn a converged deploy into a\n* failure — so this swallows anyway, and reports each session independently\n* so one bad implementation cannot silence another.\n*/\nasync function finishReporters(reporters, outcome, redaction) {\n\tconst entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];\n\tawait Promise.all(reporters.map(async ({ reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.finish({\n\t\t\t\tok: outcome.ok,\n\t\t\t\tcancelled: outcome.cancelled,\n\t\t\t\tfailingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),\n\t\t\t\terrorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),\n\t\t\t\tentities\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/**\n* Owns the reporting sessions around the pipeline: the inner run opens them\n* once it knows which extensions are configured, and this closes them on\n* every exit path — a returned failure, a success, or a thrown defect — as\n* the `record` step, which also writes the run report.\n* Nothing here can change what the pipeline returns.\n*/\nasync function runStackPipeline(action, opts) {\n\tconst reporters = [];\n\tlet outcome;\n\ttry {\n\t\toutcome = await runStackPipelineInner(action, opts, reporters);\n\t} catch (error) {\n\t\topts.steps.failOpen();\n\t\topts.steps.start({ name: \"record\" });\n\t\tconst thrown = redactThrown(error, opts.redaction);\n\t\tawait finishReporters(reporters, {\n\t\t\tok: false,\n\t\t\tcancelled: false,\n\t\t\tcode: \"DEPLOY.UNEXPECTED\",\n\t\t\tmessage: thrown.message\n\t\t}, opts.redaction);\n\t\topts.steps.finish({ name: \"record\" });\n\t\tthrow thrown;\n\t}\n\tif (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));\n\tif (!outcome.ok) opts.steps.failOpen();\n\topts.steps.start({ name: \"record\" });\n\tawait finishReporters(reporters, outcome.ok ? {\n\t\tok: true,\n\t\tcancelled: false,\n\t\tsummary: outcome.value\n\t} : {\n\t\tok: false,\n\t\tcancelled: wasInterrupted(outcome.failure),\n\t\tcode: outcome.failure.code,\n\t\tmessage: outcome.failure.message\n\t}, opts.redaction);\n\tif (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({\n\t\tsummary: outcome.ok ? outcome.value : void 0,\n\t\tenvironment: opts.environment,\n\t\tfailure: outcome.ok ? void 0 : {\n\t\t\tcode: outcome.failure.code,\n\t\t\tmessage: outcome.failure.message\n\t\t}\n\t}))) opts.steps.finish({ name: \"record\" });\n\telse opts.steps.fail({ name: \"record\" });\n\treturn outcome;\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 runStackPipelineInner(action, opts, reporters) {\n\tconst { entry, config: composerConfig, name, environment, cwd, onEvent, deps, steps } = opts;\n\tsteps.start({ name: \"prepare\" });\n\tremoveLeftoverAppConfigurationFiles(cwd);\n\ttry {\n\t\tvalidateEnvironmentName(environment);\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\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tlet preflightTransportEnv = {};\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\treadSecrets: action === \"deploy\",\n\t\t\tredaction: opts.redaction,\n\t\t\tonEvent: (event) => {\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase \"loaded\":\n\t\t\t\t\t\tsteps.finish({ name: \"prepare\" });\n\t\t\t\t\t\tsteps.start({ name: \"assemble\" });\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-started\":\n\t\t\t\t\t\tsteps.start({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-assembled\":\n\t\t\t\t\t\tsteps.finish({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t}, event.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\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\tsteps.finish({ name: \"assemble\" });\n\t\tconst { graph, name: resolvedName } = pipeline;\n\t\tconst config = pipeline.configSource.value;\n\t\tsteps.start({ name: \"connect\" });\n\t\tif (action === \"deploy\") reporters.push(...await beginReporters(config.extensions, {\n\t\t\tappName: resolvedName,\n\t\t\tgraph,\n\t\t\tenvironment,\n\t\t\tcwd,\n\t\t\treportId: opts.reportId,\n\t\t\tcredentials: deps.credentials\n\t\t}, opts.redaction));\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\") {\n\t\t\t\t\tconst instance = await extension.container.ensure({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t} else {\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\tenvironment\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\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\tawait attachReporters(reporters, containers, opts.redaction);\n\t\talchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;\n\t\tsteps.finish({ name: \"connect\" });\n\t\tif (action === \"deploy\") {\n\t\t\tsteps.start({ name: \"preflight\" });\n\t\t\tconst counts = {};\n\t\t\tconst report = (reported) => {\n\t\t\t\tfor (const [key, value] of Object.entries(reported)) counts[key] = (counts[key] ?? 0) + value;\n\t\t\t};\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.preflight === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst payload = await extension.preflight({\n\t\t\t\t\t\tgraph,\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tconfiguration: pipeline.configuration,\n\t\t\t\t\t\tsecrets: pipeline.secrets,\n\t\t\t\t\t\tcredentials: deps.credentials,\n\t\t\t\t\t\treport\n\t\t\t\t\t});\n\t\t\t\t\tif (payload !== void 0) preflightPayloads.set(extension.id, payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tpreflightTransportEnv = preflightEnv(preflightPayloads);\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t}\n\t\t\tsteps.finish({ name: \"preflight\" }, counts);\n\t\t}\n\t\tfor (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] ??= \"\";\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\tlet handover;\n\ttry {\n\t\ttry {\n\t\t\thandover = prepareSecondProcess({\n\t\t\t\tfile: deployAppConfigurationFile(cwd, randomUUID()),\n\t\t\t\tappConfigurationRead: pipeline.graph.appConfigurationRead,\n\t\t\t\tnodeAddresses: nodeAddresses(pipeline.graph),\n\t\t\t\tsecretsKeys: secretsKeys(pipeline.graph),\n\t\t\t\tknownSecrets: opts.redaction.knownSecrets\n\t\t\t});\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigFile: pipeline.configSource.file,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tenvironment,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t\thandover.writeFile();\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst invocation = alchemyInvocation({\n\t\t\tcommand: action,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage: alchemyStage,\n\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\tpreflightEnv: preflightTransportEnv,\n\t\t\tenv: {\n\t\t\t\t...reporterChildEnv(reporters, opts.redaction),\n\t\t\t\t...handover.env,\n\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t},\n\t\t\tredactedValues: opts.redaction.allValues()\n\t\t});\n\t\tsteps.start({ name: \"apply\" });\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(invocation);\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: reproduceCommand(invocation),\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tconst reproduce = reproduceCommand(invocation, outcome);\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand: reproduce,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) {\n\t\t\tconst engineCause = readEngineFailureCause(resultFilePath, (text) => opts.redaction.redact(text));\n\t\t\tconst withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\\n${engineCause}`;\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {\n\t\t\t\texitCode: status,\n\t\t\t\t...engineCause !== void 0 ? { engineCause } : {},\n\t\t\t\tdiagnostics: {\n\t\t\t\t\texitCode: status,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduce,\n\t\t\t\t\tcwd\n\t\t\t\t}\n\t\t\t} }));\n\t\t}\n\t\tsteps.finish({ name: \"apply\" });\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.configSource.value.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\tenvironment\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.configSource.value.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, deps.credentials);\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(redactSummary(readDeploymentSummary(resultFilePath), opts.redaction));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t\tfs.rmSync(engineFailureFilePath(resultFilePath), { force: true });\n\t\t} catch {}\n\t\thandover?.removeFile();\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-Dh1CQ9X6.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,6BAA6B;AAuBnC,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,I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AI;GACH,GAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;GACzC,GAAG,OAAO,sBAAsB,cAAc,GAAG,EAAE,OAAO,KAAK,CAAC;EACjE,QAAQ,CAAC;EACT,UAAU,WAAW;CACtB;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-deployed-Cj37uZ6w.mjs","names":[],"sources":["../../../1-prisma-cloud/0-lowering/lowering/dist/credentials-hqu7O0sN.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/container-CuNTXJjn.mjs","../../../1-prisma-cloud/0-lowering/lowering/dist/deployed.mjs","../src/family/deployed-nodes.ts","../src/family/list-deployed.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Config from \"effect/Config\";\n//#region package.json\nvar version = \"0.37.0\";\n//#endregion\n//#region src/credentials.ts\n/**\n* The Prisma service token used to authenticate Management API calls. Kept\n* as a Redacted value so it never lands in logs or error output.\n*/\nvar PrismaCredentials = class extends Context.Service()(\"PrismaComposerCredentials\") {};\n/** Resolve the token from the `PRISMA_SERVICE_TOKEN` environment variable. */\nconst fromEnv = () => Layer.effect(PrismaCredentials, Effect.gen(function* () {\n\treturn { token: yield* Config.Redacted(\"PRISMA_SERVICE_TOKEN\") };\n}));\nconst DEFAULT_BASE_URL = \"https://api.prisma.io\";\nconst isLoopbackHost = (hostname) => hostname === \"localhost\" || hostname.endsWith(\".localhost\") || hostname === \"127.0.0.1\" || hostname === \"[::1]\";\n/** Same validation as upstream alchemy's `PrismaEnvironment`: an HTTP(S) origin, HTTPS unless loopback, no credentials, no path/query/fragment. */\nconst normalizeBaseUrl = (value) => Effect.try({\n\ttry: () => {\n\t\tconst url = new URL(value);\n\t\tif (url.protocol !== \"https:\" && url.protocol !== \"http:\") throw new Error(\"Prisma Management API URL must use HTTP or HTTPS.\");\n\t\tif (url.username.length > 0 || url.password.length > 0) throw new Error(\"Prisma Management API URL must not contain credentials.\");\n\t\tif (url.protocol === \"http:\" && !isLoopbackHost(url.hostname)) throw new Error(\"Prisma Management API URL must use HTTPS unless it targets a loopback host.\");\n\t\tif (url.pathname !== \"/\" && url.pathname !== \"\" || url.search.length > 0 || url.hash.length > 0) throw new Error(\"Prisma Management API URL must be an origin without a path, query, or fragment.\");\n\t\treturn url.origin;\n\t},\n\tcatch: (cause) => cause instanceof Error ? cause : /* @__PURE__ */ new Error(`Invalid Prisma Management API URL: ${String(cause)}`)\n});\n/**\n* Headers the Management API records in its deploy analytics: which tool sent\n* the request, and whether it ran in GitHub Actions. The API behaves the same\n* without them.\n*/\nconst deploySourceHeaders = () => ({\n\t\"x-prisma-deploy-source\": process.env[\"GITHUB_ACTIONS\"] === \"true\" ? \"github-action\" : \"composer\",\n\t\"x-prisma-client-name\": \"composer\",\n\t\"x-prisma-client-version\": version\n});\n/**\n* The Management API origin every Prisma-Cloud client in this package uses —\n* Composer's own SDK client AND upstream alchemy's postgres providers resolve\n* it through this one function, so `PRISMA_API_URL` can never point them at\n* different hosts. Mirrors upstream alchemy's `PrismaEnvironment` resolution:\n* `PRISMA_API_URL`, then `PRISMA_MANAGEMENT_API_URL`, then the public origin,\n* normalized and validated identically.\n*/\nconst managementApiBaseUrl = (env) => env !== void 0 ? normalizeBaseUrl(env[\"PRISMA_API_URL\"] || env[\"PRISMA_MANAGEMENT_API_URL\"] || DEFAULT_BASE_URL) : Config.String(\"PRISMA_API_URL\").pipe(Config.orElse(() => Config.String(\"PRISMA_MANAGEMENT_API_URL\")), Config.withDefault(DEFAULT_BASE_URL), Effect.flatMap(normalizeBaseUrl));\n//#endregion\nexport { managementApiBaseUrl as i, deploySourceHeaders as n, fromEnv as r, PrismaCredentials as t };\n\n//# sourceMappingURL=credentials-hqu7O0sN.mjs.map","import { i as managementApiBaseUrl, n as deploySourceHeaders, t as PrismaCredentials } from \"./credentials-hqu7O0sN.mjs\";\nimport { createManagementApiClient } from \"@prisma/management-api-sdk\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Data from \"effect/Data\";\n//#region src/client.ts\n/**\n* The typed Prisma Management API client, built once from the resolved\n* credentials. Providers yield this in their outer Effect and call it inside\n* `reconcile` / `delete`.\n*/\nvar ManagementClient = class extends Context.Service()(\"PrismaManagementClient\") {};\n/**\n* By default the base URL comes from `managementApiBaseUrl()` — the SAME\n* resolver upstream's providers use (see providers.ts), so `PRISMA_API_URL`\n* can never split the postgres family and the compute/bucket/state clients\n* across hosts. `apiOrigin` overrides it (tests point it at a fake).\n*/\nconst layer = (options) => Layer.effect(ManagementClient, Effect.gen(function* () {\n\tconst { token } = yield* PrismaCredentials;\n\tconst baseUrl = options?.apiOrigin ?? (yield* managementApiBaseUrl());\n\treturn createManagementApiClient({\n\t\ttoken: Redacted.value(token),\n\t\tbaseUrl,\n\t\theaders: deploySourceHeaders()\n\t});\n}));\n//#endregion\n//#region src/http.ts\n/** A non-2xx response from the Management API (or a transport failure). */\nvar PrismaApiError = class extends Data.TaggedError(\"PrismaApiError\") {};\nconst attempt = (f) => Effect.tryPromise({\n\ttry: f,\n\tcatch: (cause) => new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: String(cause)\n\t})\n});\nconst fail = (r) => Effect.fail(new PrismaApiError({\n\tstatus: r.response.status,\n\tmessage: JSON.stringify(r.error)\n}));\n/** Unwrap `data`, failing on any API error. Preserves the SDK's response type. */\nconst call = (f) => attempt(f).pipe(Effect.flatMap((r) => r.error !== void 0 || r.data === void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Unwrap `data`, mapping a 404 to `undefined` (resource gone / not found). */\nconst callOptional = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 ? Effect.succeed(void 0) : r.error !== void 0 ? fail(r) : Effect.succeed(r.data)));\n/** Fire-and-forget a call, tolerating a 404 (already deleted). */\nconst callVoid = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 404 || r.error === void 0 ? Effect.void : fail(r)));\n/**\n* Fire a CREATE call, tolerating a 409 (it already exists). Gives the caller\n* create-only semantics: the thing is created when absent, and an existing one\n* — whoever created it — is left exactly as it is.\n*/\nconst callCreateOnly = (f) => attempt(f).pipe(Effect.flatMap((r) => r.response.status === 409 || r.error === void 0 ? Effect.void : fail(r)));\n//#endregion\n//#region src/pagination.ts\n/** Far beyond any real collection size per listing; hitting it means the API's pagination is broken. */\nconst MAX_PAGES = 1e3;\nconst brokenPaginationError = (description, reason) => new PrismaApiError({\n\tstatus: 0,\n\tmessage: `listing ${description} ${reason} — the Management API pagination appears broken; refusing to continue with a possibly incomplete listing.`\n});\n/** {@link drivePages} in its most common shape: every page's rows, accumulated. */\nconst collectPages = (description, fetchPage) => Effect.gen(function* () {\n\tconst rows = [];\n\tyield* drivePages(description, fetchPage, (data) => {\n\t\trows.push(...data);\n\t\treturn false;\n\t});\n\treturn rows;\n});\n/**\n* Drives a cursor-paginated Management API listing with a guard against\n* broken pagination: a cursor that does not advance, more pages reported\n* without a cursor to fetch them with, or more than {@link MAX_PAGES} pages,\n* FAILS instead of hanging forever or returning a listing known to be\n* incomplete. `onPage` receives each page's rows as they arrive; returning\n* `true` stops early (the caller found what it wanted).\n*/\nconst drivePages = (description, fetchPage, onPage) => Effect.gen(function* () {\n\tlet cursor;\n\tfor (let pageCount = 0;; pageCount++) {\n\t\tif (pageCount >= MAX_PAGES) return yield* Effect.fail(brokenPaginationError(description, `did not finish within ${String(MAX_PAGES)} pages`));\n\t\tconst page = yield* fetchPage(cursor);\n\t\tif (onPage(page.data)) return;\n\t\tif (!page.pagination.hasMore) return;\n\t\tconst next = page.pagination.nextCursor;\n\t\tif (next === null) return yield* Effect.fail(brokenPaginationError(description, \"reported more pages but returned no cursor\"));\n\t\tif (next === cursor) return yield* Effect.fail(brokenPaginationError(description, \"returned a non-advancing cursor\"));\n\t\tcursor = next;\n\t}\n});\n/**\n* {@link drivePages} for Promise-based callers (e.g. target's preflight,\n* which speaks the SDK's `{data, error}` shape directly). Same guard, same\n* errors; deliberately a sibling loop rather than a wrapper, because routing\n* a Promise fetch through Effect and back (`Effect.tryPromise` +\n* `runPromise`) would re-wrap the caller's own thrown errors. `fetchPage`\n* rejections propagate untouched.\n*/\nasync function drivePagesAsync(description, fetchPage, onPage) {\n\tlet cursor;\n\tfor (let pageCount = 0;; pageCount++) {\n\t\tif (pageCount >= MAX_PAGES) throw brokenPaginationError(description, `did not finish within ${String(MAX_PAGES)} pages`);\n\t\tconst page = await fetchPage(cursor);\n\t\tif (onPage(page.data)) return;\n\t\tif (!page.pagination.hasMore) return;\n\t\tconst next = page.pagination.nextCursor;\n\t\tif (next === null) throw brokenPaginationError(description, \"reported more pages but returned no cursor\");\n\t\tif (next === cursor) throw brokenPaginationError(description, \"returned a non-advancing cursor\");\n\t\tcursor = next;\n\t}\n}\n//#endregion\n//#region src/container.ts\n/** Raised with `ensure: false` when the app's Project (or a named environment's Branch) doesn't exist. */\nvar ContainerNotFoundError = class extends Data.TaggedError(\"ContainerNotFoundError\") {};\n/** The environment that maps to the Project's default Branch. */\nconst PRODUCTION_ENVIRONMENT = \"production\";\n/** Whether `environment` maps to the Project's default Branch rather than a Branch of its own. */\nfunction isProductionEnvironment(environment) {\n\treturn environment === PRODUCTION_ENVIRONMENT;\n}\n/** Raised when a name other than `production` resolves to the Project's default Branch, which would make it production under a second name. */\nvar DefaultBranchUnderAnotherNameError = class extends Data.TaggedError(\"DefaultBranchUnderAnotherNameError\") {\n\tget message() {\n\t\treturn `The environment \"${this.environment}\" names the Branch ${this.branchId}, which is this Project's default Branch, so that Branch is production. Use the environment ${PRODUCTION_ENVIRONMENT} for it, and another name for a separate environment.`;\n\t}\n};\nconst listAllProjects = (client) => collectPages(\"projects\", (cursor) => call(() => client.GET(\"/v1/projects\", { params: { query: cursor === void 0 ? {} : { cursor } } })));\n/**\n* Workspace ids circulate in two shapes: `wksp_`-prefixed and bare. Compare\n* bare-to-bare so a `wksp_`-prefixed API id still matches a bare configured\n* one (the same normalization `state/bootstrap.ts` applies to the same\n* `/v1/projects` listing).\n*/\nconst bareWorkspaceId = (id) => id.startsWith(\"wksp_\") ? id.slice(5) : id;\n/**\n* Finds the app's Project by logical id or name in the workspace, creating\n* one if absent. Logical id match (exact, workspace-unique) is preferred over\n* display-name match (oldest-wins fallback for projects without a logical id).\n* Creates one if none match, unless `ensure` is `false` (find-only —\n* `destroy`), in which case an absent Project fails with\n* `ContainerNotFoundError`. No ownership marker and no `--project` override\n* (both deferred — see ADR-0019).\n*/\nconst resolveProject = (client, workspaceId, appName, ensure, region) => Effect.gen(function* () {\n\tconst workspaceProjects = (yield* listAllProjects(client)).filter((p) => bareWorkspaceId(p.workspace.id) === bareWorkspaceId(workspaceId));\n\tconst logicalIdMatch = workspaceProjects.find((p) => p.logicalId != null && p.logicalId === appName);\n\tif (logicalIdMatch !== void 0) return logicalIdMatch.id;\n\tconst nameMatch = workspaceProjects.filter((p) => p.name === appName).sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];\n\tif (nameMatch !== void 0) return nameMatch.id;\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({ appName }));\n\tif (region === void 0) return yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `project \"${appName}\" does not exist yet and no deploy region is configured. Set the region via prismaCloud({ region: '<id>' }) in your config, or set the PRISMA_REGION environment variable`\n\t}));\n\treturn (yield* call(() => client.POST(\"/v1/projects\", { body: {\n\t\tname: appName,\n\t\tworkspaceId,\n\t\tcreateDatabase: false,\n\t\tlogicalId: appName,\n\t\tregion\n\t} })).pipe(Effect.catch((err) => err.status === 409 ? Effect.fail(new PrismaApiError({\n\t\tstatus: 409,\n\t\tmessage: \"a project with this name already exists in the workspace; rename your Composer module or free the name.\"\n\t})) : Effect.fail(err)))).data.id;\n});\n/**\n* The project's implicit default Branch — every live Project owns exactly\n* one (a platform invariant). The list endpoint has no `isDefault` filter,\n* so this pages through the Branches (bounded — drivePages) and returns as\n* soon as a page contains it. Never creates one: its absence means the\n* platform's invariant is broken, which is not something a deploy can\n* repair.\n*/\nconst resolveDefaultBranchId = (client, projectId) => Effect.gen(function* () {\n\tlet found;\n\tyield* drivePages(`branches of project ${projectId}`, (cursor) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\t\tpath: { projectId },\n\t\tquery: cursor === void 0 ? {} : { cursor }\n\t} })), (data) => {\n\t\tfound = data.find((b) => b.isDefault)?.id;\n\t\treturn found !== void 0;\n\t});\n\tif (found !== void 0) return found;\n\treturn yield* Effect.fail(new PrismaApiError({\n\t\tstatus: 0,\n\t\tmessage: `project ${projectId} has no default Branch — the platform guarantees every live Project owns one; contact support.`\n\t}));\n});\nconst findBranch = (client, projectId, gitName) => call(() => client.GET(\"/v1/projects/{projectId}/branches\", { params: {\n\tpath: { projectId },\n\tquery: { gitName }\n} })).pipe(Effect.map((page) => {\n\tconst branch = page.data[0];\n\treturn branch === void 0 ? void 0 : {\n\t\tid: branch.id,\n\t\tisDefault: branch.isDefault\n\t};\n}));\n/**\n* Finds the environment's Branch by its exact `gitName`, creating it if absent\n* unless `ensure` is `false` (find-only — `destroy`), in which case an\n* absent Branch fails with `ContainerNotFoundError`. A `gitName` that finds\n* the default Branch fails with `DefaultBranchUnderAnotherNameError`. The Management API has\n* no server-side \"create-or-return\" idempotency (`POST\n* /v1/projects/:id/branches` 409s on a duplicate `gitName`, with no request\n* field to make that a no-op), so idempotency is client-side: observe\n* first, and on a racing 409 from create, re-observe rather than fail.\n*/\nconst resolveBranch = (client, projectId, gitName, appName, ensure) => Effect.gen(function* () {\n\tconst existing = yield* findBranch(client, projectId, gitName);\n\tif (existing !== void 0) return yield* refuseDefaultBranch(existing, gitName);\n\tif (!ensure) return yield* Effect.fail(new ContainerNotFoundError({\n\t\tappName,\n\t\tenvironment: gitName\n\t}));\n\treturn yield* call(() => client.POST(\"/v1/projects/{projectId}/branches\", {\n\t\tparams: { path: { projectId } },\n\t\tbody: { gitName }\n\t})).pipe(Effect.map((r) => r.data.id), Effect.catch((err) => err.status === 409 ? Effect.gen(function* () {\n\t\tconst found = yield* findBranch(client, projectId, gitName);\n\t\tif (found === void 0) return yield* Effect.fail(err);\n\t\treturn yield* refuseDefaultBranch(found, gitName);\n\t}) : Effect.fail(err)));\n});\nconst refuseDefaultBranch = (branch, gitName) => branch.isDefault === true ? Effect.fail(new DefaultBranchUnderAnotherNameError({\n\tenvironment: gitName,\n\tbranchId: branch.id\n})) : Effect.succeed(branch.id);\n/**\n* Resolves the two containers an environment's deploy runs into (ADR-0019):\n* the app's **Project**, found-or-created by name, and its **Branch**. The\n* environment `production` is the Project's default Branch, read into\n* `defaultBranchId` and never created; `branchId` is omitted. Any other name\n* is the Branch with that `gitName`, found-or-created into `branchId`. With\n* `ensure: false` (`destroy`), nothing is created — an absent Project or\n* Branch fails with `ContainerNotFoundError` instead.\n*/\nconst resolveContainer = (opts) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tconst ensure = opts.ensure ?? true;\n\tconst projectId = yield* resolveProject(client, opts.workspaceId, opts.appName, ensure, opts.region);\n\tif (isProductionEnvironment(opts.environment)) return {\n\t\tprojectId,\n\t\tdefaultBranchId: yield* resolveDefaultBranchId(client, projectId)\n\t};\n\treturn {\n\t\tprojectId,\n\t\tbranchId: yield* resolveBranch(client, projectId, opts.environment, opts.appName, ensure)\n\t};\n});\n/**\n* Soft-deletes a Branch. Tolerates a 404 (already gone). The API refuses if\n* the Branch still has live members or is the production/default Branch —\n* that surfaces as a `PrismaApiError`.\n*/\nconst deleteBranch = (branchId) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tyield* callVoid(() => client.DELETE(\"/v1/branches/{branchId}\", { params: { path: { branchId } } }));\n});\n/**\n* Deletes a Project. Tolerates a 404 (already gone). The API refuses with a\n* 400 if the Project still has live dependencies (e.g. another environment's\n* Branch/resources) — that surfaces as a `PrismaApiError`.\n*/\nconst deleteProject = (projectId) => Effect.gen(function* () {\n\tconst client = yield* ManagementClient;\n\tyield* callVoid(() => client.DELETE(\"/v1/projects/{id}\", { params: { path: { id: projectId } } }));\n});\n//#endregion\nexport { layer as _, deleteProject as a, resolveDefaultBranchId as c, drivePagesAsync as d, PrismaApiError as f, ManagementClient as g, callOptional as h, deleteBranch as i, collectPages as l, callCreateOnly as m, DefaultBranchUnderAnotherNameError as n, isProductionEnvironment as o, call as p, PRODUCTION_ENVIRONMENT as r, resolveContainer as s, ContainerNotFoundError as t, drivePages as u };\n\n//# sourceMappingURL=container-CuNTXJjn.mjs.map","import { g as ManagementClient, h as callOptional, l as collectPages, p as call, s as resolveContainer } from \"./container-CuNTXJjn.mjs\";\nimport * as Effect from \"effect/Effect\";\n//#region src/deployed.ts\nconst program = (input) => Effect.gen(function* () {\n\tconst container = yield* resolveContainer({\n\t\tworkspaceId: input.workspaceId,\n\t\tappName: input.appName,\n\t\tensure: false,\n\t\tenvironment: input.environment\n\t});\n\tconst { projectId } = container;\n\tconst branchId = container.branchId ?? container.defaultBranchId;\n\tif (branchId === void 0) return yield* Effect.die(/* @__PURE__ */ new Error(`project ${projectId} resolved no Branch`));\n\tconst client = yield* ManagementClient;\n\tconst topology = yield* callOptional(() => client.GET(\"/v1/projects/{projectId}/branches/{branchId}/application-topology\", { params: { path: {\n\t\tprojectId,\n\t\tbranchId\n\t} } }));\n\tif (topology === void 0 || topology.data.nodes.length === 0) return {\n\t\tprojectId,\n\t\tbranchId,\n\t\tnodes: [],\n\t\tservices: [],\n\t\tdatabases: [],\n\t\tbuckets: []\n\t};\n\tconst query = (cursor) => cursor === void 0 ? {\n\t\tprojectId,\n\t\tbranchId\n\t} : {\n\t\tprojectId,\n\t\tbranchId,\n\t\tcursor\n\t};\n\tconst services = yield* collectPages(`services of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/services\", { params: { query: query(cursor) } })));\n\tconst databases = yield* collectPages(`databases of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/databases\", { params: { query: query(cursor) } })));\n\tconst buckets = yield* collectPages(`buckets of branch ${branchId}`, (cursor) => call(() => client.GET(\"/v1/buckets\", { params: { query: query(cursor) } })));\n\treturn {\n\t\tprojectId,\n\t\tbranchId,\n\t\tnodes: topology.data.nodes.map(({ logicalId, parentLogicalId, kind, type }) => ({\n\t\t\tlogicalId,\n\t\t\tparentLogicalId,\n\t\t\tkind,\n\t\t\t...type === void 0 ? {} : { type }\n\t\t})),\n\t\tservices: services.map(({ id, logicalId, appEndpointDomain }) => ({\n\t\t\tid,\n\t\t\tlogicalId,\n\t\t\tappEndpointDomain\n\t\t})),\n\t\tdatabases: databases.map(({ id, logicalId }) => ({\n\t\t\tid,\n\t\t\tlogicalId\n\t\t})),\n\t\tbuckets: buckets.map(({ id, logicalId }) => ({\n\t\t\tid,\n\t\t\tlogicalId\n\t\t}))\n\t};\n});\n/**\n* Reads what an environment has deployed: its Project and Branch by the same\n* find-only lookup `destroy` uses, the application topology the last deploy\n* wrote, and the Branch's services, databases and buckets. `undefined` when\n* there is no Project or no Branch. Rejects on any other Management API\n* failure.\n*/\nasync function readDeployedEnvironment(client, input) {\n\treturn Effect.runPromise(program(input).pipe(Effect.catchTag(\"ContainerNotFoundError\", () => Effect.succeed(void 0)), Effect.catchTag(\"DefaultBranchUnderAnotherNameError\", (error) => Effect.fail(new Error(error.message))), Effect.catchTag(\"PrismaApiError\", (error) => Effect.fail(/* @__PURE__ */ new Error(`Prisma Management API error: ${error.message}.`))), Effect.provideService(ManagementClient, client)));\n}\n//#endregion\n//#region src/resource-rows.ts\n/** The platform row each Prisma Cloud resource type deploys to. A type missing here, such as an S3 credentials resource, has no row. */\nconst RESOURCE_ROW_KINDS = /* @__PURE__ */ new Map([\n\t[\"postgres\", \"database\"],\n\t[\"raw-postgres\", \"database\"],\n\t[\"s3\", \"bucket\"]\n]);\n//#endregion\nexport { RESOURCE_ROW_KINDS, readDeployedEnvironment };\n\n//# sourceMappingURL=deployed.mjs.map","import { type DeployedEnvironment, RESOURCE_ROW_KINDS } from '@internal/lowering/deployed';\n\n/** One row of `deploy list`: a topology node and the platform row it deployed to. */\nexport interface DeployedNode {\n readonly address: string;\n readonly kind: string;\n readonly platformId: string | null;\n readonly url: string | null;\n}\n\ntype TopologyNode = DeployedEnvironment['nodes'][number];\n\nfunction kindOf(node: TopologyNode): string {\n if (node.parentLogicalId === null) return 'project';\n if (node.kind === 'resource') {\n if (node.type === undefined) return 'resource';\n const rowKind = RESOURCE_ROW_KINDS.get(node.type);\n if (rowKind === 'database') return 'postgres';\n return rowKind ?? node.type;\n }\n return node.kind;\n}\n\nfunction rowId(rows: readonly { id: string; logicalId: string | null }[], logicalId: string) {\n return rows.find((row) => row.logicalId === logicalId)?.id ?? null;\n}\n\nfunction deployedNode(deployed: DeployedEnvironment, node: TopologyNode): DeployedNode {\n const kind = kindOf(node);\n const address = node.logicalId;\n switch (kind) {\n case 'project':\n return { address, kind, platformId: deployed.projectId, url: null };\n case 'service': {\n const row = deployed.services.find((service) => service.logicalId === address);\n return {\n address,\n kind,\n platformId: row?.id ?? null,\n url: row?.appEndpointDomain ?? null,\n };\n }\n case 'postgres':\n return { address, kind, platformId: rowId(deployed.databases, address), url: null };\n case 'bucket':\n return { address, kind, platformId: rowId(deployed.buckets, address), url: null };\n default:\n return { address, kind, platformId: null, url: null };\n }\n}\n\n/** Every node of the environment's topology, in topology order, joined by `logicalId` to the platform row it deployed to. The root's row is the Project. */\nexport function deployedNodes(deployed: DeployedEnvironment): DeployedNode[] {\n return deployed.nodes.map((node) => deployedNode(deployed, node));\n}\n","import { resolveAppIdentity, validateEnvironmentName } from '@internal/cli/app-identity';\nimport type { ComposerConfigSource } from '@internal/cli/control';\nimport { CliStructuredError } from '@internal/foundation/errors';\nimport { notOk, ok, type Result } from '@internal/foundation/result';\nimport { readDeployedEnvironment } from '@internal/lowering/deployed';\nimport type { ManagementApiClient } from '@prisma/cli-engine';\nimport { type DeployedNode, deployedNodes } from './deployed-nodes.ts';\n\nexport interface ListDeployedInput {\n readonly config: ComposerConfigSource;\n readonly entry: string | undefined;\n readonly name: string | undefined;\n readonly environment: string;\n readonly cwd: string;\n readonly workspaceId: string | undefined;\n readonly client: ManagementApiClient;\n}\n\nfunction notFound(app: string, environment: string): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.TARGET_NOT_FOUND',\n `Nothing deployed for ${app} in the environment ${environment}.`,\n { fix: 'Deploy it first.' },\n );\n}\n\nfunction lookupFailed(error: unknown): CliStructuredError {\n return new CliStructuredError(\n 'DEPLOY.CONTAINER_FAILED',\n error instanceof Error ? error.message : String(error),\n { cause: error },\n );\n}\n\n/** Every node the app has deployed in the environment, or `DEPLOY.TARGET_NOT_FOUND` when the environment has no Project, Branch or topology. */\nexport async function listDeployed(\n input: ListDeployedInput,\n): Promise<Result<readonly DeployedNode[], CliStructuredError>> {\n let app: string;\n try {\n validateEnvironmentName(input.environment);\n app = (await resolveAppIdentity(input.entry, input.name, input.cwd, input.config)).name;\n } catch (error) {\n if (CliStructuredError.is(error)) return notOk(error);\n throw error;\n }\n if (input.workspaceId === undefined) {\n return notOk(lookupFailed(new Error('environment variable PRISMA_WORKSPACE_ID is required.')));\n }\n\n let deployed: Awaited<ReturnType<typeof readDeployedEnvironment>>;\n try {\n deployed = await readDeployedEnvironment(input.client, {\n workspaceId: input.workspaceId,\n appName: app,\n environment: input.environment,\n });\n } catch (error) {\n return notOk(lookupFailed(error));\n }\n const nodes = deployed === undefined ? [] : deployedNodes(deployed);\n if (nodes.length === 0) return notOk(notFound(app, input.environment));\n return ok(nodes);\n}\n"],"mappings":";;;;;;;;;AAYsC,QAAQ,QAAQ,CAAC,CAAC,2BAA2B;;;;;;;;ACCnF,IAAI,mBAAmB,cAAc,QAAQ,QAAQ,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;;AAmBlF,IAAI,iBAAiB,cAAc,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC;AACvE,MAAM,WAAW,MAAM,OAAO,WAAW;C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AM,MAAM,MAAM,KAAK,MAAM,MAAM,EAAA,CAAG;CACrF,SAAS,OAAO;EACd,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACR;CACA,IAAI,MAAM,gBAAgB,KAAA,GACxB,OAAO,MAAM,6BAAa,IAAI,MAAM,uDAAuD,CAAC,CAAC;CAG/F,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,wBAAwB,MAAM,QAAQ;GACrD,aAAa,MAAM;GACnB,SAAS;GACT,aAAa,MAAM;EACrB,CAAC;CACH,SAAS,OAAO;EACd,OAAO,MAAM,aAAa,KAAK,CAAC;CAClC;CACA,MAAM,QAAQ,aAAa,KAAA,IAAY,CAAC,IAAI,cAAc,QAAQ;CAClE,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM,SAAS,KAAK,MAAM,WAAW,CAAC;CACrE,OAAO,GAAG,KAAK;AACjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"redaction-Bf8FvTFH-M5hYsi--.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.d.mts","../../../0-framework/0-foundation/foundation/dist/secret-CHOw4LBU.d.mts","../../../0-framework/0-foundation/foundation/dist/pointer-CyQZZugO.d.mts","../../../../node_modules/@standard-schema/spec/dist/index.d.ts","../../../0-framework/1-core/core/dist/graph-types-DRe9UUOp.d.mts","../../../0-framework/1-core/core/dist/app-config-Bf_y5R7o.d.mts","../../../0-framework/3-tooling/assemble/dist/index.d.mts","../../../0-framework/0-foundation/foundation/dist/result.d.mts","../../../0-framework/3-tooling/cli/dist/dev-Df-kx6UV.d.mts","../../../0-framework/3-tooling/cli/dist/deployment-summary-p88NV5m5.d.mts","../../../0-framework/3-tooling/cli/dist/dev-current-BPnQtqnQ.d.mts","../../../0-framework/3-tooling/cli/dist/family-qagovuqK.d.mts","../../../0-framework/3-tooling/cli/dist/redaction-Bf8FvTFH.d.mts"],"x_google_ignoreList":[3],"mappings":";;;;;;;UACU,wBA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AS;EACtB,UAAU;;;;;;EAMV,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"redaction-HnbkSFrK-BjFRb2aC.mjs","names":["#names"],"sources":["../../../0-framework/3-tooling/cli/dist/composer-config-DO_iG0iR.mjs","../../../0-framework/3-tooling/cli/dist/redaction-HnbkSFrK.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/composer-config.ts\n/**\n* What makes a `composer` section valid, shared by the CLI's section validator and the programmatic operations.\n* It imports nothing from the CLI engine, because `@prisma/composer` must not depend on it.\n*/\nconst SECTION_FIX = \"Write `composer: composer({ entry: './module.ts', extensions: [...], state: ... })` in prisma.config.ts, with `import { defineConfig as composer } from '@prisma/composer/config'`.\";\nconst MOVE_TO_SECTION_FIX = `${SECTION_FIX} If the project has a prisma-composer.config.ts, move its extensions and state into that section and delete the file.`;\nconst SECTION_IS_THE_ONLY_SOURCE = \"Composer reads its configuration only from the `composer` section of prisma.config.ts.\";\nconst DESCRIPTOR_FIX = \"Use the descriptor the extension factory returns, unchanged, instead of building one by hand.\";\nconst RETIRED_FILE_NAMES = [\n\t\"ts\",\n\t\"mts\",\n\t\"mjs\",\n\t\"js\"\n].map((extension) => `prisma-composer.config.${extension}`);\nconst sectionMissing = {\n\tcode: \"CONFIG.SECTION_MISSING\",\n\tsummary: \"No loaded prisma.config.ts declares a `composer` section.\",\n\twhy: `${SECTION_IS_THE_ONLY_SOURCE} A prisma-composer.config.ts file is no longer read.`,\n\tfix: MOVE_TO_SECTION_FIX\n};\n/** What the generated stack file throws when the file it imports has no `composer` export. */\nfunction noComposerExportMessage(configFile) {\n\treturn `${configFile} declares no \\`composer\\` section. Pass the prisma.config.ts that declares it.`;\n}\nfunction configFileMissing(file) {\n\treturn {\n\t\tcode: \"CONFIG.FILE_MISSING\",\n\t\tsummary: `${file} does not exist.`,\n\t\tfix: \"Pass the path of the prisma.config.ts that declares the `composer` section.\",\n\t\twhere: file\n\t};\n}\n/** A prisma-composer.config.* beside the declaring file would otherwise be silently ignored. */\n/** The path with symlinks resolved; the path itself when it cannot be resolved, so the check never throws. */\nfunction realPath(file) {\n\ttry {\n\t\treturn fs.realpathSync(file);\n\t} catch {\n\t\treturn file;\n\t}\n}\nfunction retiredFileFinding(configFile) {\n\tconst directory = path.dirname(realPath(configFile));\n\tconst found = RETIRED_FILE_NAMES.map((name) => path.join(directory, name)).find((file) => fs.existsSync(file));\n\tif (found === void 0) return void 0;\n\treturn {\n\t\tcode: \"CONFIG.FILE_RETIRED\",\n\t\tsummary: `${found} is no longer read.`,\n\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\tfix: MOVE_TO_SECTION_FIX,\n\t\twhere: found\n\t};\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isExtensionDescriptor(value) {\n\treturn isObject(value) && typeof value[\"id\"] === \"string\" && value[\"id\"].length > 0 && isObject(value[\"nodes\"]);\n}\nfunction isStateDescriptor(value) {\n\treturn isObject(value) && typeof value[\"extension\"] === \"string\" && typeof value[\"create\"] === \"function\";\n}\nconst stateInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.state` must be a state descriptor with a string `extension` and a `create` function.\",\n\tfix: \"Set `state` to the state descriptor an extension provides, e.g. `state: prismaState()`.\",\n\tfield: \"state\"\n};\nconst SECTION_FIELDS = /* @__PURE__ */ new Set([\n\t\"entry\",\n\t\"extensions\",\n\t\"state\",\n\t\"config\",\n\t\"secrets\"\n]);\nconst entryInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.entry` must be a non-empty string: the path to the module whose default export is the app.\",\n\tfix: \"Set `entry` to that module's path, relative to prisma.config.ts, e.g. `entry: './module.ts'`.\",\n\tfield: \"entry\"\n};\n/** Neither the section's `entry` nor an override names the module whose default export is the app. */\nconst entryMissing = {\n\tcode: \"CONFIG.ENTRY_MISSING\",\n\tsummary: \"No entry module is set, so there is no app to load.\",\n\twhy: \"The entry is the module whose default export is the app root, built with module(...).\",\n\tfix: \"Set `entry: './module.ts'` in the `composer` section of prisma.config.ts, or pass `--entry <path>` (the `entry` input when calling @prisma/composer/control).\",\n\tfield: \"entry\"\n};\nfunction unknownField(key) {\n\treturn {\n\t\tcode: \"CONFIG.FIELD_UNKNOWN\",\n\t\tsummary: `The \\`composer\\` section has no field \\`${key}\\`.`,\n\t\tfix: key === \"composer\" ? \"Pass the `composer` property of the prisma.config.ts export, not the whole export. The section takes only `entry`, `extensions`, `state`, `config` and `secrets`.\" : `Remove \\`${key}\\`. The section takes only \\`entry\\`, \\`extensions\\`, \\`state\\`, \\`config\\` and \\`secrets\\`.`,\n\t\tfield: key\n\t};\n}\nfunction checkExtensions(value) {\n\tif (!Array.isArray(value)) return {\n\t\textensions: [],\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"`composer.extensions` must be an array of extension descriptors.\",\n\t\t\tfix: \"Set `extensions` to the descriptors your extensions provide, e.g. `extensions: [nodeBuild()]`.\",\n\t\t\tfield: \"extensions\"\n\t\t}]\n\t};\n\tconst findings = [];\n\tconst extensions = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of value.entries()) {\n\t\tconst field = `extensions[${index}]`;\n\t\tif (!isObject(entry)) {\n\t\t\tfindings.push({\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: `\\`composer.${field}\\` must be an extension descriptor object.`,\n\t\t\t\tfix: \"Put the descriptor an extension factory returns here, e.g. `nodeBuild()`, not the factory itself.\",\n\t\t\t\tfield\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.id\\` must be a non-empty string (the extension package name).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse if (seen.has(id)) findings.push({\n\t\t\tcode: \"CONFIG.EXTENSION_DUPLICATE\",\n\t\t\tsummary: `Extension \"${id}\" is listed more than once in \\`composer.extensions\\`.`,\n\t\t\tfix: `Remove the repeated \"${id}\" entry from \\`extensions\\`.`,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse seen.add(id);\n\t\tif (!isObject(entry[\"nodes\"])) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.nodes\\` must be an object (the node-ID → control registry).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.nodes`\n\t\t});\n\t\tif (isExtensionDescriptor(entry)) extensions.push(entry);\n\t}\n\treturn {\n\t\tfindings,\n\t\textensions\n\t};\n}\nfunction isAdapterList(value) {\n\treturn Array.isArray(value) && value.every((entry) => typeof entry === \"function\");\n}\nfunction checkAdapters(list, value) {\n\tif (value === void 0) return [];\n\tif (!Array.isArray(value)) return [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}\\` must be an array of adapters.`,\n\t\tfix: `Set \\`${list}\\` to a list of adapters, e.g. \\`${list}: [dotenv(), environmentVariables()]\\`, imported from '@prisma/composer/config'.`,\n\t\tfield: list\n\t}];\n\treturn value.flatMap((entry, index) => typeof entry === \"function\" ? [] : [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}[${index}]\\` must be an adapter: a function that receives the environment and returns its values.`,\n\t\tfix: \"Put an adapter here, e.g. `dotenv()`.\",\n\t\tfield: `${list}[${index}]`\n\t}]);\n}\nfunction checkFields(section) {\n\tif (Object.hasOwn(section, \"configPath\")) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_RETIRED\",\n\t\t\tsummary: \"`composer.configPath` is no longer supported: prisma-composer.config.ts is no longer read.\",\n\t\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\t\tfix: `Replace \\`configPath\\` with the section itself. ${MOVE_TO_SECTION_FIX}`,\n\t\t\tfield: \"configPath\"\n\t\t}]\n\t};\n\tif (Object.hasOwn(section, \"composer\")) return {\n\t\tok: false,\n\t\tfindings: [unknownField(\"composer\")]\n\t};\n\tconst findings = Object.keys(section).filter((key) => !SECTION_FIELDS.has(key)).map(unknownField);\n\tconst checked = checkExtensions(section[\"extensions\"]);\n\tfindings.push(...checked.findings);\n\tconst state = section[\"state\"];\n\tif (!isStateDescriptor(state)) findings.push(stateInvalid);\n\tconst entry = section[\"entry\"];\n\tconst entryValid = entry === void 0 || typeof entry === \"string\" && entry.length > 0;\n\tif (!entryValid) findings.push(entryInvalid);\n\tconst config = section[\"config\"];\n\tconst secrets = section[\"secrets\"];\n\tfindings.push(...checkAdapters(\"config\", config), ...checkAdapters(\"secrets\", secrets));\n\tconst [first, ...rest] = findings;\n\tif (first === void 0 && isStateDescriptor(state) && entryValid && (config === void 0 || isAdapterList(config)) && (secrets === void 0 || isAdapterList(secrets))) return {\n\t\tok: true,\n\t\tvalue: {\n\t\t\textensions: checked.extensions,\n\t\t\tstate,\n\t\t\t...entry === void 0 ? {} : { entry },\n\t\t\t...config === void 0 ? {} : { config },\n\t\t\t...secrets === void 0 ? {} : { secrets }\n\t\t}\n\t};\n\treturn {\n\t\tok: false,\n\t\tfindings: [first ?? stateInvalid, ...rest]\n\t};\n}\n/**\n* Checks the fields that identify each descriptor and returns the descriptors as the config file's own objects.\n* Never throws: a section's values are user code, and a throwing getter or Proxy trap becomes a finding.\n*/\nfunction checkComposerSection(raw) {\n\tif (!isObject(raw)) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"The `composer` section of prisma.config.ts must be an object.\",\n\t\t\tfix: SECTION_FIX\n\t\t}]\n\t};\n\ttry {\n\t\treturn checkFields({ ...raw });\n\t} catch (cause) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfindings: [{\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: \"The `composer` section of prisma.config.ts could not be read.\",\n\t\t\t\twhy: `Reading it threw: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: SECTION_FIX\n\t\t\t}]\n\t\t};\n\t}\n}\n/**\n* The whole check, shared by the section validator and the programmatic operations so both report the same findings in the same order: the retired file beside the declaring `configFile` (resolved through symlinks), then every field finding.\n*/\nfunction checkComposerConfig(raw, configFile) {\n\tconst retired = retiredFileFinding(configFile);\n\tconst checked = checkComposerSection(raw);\n\tif (retired === void 0) return checked;\n\treturn {\n\t\tok: false,\n\t\tfindings: checked.ok ? [retired] : [retired, ...checked.findings]\n\t};\n}\n//#endregion\nexport { sectionMissing as a, noComposerExportMessage as i, configFileMissing as n, entryMissing as r, checkComposerConfig as t };\n\n//# sourceMappingURL=composer-config-DO_iG0iR.mjs.map","import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/redaction.ts\nconst REDACTED = \"[redacted]\";\n/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */\nconst SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;\n/**\n* The credential-looking values in `variables`: text of eight characters or more under a name\n* that looks like a credential's. The length limit keeps a one-letter placeholder from blanking\n* every matching letter.\n*/\nfunction credentialLookingValues(variables) {\n\treturn Object.entries(variables).flatMap(([name, value]) => SECRET_ENV_NAME.test(name) && typeof value === \"string\" && value.length >= 8 ? [value] : []);\n}\n/**\n* Finds every secret in a text: one regular expression for all of them, built once. A match\n* is the span of the longest secret that starts at a position, and spans that overlap are\n* merged, so two overlapping secrets are hidden whole.\n*/\nvar SecretMatcher = class {\n\tstarts;\n\tprefixes = /* @__PURE__ */ new Set();\n\tlongestPrefix;\n\tconstructor(values) {\n\t\tconst sorted = [...new Set(values)].filter((value) => value.length > 0).sort((a, b) => b.length - a.length);\n\t\tthis.starts = sorted.length === 0 ? void 0 : new RegExp(`(?=(${sorted.map((value) => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"|\")}))`, \"g\");\n\t\tfor (const value of sorted) for (let length = 1; length < value.length; length++) this.prefixes.add(value.slice(0, length));\n\t\tthis.longestPrefix = Math.max(0, (sorted[0]?.length ?? 0) - 1);\n\t}\n\t/** The merged spans of every secret in `text`, in order, as `[start, end)`. */\n\tspans(text) {\n\t\tconst spans = [];\n\t\tif (this.starts === void 0) return spans;\n\t\tfor (const match of text.matchAll(this.starts)) {\n\t\t\tconst start = match.index;\n\t\t\tconst end = start + (match[1]?.length ?? 0);\n\t\t\tconst last = spans.at(-1);\n\t\t\tif (last !== void 0 && start < last[1]) last[1] = Math.max(last[1], end);\n\t\t\telse spans.push([start, end]);\n\t\t}\n\t\treturn spans;\n\t}\n\t/** The length of the longest end of `text` that is the start, not the whole, of a secret. */\n\tstartOfSecretAtEnd(text) {\n\t\tfor (let length = Math.min(this.longestPrefix, text.length); length > 0; length--) if (this.prefixes.has(text.slice(text.length - length))) return length;\n\t\treturn 0;\n\t}\n\t/** `text` with each span replaced by `[redacted]`. */\n\tredact(text) {\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tfor (const [start, end] of this.spans(text)) {\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\treturn from === 0 ? text : out + text.slice(from);\n\t}\n};\n/** `text` with each value in `values` replaced by `[redacted]`, at any length; an empty one is skipped. Overlapping values are hidden whole. */\nfunction redactValues(text, values) {\n\treturn new SecretMatcher(values).redact(text);\n}\n/** `text` with bearer and basic tokens, JWTs, the password in a URL, and `token=…`-style pairs replaced by `[redacted]`. */\nfunction redactShapes(text) {\n\treturn text.replace(/\\b(Bearer|Basic)\\s+[\\w.~+/=-]+/gi, `$1 ${REDACTED}`).replace(/\\beyJ[\\w-]+\\.[\\w-]+\\.[\\w-]*/g, REDACTED).replace(/(\\b[a-z][\\w+.-]*:\\/\\/[^\\s:/@]*:)[^\\s/@]+@/gi, `$1${REDACTED}@`).replace(/\\b((?:[\\w-]*[_-])?(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key)[\"']?\\s*[:=]\\s*[\"']?)[^\\s\"',;&]+/gi, `$1${REDACTED}`);\n}\n/**\n* `text` with the credential-looking values of `env` and the credential shapes replaced by\n* `[redacted]`. For a process that has no `SecretRedaction`; `SecretRedaction.redact` hides\n* the known secrets too.\n*/\nfunction redactCredentialLooking(text, env) {\n\treturn redactShapes(redactValues(text, credentialLookingValues(env)));\n}\n/**\n* The known secrets of one command: the values under the secrets keys the graph names, in the app\n* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.\n*/\nvar KnownSecrets = class {\n\t#names = /* @__PURE__ */ new Map();\n\tconstructor(secrets = []) {\n\t\tthis.add(secrets);\n\t}\n\t/** Adds each secret whose value is not empty. A value already known keeps its first name. */\n\tadd(secrets) {\n\t\tfor (const { name, value } of secrets) if (value.length > 0 && !this.#names.has(value)) this.#names.set(value, name);\n\t}\n\tvalues() {\n\t\treturn new Set(this.#names.keys());\n\t}\n\t/**\n\t* The name of a known secret `text` holds, or undefined. A secret of\n\t* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter\n\t* one only when it is all of `text`.\n\t*/\n\tnameIn(text) {\n\t\tfor (const [value, name] of this.#names) if (value.length >= 8 ? text.includes(value) : text === value) return name;\n\t}\n};\n/**\n* What one command hides from everything it prints, returns or reports (ADR-0062): its known\n* secrets, and the credential-looking values, which only look like secrets by the name of the\n* variable they are under. It starts with the credential-looking values of the process\n* environment.\n*/\nvar SecretRedaction = class {\n\tknownSecrets = new KnownSecrets();\n\tcredentialLooking = /* @__PURE__ */ new Set();\n\tmatcher;\n\tconstructor(env) {\n\t\tthis.addCredentialLookingValues(credentialLookingValues(env));\n\t}\n\taddKnownSecrets(secrets) {\n\t\tthis.knownSecrets.add(secrets);\n\t}\n\taddCredentialLookingValues(values) {\n\t\tfor (const value of values) if (value.length > 0) this.credentialLooking.add(value);\n\t}\n\t/** The known secrets and the credential-looking values, longest first. */\n\tallValues() {\n\t\treturn [.../* @__PURE__ */ new Set([...this.knownSecrets.values(), ...this.credentialLooking])].sort((a, b) => b.length - a.length);\n\t}\n\t/** `text` with every known secret and credential-looking value replaced by `[redacted]` at any length, then bearer tokens, JWTs, URL passwords and `token=…` pairs. */\n\tredact(text) {\n\t\tconst size = this.knownSecrets.values().size + this.credentialLooking.size;\n\t\tif (this.matcher?.size !== size) this.matcher = {\n\t\t\tsize,\n\t\t\tmatcher: new SecretMatcher(this.allValues())\n\t\t};\n\t\treturn redactShapes(this.matcher.matcher.redact(text));\n\t}\n};\n/** The text under each name in `secretsKeys`, in the app configuration and in the app secrets, at any length. */\nfunction valuesUnderSecretsKeys(configuration, secrets, secretsKeys) {\n\treturn secretsKeys.flatMap((name) => [configuration[name], secrets[name]].flatMap((value) => typeof value === \"string\" ? [{\n\t\tname,\n\t\tvalue\n\t}] : []));\n}\nfunction redactData(value, redaction) {\n\tif (typeof value === \"string\") return redaction.redact(value);\n\tif (Array.isArray(value)) return value.map((member) => redactData(member, redaction));\n\tif (typeof value === \"object\" && value !== null && Object.getPrototypeOf(value) === Object.prototype) return Object.fromEntries(Object.entries(value).map(([key, member]) => [key, redactData(member, redaction)]));\n\treturn value;\n}\n/**\n* `error` with every value `redaction` hides removed from its summary, `why`, `fix` and every string in\n* its `meta`. The code, severity, `where` and docs link are kept. The cause is dropped, because\n* it holds the same text unredacted and a renderer may print it.\n*/\nfunction redactError(error, redaction) {\n\treturn new CliStructuredError(error.code, redaction.redact(error.message), {\n\t\tseverity: error.severity,\n\t\t...error.why === void 0 ? {} : { why: redaction.redact(error.why) },\n\t\t...error.fix === void 0 ? {} : { fix: redaction.redact(error.fix) },\n\t\t...error.where === void 0 ? {} : { where: error.where },\n\t\t...error.meta === void 0 ? {} : { meta: Object.fromEntries(Object.entries(error.meta).map(([key, value]) => [key, redactData(value, redaction)])) },\n\t\t...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl }\n\t});\n}\nfunction setOwn(error, name, value) {\n\tObject.defineProperty(error, name, {\n\t\tvalue,\n\t\twritable: true,\n\t\tconfigurable: true\n\t});\n}\nconst UNPRINTABLE = \"A value was thrown that cannot be turned into text.\";\nfunction safeString(value) {\n\ttry {\n\t\treturn String(value);\n\t} catch {\n\t\ttry {\n\t\t\treturn Object.prototype.toString.call(value);\n\t\t} catch {\n\t\t\treturn UNPRINTABLE;\n\t\t}\n\t}\n}\n/**\n* The error to rethrow in place of a thrown defect, with every secret removed from its message\n* and stack, and from those of each error in its `cause` chain and in an `AggregateError`'s\n* `errors`. A cause that is text or plain data becomes a redacted copy. Each error is redacted\n* in place where it can be. One whose properties cannot change, such as a frozen error, is\n* replaced by a new error with the redacted message, stack and cause. A thrown value that is not\n* an `Error` becomes an `Error` whose message is its redacted text. Never throws: when reading\n* the error fails, the result is a new `Error` holding the redacted text of what was thrown.\n*/\nfunction redactThrown(thrown, redaction) {\n\ttry {\n\t\treturn thrown instanceof Error ? redactErrorChain(thrown, redaction, /* @__PURE__ */ new Map()) : new Error(redaction.redact(safeString(thrown)));\n\t} catch {\n\t\treturn new Error(redaction.redact(safeString(thrown)));\n\t}\n}\nfunction redactErrorChain(error, redaction, seen) {\n\tconst done = seen.get(error);\n\tif (done !== void 0) return done;\n\tseen.set(error, error);\n\tconst message = redaction.redact(typeof error.message === \"string\" ? error.message : safeString(error.message));\n\tconst stack = typeof error.stack === \"string\" ? redaction.redact(error.stack) : void 0;\n\tconst cause = error.cause instanceof Error ? redactErrorChain(error.cause, redaction, seen) : redactData(error.cause, redaction);\n\tconst members = error instanceof AggregateError ? error.errors.map((member) => member instanceof Error ? redactErrorChain(member, redaction, seen) : redactData(member, redaction)) : void 0;\n\ttry {\n\t\tsetOwn(error, \"message\", message);\n\t\tif (stack !== void 0) setOwn(error, \"stack\", stack);\n\t\tif (error.cause !== void 0) setOwn(error, \"cause\", cause);\n\t\tif (members !== void 0) setOwn(error, \"errors\", members);\n\t\treturn error;\n\t} catch {\n\t\tconst options = cause === void 0 ? void 0 : { cause };\n\t\tconst copy = members === void 0 ? new Error(message, options) : new AggregateError(members, message, options);\n\t\tcopy.name = error.name;\n\t\tsetOwn(copy, \"stack\", stack ?? `${error.name}: ${message}`);\n\t\tseen.set(error, copy);\n\t\treturn copy;\n\t}\n}\n/** `event` with every value `redaction` hides removed from the text it carries: a message, or a dev server's output line. */\nfunction redactDevEvent(event, redaction) {\n\tswitch (event.kind) {\n\t\tcase \"target-warning\":\n\t\tcase \"rebuild-failed\":\n\t\tcase \"watch-error\":\n\t\tcase \"stop-error\": return {\n\t\t\t...event,\n\t\t\tmessage: redaction.redact(event.message)\n\t\t};\n\t\tcase \"dev-server-output\": return {\n\t\t\t...event,\n\t\t\tline: redaction.redact(event.line)\n\t\t};\n\t\tdefault: return event;\n\t}\n}\n/** `summary` with every value `redaction` hides removed from each entity's id, url and details. */\nfunction redactSummary(summary, redaction) {\n\tif (summary === void 0) return void 0;\n\treturn {\n\t\tapp: summary.app,\n\t\tnodes: summary.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities.map((entity) => ({\n\t\t\t\t...entity,\n\t\t\t\tid: redaction.redact(entity.id),\n\t\t\t\t...entity.url === void 0 ? {} : { url: redaction.redact(entity.url) },\n\t\t\t\t...entity.details === void 0 ? {} : { details: Object.fromEntries(Object.entries(entity.details).map(([key, value]) => [key, redaction.redact(value)])) }\n\t\t\t}))\n\t\t}))\n\t};\n}\nfunction isHighSurrogate(code) {\n\treturn code >= 55296 && code <= 56319;\n}\n/**\n* Redacts a stream of text chunk by chunk: every value in `values` becomes `[redacted]`, and\n* overlapping values are hidden whole. It holds back only the end of the text that could still\n* be part of a value: the longest end that could start one, or a match that a later value could\n* extend. So a value split across two chunks is still replaced, and text that cannot start one,\n* such as a prompt, is returned at once. It never splits a surrogate pair. `push` returns the\n* text that is ready; `end` returns the rest.\n*/\nvar StreamRedactor = class {\n\theld = \"\";\n\tmatcher;\n\tconstructor(values) {\n\t\tthis.matcher = new SecretMatcher(values);\n\t}\n\tpush(chunk) {\n\t\tconst text = this.held + chunk;\n\t\tconst cut = text.length - this.matcher.startOfSecretAtEnd(text);\n\t\tlet out = \"\";\n\t\tlet from = 0;\n\t\tlet ready = cut;\n\t\tfor (const [start, end] of this.matcher.spans(text)) {\n\t\t\tif (end > cut) {\n\t\t\t\tready = Math.min(cut, start);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tout += text.slice(from, start) + REDACTED;\n\t\t\tfrom = end;\n\t\t}\n\t\tif (ready > from && ready < text.length && isHighSurrogate(text.charCodeAt(ready - 1))) ready -= 1;\n\t\tthis.held = text.slice(ready);\n\t\treturn out + text.slice(from, ready);\n\t}\n\tend() {\n\t\tconst text = this.held;\n\t\tthis.held = \"\";\n\t\treturn this.matcher.redact(text);\n\t}\n};\n//#endregion\nexport { redactCredentialLooking as a, redactSummary as c, credentialLookingValues as i, redactThrown as l, SecretRedaction as n, redactDevEvent as o, StreamRedactor as r, redactError as s, KnownSecrets as t, valuesUnderSecretsKeys as u };\n\n//# sourceMappingURL=redaction-HnbkSFrK.mjs.map"],"mappings":";;;;;;;;AAOA,MAAM,cAAc;AACpB,MAAM,sBAAsB,GAAG,YAAY;AAC3C,MAAM,6BAA6B;AACnC,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;CAC1B;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,cAAc,0BAA0B,WAAW;AAC1D,MAAM,iBAAiB;CACtB,MAAM;CACN,SAAS;CACT,KAAK,GAAG,2BAA2B;CACnC,KAAK;AACN;;AAEA,SAAS,wBAAwB,YAAY;CAC5C,OAAO,GAAG,WAAW;AACtB;AACA,SAAS,kBAAkB,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