@prisma/composer 0.39.0-dev.12 → 0.39.0-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-DriAu5RU-C8hYpR38.d.mts → app-config-Dhypzb6a-C3Kb0XtS.d.mts} +35 -63
- package/dist/app-config-Dhypzb6a-C3Kb0XtS.d.mts.map +1 -0
- package/dist/{app-converge-DkTFs-ih-CAr2feEu.mjs → app-converge-CHMILMYi-JJnwJd2I.mjs} +5 -5
- package/dist/app-converge-CHMILMYi-JJnwJd2I.mjs.map +1 -0
- package/dist/config-D615fYD5.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +12 -2
- package/dist/config.mjs.map +1 -0
- package/dist/control.d.mts +236 -16
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +5 -5
- package/dist/control.mjs.map +1 -1
- package/dist/{converge-in-process-x89zb2MF-Dvj-J8xo.mjs → converge-in-process-CfeblFN9-B1KvX1Fa.mjs} +4 -4
- package/dist/{converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map → converge-in-process-CfeblFN9-B1KvX1Fa.mjs.map} +1 -1
- package/dist/{converge-in-process-CTomEXaD-BnDylZP8.d.mts → converge-in-process-DZRf9uYm-Ohjvy0s_.d.mts} +6 -6
- package/dist/{converge-in-process-CTomEXaD-BnDylZP8.d.mts.map → converge-in-process-DZRf9uYm-Ohjvy0s_.d.mts.map} +1 -1
- package/dist/{deploy-DHgEJDpg.d.mts → deploy-CncPyRbo.d.mts} +4 -4
- package/dist/{deploy-DHgEJDpg.d.mts.map → deploy-CncPyRbo.d.mts.map} +1 -1
- package/dist/{deploy-CSU0kr4j.mjs → deploy-DPX4IXzF.mjs} +15 -43
- package/dist/deploy-DPX4IXzF.mjs.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{dev-converge-messages-DML4rTz7-C_EAB5M_.mjs → dev-converge-messages-CElmPylA-BenEozC3.mjs} +7 -7
- package/dist/dev-converge-messages-CElmPylA-BenEozC3.mjs.map +1 -0
- package/dist/dev-converge-worker.mjs +3 -3
- package/dist/dev-converge-worker.mjs.map +1 -1
- package/dist/{dev-current-C7rT6Yxw-yJ1ORrSC.mjs → dev-current-C7R8uqyQ-CM3PrTGG.mjs} +8 -19
- package/dist/dev-current-C7R8uqyQ-CM3PrTGG.mjs.map +1 -0
- package/dist/{dist-Cf_mZHaH.mjs → dist-Bw5O9TDx.mjs} +2 -2
- package/dist/{dist-Cf_mZHaH.mjs.map → dist-Bw5O9TDx.mjs.map} +1 -1
- package/dist/execute-deploy-destroy-BIRdFfwR-BjLOxnQd.mjs +476 -0
- package/dist/execute-deploy-destroy-BIRdFfwR-BjLOxnQd.mjs.map +1 -0
- package/dist/{execute-dev-BtSLDMkv-DAXRcK9h.mjs → execute-dev-D9PxdbV3-CHISvcxU.mjs} +11 -15
- package/dist/execute-dev-D9PxdbV3-CHISvcxU.mjs.map +1 -0
- package/dist/{execute-dev-current-LEdiAZSw-CwM41ylY.mjs → execute-dev-current-BghQ0HLe-BC3mOHRQ.mjs} +4 -4
- package/dist/{execute-dev-current-LEdiAZSw-CwM41ylY.mjs.map → execute-dev-current-BghQ0HLe-BC3mOHRQ.mjs.map} +1 -1
- package/dist/{execute-log-CzzB35KD-BBHeeC1M.mjs → execute-log-Bg7v1TBv-DigUuQSN.mjs} +4 -4
- package/dist/{execute-log-CzzB35KD-BBHeeC1M.mjs.map → execute-log-Bg7v1TBv-DigUuQSN.mjs.map} +1 -1
- package/dist/{graph-D2WMLL43-CeiC5wdy.mjs → graph-BYo1OEqk-D5AtX8q4.mjs} +5 -5
- package/dist/graph-BYo1OEqk-D5AtX8q4.mjs.map +1 -0
- package/dist/{graph-CUYXjK8S-BzL-mhjq.d.mts → graph-CRFQxH8r-CI1p78T8.d.mts} +3 -3
- package/dist/graph-CRFQxH8r-CI1p78T8.d.mts.map +1 -0
- package/dist/{graph-types-D4PrtP-l-B0uuchTl.d.mts → graph-types-BeNeqIt4-LGyYX_Sm.d.mts} +9 -10
- package/dist/{graph-types-D4PrtP-l-B0uuchTl.d.mts.map → graph-types-BeNeqIt4-LGyYX_Sm.d.mts.map} +1 -1
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-D8chHe55.d.mts → index-DOJMK47O.d.mts} +3 -3
- package/dist/{index-D8chHe55.d.mts.map → index-DOJMK47O.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/internal-converge.d.mts +4 -4
- package/dist/internal-converge.mjs +2 -2
- package/dist/{load-entry-CEoVBdMj-CHOz7jKf.mjs → load-entry-CEoVBdMj-L1mXTtEO.mjs} +5 -5
- package/dist/load-entry-CEoVBdMj-L1mXTtEO.mjs.map +1 -0
- package/dist/{local-target-7KRsLMDO.d.mts → local-target-DZFvgvVK.d.mts} +2 -2
- package/dist/{local-target-7KRsLMDO.d.mts.map → local-target-DZFvgvVK.d.mts.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/{nextjs-DLyeRR7M-CzUbvPaJ.d.mts → nextjs-DLyeRR7M-C2z32CtL.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map → nextjs-DLyeRR7M-C2z32CtL.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{run-report-CmBz2-xc-Cc8rV1CX.mjs → run-report-HI2JqCSO-BWPG--nb.mjs} +5 -7
- package/dist/run-report-HI2JqCSO-BWPG--nb.mjs.map +1 -0
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-Det-FSAL-DRvo57Lf.mjs +174 -0
- package/dist/steps-Det-FSAL-DRvo57Lf.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/{validate-environment-DCZiNSlR-C7lv0cH1.mjs → validate-environment-BevPErw8-BDbXIt8U.mjs} +331 -9
- package/dist/validate-environment-BevPErw8-BDbXIt8U.mjs.map +1 -0
- package/package.json +11 -14
- package/skills/prisma-composer-core-concepts/SKILL.md +6 -23
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +0 -1
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs +0 -186
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +0 -1
- package/dist/app-converge-DkTFs-ih-CAr2feEu.mjs.map +0 -1
- package/dist/config-Bpi8QVLB.d.mts +0 -1
- package/dist/deploy-CSU0kr4j.mjs.map +0 -1
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts +0 -33
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map +0 -1
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs +0 -153
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map +0 -1
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +0 -1
- package/dist/dev-current-C7rT6Yxw-yJ1ORrSC.mjs.map +0 -1
- package/dist/execute-deploy-destroy-C-aK5jh--D-AjLWc2.mjs +0 -855
- package/dist/execute-deploy-destroy-C-aK5jh--D-AjLWc2.mjs.map +0 -1
- package/dist/execute-dev-BtSLDMkv-DAXRcK9h.mjs.map +0 -1
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +0 -1
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +0 -1
- package/dist/internal-app-configuration-file.d.mts +0 -16
- package/dist/internal-app-configuration-file.d.mts.map +0 -1
- package/dist/internal-app-configuration-file.mjs +0 -2
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +0 -1
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs +0 -90
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +0 -1
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs +0 -339
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs.map +0 -1
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts +0 -232
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +0 -1
- package/dist/report.d.mts +0 -19
- package/dist/report.d.mts.map +0 -1
- package/dist/report.mjs +0 -97
- package/dist/report.mjs.map +0 -1
- package/dist/run-report-CmBz2-xc-Cc8rV1CX.mjs.map +0 -1
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +0 -112
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +0 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +0 -1
- package/src/exports/internal-app-configuration-file.ts +0 -1
- package/src/exports/report.ts +0 -1
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
|
|
2
|
-
import { t as DEV_DIR } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
|
|
3
|
-
import * as path$1 from "node:path";
|
|
4
|
-
import * as fs$1 from "node:fs";
|
|
5
|
-
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-D0rB5g65.mjs
|
|
6
|
-
function textIn(value, at) {
|
|
7
|
-
if (typeof value === "string") return [{
|
|
8
|
-
at,
|
|
9
|
-
text: value
|
|
10
|
-
}];
|
|
11
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return [{
|
|
12
|
-
at,
|
|
13
|
-
text: String(value)
|
|
14
|
-
}];
|
|
15
|
-
if (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));
|
|
16
|
-
if (typeof value === "object" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a root input field Load read holds a known secret. */
|
|
20
|
-
function refuseSecretsInRootInput(read, knownSecrets, consequence) {
|
|
21
|
-
const readPlaces = read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
|
|
22
|
-
where: `Root input field input.${at.join(".")}`,
|
|
23
|
-
text
|
|
24
|
-
})));
|
|
25
|
-
for (const { where, text } of readPlaces) {
|
|
26
|
-
const name = knownSecrets.nameIn(text);
|
|
27
|
-
if (name === void 0) continue;
|
|
28
|
-
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the platform secret "${name}". ${consequence}`, { fix: `Pass the value of the platform secret "${name}" to where this value is used, or give this plain value text that does not contain the value of "${name}".` });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a plain platform variable's text holds a known secret. */
|
|
32
|
-
function refuseSecretsInPlainVariables(plainVariableText, knownSecrets, consequence) {
|
|
33
|
-
for (const [variable, text] of Object.entries(plainVariableText)) {
|
|
34
|
-
const name = knownSecrets.nameIn(text);
|
|
35
|
-
if (name === void 0) continue;
|
|
36
|
-
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `The platform variable "${variable}", which prisma dev read from the \`config\` adapters, holds the value of the platform secret "${name}". ${consequence}`, { fix: `Keep the value of "${name}" out of the platform variable "${variable}", or give "${variable}" a different value.` });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/** Names the app configuration file the first process wrote for this run (ADR-0062). */
|
|
40
|
-
const APP_CONFIGURATION_FILE_ENV = "PRISMA_COMPOSER_APP_CONFIGURATION_FILE";
|
|
41
|
-
const FILE_NAME = /^app-configuration-(\d+)(-[^/]*)?\.json$/;
|
|
42
|
-
/** The app configuration file a destroy run writes: unique per run, so concurrent runs from one checkout never share one. */
|
|
43
|
-
function deployAppConfigurationFile(cwd, runId) {
|
|
44
|
-
return path$1.join(cwd, ".prisma-composer", `app-configuration-${String(process.pid)}-${runId}.json`);
|
|
45
|
-
}
|
|
46
|
-
function isRunning(pid) {
|
|
47
|
-
try {
|
|
48
|
-
process.kill(pid, 0);
|
|
49
|
-
return true;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
return error instanceof Error && "code" in error && error.code === "EPERM";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in
|
|
56
|
-
* each dev environment's folder: a run killed before its exit handler ran leaves its file. A
|
|
57
|
-
* file is deleted only when its process is not running and it is older than
|
|
58
|
-
* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.
|
|
59
|
-
*/
|
|
60
|
-
function removeLeftoverAppConfigurationFiles(cwd) {
|
|
61
|
-
const devRoot = path$1.join(cwd, DEV_DIR);
|
|
62
|
-
const dirs = [path$1.join(cwd, ".prisma-composer")];
|
|
63
|
-
try {
|
|
64
|
-
for (const entry of fs$1.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path$1.join(devRoot, entry.name));
|
|
65
|
-
} catch {}
|
|
66
|
-
for (const dir of dirs) {
|
|
67
|
-
let names;
|
|
68
|
-
try {
|
|
69
|
-
names = fs$1.readdirSync(dir);
|
|
70
|
-
} catch {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
for (const name of names) {
|
|
74
|
-
const pid = Number(FILE_NAME.exec(name)?.[1]);
|
|
75
|
-
if (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;
|
|
76
|
-
const file = path$1.join(dir, name);
|
|
77
|
-
try {
|
|
78
|
-
if (Date.now() - fs$1.statSync(file).mtimeMs < 6e5) continue;
|
|
79
|
-
fs$1.rmSync(file, { force: true });
|
|
80
|
-
} catch {}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* First process: the app configuration file and the environment the second process starts with (ADR-0062).
|
|
86
|
-
* Refuses a file that would hold any of `knownSecrets`.
|
|
87
|
-
*/
|
|
88
|
-
function prepareSecondProcess(input) {
|
|
89
|
-
const { file } = input;
|
|
90
|
-
refuseSecretsInRootInput(input.appConfigurationRead, input.knownSecrets, "Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.");
|
|
91
|
-
refuseSecretsInPlainVariables(input.plainVariableText, input.knownSecrets, "Composer hands the second process every plain value in a file, and never writes a secret to a file.");
|
|
92
|
-
const contents = {
|
|
93
|
-
appConfigurationRead: input.appConfigurationRead,
|
|
94
|
-
plainVariableText: input.plainVariableText,
|
|
95
|
-
nodeAddresses: input.nodeAddresses
|
|
96
|
-
};
|
|
97
|
-
const env = { [APP_CONFIGURATION_FILE_ENV]: file };
|
|
98
|
-
const remove = () => {
|
|
99
|
-
try {
|
|
100
|
-
fs$1.rmSync(file, { force: true });
|
|
101
|
-
} catch {}
|
|
102
|
-
};
|
|
103
|
-
return {
|
|
104
|
-
env,
|
|
105
|
-
writeFile() {
|
|
106
|
-
fs$1.rmSync(file, { force: true });
|
|
107
|
-
fs$1.writeFileSync(file, JSON.stringify(contents), {
|
|
108
|
-
mode: 384,
|
|
109
|
-
flag: "wx"
|
|
110
|
-
});
|
|
111
|
-
process.off("exit", remove);
|
|
112
|
-
process.on("exit", remove);
|
|
113
|
-
},
|
|
114
|
-
removeFile() {
|
|
115
|
-
process.off("exit", remove);
|
|
116
|
-
remove();
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function missingVariable(name, what) {
|
|
121
|
-
return `${name} is not set. This stack file runs as the second process of a Composer destroy, which ${what}.`;
|
|
122
|
-
}
|
|
123
|
-
function isRecord(value) {
|
|
124
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
125
|
-
}
|
|
126
|
-
function isTextList(value) {
|
|
127
|
-
return Array.isArray(value) && value.every((member) => typeof member === "string");
|
|
128
|
-
}
|
|
129
|
-
function rootFieldsOf(value) {
|
|
130
|
-
if (!Array.isArray(value)) return void 0;
|
|
131
|
-
const fields = [];
|
|
132
|
-
for (const member of value) {
|
|
133
|
-
if (!isRecord(member) || !isTextList(member["path"])) return void 0;
|
|
134
|
-
fields.push("value" in member ? {
|
|
135
|
-
path: member["path"],
|
|
136
|
-
value: member["value"]
|
|
137
|
-
} : { path: member["path"] });
|
|
138
|
-
}
|
|
139
|
-
return fields;
|
|
140
|
-
}
|
|
141
|
-
function textByKeyOf(value) {
|
|
142
|
-
if (!isRecord(value)) return void 0;
|
|
143
|
-
const byKey = {};
|
|
144
|
-
for (const [key, member] of Object.entries(value)) {
|
|
145
|
-
if (typeof member !== "string") return void 0;
|
|
146
|
-
byKey[key] = member;
|
|
147
|
-
}
|
|
148
|
-
return byKey;
|
|
149
|
-
}
|
|
150
|
-
/** Second process: the app configuration file the first process named in its environment. */
|
|
151
|
-
function readAppConfigurationFile(env) {
|
|
152
|
-
const file = env[APP_CONFIGURATION_FILE_ENV];
|
|
153
|
-
if (file === void 0 || file === "") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, "names the app configuration file it wrote there"));
|
|
154
|
-
let text;
|
|
155
|
-
try {
|
|
156
|
-
text = fs$1.readFileSync(file, "utf8");
|
|
157
|
-
} catch (cause) {
|
|
158
|
-
const message = cause instanceof Error ? cause.message : String(cause);
|
|
159
|
-
throw new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });
|
|
160
|
-
}
|
|
161
|
-
const notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not in the shape this version of Composer reads: ${what}. The usual cause is a \`prisma\` CLI and an app on different Composer versions. Put the \`prisma\` CLI and the app's \`@prisma/composer\` on the same version.`);
|
|
162
|
-
let parsed;
|
|
163
|
-
try {
|
|
164
|
-
parsed = JSON.parse(text);
|
|
165
|
-
} catch {
|
|
166
|
-
throw notComposers("it is not JSON");
|
|
167
|
-
}
|
|
168
|
-
if (!isRecord(parsed)) throw notComposers("it is not JSON");
|
|
169
|
-
const read = parsed["appConfigurationRead"];
|
|
170
|
-
if (!isRecord(read)) throw notComposers("appConfigurationRead is not an object");
|
|
171
|
-
const rootInput = rootFieldsOf(read["rootInput"]);
|
|
172
|
-
if (rootInput === void 0) throw notComposers("rootInput is not a list of fields");
|
|
173
|
-
const plainVariableText = textByKeyOf(parsed["plainVariableText"]);
|
|
174
|
-
if (plainVariableText === void 0) throw notComposers("plainVariableText is not an object of text");
|
|
175
|
-
const addresses = parsed["nodeAddresses"];
|
|
176
|
-
if (!isTextList(addresses)) throw notComposers("nodeAddresses is not a list of node addresses");
|
|
177
|
-
return {
|
|
178
|
-
appConfigurationRead: { rootInput },
|
|
179
|
-
plainVariableText,
|
|
180
|
-
nodeAddresses: addresses
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
|
-
export { refuseSecretsInRootInput as a, refuseSecretsInPlainVariables as i, prepareSecondProcess as n, removeLeftoverAppConfigurationFiles as o, readAppConfigurationFile as r, deployAppConfigurationFile as t };
|
|
185
|
-
|
|
186
|
-
//# sourceMappingURL=app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-configuration-file-D0rB5g65-CdMrjkCc.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-D0rB5g65.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/secret-as-plain-value.ts\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a root input field Load read holds a known secret. */\nfunction refuseSecretsInRootInput(read, knownSecrets, consequence) {\n\tconst readPlaces = read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t})));\n\tfor (const { where, text } of readPlaces) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the platform secret \"${name}\". ${consequence}`, { fix: `Pass the value of the platform secret \"${name}\" to where this value is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a plain platform variable's text holds a known secret. */\nfunction refuseSecretsInPlainVariables(plainVariableText, knownSecrets, consequence) {\n\tfor (const [variable, text] of Object.entries(plainVariableText)) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `The platform variable \"${variable}\", which prisma dev read from the \\`config\\` adapters, holds the value of the platform secret \"${name}\". ${consequence}`, { fix: `Keep the value of \"${name}\" out of the platform variable \"${variable}\", or give \"${variable}\" a different value.` });\n\t}\n}\n//#endregion\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\n/**\n* First process: the app configuration file and the environment the second process starts with (ADR-0062).\n* Refuses a file that would hold any of `knownSecrets`.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file } = input;\n\trefuseSecretsInRootInput(input.appConfigurationRead, input.knownSecrets, \"Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.\");\n\trefuseSecretsInPlainVariables(input.plainVariableText, input.knownSecrets, \"Composer hands the second process every plain value in a file, and never writes a secret to a file.\");\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tplainVariableText: input.plainVariableText,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer destroy, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not in the shape this version of Composer reads: ${what}. The usual cause is a \\`prisma\\` CLI and an app on different Composer versions. Put the \\`prisma\\` CLI and the app's \\`@prisma/composer\\` on the same version.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst plainVariableText = textByKeyOf(parsed[\"plainVariableText\"]);\n\tif (plainVariableText === void 0) throw notComposers(\"plainVariableText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: { rootInput },\n\t\tplainVariableText,\n\t\tnodeAddresses: addresses\n\t};\n}\n//#endregion\nexport { refuseSecretsInPlainVariables as a, removeLeftoverAppConfigurationFiles as i, prepareSecondProcess as n, refuseSecretsInRootInput as o, readAppConfigurationFile as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-D0rB5g65.mjs.map"],"mappings":";;;;;AAKA,SAAS,OAAO,OAAO,IAAI;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO,CAAC;EACtC;EACA,MAAM;CACP,CAAC;CACD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,OAAO,UAAU,UAAU,OAAO,CAAC;EACjG;EACA,MAAM,OAAO,KAAK;CACnB,CAAC;CACD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,S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;;AAEA,SAAS,yBAAyB,KAAK;CACtC,MAAM,OAAO,IAAI;CACjB,IAAI,SAAS,KAAK,KAAK,SAAS,IAAI,MAAM,IAAI,MAAM,gBAAgB,4BAA4B,iDAAiD,CAAC;CAClJ,IAAI;CACJ,IAAI;EACH,OAAOA,KAAG,aAAa,MAAM,MAAM;CACpC,SAAS,OAAO;EACf,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,MAAM,IAAI,MAAM,6CAA6C,KAAK,IAAI,QAAQ,yHAAyH,EAAE,MAAM,CAAC;CACjN;CACA,MAAM,gBAAgB,yBAAyB,IAAI,MAAM,8BAA8B,KAAK,uDAAuD,KAAK,gKAAgK;CACxT,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,IAAI;CACzB,QAAQ;EACP,MAAM,aAAa,gBAAgB;CACpC;CACA,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,aAAa,gBAAgB;CAC1D,MAAM,OAAO,OAAO;CACpB,IAAI,CAAC,SAAS,IAAI,GAAG,MAAM,aAAa,uCAAuC;CAC/E,MAAM,YAAY,aAAa,KAAK,YAAY;CAChD,IAAI,cAAc,KAAK,GAAG,MAAM,aAAa,mCAAmC;CAChF,MAAM,oBAAoB,YAAY,OAAO,oBAAoB;CACjE,IAAI,sBAAsB,KAAK,GAAG,MAAM,aAAa,4CAA4C;CACjG,MAAM,YAAY,OAAO;CACzB,IAAI,CAAC,WAAW,SAAS,GAAG,MAAM,aAAa,+CAA+C;CAC9F,OAAO;EACN,sBAAsB,EAAE,UAAU;EAClC;EACA,eAAe;CAChB;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-converge-DkTFs-ih-CAr2feEu.mjs","names":["fs","path"],"sources":["../../../0-framework/3-tooling/cli/dist/app-converge-DkTFs-ih.mjs"],"sourcesContent":["import \"./converge-contract-DrO0Jt9l.mjs\";\nimport { createRequire } from \"node:module\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { pathToFileURL } from \"node:url\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region package.json\nvar version = \"0.39.0-dev.12\";\n//#endregion\n//#region src/app-converge.ts\nconst ENTRY = \"@prisma/composer/internal/converge\";\nconst CONTRACT_ENTRY = \"@prisma/composer/internal/converge-contract\";\nconst ENTRY_FUNCTIONS = [\n\t\"lower\",\n\t\"convergeInProcess\",\n\t\"localTargetProviders\",\n\t\"devState\"\n];\n/** The Composer version this host runs; every Composer package carries the same one. */\nconst HOST_COMPOSER_VERSION = version;\nfunction unresolvable(appDir, detail, cause) {\n\treturn new CliStructuredError(\"DEPS.CONVERGE_UNRESOLVABLE\", `Could not load the converge from the app's @prisma/composer in \"${appDir}\": ${detail}`, {\n\t\twhy: \"`prisma deploy` and `prisma dev` run the lowering and Alchemy from the app's own install of @prisma/composer, so the app, its extensions and Alchemy share one copy of alchemy.\",\n\t\tfix: \"Install @prisma/composer in the app, at the same version as the Composer the `prisma` CLI runs.\",\n\t\t...cause === void 0 ? {} : { cause }\n\t});\n}\nfunction installedVersion(require) {\n\ttry {\n\t\tconst parsed = JSON.parse(fs.readFileSync(require.resolve(\"@prisma/composer/package.json\"), \"utf8\"));\n\t\treturn typeof parsed === \"object\" && parsed !== null && \"version\" in parsed && typeof parsed.version === \"string\" ? parsed.version : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\nasync function importFile(appDir, file) {\n\ttry {\n\t\treturn await import(pathToFileURL(file).href);\n\t} catch (error) {\n\t\tthrow unresolvable(appDir, `${file} failed to load: ${error instanceof Error ? error.message : String(error)}`, error);\n\t}\n}\nfunction contractMismatch(host, app) {\n\tconst appVersion = app.version ?? \"an unknown version\";\n\tconst update = app.contract < host.contract ? `Upgrade the app's @prisma/composer to a release that speaks converge contract ${host.contract}, such as ${host.version}.` : `Upgrade the \\`prisma\\` CLI to one that runs a Composer speaking converge contract ${app.contract}, such as ${appVersion}.`;\n\treturn new CliStructuredError(\"DEPS.CONVERGE_CONTRACT_MISMATCH\", `The app's @prisma/composer ${appVersion} speaks converge contract ${app.contract}, and the \\`prisma\\` CLI's Composer ${host.version} speaks contract ${host.contract}.`, {\n\t\twhy: \"Deploy and dev call the app's @prisma/composer from the CLI's Composer, and the two read each other's data only when they speak the same converge contract.\",\n\t\tfix: update\n\t});\n}\n/**\n* The app's `lower`, converge and local target functions, from the install `appDir` resolves. Reads the app's\n* converge contract before loading anything else. Raises\n* DEPS.CONVERGE_UNRESOLVABLE when the install is missing or predates the\n* in-process converge, and DEPS.CONVERGE_CONTRACT_MISMATCH when it speaks\n* another contract than `host`.\n*/\nasync function loadAppConvergeEntry(appDir, host = {\n\tcontract: 2,\n\tversion: HOST_COMPOSER_VERSION\n}) {\n\tconst require = createRequire(path.join(appDir, \"package.json\"));\n\tlet contractFile;\n\tlet file;\n\ttry {\n\t\tcontractFile = require.resolve(CONTRACT_ENTRY);\n\t\tfile = require.resolve(ENTRY);\n\t} catch (error) {\n\t\tthrow unresolvable(appDir, `${CONTRACT_ENTRY} or ${ENTRY} does not resolve.`, error);\n\t}\n\tconst { CONVERGE_CONTRACT: appContract } = await importFile(appDir, contractFile);\n\tif (typeof appContract !== \"number\") throw unresolvable(appDir, `${contractFile} exports no CONVERGE_CONTRACT.`);\n\tif (appContract !== host.contract) throw contractMismatch(host, {\n\t\tcontract: appContract,\n\t\tversion: installedVersion(require)\n\t});\n\tconst entry = await importFile(appDir, file);\n\tconst missing = ENTRY_FUNCTIONS.filter((name) => typeof entry[name] !== \"function\");\n\tif (missing.length > 0) throw unresolvable(appDir, `${file} exports no ${missing.join(\", \")}.`);\n\treturn blindCast({\n\t\tlower: entry[\"lower\"],\n\t\tconverge: entry[\"convergeInProcess\"],\n\t\tlocalTargetProviders: entry[\"localTargetProviders\"],\n\t\tdevState: entry[\"devState\"]\n\t});\n}\n//#endregion\nexport { loadAppConvergeEntry as t };\n\n//# sourceMappingURL=app-converge-DkT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AAM,UAAU,cAAcC,OAAK,KAAK,QAAQ,cAAc,CAAC;CAC/D,IAAI;CACJ,IAAI;CACJ,IAAI;EACH,eAAe,QAAQ,QAAQ,cAAc;EAC7C,OAAO,QAAQ,QAAQ,KAAK;CAC7B,SAAS,OAAO;EACf,MAAM,aAAa,QAAQ,GAAG,eAAe,MAAM,MAAM,qBAAqB,KAAK;CACpF;CACA,MAAM,EAAE,mBAAmB,gBAAgB,MAAM,WAAW,QAAQ,YAAY;CAChF,IAAI,OAAO,gBAAgB,UAAU,MAAM,aAAa,QAAQ,GAAG,aAAa,+BAA+B;CAC/G,IAAI,gBAAgB,KAAK,UAAU,MAAM,iBAAiB,MAAM;EAC/D,UAAU;EACV,SAAS,iBAAiB,OAAO;CAClC,CAAC;CACD,MAAM,QAAQ,MAAM,WAAW,QAAQ,IAAI;CAC3C,MAAM,UAAU,gBAAgB,QAAQ,SAAS,OAAO,MAAM,UAAU,UAAU;CAClF,IAAI,QAAQ,SAAS,GAAG,MAAM,aAAa,QAAQ,GAAG,KAAK,cAAc,QAAQ,KAAK,IAAI,EAAE,EAAE;CAC9F,OAAO,UAAU;EAChB,OAAO,MAAM;EACb,UAAU,MAAM;EAChB,sBAAsB,MAAM;EAC5B,UAAU,MAAM;CACjB,CAAC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-CSU0kr4j.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy.mjs"],"sourcesContent":["import { C as isPlainObject, T as originOf, a as ROOT_INPUT_UNREAD_ERROR, i as secretsKeys, m as isValueResource, r as nodeAddresses, t as Load, w as isValue, x as slotsOf } from \"./graph-D2WMLL43.mjs\";\nimport { i as readPreflightPayload, s as deserializeContainers } from \"./preflight-transport-2d6iIchu.mjs\";\nimport { POINTER } from \"@internal/foundation/pointer\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport * as Alchemy from \"alchemy\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Data from \"effect/Data\";\nimport * as Predicate from \"effect/Predicate\";\n//#region src/comparable-props.ts\n/**\n* Resource props as plain data that `structuredClone` copies unchanged, so two props compare by\n* content with `isDeepStrictEqual` even after one crossed a thread. Every object or array is\n* tagged by what it was, so no two different props give the same data:\n*\n* - a `Value` is described by what core knows of it: a source by its kind, pointer kind, label,\n* secrets key and payload; any other value only as derived, with the kind of its origin;\n* - a `Date`, `RegExp`, `Map` or `Set` keeps its content;\n* - an instance of another class keeps its class name and own enumerable fields;\n* - a function or symbol becomes its text;\n* - a reference back to an object that contains it becomes a cycle marker.\n*/\nfunction comparableProps(props) {\n\treturn asData(props, /* @__PURE__ */ new Set());\n}\nfunction asData(value, containing) {\n\tif (typeof value === \"function\") return { function: String(value) };\n\tif (typeof value === \"symbol\") return { symbol: String(value) };\n\tif (typeof value !== \"object\" || value === null) return value;\n\tif (containing.has(value)) return { cycle: true };\n\tcontaining.add(value);\n\ttry {\n\t\treturn objectAsData(value, (inner) => asData(inner, containing));\n\t} finally {\n\t\tcontaining.delete(value);\n\t}\n}\nfunction objectAsData(value, inner) {\n\tif (isValue(value)) {\n\t\tconst origin = originOf(value);\n\t\tif (origin.kind !== \"source\") return { value: { derived: origin.kind } };\n\t\treturn { value: {\n\t\t\tsourceKind: origin.sourceKind,\n\t\t\tpointer: Reflect.get(value, POINTER),\n\t\t\tlabel: origin.label,\n\t\t\tsecretsKey: origin.sourceKind === \"secret\" ? origin.secretsKey : void 0,\n\t\t\tpayload: inner(Reflect.get(value, \"payload\"))\n\t\t} };\n\t}\n\tif (Array.isArray(value)) return { array: value.map(inner) };\n\tif (value instanceof Date) return { date: value.getTime() };\n\tif (value instanceof RegExp) return { regexp: String(value) };\n\tif (value instanceof Map) return { map: [...value].map(([key, entry]) => [inner(key), inner(entry)]) };\n\tif (value instanceof Set) return { set: [...value].map(inner) };\n\tconst fields = Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, inner(entry)]));\n\tif (isPlainObject(value)) return { object: fields };\n\treturn {\n\t\tinstance: value.constructor?.name,\n\t\tfields\n\t};\n}\n//#endregion\n//#region src/control/deploy.ts\n/** Routes each graph node to its extension descriptor (by node.extension/type) and runs provision → serialize → package → deploy in dependency order. */\nvar LowerError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"LowerError\";\n\t}\n};\n/** The `name` of the error `lower()` fails with when it builds a graph whose node addresses differ from `firstProcessNodeAddresses`. */\nconst GRAPH_CHANGED_ERROR = \"GraphChangedError\";\nvar GraphChangedError = class extends LowerError {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = GRAPH_CHANGED_ERROR;\n\t}\n};\nfunction assertSameNodeAddresses(built, firstProcess) {\n\tconst onlyBuilt = built.filter((address) => !firstProcess.includes(address));\n\tconst onlyFirst = firstProcess.filter((address) => !built.includes(address));\n\tif (onlyBuilt.length === 0 && onlyFirst.length === 0) return;\n\tconst list = (addresses) => addresses.length === 0 ? \"none\" : addresses.map((address) => `\"${address}\"`).join(\", \");\n\tthrow new GraphChangedError(`lower() built a different graph from the one Composer checked first. Only in the graph lower() built: ${list(onlyBuilt)}. Only in the graph Composer checked: ${list(onlyFirst)}. A module body must build the same graph every time; one that reads the process environment, a file or the clock can build a different one.`);\n}\n/** A service's own param: its binding, else its `default`, else absent when optional. A `provision` need (ADR-0031) is filled per edge in `buildConfig`, never here. */\nfunction resolveParam(node, serviceId, name, param, bound) {\n\tif (bound !== void 0) {\n\t\tif (param.provision !== void 0) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") is bound at provision and also declares a framework provision need (\"${String(param.provision.brand)}\"). Remove the binding or the \\`provision\\` facet.`);\n\t\tconst result = param.schema[\"~standard\"].validate(bound);\n\t\tif (result instanceof Promise) throw new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") uses an async Standard Schema — a provision-time literal value requires a synchronous validator.`);\n\t\tif (result.issues !== void 0) {\n\t\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\t\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") received an invalid provision-time value: ${messages}`);\n\t\t}\n\t\treturn result.value;\n\t}\n\tif (param.default !== void 0) return param.default;\n\tif (param.optional === true) return void 0;\n\tthrow new LowerError(`Param \"${name}\" of \"${serviceId}\" (service \"${node.name}\") has no default, is not optional, and was not bound at provision — bind it on its provision() call with a literal value or a value the deploy has, or give it a default.`);\n}\n/**\n* Assembles a service's typed Config. Connection params come from the\n* dependency edge's lowered outputs — or, for a param carrying a `provision`\n* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints\n* it, the producer hands nothing over. The service's own params resolve via\n* `resolveParam` (provision-time binding, then default, then loud\n* unbound-required failure).\n*\n* This is also where the connection contract is enforced: a producer that fails to\n* supply a required param its consumer's connection declares fails the deploy\n* here, naming the edge, rather than reaching the consumer as `undefined`.\n*/\nfunction buildConfig(node, id, graph, lowered, provisioned) {\n\tconst inputs = slotConnectionParams(node, id, graph, lowered, provisioned);\n\tconst boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));\n\tconst service = {};\n\tfor (const [name, param] of Object.entries(node.params)) {\n\t\tconst value = resolveParam(node, id, name, param, boundParams.get(name));\n\t\tif (value !== void 0) service[name] = value;\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n}\n/**\n* The connection params of each of a service's or resource's dependency\n* slots, resolved against the producer's lowered outputs or the minted\n* `provisioned` value, with the connection contract enforced (see `buildConfig`).\n*/\nfunction connectionInputs(ctx) {\n\treturn slotConnectionParams(ctx.node, ctx.id, ctx.graph, ctx.lowered, ctx.provisioned);\n}\nfunction slotConnectionParams(node, id, graph, lowered, provisioned) {\n\tconst inputs = {};\n\tfor (const [inputName, inputNode] of Object.entries(node.inputs)) {\n\t\tconst edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === \"dependency\");\n\t\tconst producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};\n\t\tconst values = {};\n\t\tfor (const [name, param] of Object.entries(inputNode.connection.params)) {\n\t\t\tif (param.provision !== void 0) {\n\t\t\t\tvalues[name] = provisioned.get(`${id}.${inputName}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst value = producedOutputs[name];\n\t\t\tif (value === void 0 && param.optional !== true && edge !== void 0) throw new LowerError(`Connection input \"${id}.${inputName}\" declares param \"${name}\", but its producer \"${edge.from}\" did not supply it — the producer's outputs carry [${Object.keys(producedOutputs).join(\", \") || \"nothing\"}]. Add \"${name}\" to the outputs the producer returns from its lowering, or declare the param optional on the connection.`);\n\t\t\tvalues[name] = value;\n\t\t}\n\t\tinputs[inputName] = values;\n\t}\n\treturn inputs;\n}\n/**\n* Joins resolved report entries back to their graph nodes — the last step of a\n* deploy report, run inside the Action with apply's resolved values.\n*\n* The entries cross Alchemy's action-input boundary, so they carry addresses\n* and plain entities only; the graph is held by closure on this side. That\n* split is why this join exists at all, and it is what keeps functions and\n* Standard Schemas (which a node carries, and which the plan's input hash\n* would have to serialize) out of the input.\n*\n* Skips an address the graph no longer holds: entries are data, the graph is\n* truth.\n*/\nfunction joinDeployment(graph, entries) {\n\tconst nodes = [];\n\tfor (const entry of entries) {\n\t\tconst node = graph.nodes.find((n) => n.id === entry.address)?.node;\n\t\tif (node === void 0 || node.kind !== \"service\" && node.kind !== \"resource\") continue;\n\t\tnodes.push({\n\t\t\taddress: entry.address,\n\t\t\tnode,\n\t\t\tentities: entry.entities\n\t\t});\n\t}\n\treturn nodes;\n}\n/** The deploy report: every deployed node joined with its graph node, and the deploy preflight's findings. */\nfunction deploymentResult(app, graph, entries, findings) {\n\treturn {\n\t\tapp,\n\t\tnodes: joinDeployment(graph, entries),\n\t\tfindings\n\t};\n}\nfunction missingBundleError(id) {\n\treturn new LowerError(`No bundle provided for service \"${id}\" (opts.bundles[\"${id}\"] is required).`);\n}\n/** The message `prisma dev` structures as `DEV.DEV_SERVER_UNSUPPORTED` (ADR-0056). */\nfunction noReserveError(id, extension, type) {\n\treturn new LowerError(`service \"${id}\" runs a dev server but its descriptor (${extension}/${type}) has no \\`reserve\\` step`);\n}\nfunction unassembledWithBundleError(address) {\n\treturn new LowerError(`\"${address}\" is listed in opts.unassembled and also has a bundle in opts.bundles — a service is either assembled or not.`);\n}\nfunction unassembledNotServiceError(address) {\n\treturn new LowerError(`\"${address}\" is listed in opts.unassembled but is not a service in the graph.`);\n}\nfunction duplicateExtensionError(id) {\n\treturn new LowerError(`Extension \"${id}\" is listed more than once in \\`extensions\\` — each extension id must be unique.`);\n}\n/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */\nfunction extensionsById(config) {\n\tconst map = /* @__PURE__ */ new Map();\n\tfor (const extension of config.extensions) {\n\t\tif (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));\n\t\tmap.set(extension.id, extension);\n\t}\n\treturn Effect.succeed(map);\n}\nfunction unknownExtensionError(extension, id) {\n\treturn new LowerError(`No extension \"${extension}\" is configured (needed by node \"${id}\") — add it to \\`extensions\\` in the \\`composer\\` section of prisma.config.ts (import its /control entry and list its descriptor).`);\n}\nfunction unknownNodeTypeError(extension, type) {\n\treturn new LowerError(`Extension \"${extension.id}\" has no descriptor for node type \"${type}\" (known: ${Object.keys(extension.nodes).join(\", \")}).`);\n}\n/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */\nfunction unknownProvisionerError(extension, brand, edgeId) {\n\tconst known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(\", \") : \"(none registered)\";\n\treturn new LowerError(`Extension \"${extension.id}\" has no provisioner for need \"${String(brand)}\" (needed by edge \"${edgeId}\") (known: ${known}).`);\n}\n/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */\nfunction crossExtensionProvisionError(edgeId) {\n\treturn new LowerError(`Provisioned edge \"${edgeId}\" spans two extensions — cross-extension provisioned edges aren't supported yet.`);\n}\n/**\n* More than one provisioned param on one connection (ADR-0031). One edge mints\n* ONE value, keyed by edge id, so a second need on the same connection would\n* silently receive the first's value under the first's brand.\n*/\nfunction multipleProvisionedParamsError(edgeId, names) {\n\treturn new LowerError(`Connection input \"${edgeId}\" declares more than one provisioned param (${names.join(\", \")}) — only one provisioned param per connection is supported.`);\n}\nfunction wrongKindError(extension, type, expected, got) {\n\treturn new LowerError(`Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${got}\" descriptor — this node needs a \"${expected}\" descriptor.`);\n}\n/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */\nfunction descriptorFor(extensions, node, id) {\n\tconst extension = extensions.get(node.extension);\n\tif (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));\n\tconst descriptor = extension.nodes[node.type];\n\tif (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));\n\tif (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\treturn Effect.succeed(descriptor);\n}\n/**\n* The state-layer precedence a deploy resolves to: an explicit opts.state\n* always wins; failing that, the config's own (required) state descriptor,\n* created with its owning extension's resolved container (`undefined` when\n* that extension declared none). A pure function so the precedence is\n* testable without booting Alchemy.\n*/\nfunction resolveStateLayer(opts, config, containers) {\n\treturn opts.state ?? config.state.create(containers.get(config.state.extension), opts.credentials);\n}\n/**\n* All configured extensions' providers merged, config array order — an\n* extension without `providers` is skipped; no used-extensions-only\n* filtering (ADR-0017's pinned providers rule).\n*/\nfunction mergedProviders(config, credentials) {\n\tconst [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers({ credentials })] : []);\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/**\n* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.\n* Fails with LowerError or whatever an extension's lowering raises — the error type is open.\n*/\nfunction lowering(root, config, opts) {\n\treturn blindCast(Effect.gen(function* () {\n\t\tconst graph = Load(root, {\n\t\t\tid: opts.name,\n\t\t\t...opts.environment !== void 0 ? { environment: { name: opts.environment } } : {},\n\t\t\t...opts.appConfigurationRead !== void 0 ? { appConfigurationRead: opts.appConfigurationRead } : {}\n\t\t});\n\t\tif (opts.firstProcessNodeAddresses !== void 0) assertSameNodeAddresses(nodeAddresses(graph), opts.firstProcessNodeAddresses);\n\t\tconst extensions = yield* extensionsById(config);\n\t\tconst { containers, preflightPayloads, findings } = lowerInputs(config, opts);\n\t\tconst preflightOf = (extensionId) => preflightPayloads.get(extensionId);\n\t\tconst lowered = /* @__PURE__ */ new Map();\n\t\tconst entries = [];\n\t\tconst provisioned = /* @__PURE__ */ new Map();\n\t\tconst applications = /* @__PURE__ */ new Map();\n\t\tfor (const descriptor of config.extensions) {\n\t\t\tif (descriptor.application === void 0) continue;\n\t\t\tconst appCtx = {\n\t\t\t\tid: graph.root.id,\n\t\t\t\taddress: \"\",\n\t\t\t\tnode: graph.root.node,\n\t\t\t\tgraph,\n\t\t\t\topts,\n\t\t\t\tapplication: void 0,\n\t\t\t\tcontainer: containers.get(descriptor.id),\n\t\t\t\tpreflight: preflightOf(descriptor.id),\n\t\t\t\tlowered,\n\t\t\t\tprovisioned\n\t\t\t};\n\t\t\tapplications.set(descriptor.id, yield* descriptor.application.provision(appCtx));\n\t\t}\n\t\tfor (const edge of graph.edges) {\n\t\t\tif (edge.kind !== \"dependency\") continue;\n\t\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\t\tif (consumer === void 0 || consumer.kind !== \"service\" && consumer.kind !== \"resource\") continue;\n\t\t\tconst slot = slotsOf(consumer)[edge.input];\n\t\t\tif (slot === void 0) continue;\n\t\t\tconst provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);\n\t\t\tif (provisionedParams.length === 0) continue;\n\t\t\tconst edgeId = `${edge.to}.${edge.input}`;\n\t\t\tif (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));\n\t\t\tconst need = provisionedParams[0]?.[1].provision;\n\t\t\tif (need === void 0) continue;\n\t\t\tconst provider = graph.nodes.find((n) => n.id === edge.from)?.node;\n\t\t\tif (provider === void 0 || provider.kind !== \"service\" && provider.kind !== \"resource\") continue;\n\t\t\tif (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));\n\t\t\tconst extension = extensions.get(consumer.extension);\n\t\t\tif (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));\n\t\t\tconst provisioner = extension.provisions?.get(need.brand);\n\t\t\tif (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));\n\t\t\tconst ref = yield* provisioner.provision({\n\t\t\t\tapp: graph.root.id,\n\t\t\t\tedgeId,\n\t\t\t\tconsumerAddress: edge.to,\n\t\t\t\tproviderAddress: edge.from,\n\t\t\t\tinput: edge.input,\n\t\t\t\tneed\n\t\t\t});\n\t\t\tprovisioned.set(edgeId, ref);\n\t\t}\n\t\tconst unassembled = new Set(opts.unassembled ?? []);\n\t\tfor (const address of unassembled) {\n\t\t\tif (address in opts.bundles) return yield* Effect.fail(unassembledWithBundleError(address));\n\t\t\tconst found = graph.nodes.find((n) => n.id === address);\n\t\t\tif (found === void 0 || found.node.kind !== \"service\") return yield* Effect.fail(unassembledNotServiceError(address));\n\t\t}\n\t\tconst services = /* @__PURE__ */ new Map();\n\t\tconst ctxFor = (id, node) => ({\n\t\t\tid,\n\t\t\taddress: id,\n\t\t\tnode,\n\t\t\tgraph,\n\t\t\topts,\n\t\t\tapplication: applications.get(node.extension),\n\t\t\tcontainer: containers.get(node.extension),\n\t\t\tpreflight: preflightOf(node.extension),\n\t\t\tlowered,\n\t\t\tprovisioned,\n\t\t\tservices\n\t\t});\n\t\tfor (const { id, node } of graph.nodes) {\n\t\t\tif (node.kind !== \"service\") continue;\n\t\t\tconst descriptor = yield* descriptorFor(extensions, node, id);\n\t\t\tif (descriptor.kind !== \"service\") continue;\n\t\t\tservices.set(id, yield* descriptor.provision(ctxFor(id, node)));\n\t\t}\n\t\tfor (const { id, node } of graph.nodes) {\n\t\t\tif (node.kind === \"module\") continue;\n\t\t\tif (node.kind === \"dependency\") continue;\n\t\t\tconst ctx = ctxFor(id, node);\n\t\t\tconst descriptor = yield* descriptorFor(extensions, node, id);\n\t\t\tif (descriptor.kind === \"resource\") {\n\t\t\t\tconst result = yield* descriptor(ctx);\n\t\t\t\tlowered.set(id, result.outputs);\n\t\t\t\tif (!isValueResource(node)) entries.push({\n\t\t\t\t\taddress: id,\n\t\t\t\t\tentities: result.entities\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (descriptor.kind !== \"service\") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));\n\t\t\tconst service = node;\n\t\t\tconst provisionedNode = services.get(id);\n\t\t\tconst typedConfig = buildConfig(service, id, graph, lowered, provisioned);\n\t\t\tconst serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);\n\t\t\tif (unassembled.has(id)) {\n\t\t\t\tif (descriptor.reserve === void 0) return yield* Effect.fail(noReserveError(id, node.extension, node.type));\n\t\t\t\tconst result = yield* descriptor.reserve(ctx, provisionedNode, serialized);\n\t\t\t\tlowered.set(id, result.outputs);\n\t\t\t\tentries.push({\n\t\t\t\t\taddress: id,\n\t\t\t\t\tentities: result.entities\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst bundle = opts.bundles[id];\n\t\t\tif (bundle === void 0) return yield* Effect.fail(missingBundleError(id));\n\t\t\tconst artifact = yield* descriptor.package(ctx, {\n\t\t\t\tassembled: {\n\t\t\t\t\tdir: bundle.dir,\n\t\t\t\t\tentry: bundle.entry\n\t\t\t\t},\n\t\t\t\taddress: id\n\t\t\t}, serialized);\n\t\t\tconst result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);\n\t\t\tlowered.set(id, result.outputs);\n\t\t\tentries.push({\n\t\t\t\taddress: id,\n\t\t\t\tentities: result.entities\n\t\t\t});\n\t\t}\n\t\tif (opts.report !== void 0) {\n\t\t\tconst report = opts.report;\n\t\t\tyield* Alchemy.Action(\"composer-deployment-report\", (input) => Effect.sync(() => {\n\t\t\t\treport(deploymentResult(opts.name, graph, input.entries, findings));\n\t\t\t}))({\n\t\t\t\tnonce: Date.now(),\n\t\t\t\tentries\n\t\t\t});\n\t\t}\n\t}));\n}\n/** The containers and preflight payloads a host wrote into the environment of a stack file it runs as a child. */\nfunction transportedLowerInputs(config) {\n\tconst env = process.env;\n\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tfor (const { id } of config.extensions) {\n\t\tconst payload = readPreflightPayload(id, env);\n\t\tif (payload !== void 0) preflightPayloads.set(id, payload);\n\t}\n\treturn {\n\t\tcontainers: deserializeContainers(config.extensions, env),\n\t\tpreflightPayloads\n\t};\n}\nfunction lowerInputs(config, opts) {\n\tconst { containers, preflightPayloads } = opts;\n\tconst findings = opts.findings ?? { unset: [] };\n\tif (containers !== void 0 && preflightPayloads !== void 0) return {\n\t\tcontainers,\n\t\tpreflightPayloads,\n\t\tfindings\n\t};\n\tif (containers === void 0 && preflightPayloads === void 0) return {\n\t\t...transportedLowerInputs(config),\n\t\tfindings\n\t};\n\tconst missing = containers === void 0 ? \"containers\" : \"preflightPayloads\";\n\tthrow new Error(`lower() was passed ${missing === \"containers\" ? \"preflightPayloads\" : \"containers\"} without ${missing}. Pass both, or neither to read both from the environment.`);\n}\n/**\n* The whole-stack wrapper: Load → route each node through the config's\n* extension registries → an Alchemy Stack, which `deploy` hands to\n* `Alchemist.plan` and a generated stack file exports for the alchemy CLI.\n*/\nfunction lower(root, config, opts) {\n\tconst stackEffect = blindCast(Effect.orDie(lowering(root, config, opts)));\n\tconst providers = opts.providers ?? mergedProviders(config, opts.credentials);\n\treturn Alchemy.Stack(opts.name, {\n\t\tproviders,\n\t\tstate: resolveStateLayer(opts, config, lowerInputs(config, opts).containers)\n\t}, stackEffect);\n}\n//#endregion\n//#region src/control/provider-error.ts\nconst PROVIDER_FAILURE_TAG = \"ProviderFailure\";\n/** A provider operation failed with an error that carries no `_tag` of its own; `cause` is that error. */\nvar ProviderFailure = class extends Data.TaggedError(PROVIDER_FAILURE_TAG) {};\nfunction isProviderError(cause) {\n\treturn Predicate.hasProperty(cause, \"_tag\") && typeof cause._tag === \"string\";\n}\n/** What a provider operation threw, as the error Alchemy's lifecycle methods fail with: an error with a `_tag` as it is, anything else wrapped in a `ProviderFailure`. */\nfunction toProviderError(cause) {\n\tif (isProviderError(cause)) return cause;\n\treturn new ProviderFailure({\n\t\tmessage: cause instanceof Error ? cause.message : String(cause),\n\t\tcause\n\t});\n}\n/** The original error of a provider failure `toProviderError` wrapped, or `undefined` for any other error. */\nfunction wrappedProviderError(error) {\n\treturn Predicate.isTagged(error, PROVIDER_FAILURE_TAG) && \"cause\" in error ? error.cause : void 0;\n}\n//#endregion\nexport { GRAPH_CHANGED_ERROR, LowerError, ROOT_INPUT_UNREAD_ERROR, buildConfig, comparableProps, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };\n\n//# sourceMappingURL=deploy.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,OAAO,uBAAuB,IAAI,IAAI,CAAC;AAC/C;AACA,SAAS,OAAO,OAAO,YAAY;CAClC,IAAI,OAAO,UAAU,YAAY,OAAO,EAAE,UAAU,OAAO,KAAK,EAAE;CAClE,IAAI,OAAO,UAAU,UAAU,OAAO,EAAE,QAAQ,OAAO,KAAK,EAAE;CAC9D,IAAI,OAAO,UAAU,YAAY,UAAU,MAA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EACA;EACA;CACD;CACA,IAAI,eAAe,KAAK,KAAK,sBAAsB,KAAK,GAAG,OAAO;EACjE,GAAG,uBAAuB,MAAM;EAChC;CACD;CACA,MAAM,UAAU,eAAe,KAAK,IAAI,eAAe;CACvD,MAAM,IAAI,MAAM,sBAAsB,YAAY,eAAe,sBAAsB,aAAa,WAAW,QAAQ,2DAA2D;AACnL;;;;;;AAMA,SAAS,MAAM,MAAM,QAAQ,MAAM;CAClC,MAAM,cAAc,UAAU,OAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC;CACxE,MAAM,YAAY,KAAK,aAAa,gBAAgB,QAAQ,KAAK,WAAW;CAC5E,OAAO,QAAQ,MAAM,KAAK,MAAM;EAC/B;EACA,OAAO,kBAAkB,MAAM,QAAQ,YAAY,QAAQ,IAAI,CAAC,CAAC,UAAU;CAC5E,GAAG,WAAW;AACf;AAGA,MAAM,uBAAuB;;AAE7B,IAAI,kBAAkB,cAAc,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;AAC5E,SAAS,gBAAgB,OAAO;CAC/B,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,OAAO,MAAM,SAAS;AACtE;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,OAAO,IAAI,gBAAgB;EAC1B,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC9D;CACD,CAAC;AACF;;AAEA,SAAS,qBAAqB,OAAO;CACpC,OAAO,UAAU,SAAS,OAAO,oBAAoB,KAAK,WAAW,QAAQ,MAAM,QAAQ,KAAK;AACjG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { G as PreflightFindings, g as DeployedEntity } from "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
2
|
-
import "./config-Bpi8QVLB.mjs";
|
|
3
|
-
import "./deploy-DHgEJDpg.mjs";
|
|
4
|
-
//#region ../../0-framework/3-tooling/cli/dist/deployment-summary-6LgQDUuu.d.mts
|
|
5
|
-
//#region src/deployment-summary.d.ts
|
|
6
|
-
/** The serializable projection of DeploymentResult — what CAN cross the process
|
|
7
|
-
* boundary. Writer (report hook) and reader (deploy operation) share this shape. */
|
|
8
|
-
interface DeployedNodeSummary {
|
|
9
|
-
readonly address: string;
|
|
10
|
-
readonly entities: readonly DeployedEntity[];
|
|
11
|
-
}
|
|
12
|
-
interface DeploymentSummary {
|
|
13
|
-
readonly app: string;
|
|
14
|
-
readonly nodes: readonly DeployedNodeSummary[];
|
|
15
|
-
/** The platform variables with no value that the deploy preflight found. */
|
|
16
|
-
readonly findings: PreflightFindings;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Child half of the failure protocol, called by the generated stack file.
|
|
20
|
-
* Keeps a bounded tail of everything this process logs through `console`,
|
|
21
|
-
* passing every call through except Alchemy's CLI advice (see
|
|
22
|
-
* {@link withComposerAdvice}), and on a non-zero exit writes the
|
|
23
|
-
* redacted cause beside the result file. `console`, not the output streams:
|
|
24
|
-
* alchemy's logger and its error reporting both go through it, and under Bun
|
|
25
|
-
* `console` does not reach `process.stdout.write`.
|
|
26
|
-
*
|
|
27
|
-
* When stdout is not a terminal it carries the parent's data lines, so
|
|
28
|
-
* everything this process prints goes to stderr instead.
|
|
29
|
-
*/
|
|
30
|
-
declare function captureEngineFailure(): void;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { DeploymentSummary as n, captureEngineFailure as r, DeployedNodeSummary as t };
|
|
33
|
-
//# sourceMappingURL=deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-6LgQDUuu.d.mts"],"mappings":";;;;;;;UAKU;WACC;WACA,mBAAmB;;UAEpB;WACC;WACA,gBAAgB;;WAEhB,UAAU;;;;;;;;;;;;;;iBAcJ"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { i as redactCredentialLooking } from "./redaction-DY6eDC12-W-FzW7_r.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-CVJZn2v0.mjs
|
|
5
|
-
/**
|
|
6
|
-
* The deploy result as data, and what a stack file run as a child hands back
|
|
7
|
-
* to the CLI: the summary file the report hook writes, and the failure cause
|
|
8
|
-
* the child records when it exits non-zero. `DeploymentResult` holds live
|
|
9
|
-
* graph nodes (ADR-0033), so the summary keeps only what can be serialized.
|
|
10
|
-
* Both files are best-effort: a write failure never fails the child.
|
|
11
|
-
*/
|
|
12
|
-
/** Env var the deploy operation sets on the alchemy child: when present,
|
|
13
|
-
* the report hook also writes the JSON DeploymentSummary there. */
|
|
14
|
-
const DEPLOYMENT_RESULT_FILE_ENV = "PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE";
|
|
15
|
-
/** Pure projection: keeps app, each node's address/entities and the findings, drops the in-process `node`. */
|
|
16
|
-
function toDeploymentSummary(result) {
|
|
17
|
-
return {
|
|
18
|
-
app: result.app,
|
|
19
|
-
nodes: result.nodes.map((node) => ({
|
|
20
|
-
address: node.address,
|
|
21
|
-
entities: node.entities
|
|
22
|
-
})),
|
|
23
|
-
findings: result.findings
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Writer half, called by the report hook inside the alchemy child: when the
|
|
28
|
-
* env var names a file, write the summary there. Best-effort — a write
|
|
29
|
-
* failure must not fail a deploy that already converged, so it is swallowed.
|
|
30
|
-
*/
|
|
31
|
-
function writeDeploymentSummaryFile(result) {
|
|
32
|
-
const file = process.env[DEPLOYMENT_RESULT_FILE_ENV];
|
|
33
|
-
if (file === void 0 || file.length === 0) return;
|
|
34
|
-
try {
|
|
35
|
-
fs$1.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));
|
|
36
|
-
} catch {}
|
|
37
|
-
}
|
|
38
|
-
/** The child's failure cause rides beside the result file, so the one env var names both and the parent's cleanup removes both. */
|
|
39
|
-
function engineFailureFilePath(resultFilePath) {
|
|
40
|
-
return `${resultFilePath}.failure.txt`;
|
|
41
|
-
}
|
|
42
|
-
/** Fits the platform's 5000-character build `errorMessage` with room for the exit-status prefix. */
|
|
43
|
-
const ENGINE_FAILURE_CAUSE_LIMIT = 1e3;
|
|
44
|
-
/** Alchemy's advice to rerun its own CLI with `--adopt` or to import a resource with adoption, which a Composer user has no way to do. */
|
|
45
|
-
const ALCHEMY_ADOPT_ADVICE = [
|
|
46
|
-
[/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."],
|
|
47
|
-
[/Re-run with `--adopt` \(or wrap the effect in `adopt\(true\)`\) to replace it anyway\./g, "Remove that resource, then deploy again."],
|
|
48
|
-
[/\(re-deploy with --adopt to take ownership, then destroy\)/g, "(remove it by hand)"],
|
|
49
|
-
[/Import it with explicit adoption (?:instead of silently taking it over|or choose a different [\w ]+ name)\./g, "Something other than this app holds it. Remove that resource, then deploy again."],
|
|
50
|
-
[/; rerun with adoption enabled if it is the intended [\w ]+\./g, ". Remove that resource, then deploy again."]
|
|
51
|
-
];
|
|
52
|
-
/** Replaces Alchemy CLI advice in engine output with steps that work from Composer. */
|
|
53
|
-
function withComposerAdvice(text) {
|
|
54
|
-
return ALCHEMY_ADOPT_ADVICE.reduce((current, [advice, replacement]) => current.replace(advice, replacement), text);
|
|
55
|
-
}
|
|
56
|
-
const STDOUT_CONSOLE_METHODS = /* @__PURE__ */ new Set([
|
|
57
|
-
"log",
|
|
58
|
-
"info",
|
|
59
|
-
"debug"
|
|
60
|
-
]);
|
|
61
|
-
/**
|
|
62
|
-
* Child half of the failure protocol, called by the generated stack file.
|
|
63
|
-
* Keeps a bounded tail of everything this process logs through `console`,
|
|
64
|
-
* passing every call through except Alchemy's CLI advice (see
|
|
65
|
-
* {@link withComposerAdvice}), and on a non-zero exit writes the
|
|
66
|
-
* redacted cause beside the result file. `console`, not the output streams:
|
|
67
|
-
* alchemy's logger and its error reporting both go through it, and under Bun
|
|
68
|
-
* `console` does not reach `process.stdout.write`.
|
|
69
|
-
*
|
|
70
|
-
* When stdout is not a terminal it carries the parent's data lines, so
|
|
71
|
-
* everything this process prints goes to stderr instead.
|
|
72
|
-
*/
|
|
73
|
-
function captureEngineFailure() {
|
|
74
|
-
const resultFile = process.env[DEPLOYMENT_RESULT_FILE_ENV];
|
|
75
|
-
if (resultFile === void 0 || resultFile.length === 0) return;
|
|
76
|
-
const stdoutToStderr = process.stdout.isTTY !== true;
|
|
77
|
-
if (stdoutToStderr) process.stdout.write = process.stderr.write.bind(process.stderr);
|
|
78
|
-
let tail = "";
|
|
79
|
-
for (const method of [
|
|
80
|
-
"log",
|
|
81
|
-
"info",
|
|
82
|
-
"warn",
|
|
83
|
-
"error",
|
|
84
|
-
"debug"
|
|
85
|
-
]) {
|
|
86
|
-
const original = stdoutToStderr && STDOUT_CONSOLE_METHODS.has(method) ? console.error : console[method];
|
|
87
|
-
console[method] = (...args) => {
|
|
88
|
-
const text = format(...args);
|
|
89
|
-
const shown = withComposerAdvice(text);
|
|
90
|
-
tail = `${tail}${redactCredentialLooking(shown, process.env)}\n`.slice(-65536);
|
|
91
|
-
if (shown === text) original.apply(console, args);
|
|
92
|
-
else original.call(console, shown);
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
process.once("exit", (code) => {
|
|
96
|
-
if (code === 0) return;
|
|
97
|
-
const cause = engineFailureCause(tail, process.env);
|
|
98
|
-
if (cause === void 0) return;
|
|
99
|
-
try {
|
|
100
|
-
fs$1.writeFileSync(engineFailureFilePath(resultFile), cause);
|
|
101
|
-
} catch {}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/** 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. */
|
|
105
|
-
function readEngineFailureCause(resultFilePath, redact) {
|
|
106
|
-
let cause;
|
|
107
|
-
try {
|
|
108
|
-
cause = fs$1.readFileSync(engineFailureFilePath(resultFilePath), "utf8");
|
|
109
|
-
} catch {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
return cause.length > 0 ? redact(cause) : void 0;
|
|
113
|
-
}
|
|
114
|
-
/** Effect's pretty log prefix, e.g. `[10:29:16.556] INFO (#53): `. */
|
|
115
|
-
const LOG_PREFIX = /^\[[\d:.]+\] ([A-Z]+) \(#\d+\): ?/;
|
|
116
|
-
/** Alchemy's per-resource failure row, e.g. `[web] fail — UnknownError: …`. */
|
|
117
|
-
const RESOURCE_FAIL_ROW = /^\[[^\]]+\] fail\b/;
|
|
118
|
-
const STACK_FRAME = /^\s*at /;
|
|
119
|
-
/**
|
|
120
|
-
* The failure the output describes: every line from the first failure line
|
|
121
|
-
* (a failed resource row, an ERROR log, or an `error:` line) to the end, minus
|
|
122
|
-
* blank lines, stack frames and info logs; the last five lines when there is no
|
|
123
|
-
* failure line. Redacted, then capped.
|
|
124
|
-
*/
|
|
125
|
-
function engineFailureCause(output, env) {
|
|
126
|
-
const lines = [];
|
|
127
|
-
for (const raw of stripVTControlCharacters(output).split(/\r\n|\r|\n/)) {
|
|
128
|
-
const clean = raw.replace(/(?![\t])\p{Cc}/gu, "").trimEnd();
|
|
129
|
-
const prefix = LOG_PREFIX.exec(clean);
|
|
130
|
-
const text = (prefix === null ? clean : clean.slice(prefix[0].length)).trim();
|
|
131
|
-
if (text.length === 0 || text === "{" || text === "}" || STACK_FRAME.test(text)) continue;
|
|
132
|
-
const level = prefix?.[1];
|
|
133
|
-
const failure = level === "ERROR" || level === "FATAL" || RESOURCE_FAIL_ROW.test(text) || /^\W*error:/i.test(text);
|
|
134
|
-
lines.push({
|
|
135
|
-
text,
|
|
136
|
-
failure,
|
|
137
|
-
info: !failure && level !== void 0
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const start = lines.findIndex((line) => line.failure);
|
|
141
|
-
const kept = start === -1 ? lines.slice(-5) : lines.slice(start).filter((line) => !line.info);
|
|
142
|
-
if (kept.length === 0) return void 0;
|
|
143
|
-
const cause = redactCredentialLooking(kept.map((line) => line.text).join("\n"), env);
|
|
144
|
-
return cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;
|
|
145
|
-
}
|
|
146
|
-
/** A failure cause capped to fit the platform build's error message. */
|
|
147
|
-
function capFailureCause(cause) {
|
|
148
|
-
return cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;
|
|
149
|
-
}
|
|
150
|
-
//#endregion
|
|
151
|
-
export { readEngineFailureCause as a, writeDeploymentSummaryFile as c, engineFailureFilePath as i, capFailureCause as n, toDeploymentSummary as o, captureEngineFailure as r, withComposerAdvice as s, DEPLOYMENT_RESULT_FILE_ENV as t };
|
|
152
|
-
|
|
153
|
-
//# sourceMappingURL=deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployment-summary-CVJZn2v0-Dz-gX1rp.mjs","names":["fs"],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-CVJZn2v0.mjs"],"sourcesContent":["import { i as redactCredentialLooking } from \"./redaction-DY6eDC12.mjs\";\nimport * as fs from \"node:fs\";\nimport { format, stripVTControlCharacters } from \"node:util\";\n//#region src/deployment-summary.ts\n/**\n* The deploy result as data, and what a stack file run as a child hands back\n* to the CLI: the summary file the report hook writes, and the failure cause\n* the child records when it exits non-zero. `DeploymentResult` holds live\n* graph nodes (ADR-0033), so the summary keeps only what can be serialized.\n* Both files are best-effort: a write failure never fails the child.\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 and the findings, 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\tfindings: result.findings\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}\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` or to import a resource with adoption, which a Composer user has no way to do. */\nconst ALCHEMY_ADOPT_ADVICE = [\n\t[/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.\"],\n\t[/Re-run with `--adopt` \\(or wrap the effect in `adopt\\(true\\)`\\) to replace it anyway\\./g, \"Remove that resource, then deploy again.\"],\n\t[/\\(re-deploy with --adopt to take ownership, then destroy\\)/g, \"(remove it by hand)\"],\n\t[/Import it with explicit adoption (?:instead of silently taking it over|or choose a different [\\w ]+ name)\\./g, \"Something other than this app holds it. Remove that resource, then deploy again.\"],\n\t[/; rerun with adoption enabled if it is the intended [\\w ]+\\./g, \". Remove that resource, then deploy again.\"]\n];\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/** A failure cause capped to fit the platform build's error message. */\nfunction capFailureCause(cause) {\n\treturn cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;\n}\n//#endregion\nexport { readEngineFailureCause as a, writeDeploymentSummaryFile as c, engineFailureFilePath as i, capFailureCause as n, toDeploymentSummary as o, captureEngineFailure as r, withComposerAdvice as s, DEPLOYMENT_RESULT_FILE_ENV as t };\n\n//# sourceMappingURL=deployment-summary-CVJZn2v0.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,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;EACF,UAAU,OAAO;CAClB;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;;AAEA,SAAS,sBAAsB,gBAAgB;CAC9C,OAAO,GAAG,eAAe;AAC1B;;AAEA,MAAM,6BAA6B;;AAEnC,MAAM,uBAAuB;CAC5B,CAAC,sFAAsF,kFAAkF;CACzK,CAAC,2FAA2F,0CAA0C;CACtI,CAAC,+DAA+D,qBAAqB;CACrF,CAAC,gHAAgH,kFAAkF;CACnM,CAAC,iEAAiE,4CAA4C;AAC/G;;AAEA,SAAS,mBAAmB,MAAM;CACjC,OAAO,qBAAqB,QAAQ,SAAS,CAAC,QAAQ,iBAAiB,QAAQ,QAAQ,QAAQ,WAAW,GAAG,IAAI;AAClH;AACA,MAAM,yCAAyC,IA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,CAAC;CACf,KAAK,MAAM,OAAO,yBAAyB,MAAM,CAAC,CAAC,MAAM,YAAY,GAAG;EACvE,MAAM,QAAQ,IAAI,QAAQ,oBAAoB,EAAE,CAAC,CAAC,QAAQ;EAC1D,MAAM,SAAS,WAAW,KAAK,KAAK;EACpC,MAAM,QAAQ,WAAW,OAAO,QAAQ,MAAM,MAAM,OAAO,EAAE,CAAC,MAAM,EAAA,CAAG,KAAK;EAC5E,IAAI,KAAK,WAAW,KAAK,SAAS,OAAO,SAAS,OAAO,YAAY,KAAK,IAAI,GAAG;EACjF,MAAM,QAAQ,SAAS;EACvB,MAAM,UAAU,UAAU,WAAW,UAAU,WAAW,kBAAkB,KAAK,IAAI,KAAK,cAAc,KAAK,IAAI;EACjH,MAAM,KAAK;GACV;GACA;GACA,MAAM,CAAC,WAAW,UAAU,KAAK;EAClC,CAAC;CACF;CACA,MAAM,QAAQ,MAAM,WAAW,SAAS,KAAK,OAAO;CACpD,MAAM,OAAO,UAAU,KAAK,MAAM,MAAM,EAAE,IAAI,MAAM,MAAM,KAAK,CAAC,CAAC,QAAQ,SAAS,CAAC,KAAK,IAAI;CAC5F,IAAI,KAAK,WAAW,GAAG,OAAO,KAAK;CACnC,MAAM,QAAQ,wBAAwB,KAAK,KAAK,SAAS,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,GAAG,GAAG;CACnF,OAAO,MAAM,UAAU,6BAA6B,QAAQ,GAAG,MAAM,MAAM,GAAG,6BAA6B,CAAC,EAAE;AAC/G;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,MAAM,UAAU,6BAA6B,QAAQ,GAAG,MAAM,MAAM,GAAG,6BAA6B,CAAC,EAAE;AAC/G"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-converge-messages-DML4rTz7-C_EAB5M_.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-converge-messages-DML4rTz7.mjs"],"sourcesContent":["import { n as failureReasonOf } from \"./converge-in-process-x89zb2MF.mjs\";\nimport { Load } from \"@internal/core\";\nimport { comparableProps } from \"@internal/core/deploy\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport { resolveLocalTargets } from \"@internal/core/local-target\";\n//#region src/dev/value-reads-change.ts\nconst readKey = (read) => JSON.stringify([\n\tread.reader,\n\tread.resource,\n\tread.path\n]);\nfunction readsByResource(snapshot) {\n\tconst byResource = /* @__PURE__ */ new Map();\n\tfor (const read of snapshot.reads) {\n\t\tconst keys = byResource.get(read.resource) ?? /* @__PURE__ */ new Set();\n\t\tkeys.add(readKey(read));\n\t\tbyResource.set(read.resource, keys);\n\t}\n\treturn byResource;\n}\nfunction propsAt(graph, address) {\n\tconst found = graph.nodes.find((entry) => entry.id === address)?.node;\n\treturn found?.kind === \"resource\" ? found.props : void 0;\n}\nfunction valueReadsSnapshot(graph) {\n\treturn {\n\t\treads: graph.valueReads.map(({ reader, resource, path }) => ({\n\t\t\treader,\n\t\t\tresource,\n\t\t\tpath\n\t\t})),\n\t\tprops: Object.fromEntries(graph.valueReads.map(({ resource }) => [resource, comparableProps(propsAt(graph, resource))]))\n\t};\n}\nconst hasMemberNotIn = (keys, other) => [...keys].some((key) => !other.has(key));\nfunction valueReadsChange(started, rebuilt) {\n\tconst before = readsByResource(started);\n\tconst after = readsByResource(rebuilt);\n\tconst added = [];\n\tconst removed = [];\n\tconst changed = [];\n\tfor (const address of /* @__PURE__ */ new Set([...before.keys(), ...after.keys()])) {\n\t\tconst was = before.get(address) ?? /* @__PURE__ */ new Set();\n\t\tconst is = after.get(address) ?? /* @__PURE__ */ new Set();\n\t\tconst gained = hasMemberNotIn(is, was);\n\t\tconst lost = hasMemberNotIn(was, is);\n\t\tif (was.size > 0 && is.size > 0 && !isDeepStrictEqual(started.props[address], rebuilt.props[address]) || gained && lost) changed.push(address);\n\t\telse if (gained) added.push(address);\n\t\telse if (lost) removed.push(address);\n\t}\n\tif (added.length + removed.length + changed.length === 0) return void 0;\n\treturn {\n\t\tadded,\n\t\tremoved,\n\t\tchanged\n\t};\n}\n//#endregion\n//#region src/operations/dev-converge.ts\n/**\n* One `prisma dev` converge as plain data, and the steps that run it: Load,\n* `lower()` against the local target, then Alchemy's plan and apply. The\n* default runs it in a new worker thread (`dev-converge-in-worker.ts`), so each\n* converge imports the app's definition files as they are on disk.\n*/\nfunction cloneable(envelope) {\n\ttry {\n\t\treturn structuredClone(envelope);\n\t} catch {\n\t\tconst { meta: _meta, ...rest } = envelope;\n\t\treturn rest;\n\t}\n}\n/** `error` as a result: a structured error as its envelope, any other as a failed outcome. */\nfunction thrownResult(error, appFiles = []) {\n\treturn CliStructuredError.is(error) ? {\n\t\tkind: \"error\",\n\t\terror: cloneable(error.toEnvelope()),\n\t\tappFiles\n\t} : {\n\t\tkind: \"outcome\",\n\t\toutcome: {\n\t\t\tkind: \"failed\",\n\t\t\treasons: [failureReasonOf(error)]\n\t\t},\n\t\tappFiles\n\t};\n}\nfunction containersOf(job, resolved) {\n\tconst containers = /* @__PURE__ */ new Map();\n\tfor (const [id, text] of Object.entries(job.containers)) {\n\t\tconst descriptor = resolved.get(id);\n\t\tif (descriptor !== void 0) containers.set(id, descriptor.container.deserialize(text));\n\t}\n\treturn containers;\n}\n/**\n* Lowers `app` against the local target and plans and applies it, as `job` describes. First it\n* Loads the app as `lower()` will, and refuses to converge when its value reads differ from the\n* ones the session started with.\n*/\nasync function convergeDevJob(job, app, report, signal) {\n\ttry {\n\t\tconst graph = Load(app.root, {\n\t\t\tid: job.name,\n\t\t\tenvironment: { name: job.environment },\n\t\t\tappConfigurationRead: job.appConfigurationRead\n\t\t});\n\t\tconst change = valueReadsChange(job.valueReads, valueReadsSnapshot(graph));\n\t\tif (change !== void 0) return {\n\t\t\tkind: \"value-reads-changed\",\n\t\t\tchange,\n\t\t\tappFiles: app.appFiles\n\t\t};\n\t\tconst resolved = await resolveLocalTargets(app.config);\n\t\tconst containers = containersOf(job, resolved);\n\t\tconst stack = app.entry.lower(app.root, app.config, {\n\t\t\tname: job.name,\n\t\t\tenvironment: job.environment,\n\t\t\tappConfigurationRead: job.appConfigurationRead,\n\t\t\tfirstProcessNodeAddresses: job.nodeAddresses,\n\t\t\tbundles: { ...job.bundles },\n\t\t\tunassembled: job.unassembled,\n\t\t\tcontainers,\n\t\t\tpreflightPayloads: new Map(Object.entries(job.preflightPayloads)),\n\t\t\tproviders: app.entry.localTargetProviders(resolved, containers, job.devDir, job.plainVariableText, job.namedSecrets),\n\t\t\tstate: app.entry.devState()\n\t\t});\n\t\treturn {\n\t\t\tkind: \"outcome\",\n\t\t\toutcome: await app.entry.converge({\n\t\t\t\toperation: \"deploy\",\n\t\t\t\tstack,\n\t\t\t\tstage: job.environment,\n\t\t\t\tcwd: job.cwd,\n\t\t\t\tenv: {},\n\t\t\t\tsignal,\n\t\t\t\tonEvent: report.onEvent,\n\t\t\t\toutput: report.output\n\t\t\t}),\n\t\t\tappFiles: app.appFiles\n\t\t};\n\t} catch (error) {\n\t\treturn thrownResult(error, app.appFiles);\n\t}\n}\n//#endregion\n//#region src/operations/dev-converge-messages.ts\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction isAbortMessage(value) {\n\treturn isRecord(value) && value[\"kind\"] === \"abort\";\n}\nfunction isWorkerMessage(value) {\n\tif (!isRecord(value)) return false;\n\tswitch (value[\"kind\"]) {\n\t\tcase \"event\": return isRecord(value[\"event\"]);\n\t\tcase \"output\": return typeof value[\"text\"] === \"string\";\n\t\tcase \"result\": return isRecord(value[\"result\"]) && typeof value[\"result\"][\"kind\"] === \"string\";\n\t\tdefault: return false;\n\t}\n}\n//#endregion\nexport { valueReadsSnapshot as a, thrownResult as i, isWorkerMessage as n, convergeDevJob as r, isAbortMessage as t };\n\n//# sourceMappingURL=dev-converge-messages-DML4rTz7.mjs.map"],"mappings":";;;;;;;;AAOA,MAAM,WAAW,SAAS,KAAK,UAAU;CACxC,KAAK;CACL,KAAK;CACL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ACjB;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-current-C7rT6Yxw-yJ1ORrSC.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/result.mjs","../../../0-framework/3-tooling/cli/dist/dev-current-C7rT6Yxw.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 { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { notOk, ok } from \"@internal/foundation/result\";\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}\nconst RUN_OF = {\n\tdeploy: {\n\t\trunning: \"this deploy\",\n\t\truns: \"the deploy\"\n\t},\n\tdestroy: {\n\t\trunning: \"this destroy\",\n\t\truns: \"the destroy\"\n\t},\n\tdev: {\n\t\trunning: \"`prisma dev`\",\n\t\truns: \"`prisma dev`\"\n\t}\n};\n/**\n* An extension older than this Composer stores the input it is given but\n* resolves from a key without `environment`, so it may read every name as\n* production, or, locally, put every environment in one copy. Its\n* `deserialize` rebuilds only the fields it knows, so the container the\n* Alchemy child rebuilds shows which environment it really resolved.\n* Refusing here keeps a mismatched install from deploying into, destroying\n* or running the wrong place.\n*/\nfunction requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {\n\tlet rebuiltEnvironment;\n\ttry {\n\t\trebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;\n\t} catch {\n\t\trebuiltEnvironment = void 0;\n\t}\n\tif (rebuiltEnvironment === environment) return;\n\tconst { running, runs } = RUN_OF[action];\n\tthrow new CliStructuredError(\"DEPS.EXTENSION_INCOMPATIBLE\", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });\n}\n/** A failed converge's reasons as text, one per line, without a tag the message already starts with. */\nfunction convergeReasonsText(reasons) {\n\treturn reasons.map(({ tag, message }) => tag === \"Error\" || tag === \"Unknown\" || message.startsWith(tag) ? message : `${tag}: ${message}`).join(\"\\n\");\n}\n//#endregion\n//#region src/operations/deploy.ts\n/** The environment `deploy` targets when none is named. */\nconst DEFAULT_DEPLOY_ENVIRONMENT = \"production\";\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 startedAt = performance.now();\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-C-aK5jh-.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"deploy\", error));\n\t}\n\tconst result = await executor.executeDeploy(input, deps, cwd);\n\tif (!result.ok) return result;\n\treturn ok({\n\t\t...result.value,\n\t\tdurationMs: Math.round(performance.now() - startedAt)\n\t});\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-BtSLDMkv.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"dev\", error));\n\t}\n\treturn executor.executeDev(input, deps, cwd);\n}\n//#endregion\n//#region src/operations/dev-current.ts\nasync function loadExecutor(operation) {\n\ttry {\n\t\treturn ok(await import(\"./execute-dev-current-LEdiAZSw.mjs\"));\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(operation, error));\n\t}\n}\n/** Where the node at `input.address` runs locally in the environment. */\nasync function devUrl(input) {\n\tconst executor = await loadExecutor(\"dev url\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevUrl(input, input.cwd ?? process.cwd());\n}\n/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */\nasync function devStop(input) {\n\tconst executor = await loadExecutor(\"dev stop\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevStop(input, input.cwd ?? process.cwd());\n}\n//#endregion\nexport { DEFAULT_DEPLOY_ENVIRONMENT as a, convergeReasonsText as c, requireContainerForEnvironment as d, toStructured as f, devWithDeps as i, executionDiagnostics as l, devUrl as n, deploy as o, dev as r, deployWithDeps as s, devStop as t, executorLoadFailure as u };\n\n//# sourceMappingURL=dev-current-C7rT6Yxw.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,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACxE,OAAO,KAAK;CACb;;;;;CAKA,cAAc;EACb,IAAI,KAAK,IAAI,MAAM,IAAI,cAAc,kCAAkC;EACvE,OAAO,KAAK;CACb;AACD;;;;AAIA,SAAS,GAAG,OAAO;CAClB,OAAO,WAAW,GAAG,KAAK;AAC3B;;;;AAIA,SAAS,MAAM,SAAS;CACvB,OAAO,WAAW,MAAM,OAAO;AAChC;;;;;AAKA,MAAM,UAAU,WAAW,GAAG,KAAK,CAAC;;;;;AAKpC,SAAS,SAAS;CACjB,OAAO;AACR;;;;;;;AC/EA,SAAS,qBAAqB,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