@prisma/composer 0.25.0 → 0.26.0-dev.1

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 (58) hide show
  1. package/dist/{app-config-joXc-BKm-CdcXqNMD.mjs → app-config-CGJHcFb--CIEFCG4V.mjs} +3 -3
  2. package/dist/{app-config-joXc-BKm-CdcXqNMD.mjs.map → app-config-CGJHcFb--CIEFCG4V.mjs.map} +1 -1
  3. package/dist/{app-config-jGcCcxK4-DnzGGbDS.d.mts → app-config-DyCMnkDr-CguUhanl.d.mts} +4 -4
  4. package/dist/{app-config-jGcCcxK4-DnzGGbDS.d.mts.map → app-config-DyCMnkDr-CguUhanl.d.mts.map} +1 -1
  5. package/dist/config-CdxvLFzg.mjs.map +1 -1
  6. package/dist/config-i9yR7YWi.d.mts +1 -0
  7. package/dist/config.d.mts +2 -2
  8. package/dist/config.mjs +1 -1
  9. package/dist/control.d.mts +63 -44
  10. package/dist/control.d.mts.map +1 -1
  11. package/dist/control.mjs +10 -42
  12. package/dist/control.mjs.map +1 -1
  13. package/dist/deploy-i9yR7YWi.d.mts +1 -0
  14. package/dist/deploy.d.mts +2 -2
  15. package/dist/deploy.mjs +1 -1
  16. package/dist/deploy.mjs.map +1 -1
  17. package/dist/deployment-summary-37e6WEuh-BOTJynIi.mjs +168 -0
  18. package/dist/deployment-summary-37e6WEuh-BOTJynIi.mjs.map +1 -0
  19. package/dist/deployment-summary-CU-eVvJM-c3AqO52N.d.mts +26 -0
  20. package/dist/deployment-summary-CU-eVvJM-c3AqO52N.d.mts.map +1 -0
  21. package/dist/dev-Bmq-eLnv-DsenQNJM.mjs +154 -0
  22. package/dist/dev-Bmq-eLnv-DsenQNJM.mjs.map +1 -0
  23. package/dist/{execute-deploy-destroy-CvKCwVkD-Di3Ooeip.mjs → execute-deploy-destroy-c0eko3AO-BoK0-r1U.mjs} +43 -32
  24. package/dist/execute-deploy-destroy-c0eko3AO-BoK0-r1U.mjs.map +1 -0
  25. package/dist/{execute-dev-BLCK5wF7-CJvkj5wl.mjs → execute-dev-BICPaq1g-DQccw8kr.mjs} +180 -131
  26. package/dist/{execute-dev-BLCK5wF7-CJvkj5wl.mjs.map → execute-dev-BICPaq1g-DQccw8kr.mjs.map} +1 -1
  27. package/dist/{execute-log-B_zCJ17b-CE954g1a.mjs → execute-log-DivzSDBL-CBdSN2Vv.mjs} +7 -10
  28. package/dist/execute-log-DivzSDBL-CBdSN2Vv.mjs.map +1 -0
  29. package/dist/{local-target-DnA2E8IN.mjs → local-target-B4xoiDAV.mjs} +2 -2
  30. package/dist/{local-target-DnA2E8IN.mjs.map → local-target-B4xoiDAV.mjs.map} +1 -1
  31. package/dist/local-target.d.mts +1 -1
  32. package/dist/local-target.mjs +2 -2
  33. package/dist/nextjs-control.d.mts +4 -4
  34. package/dist/nextjs-control.mjs +2 -2
  35. package/dist/nextjs-control.mjs.map +1 -1
  36. package/dist/node-control.d.mts +4 -4
  37. package/dist/node-control.mjs +2 -2
  38. package/dist/node-control.mjs.map +1 -1
  39. package/dist/{pipeline-C7gNjMzJ-CzM8DNS_.mjs → pipeline-DYvl561J-DDtnkFPh.mjs} +278 -311
  40. package/dist/pipeline-DYvl561J-DDtnkFPh.mjs.map +1 -0
  41. package/dist/report.d.mts +4 -3
  42. package/dist/report.d.mts.map +1 -1
  43. package/dist/report.mjs +2 -2
  44. package/dist/report.mjs.map +1 -1
  45. package/dist/{run-alchemy-pANK8XNX-CgCpXLkG.mjs → run-alchemy-BEvB2sYQ-Cy2fhbcu.mjs} +2 -2
  46. package/dist/{run-alchemy-pANK8XNX-CgCpXLkG.mjs.map → run-alchemy-BEvB2sYQ-Cy2fhbcu.mjs.map} +1 -1
  47. package/package.json +11 -12
  48. package/skills/prisma-composer-core-concepts/SKILL.md +106 -45
  49. package/src/exports/testing.ts +1 -1
  50. package/dist/config-BGtKERz-.d.mts +0 -1
  51. package/dist/deploy-BGtKERz-.d.mts +0 -1
  52. package/dist/deployment-summary-DswOl_9E-B9MhYYDt.mjs +0 -70
  53. package/dist/deployment-summary-DswOl_9E-B9MhYYDt.mjs.map +0 -1
  54. package/dist/execute-deploy-destroy-CvKCwVkD-Di3Ooeip.mjs.map +0 -1
  55. package/dist/execute-log-B_zCJ17b-CE954g1a.mjs.map +0 -1
  56. package/dist/pipeline-C7gNjMzJ-CzM8DNS_.mjs.map +0 -1
  57. package/dist/result-CQIOBgdW.mjs +0 -247
  58. package/dist/result-CQIOBgdW.mjs.map +0 -1
@@ -0,0 +1,168 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import * as fs$1 from "node:fs";
3
+ import { format, stripVTControlCharacters } from "node:util";
4
+ //#region ../../0-framework/3-tooling/cli/dist/deployment-summary-37e6WEuh.mjs
5
+ /**
6
+ * The deploy result's cross-process protocol, whole in one place: the
7
+ * serializable shape, the env var that names the carrier file, the writer the
8
+ * report hook calls from inside the alchemy child, and the reader the deploy
9
+ * operation runs after the child exits. `DeploymentResult` itself cannot
10
+ * cross the boundary — its `DeployedNode` entries hold live graph-node
11
+ * references (ADR-0033) — so the writer projects it down to what CAN.
12
+ *
13
+ * The summary is best-effort by contract: the writer never fails the child
14
+ * over it, and the reader maps absent or malformed to `undefined`. So is the
15
+ * failure cause the child leaves beside it when it exits non-zero.
16
+ */
17
+ /** Env var the deploy operation sets on the alchemy child: when present,
18
+ * the report hook also writes the JSON DeploymentSummary there. */
19
+ const DEPLOYMENT_RESULT_FILE_ENV = "PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE";
20
+ /** Pure projection: keeps app + each node's address/entities, drops the in-process `node`. */
21
+ function toDeploymentSummary(result) {
22
+ return {
23
+ app: result.app,
24
+ nodes: result.nodes.map((node) => ({
25
+ address: node.address,
26
+ entities: node.entities
27
+ }))
28
+ };
29
+ }
30
+ /**
31
+ * Writer half, called by the report hook inside the alchemy child: when the
32
+ * env var names a file, write the summary there. Best-effort — a write
33
+ * failure must not fail a deploy that already converged, so it is swallowed.
34
+ */
35
+ function writeDeploymentSummaryFile(result) {
36
+ const file = process.env[DEPLOYMENT_RESULT_FILE_ENV];
37
+ if (file === void 0 || file.length === 0) return;
38
+ try {
39
+ fs$1.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));
40
+ } catch {}
41
+ }
42
+ function isRecord(value) {
43
+ return typeof value === "object" && value !== null;
44
+ }
45
+ /**
46
+ * Reader half, run by the deploy operation after the child exits. Absent or
47
+ * malformed → undefined — the summary is best-effort, never a deploy failure.
48
+ */
49
+ function readDeploymentSummary(resultFilePath) {
50
+ let raw;
51
+ try {
52
+ raw = fs$1.readFileSync(resultFilePath, "utf8");
53
+ } catch {
54
+ return;
55
+ }
56
+ let parsed;
57
+ try {
58
+ parsed = JSON.parse(raw);
59
+ } catch {
60
+ return;
61
+ }
62
+ if (!isRecord(parsed) || typeof parsed["app"] !== "string" || !Array.isArray(parsed["nodes"])) return;
63
+ for (const node of parsed["nodes"]) {
64
+ if (!isRecord(node) || typeof node["address"] !== "string" || !Array.isArray(node["entities"])) return;
65
+ for (const entity of node["entities"]) if (!isRecord(entity) || typeof entity["kind"] !== "string" || typeof entity["id"] !== "string") return;
66
+ }
67
+ return blindCast(parsed);
68
+ }
69
+ /** The child's failure cause rides beside the result file, so the one env var names both and the parent's cleanup removes both. */
70
+ function engineFailureFilePath(resultFilePath) {
71
+ return `${resultFilePath}.failure.txt`;
72
+ }
73
+ /** Fits the platform's 5000-character build `errorMessage` with room for the exit-status prefix. */
74
+ const ENGINE_FAILURE_CAUSE_LIMIT = 1e3;
75
+ /**
76
+ * Child half of the failure protocol, called by the generated stack file.
77
+ * Keeps a bounded tail of everything this process logs through `console`,
78
+ * passing every call through untouched, and on a non-zero exit writes the
79
+ * redacted cause beside the result file. `console`, not the output streams:
80
+ * alchemy's logger and its error reporting both go through it, and under Bun
81
+ * `console` does not reach `process.stdout.write`.
82
+ */
83
+ function captureEngineFailure() {
84
+ const resultFile = process.env[DEPLOYMENT_RESULT_FILE_ENV];
85
+ if (resultFile === void 0 || resultFile.length === 0) return;
86
+ let tail = "";
87
+ for (const method of [
88
+ "log",
89
+ "info",
90
+ "warn",
91
+ "error",
92
+ "debug"
93
+ ]) {
94
+ const original = console[method];
95
+ console[method] = (...args) => {
96
+ tail = `${tail}${redactSecrets(format(...args), process.env)}\n`.slice(-65536);
97
+ original.apply(console, args);
98
+ };
99
+ }
100
+ process.once("exit", (code) => {
101
+ if (code === 0) return;
102
+ const cause = engineFailureCause(tail, process.env);
103
+ if (cause === void 0) return;
104
+ try {
105
+ fs$1.writeFileSync(engineFailureFilePath(resultFile), cause);
106
+ } catch {}
107
+ });
108
+ }
109
+ /** Parent half: the cause the child recorded, or undefined when it recorded none. */
110
+ function readEngineFailureCause(resultFilePath) {
111
+ try {
112
+ const cause = fs$1.readFileSync(engineFailureFilePath(resultFilePath), "utf8");
113
+ return cause.length > 0 ? cause : void 0;
114
+ } catch {
115
+ return;
116
+ }
117
+ }
118
+ /** Effect's pretty log prefix, e.g. `[10:29:16.556] INFO (#53): `. */
119
+ const LOG_PREFIX = /^\[[\d:.]+\] ([A-Z]+) \(#\d+\): ?/;
120
+ /** Alchemy's per-resource failure row, e.g. `[web] fail — UnknownError: …`. */
121
+ const RESOURCE_FAIL_ROW = /^\[[^\]]+\] fail\b/;
122
+ const STACK_FRAME = /^\s*at /;
123
+ /**
124
+ * The failure the output describes: every line from the first failure line
125
+ * (a failed resource row, an ERROR log, or an `error:` line) to the end, minus
126
+ * blank lines, stack frames and info logs; the last five lines when there is no
127
+ * failure line. Redacted, then capped.
128
+ */
129
+ function engineFailureCause(output, env) {
130
+ const lines = [];
131
+ for (const raw of stripVTControlCharacters(output).split(/\r\n|\r|\n/)) {
132
+ const clean = raw.replace(/(?![\t])\p{Cc}/gu, "").trimEnd();
133
+ const prefix = LOG_PREFIX.exec(clean);
134
+ const text = (prefix === null ? clean : clean.slice(prefix[0].length)).trim();
135
+ if (text.length === 0 || text === "{" || text === "}" || STACK_FRAME.test(text)) continue;
136
+ const level = prefix?.[1];
137
+ const failure = level === "ERROR" || level === "FATAL" || RESOURCE_FAIL_ROW.test(text) || /^\W*error:/i.test(text);
138
+ lines.push({
139
+ text,
140
+ failure,
141
+ info: !failure && level !== void 0
142
+ });
143
+ }
144
+ const start = lines.findIndex((line) => line.failure);
145
+ const kept = start === -1 ? lines.slice(-5) : lines.slice(start).filter((line) => !line.info);
146
+ if (kept.length === 0) return void 0;
147
+ const cause = redactSecrets(kept.map((line) => line.text).join("\n"), env);
148
+ return cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;
149
+ }
150
+ /** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */
151
+ const SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;
152
+ const REDACTED = "[redacted]";
153
+ /**
154
+ * Removes credentials from text that is about to leave the machine: the value
155
+ * of every secret-named env var, bearer/basic tokens, JWTs, the password in a
156
+ * URL, and `token=…`-style pairs. Values shorter than 8 characters are left,
157
+ * so a one-letter placeholder does not blank every matching letter.
158
+ */
159
+ function redactSecrets(text, env) {
160
+ const values = Object.entries(env).filter(([name, value]) => SECRET_ENV_NAME.test(name) && (value ?? "").length >= 8).map(([, value]) => value ?? "").sort((a, b) => b.length - a.length);
161
+ let redacted = text;
162
+ for (const value of values) redacted = redacted.replaceAll(value, REDACTED);
163
+ return redacted.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}`);
164
+ }
165
+ //#endregion
166
+ export { readEngineFailureCause as a, readDeploymentSummary as i, captureEngineFailure as n, writeDeploymentSummaryFile as o, engineFailureFilePath as r, DEPLOYMENT_RESULT_FILE_ENV as t };
167
+
168
+ //# sourceMappingURL=deployment-summary-37e6WEuh-BOTJynIi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-summary-37e6WEuh-BOTJynIi.mjs","names":["fs"],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-37e6WEuh.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport { format, stripVTControlCharacters } from \"node:util\";\nimport { blindCast } from \"@internal/foundation/casts\";\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/**\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 untouched, 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*/\nfunction captureEngineFailure() {\n\tconst resultFile = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (resultFile === void 0 || resultFile.length === 0) return;\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 = console[method];\n\t\tconsole[method] = (...args) => {\n\t\t\ttail = `${tail}${redactSecrets(format(...args), process.env)}\\n`.slice(-65536);\n\t\t\toriginal.apply(console, args);\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, or undefined when it recorded none. */\nfunction readEngineFailureCause(resultFilePath) {\n\ttry {\n\t\tconst cause = fs.readFileSync(engineFailureFilePath(resultFilePath), \"utf8\");\n\t\treturn cause.length > 0 ? cause : void 0;\n\t} catch {\n\t\treturn;\n\t}\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 = redactSecrets(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/** 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;\nconst REDACTED = \"[redacted]\";\n/**\n* Removes credentials from text that is about to leave the machine: the value\n* of every secret-named env var, bearer/basic tokens, JWTs, the password in a\n* URL, and `token=…`-style pairs. Values shorter than 8 characters are left,\n* so a one-letter placeholder does not blank every matching letter.\n*/\nfunction redactSecrets(text, env) {\n\tconst values = Object.entries(env).filter(([name, value]) => SECRET_ENV_NAME.test(name) && (value ?? \"\").length >= 8).map(([, value]) => value ?? \"\").sort((a, b) => b.length - a.length);\n\tlet redacted = text;\n\tfor (const value of values) redacted = redacted.replaceAll(value, REDACTED);\n\treturn redacted.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//#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-37e6WEuh.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,6BAA6B;;AAEnC,SAAS,oBAAoB,QAAQ;CACpC,OAAO;EACN,KAAK,OAAO;EACZ,OAAO,OAAO,MAAM,KAAK,UAAU;GAClC,SAAS,KAAK;GACd,UAAU,KAAK;EAChB,EAAE;CACH;AACD;;;;;;AAMA,SAAS,2BAA2B,QAAQ;CAC3C,MAAM,OAAO,QAAQ,IAAI;CACzB,IAAI,SAAS,KAAK,KAAK,KAAK,WAAW,GAAG;CAC1C,IAAI;EACH,KAAG,cAAc,MAAM,KAAK,UAAU,oBAAoB,MAAM,CAAC,CAAC;CACnE,QAAQ,CAAC;AACV;AACA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;;;;;AAKA,SAAS,sBAAsB,gBAAgB;CAC9C,IAAI;CACJ,IAAI;EACH,MAAMA,KAAG,aAAa,gBAAgB,MAAM;CAC7C,QAAQ;EACP;CACD;CACA,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,GAAG;CACxB,QAAQ;EACP;CACD;CACA,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,OAAO,QAAQ,GAAG;CAC/F,KAAK,MAAM,QAAQ,OAAO,UAAU;EACnC,IAAI,CAAC,SAAS,IAAI,KAAK,OAAO,KAAK,eAAe,YAAY,CAAC,MAAM,QAAQ,KAAK,WAAW,GAAG;EAChG,KAAK,MAAM,UAAU,KAAK,aAAa,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,YAAY,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+CAA+C,KAAK,SAAS,EAAE,CAAC,CAAC,QAAQ,mIAAmI,KAAK,UAAU;AACpW"}
@@ -0,0 +1,26 @@
1
+ import { u as DeployedEntity } from "./app-config-DyCMnkDr-CguUhanl.mjs";
2
+ import "./deploy-i9yR7YWi.mjs";
3
+ //#region ../../0-framework/3-tooling/cli/dist/deployment-summary-CU-eVvJM.d.mts
4
+ //#region src/deployment-summary.d.ts
5
+ /** The serializable projection of DeploymentResult — what CAN cross the process
6
+ * boundary. Writer (report hook) and reader (deploy operation) share this shape. */
7
+ interface DeployedNodeSummary {
8
+ readonly address: string;
9
+ readonly entities: readonly DeployedEntity[];
10
+ }
11
+ interface DeploymentSummary {
12
+ readonly app: string;
13
+ readonly nodes: readonly DeployedNodeSummary[];
14
+ }
15
+ /**
16
+ * Child half of the failure protocol, called by the generated stack file.
17
+ * Keeps a bounded tail of everything this process logs through `console`,
18
+ * passing every call through untouched, and on a non-zero exit writes the
19
+ * redacted cause beside the result file. `console`, not the output streams:
20
+ * alchemy's logger and its error reporting both go through it, and under Bun
21
+ * `console` does not reach `process.stdout.write`.
22
+ */
23
+ declare function captureEngineFailure(): void;
24
+ //#endregion
25
+ export { DeploymentSummary as n, captureEngineFailure as r, DeployedNodeSummary as t };
26
+ //# sourceMappingURL=deployment-summary-CU-eVvJM-c3AqO52N.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-summary-CU-eVvJM-c3AqO52N.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-CU-eVvJM.d.mts"],"mappings":";;;;;;UAIU;WACC;WACA,mBAAmB;;UAEpB;WACC;WACA,gBAAgB;;;;;;;;;;iBAUV"}
@@ -0,0 +1,154 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
3
+ import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
4
+ //#region ../../0-framework/0-foundation/foundation/dist/result.mjs
5
+ /**
6
+ * Generic Result type for representing success or failure outcomes.
7
+ *
8
+ * This is the standard way to return "expected failures" as values rather than
9
+ * throwing exceptions. See docs/Error Handling.md for the full taxonomy.
10
+ *
11
+ * Naming rationale:
12
+ * - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator
13
+ * - `NotOk` avoids collision with domain types like "Failure" or "Error"
14
+ * - `failure` property distinguishes from JS Error semantics
15
+ */
16
+ /**
17
+ * Result class that implements both Ok and NotOk variants.
18
+ */
19
+ var ResultImpl = class ResultImpl {
20
+ ok;
21
+ _value;
22
+ _failure;
23
+ constructor(ok, valueOrFailure) {
24
+ this.ok = ok;
25
+ if (ok) this._value = blindCast(valueOrFailure);
26
+ else this._failure = blindCast(valueOrFailure);
27
+ Object.freeze(this);
28
+ }
29
+ get value() {
30
+ if (!this.ok) throw new InternalError("Cannot access value on NotOk result");
31
+ return this._value;
32
+ }
33
+ get failure() {
34
+ if (this.ok) throw new InternalError("Cannot access failure on Ok result");
35
+ return this._failure;
36
+ }
37
+ /**
38
+ * Creates a successful result.
39
+ */
40
+ static ok(value) {
41
+ return blindCast(new ResultImpl(true, value));
42
+ }
43
+ /**
44
+ * Creates an unsuccessful result.
45
+ */
46
+ static notOk(failure) {
47
+ return blindCast(new ResultImpl(false, failure));
48
+ }
49
+ /**
50
+ * Asserts that this result is Ok and returns the value.
51
+ * Throws if the result is NotOk.
52
+ */
53
+ assertOk() {
54
+ if (!this.ok) throw new InternalError("Expected Ok result but got NotOk");
55
+ return this.value;
56
+ }
57
+ /**
58
+ * Asserts that this result is NotOk and returns the failure.
59
+ * Throws if the result is Ok.
60
+ */
61
+ assertNotOk() {
62
+ if (this.ok) throw new InternalError("Expected NotOk result but got Ok");
63
+ return this.failure;
64
+ }
65
+ };
66
+ /**
67
+ * Creates a successful result.
68
+ */
69
+ function ok(value) {
70
+ return ResultImpl.ok(value);
71
+ }
72
+ /**
73
+ * Creates an unsuccessful result.
74
+ */
75
+ function notOk(failure) {
76
+ return ResultImpl.notOk(failure);
77
+ }
78
+ /**
79
+ * Singleton for void success results.
80
+ * Use this for validation checks that don't produce a value.
81
+ */
82
+ const OK_VOID = ResultImpl.ok(void 0);
83
+ /**
84
+ * Returns a successful void result.
85
+ * Use this for validation checks that don't produce a value.
86
+ */
87
+ function okVoid() {
88
+ return OK_VOID;
89
+ }
90
+ //#endregion
91
+ //#region ../../0-framework/3-tooling/cli/dist/dev-Bmq-eLnv.mjs
92
+ /**
93
+ * Reads the execution diagnostics an engine-failure error carries in
94
+ * `meta.diagnostics`; undefined for every other failure.
95
+ */
96
+ function executionDiagnostics(f) {
97
+ const diagnostics = f.meta?.["diagnostics"];
98
+ if (typeof diagnostics !== "object" || diagnostics === null) return void 0;
99
+ const candidate = blindCast(diagnostics);
100
+ if (candidate["exitCode"] !== void 0 && typeof candidate["exitCode"] !== "number" || candidate["signal"] !== void 0 && typeof candidate["signal"] !== "string" || typeof candidate["stackFilePath"] !== "string" || typeof candidate["reproduceCommand"] !== "string" || typeof candidate["cwd"] !== "string") return;
101
+ return blindCast(diagnostics);
102
+ }
103
+ /**
104
+ * Site-specific wrap for foreign extension/environment causes — passthrough
105
+ * when already structured; never a boundary fallback (base-type rule 6(ii)).
106
+ */
107
+ function toStructured(code, error) {
108
+ return CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });
109
+ }
110
+ /** A failed executor import: an environmental failure of the consumer's
111
+ * installed tree, not a bug here. The import error rides as the cause. */
112
+ function executorLoadFailure(operation, error) {
113
+ return new CliStructuredError("DEPS.EXECUTOR_UNLOADABLE", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {
114
+ why: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,
115
+ fix: "Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.",
116
+ cause: error
117
+ });
118
+ }
119
+ async function deploy(input) {
120
+ return deployWithDeps(input, {});
121
+ }
122
+ /** In-package variant threading the injection seam, which the family's
123
+ * commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors
124
+ * internal types and is not part of the published surface. */
125
+ async function deployWithDeps(input, deps) {
126
+ const cwd = input.cwd ?? process.cwd();
127
+ let executor;
128
+ try {
129
+ executor = await import("./execute-deploy-destroy-c0eko3AO-BoK0-r1U.mjs");
130
+ } catch (error) {
131
+ return notOk(executorLoadFailure("deploy", error));
132
+ }
133
+ return executor.executeDeploy(input, deps, cwd);
134
+ }
135
+ async function dev(input) {
136
+ return devWithDeps(input, {});
137
+ }
138
+ /** In-package variant threading the injection seam, which the family's
139
+ * commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors
140
+ * internal types and is not part of the published surface. */
141
+ async function devWithDeps(input, deps) {
142
+ const cwd = input.cwd ?? process.cwd();
143
+ let executor;
144
+ try {
145
+ executor = await import("./execute-dev-BICPaq1g-DQccw8kr.mjs");
146
+ } catch (error) {
147
+ return notOk(executorLoadFailure("dev", error));
148
+ }
149
+ return executor.executeDev(input, deps, cwd);
150
+ }
151
+ //#endregion
152
+ export { toStructured as a, okVoid as c, executorLoadFailure as i, dev as n, notOk as o, executionDiagnostics as r, ok as s, deploy as t };
153
+
154
+ //# sourceMappingURL=dev-Bmq-eLnv-DsenQNJM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-Bmq-eLnv-DsenQNJM.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/result.mjs","../../../0-framework/3-tooling/cli/dist/dev-Bmq-eLnv.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as InternalError } from \"./internal-error-Dfur7Zqt.mjs\";\n//#region src/result.ts\n/**\n* Generic Result type for representing success or failure outcomes.\n*\n* This is the standard way to return \"expected failures\" as values rather than\n* throwing exceptions. See docs/Error Handling.md for the full taxonomy.\n*\n* Naming rationale:\n* - `Ok<T>` / `NotOk<F>` mirror the `ok: true/false` discriminator\n* - `NotOk` avoids collision with domain types like \"Failure\" or \"Error\"\n* - `failure` property distinguishes from JS Error semantics\n*/\n/**\n* Result class that implements both Ok and NotOk variants.\n*/\nvar ResultImpl = class ResultImpl {\n\tok;\n\t_value;\n\t_failure;\n\tconstructor(ok, valueOrFailure) {\n\t\tthis.ok = ok;\n\t\tif (ok) this._value = blindCast(valueOrFailure);\n\t\telse this._failure = blindCast(valueOrFailure);\n\t\tObject.freeze(this);\n\t}\n\tget value() {\n\t\tif (!this.ok) throw new InternalError(\"Cannot access value on NotOk result\");\n\t\treturn this._value;\n\t}\n\tget failure() {\n\t\tif (this.ok) throw new InternalError(\"Cannot access failure on Ok result\");\n\t\treturn this._failure;\n\t}\n\t/**\n\t* Creates a successful result.\n\t*/\n\tstatic ok(value) {\n\t\treturn blindCast(new ResultImpl(true, value));\n\t}\n\t/**\n\t* Creates an unsuccessful result.\n\t*/\n\tstatic notOk(failure) {\n\t\treturn blindCast(new ResultImpl(false, failure));\n\t}\n\t/**\n\t* Asserts that this result is Ok and returns the value.\n\t* Throws if the result is NotOk.\n\t*/\n\tassertOk() {\n\t\tif (!this.ok) throw new InternalError(\"Expected Ok result but got NotOk\");\n\t\treturn this.value;\n\t}\n\t/**\n\t* Asserts that this result is NotOk and returns the failure.\n\t* Throws if the result is Ok.\n\t*/\n\tassertNotOk() {\n\t\tif (this.ok) throw new InternalError(\"Expected NotOk result but got Ok\");\n\t\treturn this.failure;\n\t}\n};\n/**\n* Creates a successful result.\n*/\nfunction ok(value) {\n\treturn ResultImpl.ok(value);\n}\n/**\n* Creates an unsuccessful result.\n*/\nfunction notOk(failure) {\n\treturn ResultImpl.notOk(failure);\n}\n/**\n* Singleton for void success results.\n* Use this for validation checks that don't produce a value.\n*/\nconst OK_VOID = ResultImpl.ok(void 0);\n/**\n* Returns a successful void result.\n* Use this for validation checks that don't produce a value.\n*/\nfunction okVoid() {\n\treturn OK_VOID;\n}\n//#endregion\nexport { notOk, ok, okVoid };\n\n//# sourceMappingURL=result.mjs.map","import { blindCast } from \"@internal/foundation/casts\";\nimport { notOk } from \"@internal/foundation/result\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || candidate[\"signal\"] !== void 0 && typeof candidate[\"signal\"] !== \"string\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** A failed executor import: an environmental failure of the consumer's\n* installed tree, not a bug here. The import error rides as the cause. */\nfunction executorLoadFailure(operation, error) {\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\n//#endregion\n//#region src/operations/deploy.ts\nasync function deploy(input) {\n\treturn deployWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function deployWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-c0eko3AO.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"deploy\", error));\n\t}\n\treturn executor.executeDeploy(input, deps, cwd);\n}\n//#endregion\n//#region src/operations/dev.ts\nasync function dev(input) {\n\treturn devWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function devWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-dev-BICPaq1g.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"dev\", error));\n\t}\n\treturn executor.executeDev(input, deps, cwd);\n}\n//#endregion\nexport { executionDiagnostics as a, deployWithDeps as i, devWithDeps as n, executorLoadFailure as o, deploy as r, toStructured as s, dev as t };\n\n//# sourceMappingURL=dev-Bmq-eLnv.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAI,aAAa,MAAM,WAAW;CACjC;CACA;CACA;CACA,YAAY,IAAI,gBAAgB;EAC/B,KAAK,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,UAAU,cAAc;OACzC,KAAK,WAAW,UAAU,cAAc;EAC7C,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,QAAQ;EACX,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,cAAc,qCAAqC;EAC3E,OAAO,KAAK;CACb;CACA,IAAI,UAAU;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,oCAAoC;EACzE,OAAO,KAAK;CACb;;;;CAIA,OAAO,GAAG,OAAO;EAChB,OAAO,UAAU,IAAI,WAAW,MAAM,KAAK,CAAC;CAC7C;;;;CAIA,OAAO,MAAM,SAAS;EACrB,OAAO,UAAU,IAAI,WAAW,OAAO,OAAO,CAAC;CAChD;;;;;CAKA,WAAW;EACV,IAAI,CAAC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C1C,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,UAAU,KAAK,CAAC;CAClD;CACA,OAAO,SAAS,cAAc,OAAO,MAAM,GAAG;AAC/C;AAGA,eAAe,IAAI,OAAO;CACzB,OAAO,YAAY,OAAO,CAAC,CAAC;AAC7B;;;;AAIA,eAAe,YAAY,OAAO,MAAM;CACvC,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,OAAO,KAAK,CAAC;CAC/C;CACA,OAAO,SAAS,WAAW,OAAO,MAAM,GAAG;AAC5C"}
@@ -1,16 +1,16 @@
1
1
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
2
2
  import { t as containerEnv } from "./container-transport-HcvNOGZL-twPi2TIv.mjs";
3
3
  import { n as preflightEnvVarName, t as preflightEnv } from "./config-CdxvLFzg.mjs";
4
- import { n as ok, r as okVoid, s as toStructured, t as notOk } from "./result-CQIOBgdW.mjs";
4
+ import { a as toStructured, c as okVoid, o as notOk, s as ok } from "./dev-Bmq-eLnv-DsenQNJM.mjs";
5
5
  import { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from "./run-report-C2o98uD--AX8kpz4Q.mjs";
6
- import { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-DswOl_9E-B9MhYYDt.mjs";
7
- import { n as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-pANK8XNX-CgCpXLkG.mjs";
8
- import { n as runPipeline } from "./pipeline-C7gNjMzJ-CzM8DNS_.mjs";
6
+ import { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-37e6WEuh-BOTJynIi.mjs";
7
+ import { n as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-BEvB2sYQ-Cy2fhbcu.mjs";
8
+ import { n as runPipeline, r as noComposerExportMessage } from "./pipeline-DYvl561J-DDtnkFPh.mjs";
9
9
  import * as fs$1 from "node:fs";
10
10
  import * as path$1 from "node:path";
11
11
  import { randomUUID } from "node:crypto";
12
12
  import { spawnSync } from "node:child_process";
13
- //#region ../../0-framework/3-tooling/cli/dist/generate-stack-DLu6b7YM.mjs
13
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-c0eko3AO.mjs
14
14
  /** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
15
15
  const GENERATED_DIR = ".prisma-composer";
16
16
  const GENERATED_FILE = "alchemy.run.ts";
@@ -31,15 +31,15 @@ function renderOptions(input) {
31
31
  lines.push(" bundles: {");
32
32
  for (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);
33
33
  lines.push(" },");
34
- lines.push(" report: deploymentReport,");
34
+ lines.push(" report: report.deploymentReport,");
35
35
  return lines.join("\n");
36
36
  }
37
37
  /** 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. */
38
38
  function renderStackFile(input) {
39
39
  const generatedDir = path$1.join(input.cwd, GENERATED_DIR);
40
40
  const appImport = relativeImportSpecifier(generatedDir, input.entryPath);
41
- const configImport = relativeImportSpecifier(generatedDir, input.configPath);
42
- return `// Generated by \`prisma-composer deploy\`/\`prisma-composer destroy\` — overwritten on every
41
+ const configImport = relativeImportSpecifier(generatedDir, input.configFile);
42
+ return `// Generated by Composer's deploy and destroy operations — overwritten on every
43
43
  // run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the
44
44
  // CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars —
45
45
  // without them lower() refuses because no container is resolved):
@@ -48,10 +48,18 @@ function renderStackFile(input) {
48
48
  //
49
49
  // bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).
50
50
  import { lower } from '@prisma/composer/deploy';
51
- import { deploymentReport } from '@prisma/composer/report';
52
- import config from ${quote(configImport)};
51
+ import * as report from '@prisma/composer/report';
52
+ import prismaConfig from ${quote(configImport)};
53
53
  import app from ${quote(appImport)};
54
54
 
55
+ const config = prismaConfig.composer;
56
+ if (config === undefined) {
57
+ throw new Error(${quote(noComposerExportMessage(input.configFile))});
58
+ }
59
+
60
+ // The app's own @prisma/composer may predate the failure recorder.
61
+ report.captureEngineFailure?.();
62
+
55
63
  export default lower(app, config, {
56
64
  ${renderOptions(input)}
57
65
  });
@@ -66,8 +74,6 @@ function writeStackFile(input) {
66
74
  return filePath;
67
75
  }
68
76
  const GENERATED_STACK_RELATIVE_PATH = path$1.join(GENERATED_DIR, GENERATED_FILE);
69
- //#endregion
70
- //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-CvKCwVkD.mjs
71
77
  /** 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. */
72
78
  function validateStageName(stage) {
73
79
  const result = spawnSync("git", ["check-ref-format", `refs/heads/${stage}`], { stdio: "ignore" });
@@ -90,6 +96,7 @@ function hasNoLocalDeployState(cwd) {
90
96
  async function executeDeploy(input, deps, cwd) {
91
97
  const outcome = await runStackPipeline("deploy", {
92
98
  entry: input.entry,
99
+ config: input.config,
93
100
  name: input.name,
94
101
  stage: input.stage,
95
102
  cwd,
@@ -112,6 +119,7 @@ async function executeDeploy(input, deps, cwd) {
112
119
  async function executeDestroy(input, deps, cwd) {
113
120
  const outcome = await runStackPipeline("destroy", {
114
121
  entry: input.entry,
122
+ config: input.config,
115
123
  name: input.name,
116
124
  stage: input.target.kind === "stage" ? input.target.stage : void 0,
117
125
  cwd,
@@ -233,7 +241,7 @@ async function runStackPipeline(action, opts) {
233
241
  * write the stack file, run alchemy against it, then the destroy-only
234
242
  * teardown/removal suffix. The value is only ever a summary for deploy. */
235
243
  async function runStackPipelineInner(action, opts, reporters) {
236
- const { entry, name, stage, cwd, onEvent, deps } = opts;
244
+ const { entry, config: composerConfig, name, stage, cwd, onEvent, deps } = opts;
237
245
  if (stage !== void 0) try {
238
246
  validateStageName(stage);
239
247
  } catch (error) {
@@ -250,16 +258,13 @@ async function runStackPipelineInner(action, opts, reporters) {
250
258
  const preflightPayloads = /* @__PURE__ */ new Map();
251
259
  let preflightTransportEnv = {};
252
260
  try {
253
- pipeline = await runPipeline(entry, name, cwd, {
254
- runAssembler: deps.runAssembler,
255
- config: deps.config,
256
- configPath: deps.configPath
257
- }, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
261
+ pipeline = await runPipeline(entry, name, cwd, composerConfig, { runAssembler: deps.runAssembler }, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
258
262
  why: "destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.",
259
263
  fix: "Run the build, then retry the destroy.",
260
264
  cause: error
261
265
  }) : void 0);
262
- const { config, graph, name: resolvedName } = pipeline;
266
+ const { graph, name: resolvedName } = pipeline;
267
+ const config = pipeline.configSource.value;
263
268
  if (action === "deploy") reporters.push(...await beginReporters(config.extensions, {
264
269
  appName: resolvedName,
265
270
  graph,
@@ -290,7 +295,7 @@ async function runStackPipelineInner(action, opts, reporters) {
290
295
  }
291
296
  await attachReporters(reporters, containers);
292
297
  const pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;
293
- 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." });
298
+ 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." : "Destroying production needs a target whose container supplies the production deploy scope." });
294
299
  alchemyStage = pinnedStage;
295
300
  if (action === "deploy") {
296
301
  for (const extension of config.extensions) {
@@ -325,7 +330,7 @@ async function runStackPipelineInner(action, opts, reporters) {
325
330
  stackPath = writeStackFile({
326
331
  entryPath: pipeline.entryModule.path,
327
332
  cwd,
328
- configPath: pipeline.configPath,
333
+ configFile: pipeline.configSource.file,
329
334
  name: pipeline.name,
330
335
  assembled: pipeline.assembled
331
336
  });
@@ -370,18 +375,23 @@ async function runStackPipelineInner(action, opts, reporters) {
370
375
  }
371
376
  } }));
372
377
  const status = outcome.exitCode ?? 1;
373
- if (status !== 0) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} exited with status ${status}.`, { meta: {
374
- exitCode: status,
375
- diagnostics: {
378
+ if (status !== 0) {
379
+ const engineCause = readEngineFailureCause(resultFilePath);
380
+ const withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\n${engineCause}`;
381
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {
376
382
  exitCode: status,
377
- stackFilePath: stackPath,
378
- reproduceCommand,
379
- cwd
380
- }
381
- } }));
383
+ ...engineCause !== void 0 ? { engineCause } : {},
384
+ diagnostics: {
385
+ exitCode: status,
386
+ stackFilePath: stackPath,
387
+ reproduceCommand,
388
+ cwd
389
+ }
390
+ } }));
391
+ }
382
392
  try {
383
393
  if (action === "destroy") {
384
- for (const extension of pipeline.config.extensions) {
394
+ for (const extension of pipeline.configSource.value.extensions) {
385
395
  if (extension.teardown === void 0) continue;
386
396
  try {
387
397
  await extension.teardown({
@@ -392,7 +402,7 @@ async function runStackPipelineInner(action, opts, reporters) {
392
402
  throw toStructured("DEPLOY.TEARDOWN_FAILED", error);
393
403
  }
394
404
  }
395
- for (const extension of pipeline.config.extensions) {
405
+ for (const extension of pipeline.configSource.value.extensions) {
396
406
  if (extension.container === void 0) continue;
397
407
  const instance = containers.get(extension.id);
398
408
  if (instance === void 0) continue;
@@ -412,10 +422,11 @@ async function runStackPipelineInner(action, opts, reporters) {
412
422
  } finally {
413
423
  try {
414
424
  fs$1.rmSync(resultFilePath, { force: true });
425
+ fs$1.rmSync(engineFailureFilePath(resultFilePath), { force: true });
415
426
  } catch {}
416
427
  }
417
428
  }
418
429
  //#endregion
419
430
  export { executeDeploy, executeDestroy };
420
431
 
421
- //# sourceMappingURL=execute-deploy-destroy-CvKCwVkD-Di3Ooeip.mjs.map
432
+ //# sourceMappingURL=execute-deploy-destroy-c0eko3AO-BoK0-r1U.mjs.map