@prisma/composer 0.39.0-dev.6 → 0.39.0-dev.8
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-Ubi4CftJ-DUSDjI2i.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +17 -15
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
- package/dist/{app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +10 -40
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
- package/dist/app-converge-CVlo9uw2-B-fdr0nr.mjs +88 -0
- package/dist/app-converge-CVlo9uw2-B-fdr0nr.mjs.map +1 -0
- package/dist/arktype.d.mts +7 -5
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +7 -5
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-Bpi8QVLB.d.mts +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/control.d.mts +8 -23
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/{converge-in-process-BBBeood8-C7VG5b35.d.mts → converge-in-process-CTomEXaD-BnDylZP8.d.mts} +5 -5
- package/dist/{converge-in-process-BBBeood8-C7VG5b35.d.mts.map → converge-in-process-CTomEXaD-BnDylZP8.d.mts.map} +1 -1
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
- package/dist/{deploy-NArSOken.mjs → deploy-CSU0kr4j.mjs} +65 -5
- package/dist/{deploy-NArSOken.mjs.map → deploy-CSU0kr4j.mjs.map} +1 -1
- package/dist/deploy-DHgEJDpg.d.mts +32 -0
- package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +4 -4
- package/dist/{deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts.map → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map} +1 -1
- package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +3 -3
- package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map} +1 -1
- package/dist/{describe-kind-Cpm_euxo-D9WDxl5C.mjs → describe-kind-Cpm_euxo-DsSPENQa.mjs} +3 -3
- package/dist/describe-kind-Cpm_euxo-DsSPENQa.mjs.map +1 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
- package/dist/dev-converge-worker.d.mts +1 -0
- package/dist/dev-converge-worker.mjs +142 -0
- package/dist/dev-converge-worker.mjs.map +1 -0
- package/dist/{dev-current-BT66YKUB-CFI8HmP7.mjs → dev-current-ByY2RrbK-DbU6y3PF.mjs} +11 -7
- package/dist/dev-current-ByY2RrbK-DbU6y3PF.mjs.map +1 -0
- package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
- package/dist/{dist-BxtsHOfP.mjs → dist-Cf_mZHaH.mjs} +2 -2
- package/dist/{dist-BxtsHOfP.mjs.map → dist-Cf_mZHaH.mjs.map} +1 -1
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
- package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
- package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-C67FX_2B-DIKGa3gS.mjs → execute-deploy-destroy-D1jnaYqU-RAlTx-NX.mjs} +246 -193
- package/dist/execute-deploy-destroy-D1jnaYqU-RAlTx-NX.mjs.map +1 -0
- package/dist/{execute-dev-CVjdm1y1-DyFJDp6x.mjs → execute-dev-BP0Shlpd-BNFvs2LF.mjs} +434 -261
- package/dist/execute-dev-BP0Shlpd-BNFvs2LF.mjs.map +1 -0
- package/dist/{execute-dev-current-D5ANAZnU-CJQEjEnc.mjs → execute-dev-current-B792f_1m-BYJ-Rl8m.mjs} +7 -7
- package/dist/{execute-dev-current-D5ANAZnU-CJQEjEnc.mjs.map → execute-dev-current-B792f_1m-BYJ-Rl8m.mjs.map} +1 -1
- package/dist/{execute-log-BpiGoJwe-DYQw_hSp.mjs → execute-log-BiRHQq6Q-BkQk0Kvo.mjs} +8 -8
- package/dist/{execute-log-BpiGoJwe-DYQw_hSp.mjs.map → execute-log-BiRHQq6Q-BkQk0Kvo.mjs.map} +1 -1
- package/dist/{graph-DU0omY5O-BHO71z0F.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
- package/dist/{graph-C6Fqe2gn-DMa2udEA.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +19 -10
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
- package/dist/{graph-types-Bzj1fahC-C8rOVj0c.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +15 -13
- package/dist/{graph-types-Bzj1fahC-C8rOVj0c.d.mts.map → graph-types-D4PrtP-l-B0uuchTl.d.mts.map} +1 -1
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-B8s0bLZY.d.mts → index-D8chHe55.d.mts} +3 -3
- package/dist/{index-B8s0bLZY.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/internal-app-configuration-file.d.mts +5 -9
- package/dist/internal-app-configuration-file.d.mts.map +1 -1
- package/dist/internal-app-configuration-file.mjs +2 -2
- package/dist/internal-converge-contract.d.mts +6 -4
- package/dist/internal-converge-contract.d.mts.map +1 -1
- package/dist/internal-converge-contract.mjs +7 -5
- package/dist/internal-converge-contract.mjs.map +1 -1
- package/dist/internal-converge.d.mts +5 -4
- package/dist/internal-converge.mjs +4 -228
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
- package/dist/local-target-7KRsLMDO.d.mts +31 -0
- package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
- package/dist/{local-target-COdS1iNs.mjs → local-target-DhU1vaxd.mjs} +6 -6
- package/dist/{local-target-COdS1iNs.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
- package/dist/local-target.d.mts +3 -31
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-Z_xX74Cp.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-Z_xX74Cp.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.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/{pointer-DclJZFQi-DJa4t8Wa.d.mts → pointer-BX2KJ720-BxcfpaHP.d.mts} +7 -5
- package/dist/{pointer-DclJZFQi-DJa4t8Wa.d.mts.map → pointer-BX2KJ720-BxcfpaHP.d.mts.map} +1 -1
- package/dist/{preflight-transport-C7_3abXW-Bza_hn9G.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +5 -4
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
- package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +16 -4
- package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs.map → redaction-DY6eDC12-W-FzW7_r.mjs.map} +1 -1
- package/dist/{redaction-CIaE4m9U-DJGrkcn3.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +58 -17
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +2 -2
- package/dist/report.mjs.map +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
- package/dist/zod.d.mts +6 -5
- package/dist/zod.d.mts.map +1 -1
- package/dist/zod.mjs +6 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +11 -11
- package/skills/prisma-composer-core-concepts/SKILL.md +13 -10
- package/src/exports/dev-converge-worker.ts +2 -0
- package/dist/app-config-Ubi4CftJ-DUSDjI2i.d.mts.map +0 -1
- package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +0 -1
- package/dist/config-BmRE_eTa.d.mts +0 -1
- package/dist/deploy-BW_F4Y9W.d.mts +0 -12
- package/dist/deploy-BW_F4Y9W.d.mts.map +0 -1
- package/dist/describe-kind-Cpm_euxo-D9WDxl5C.mjs.map +0 -1
- package/dist/dev-current-BT66YKUB-CFI8HmP7.mjs.map +0 -1
- package/dist/execute-deploy-destroy-C67FX_2B-DIKGa3gS.mjs.map +0 -1
- package/dist/execute-dev-CVjdm1y1-DyFJDp6x.mjs.map +0 -1
- package/dist/graph-C6Fqe2gn-DMa2udEA.mjs.map +0 -1
- package/dist/graph-DU0omY5O-BHO71z0F.d.mts.map +0 -1
- package/dist/internal-converge.mjs.map +0 -1
- package/dist/local-target.d.mts.map +0 -1
- package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +0 -1
- package/dist/redaction-CIaE4m9U-DJGrkcn3.d.mts.map +0 -1
- package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs +0 -236
- package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map +0 -1
- package/dist/validate-environment-XwVDifWN-BhPOzWN8.mjs +0 -739
- package/dist/validate-environment-XwVDifWN-BhPOzWN8.mjs.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
+
import { t as CliStructuredError } from "./errors-DI3TBXE-.mjs";
|
|
3
|
+
import { m as wrappedProviderError } from "./deploy-CSU0kr4j.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { isMainThread } from "node:worker_threads";
|
|
6
|
+
import * as Alchemist from "alchemy/Alchemist";
|
|
7
|
+
import * as Interaction from "alchemy/Interaction";
|
|
8
|
+
import { recordOf } from "alchemy/Util/LogRecord";
|
|
9
|
+
import * as Cause from "effect/Cause";
|
|
10
|
+
import * as Exit from "effect/Exit";
|
|
11
|
+
import * as Logger from "effect/Logger";
|
|
12
|
+
//#region ../../0-framework/3-tooling/cli/dist/converge-in-process-x89zb2MF.mjs
|
|
13
|
+
/**
|
|
14
|
+
* The process state a converge holds while it runs: the per-thread
|
|
15
|
+
* one-converge flag, the variables Alchemy reads from `process.env`, and the working
|
|
16
|
+
* directory. Shared by the converge on the main thread and by `prisma dev`,
|
|
17
|
+
* which holds it on the main thread for the life of its converge worker.
|
|
18
|
+
*/
|
|
19
|
+
/** One flag per thread, shared by every copy of this module, so two apps' installs in one host cannot converge at once. */
|
|
20
|
+
const RUNNING = Symbol.for("prisma.composer.converge.running");
|
|
21
|
+
const flag = blindCast(globalThis);
|
|
22
|
+
/** True while this thread runs a converge. */
|
|
23
|
+
function convergeRunning() {
|
|
24
|
+
return flag[RUNNING] === true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets the process state Alchemy reads for the length of `run`, and restores
|
|
28
|
+
* it on every exit path: the variables in `env`, then the working directory.
|
|
29
|
+
* A directory that cannot be restored never leaves a variable behind and
|
|
30
|
+
* never changes what `run` returned.
|
|
31
|
+
*/
|
|
32
|
+
async function withProcessState(env, cwd, run) {
|
|
33
|
+
const previousEnv = Object.keys(env).map((name) => [name, process.env[name]]);
|
|
34
|
+
const previousCwd = process.cwd();
|
|
35
|
+
let changedDirectory = false;
|
|
36
|
+
try {
|
|
37
|
+
for (const [name, value] of Object.entries(env)) if (value === void 0) delete process.env[name];
|
|
38
|
+
else process.env[name] = value;
|
|
39
|
+
if (previousCwd !== cwd) {
|
|
40
|
+
process.chdir(cwd);
|
|
41
|
+
changedDirectory = true;
|
|
42
|
+
}
|
|
43
|
+
return await run();
|
|
44
|
+
} finally {
|
|
45
|
+
for (const [name, value] of previousEnv) if (value === void 0) delete process.env[name];
|
|
46
|
+
else process.env[name] = value;
|
|
47
|
+
if (changedDirectory) try {
|
|
48
|
+
process.chdir(previousCwd);
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Runs `run` holding three things for its length: this thread's converge flag
|
|
54
|
+
* (on `globalThis`, so it guards this thread only), the process environment
|
|
55
|
+
* variables in `env`, and the process's working directory, changed to `cwd`.
|
|
56
|
+
* All three are restored on every exit path. `held: false` means another
|
|
57
|
+
* converge on this thread holds the flag, and nothing ran.
|
|
58
|
+
*/
|
|
59
|
+
async function holdingConvergeProcess(env, cwd, run) {
|
|
60
|
+
if (convergeRunning()) return { held: false };
|
|
61
|
+
flag[RUNNING] = true;
|
|
62
|
+
try {
|
|
63
|
+
return {
|
|
64
|
+
held: true,
|
|
65
|
+
value: await withProcessState(env, cwd, run)
|
|
66
|
+
};
|
|
67
|
+
} finally {
|
|
68
|
+
flag[RUNNING] = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Runs a lowered stack's plan and apply in this process through Alchemy's
|
|
73
|
+
* programmatic API (`alchemy/Alchemist`). Alchemy's typed events and log
|
|
74
|
+
* lines come back as {@link ConvergeEvent}s, and what Alchemy writes to the
|
|
75
|
+
* terminal itself goes to the request's `output`, so the caller renders
|
|
76
|
+
* progress in its own format.
|
|
77
|
+
*
|
|
78
|
+
* Published as `@prisma/composer/internal/converge`: the CLI loads it from
|
|
79
|
+
* the app's install, so it runs on the app's copy of alchemy and effect.
|
|
80
|
+
*/
|
|
81
|
+
const FINISHED = /* @__PURE__ */ new Set([
|
|
82
|
+
"created",
|
|
83
|
+
"updated",
|
|
84
|
+
"adopted",
|
|
85
|
+
"deleted",
|
|
86
|
+
"orphaned",
|
|
87
|
+
"replaced",
|
|
88
|
+
"ran",
|
|
89
|
+
"skipped"
|
|
90
|
+
]);
|
|
91
|
+
function phaseOf(status) {
|
|
92
|
+
if (status === "pending") return "pending";
|
|
93
|
+
if (status === "fail") return "failed";
|
|
94
|
+
return FINISHED.has(status) ? "done" : "running";
|
|
95
|
+
}
|
|
96
|
+
/** Alchemy's typed event as a converge event; undefined for the events Composer does not show. */
|
|
97
|
+
function toConvergeEvent(event) {
|
|
98
|
+
switch (event.type) {
|
|
99
|
+
case "apply.resource.status": return {
|
|
100
|
+
kind: "resource",
|
|
101
|
+
fqn: event.fqn,
|
|
102
|
+
resourceType: event.resourceType,
|
|
103
|
+
status: event.status,
|
|
104
|
+
phase: phaseOf(event.status),
|
|
105
|
+
...event.message === void 0 ? {} : { message: event.message }
|
|
106
|
+
};
|
|
107
|
+
case "apply.resource.note": return {
|
|
108
|
+
kind: "log",
|
|
109
|
+
severity: event.kind === void 0 ? "info" : "verbose",
|
|
110
|
+
text: `${event.fqn}: ${event.message}`
|
|
111
|
+
};
|
|
112
|
+
default: return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const SEVERITY_OF = {
|
|
116
|
+
info: "info",
|
|
117
|
+
warn: "warn",
|
|
118
|
+
error: "warn",
|
|
119
|
+
fatal: "warn"
|
|
120
|
+
};
|
|
121
|
+
/** Alchemy's log lines at info and above, as Alchemy's console sink would print them. Typed events are left to `Alchemist.onEvent`. */
|
|
122
|
+
function logEvents(emit) {
|
|
123
|
+
return Logger.make((options) => {
|
|
124
|
+
const record = recordOf(options);
|
|
125
|
+
const severity = SEVERITY_OF[record.level];
|
|
126
|
+
if (severity === void 0) return;
|
|
127
|
+
if (record.kind === "log") {
|
|
128
|
+
const fqn = record.attributes["fqn"];
|
|
129
|
+
emit({
|
|
130
|
+
kind: "log",
|
|
131
|
+
severity,
|
|
132
|
+
text: `${typeof fqn === "string" ? `${fqn}: ` : ""}${record.data.message}`
|
|
133
|
+
});
|
|
134
|
+
if (record.data.cause !== null) emit({
|
|
135
|
+
kind: "log",
|
|
136
|
+
severity,
|
|
137
|
+
text: record.data.cause
|
|
138
|
+
});
|
|
139
|
+
} else if (record.kind === "output") emit({
|
|
140
|
+
kind: "log",
|
|
141
|
+
severity: "verbose",
|
|
142
|
+
text: record.data.text
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function textOf(value) {
|
|
147
|
+
if (typeof value === "string") return value;
|
|
148
|
+
try {
|
|
149
|
+
const json = JSON.stringify(value);
|
|
150
|
+
if (json !== void 0) return json;
|
|
151
|
+
} catch {}
|
|
152
|
+
return String(value);
|
|
153
|
+
}
|
|
154
|
+
function isRecord(value) {
|
|
155
|
+
return typeof value === "object" && value !== null;
|
|
156
|
+
}
|
|
157
|
+
/** One error as a reason. A wrapped provider failure reports the error it wraps, and a structured error reports its code as its tag. */
|
|
158
|
+
function failureReasonOf(error) {
|
|
159
|
+
if (!isRecord(error)) return {
|
|
160
|
+
tag: "Unknown",
|
|
161
|
+
message: textOf(error)
|
|
162
|
+
};
|
|
163
|
+
const wrapped = wrappedProviderError(error);
|
|
164
|
+
if (wrapped !== void 0) return failureReasonOf(wrapped);
|
|
165
|
+
const message = typeof error["message"] === "string" ? error["message"] : void 0;
|
|
166
|
+
return {
|
|
167
|
+
tag: CliStructuredError.is(error) ? error.code : typeof error["_tag"] === "string" ? error["_tag"] : error instanceof Error ? error.name : "Unknown",
|
|
168
|
+
message: message ?? textOf(error)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** The errors a converge failed with, one per distinct error, interruptions left out. */
|
|
172
|
+
function failureReasons(cause) {
|
|
173
|
+
const reasons = cause.reasons.flatMap((reason) => {
|
|
174
|
+
if (Cause.isInterruptReason(reason)) return [];
|
|
175
|
+
return [failureReasonOf(Cause.isFailReason(reason) ? reason.error : reason.defect)];
|
|
176
|
+
});
|
|
177
|
+
const unique = new Map(reasons.map((reason) => [`${reason.tag}\0${reason.message}`, reason]));
|
|
178
|
+
return unique.size > 0 ? [...unique.values()] : [{
|
|
179
|
+
tag: "Unknown",
|
|
180
|
+
message: Cause.pretty(cause)
|
|
181
|
+
}];
|
|
182
|
+
}
|
|
183
|
+
/** A stream for Alchemy's terminal output that hands each write to `write`; it reports the terminal's size and colours as stderr does. */
|
|
184
|
+
function writingTo(write) {
|
|
185
|
+
const stream = Object.create(process.stderr);
|
|
186
|
+
stream.write = (chunk) => {
|
|
187
|
+
try {
|
|
188
|
+
write(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8"));
|
|
189
|
+
} catch {}
|
|
190
|
+
return true;
|
|
191
|
+
};
|
|
192
|
+
return stream;
|
|
193
|
+
}
|
|
194
|
+
function program(request, emit) {
|
|
195
|
+
const terminal = request.output === void 0 ? process.stderr : writingTo(request.output);
|
|
196
|
+
return Effect.gen(function* () {
|
|
197
|
+
const plan = yield* Alchemist.plan({
|
|
198
|
+
stack: request.stack,
|
|
199
|
+
operation: request.operation,
|
|
200
|
+
stage: request.stage,
|
|
201
|
+
updateStateStore: true
|
|
202
|
+
});
|
|
203
|
+
yield* Alchemist.apply(plan);
|
|
204
|
+
}).pipe(Alchemist.onEvent((event) => Effect.sync(() => {
|
|
205
|
+
const converted = toConvergeEvent(event);
|
|
206
|
+
if (converted !== void 0) emit(converted);
|
|
207
|
+
})), Effect.scoped, Effect.provide(Logger.layer([logEvents(emit)])), Effect.provide(Interaction.layerNonInteractive({
|
|
208
|
+
stdout: terminal,
|
|
209
|
+
stderr: terminal
|
|
210
|
+
})), Effect.provide(Alchemist.layer()));
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Plans and applies `stack` in this process, as `alchemy deploy --yes` would.
|
|
214
|
+
* The plan's scope, and the state-store lease it holds when the store has one, closes before this
|
|
215
|
+
* returns, including when `signal` interrupts it. One converge runs at a time
|
|
216
|
+
* per process, across every install of this module: a second call while one
|
|
217
|
+
* runs is refused.
|
|
218
|
+
*/
|
|
219
|
+
const convergeInProcess = async (request) => {
|
|
220
|
+
if (convergeRunning()) return {
|
|
221
|
+
kind: "refused",
|
|
222
|
+
reason: "already-running"
|
|
223
|
+
};
|
|
224
|
+
if (!isMainThread && process.cwd() !== request.cwd) return {
|
|
225
|
+
kind: "refused",
|
|
226
|
+
reason: "worker-thread"
|
|
227
|
+
};
|
|
228
|
+
const emit = (event) => {
|
|
229
|
+
try {
|
|
230
|
+
request.onEvent?.(event);
|
|
231
|
+
} catch {}
|
|
232
|
+
};
|
|
233
|
+
try {
|
|
234
|
+
const effect = program(request, emit);
|
|
235
|
+
const held = await holdingConvergeProcess(request.env, request.cwd, async () => {
|
|
236
|
+
const exit = await Effect.runPromiseExit(effect, request.signal === void 0 ? void 0 : { signal: request.signal });
|
|
237
|
+
if (Exit.isSuccess(exit)) return { kind: "applied" };
|
|
238
|
+
if (Cause.hasInterruptsOnly(exit.cause)) return { kind: "interrupted" };
|
|
239
|
+
return {
|
|
240
|
+
kind: "failed",
|
|
241
|
+
reasons: failureReasons(exit.cause)
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
return held.held ? held.value : {
|
|
245
|
+
kind: "refused",
|
|
246
|
+
reason: "already-running"
|
|
247
|
+
};
|
|
248
|
+
} catch (error) {
|
|
249
|
+
return {
|
|
250
|
+
kind: "failed",
|
|
251
|
+
reasons: [failureReasonOf(error)]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
//#endregion
|
|
256
|
+
export { failureReasonOf as n, holdingConvergeProcess as r, convergeInProcess as t };
|
|
257
|
+
|
|
258
|
+
//# sourceMappingURL=converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converge-in-process-x89zb2MF-Dvj-J8xo.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/converge-in-process-x89zb2MF.mjs"],"sourcesContent":["import { wrappedProviderError } from \"@internal/core/deploy\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { isMainThread } from \"node:worker_threads\";\nimport * as Alchemist from \"alchemy/Alchemist\";\nimport * as Interaction from \"alchemy/Interaction\";\nimport { recordOf } from \"alchemy/Util/LogRecord\";\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Logger from \"effect/Logger\";\n//#region src/converge-process.ts\n/**\n* The process state a converge holds while it runs: the per-thread\n* one-converge flag, the variables Alchemy reads from `process.env`, and the working\n* directory. Shared by the converge on the main thread and by `prisma dev`,\n* which holds it on the main thread for the life of its converge worker.\n*/\n/** One flag per thread, shared by every copy of this module, so two apps' installs in one host cannot converge at once. */\nconst RUNNING = Symbol.for(\"prisma.composer.converge.running\");\nconst flag = blindCast(globalThis);\n/** True while this thread runs a converge. */\nfunction convergeRunning() {\n\treturn flag[RUNNING] === true;\n}\n/**\n* Sets the process state Alchemy reads for the length of `run`, and restores\n* it on every exit path: the variables in `env`, then the working directory.\n* A directory that cannot be restored never leaves a variable behind and\n* never changes what `run` returned.\n*/\nasync function withProcessState(env, cwd, run) {\n\tconst previousEnv = Object.keys(env).map((name) => [name, process.env[name]]);\n\tconst previousCwd = process.cwd();\n\tlet changedDirectory = false;\n\ttry {\n\t\tfor (const [name, value] of Object.entries(env)) if (value === void 0) delete process.env[name];\n\t\telse process.env[name] = value;\n\t\tif (previousCwd !== cwd) {\n\t\t\tprocess.chdir(cwd);\n\t\t\tchangedDirectory = true;\n\t\t}\n\t\treturn await run();\n\t} finally {\n\t\tfor (const [name, value] of previousEnv) if (value === void 0) delete process.env[name];\n\t\telse process.env[name] = value;\n\t\tif (changedDirectory) try {\n\t\t\tprocess.chdir(previousCwd);\n\t\t} catch {}\n\t}\n}\n/**\n* Runs `run` holding three things for its length: this thread's converge flag\n* (on `globalThis`, so it guards this thread only), the process environment\n* variables in `env`, and the process's working directory, changed to `cwd`.\n* All three are restored on every exit path. `held: false` means another\n* converge on this thread holds the flag, and nothing ran.\n*/\nasync function holdingConvergeProcess(env, cwd, run) {\n\tif (convergeRunning()) return { held: false };\n\tflag[RUNNING] = true;\n\ttry {\n\t\treturn {\n\t\t\theld: true,\n\t\t\tvalue: await withProcessState(env, cwd, run)\n\t\t};\n\t} finally {\n\t\tflag[RUNNING] = false;\n\t}\n}\n//#endregion\n//#region src/converge-in-process.ts\n/**\n* Runs a lowered stack's plan and apply in this process through Alchemy's\n* programmatic API (`alchemy/Alchemist`). Alchemy's typed events and log\n* lines come back as {@link ConvergeEvent}s, and what Alchemy writes to the\n* terminal itself goes to the request's `output`, so the caller renders\n* progress in its own format.\n*\n* Published as `@prisma/composer/internal/converge`: the CLI loads it from\n* the app's install, so it runs on the app's copy of alchemy and effect.\n*/\nconst FINISHED = /* @__PURE__ */ new Set([\n\t\"created\",\n\t\"updated\",\n\t\"adopted\",\n\t\"deleted\",\n\t\"orphaned\",\n\t\"replaced\",\n\t\"ran\",\n\t\"skipped\"\n]);\nfunction phaseOf(status) {\n\tif (status === \"pending\") return \"pending\";\n\tif (status === \"fail\") return \"failed\";\n\treturn FINISHED.has(status) ? \"done\" : \"running\";\n}\n/** Alchemy's typed event as a converge event; undefined for the events Composer does not show. */\nfunction toConvergeEvent(event) {\n\tswitch (event.type) {\n\t\tcase \"apply.resource.status\": return {\n\t\t\tkind: \"resource\",\n\t\t\tfqn: event.fqn,\n\t\t\tresourceType: event.resourceType,\n\t\t\tstatus: event.status,\n\t\t\tphase: phaseOf(event.status),\n\t\t\t...event.message === void 0 ? {} : { message: event.message }\n\t\t};\n\t\tcase \"apply.resource.note\": return {\n\t\t\tkind: \"log\",\n\t\t\tseverity: event.kind === void 0 ? \"info\" : \"verbose\",\n\t\t\ttext: `${event.fqn}: ${event.message}`\n\t\t};\n\t\tdefault: return;\n\t}\n}\nconst SEVERITY_OF = {\n\tinfo: \"info\",\n\twarn: \"warn\",\n\terror: \"warn\",\n\tfatal: \"warn\"\n};\n/** Alchemy's log lines at info and above, as Alchemy's console sink would print them. Typed events are left to `Alchemist.onEvent`. */\nfunction logEvents(emit) {\n\treturn Logger.make((options) => {\n\t\tconst record = recordOf(options);\n\t\tconst severity = SEVERITY_OF[record.level];\n\t\tif (severity === void 0) return;\n\t\tif (record.kind === \"log\") {\n\t\t\tconst fqn = record.attributes[\"fqn\"];\n\t\t\temit({\n\t\t\t\tkind: \"log\",\n\t\t\t\tseverity,\n\t\t\t\ttext: `${typeof fqn === \"string\" ? `${fqn}: ` : \"\"}${record.data.message}`\n\t\t\t});\n\t\t\tif (record.data.cause !== null) emit({\n\t\t\t\tkind: \"log\",\n\t\t\t\tseverity,\n\t\t\t\ttext: record.data.cause\n\t\t\t});\n\t\t} else if (record.kind === \"output\") emit({\n\t\t\tkind: \"log\",\n\t\t\tseverity: \"verbose\",\n\t\t\ttext: record.data.text\n\t\t});\n\t});\n}\nfunction textOf(value) {\n\tif (typeof value === \"string\") return value;\n\ttry {\n\t\tconst json = JSON.stringify(value);\n\t\tif (json !== void 0) return json;\n\t} catch {}\n\treturn String(value);\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/** One error as a reason. A wrapped provider failure reports the error it wraps, and a structured error reports its code as its tag. */\nfunction failureReasonOf(error) {\n\tif (!isRecord(error)) return {\n\t\ttag: \"Unknown\",\n\t\tmessage: textOf(error)\n\t};\n\tconst wrapped = wrappedProviderError(error);\n\tif (wrapped !== void 0) return failureReasonOf(wrapped);\n\tconst message = typeof error[\"message\"] === \"string\" ? error[\"message\"] : void 0;\n\treturn {\n\t\ttag: CliStructuredError.is(error) ? error.code : typeof error[\"_tag\"] === \"string\" ? error[\"_tag\"] : error instanceof Error ? error.name : \"Unknown\",\n\t\tmessage: message ?? textOf(error)\n\t};\n}\n/** The errors a converge failed with, one per distinct error, interruptions left out. */\nfunction failureReasons(cause) {\n\tconst reasons = cause.reasons.flatMap((reason) => {\n\t\tif (Cause.isInterruptReason(reason)) return [];\n\t\treturn [failureReasonOf(Cause.isFailReason(reason) ? reason.error : reason.defect)];\n\t});\n\tconst unique = new Map(reasons.map((reason) => [`${reason.tag}\\0${reason.message}`, reason]));\n\treturn unique.size > 0 ? [...unique.values()] : [{\n\t\ttag: \"Unknown\",\n\t\tmessage: Cause.pretty(cause)\n\t}];\n}\n/** A stream for Alchemy's terminal output that hands each write to `write`; it reports the terminal's size and colours as stderr does. */\nfunction writingTo(write) {\n\tconst stream = Object.create(process.stderr);\n\tstream.write = (chunk) => {\n\t\ttry {\n\t\t\twrite(typeof chunk === \"string\" ? chunk : Buffer.from(chunk).toString(\"utf8\"));\n\t\t} catch {}\n\t\treturn true;\n\t};\n\treturn stream;\n}\nfunction program(request, emit) {\n\tconst terminal = request.output === void 0 ? process.stderr : writingTo(request.output);\n\treturn Effect.gen(function* () {\n\t\tconst plan = yield* Alchemist.plan({\n\t\t\tstack: request.stack,\n\t\t\toperation: request.operation,\n\t\t\tstage: request.stage,\n\t\t\tupdateStateStore: true\n\t\t});\n\t\tyield* Alchemist.apply(plan);\n\t}).pipe(Alchemist.onEvent((event) => Effect.sync(() => {\n\t\tconst converted = toConvergeEvent(event);\n\t\tif (converted !== void 0) emit(converted);\n\t})), Effect.scoped, Effect.provide(Logger.layer([logEvents(emit)])), Effect.provide(Interaction.layerNonInteractive({\n\t\tstdout: terminal,\n\t\tstderr: terminal\n\t})), Effect.provide(Alchemist.layer()));\n}\n/**\n* Plans and applies `stack` in this process, as `alchemy deploy --yes` would.\n* The plan's scope, and the state-store lease it holds when the store has one, closes before this\n* returns, including when `signal` interrupts it. One converge runs at a time\n* per process, across every install of this module: a second call while one\n* runs is refused.\n*/\nconst convergeInProcess = async (request) => {\n\tif (convergeRunning()) return {\n\t\tkind: \"refused\",\n\t\treason: \"already-running\"\n\t};\n\tif (!isMainThread && process.cwd() !== request.cwd) return {\n\t\tkind: \"refused\",\n\t\treason: \"worker-thread\"\n\t};\n\tconst emit = (event) => {\n\t\ttry {\n\t\t\trequest.onEvent?.(event);\n\t\t} catch {}\n\t};\n\ttry {\n\t\tconst effect = program(request, emit);\n\t\tconst held = await holdingConvergeProcess(request.env, request.cwd, async () => {\n\t\t\tconst exit = await Effect.runPromiseExit(effect, request.signal === void 0 ? void 0 : { signal: request.signal });\n\t\t\tif (Exit.isSuccess(exit)) return { kind: \"applied\" };\n\t\t\tif (Cause.hasInterruptsOnly(exit.cause)) return { kind: \"interrupted\" };\n\t\t\treturn {\n\t\t\t\tkind: \"failed\",\n\t\t\t\treasons: failureReasons(exit.cause)\n\t\t\t};\n\t\t});\n\t\treturn held.held ? held.value : {\n\t\t\tkind: \"refused\",\n\t\t\treason: \"already-running\"\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tkind: \"failed\",\n\t\t\treasons: [failureReasonOf(error)]\n\t\t};\n\t}\n};\n//#endregion\nexport { failureReasonOf as n,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UAAU;GACnD,IAAI,MAAM,kBAAkB,KAAK,KAAK,GAAG,OAAO,EAAE,MAAM,cAAc;GACtE,OAAO;IACN,MAAM;IACN,SAAS,eAAe,KAAK,KAAK;GACnC;EACD,CAAC;EACD,OAAO,KAAK,OAAO,KAAK,QAAQ;GAC/B,MAAM;GACN,QAAQ;EACT;CACD,SAAS,OAAO;EACf,OAAO;GACN,MAAM;GACN,SAAS,CAAC,gBAAgB,KAAK,CAAC;EACjC;CACD;AACD"}
|
|
@@ -1,12 +1,64 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { i as POINTER } from "./describe-kind-Cpm_euxo-DsSPENQa.mjs";
|
|
3
|
+
import { O as slotsOf, _ as isValueResource, b as originOf, g as isValue, n as Load, p as isPlainObject, y as nodeAddresses } from "./graph-D2WMLL43-CeiC5wdy.mjs";
|
|
4
|
+
import { r as deserializeContainers, s as readPreflightPayload } from "./preflight-transport-2d6iIchu-B-v7Di6I.mjs";
|
|
4
5
|
import * as Alchemy from "alchemy";
|
|
5
6
|
import * as Effect from "effect/Effect";
|
|
6
7
|
import * as Layer from "effect/Layer";
|
|
7
8
|
import * as Data from "effect/Data";
|
|
8
9
|
import * as Predicate from "effect/Predicate";
|
|
9
10
|
//#region ../../0-framework/1-core/core/dist/deploy.mjs
|
|
11
|
+
/**
|
|
12
|
+
* Resource props as plain data that `structuredClone` copies unchanged, so two props compare by
|
|
13
|
+
* content with `isDeepStrictEqual` even after one crossed a thread. Every object or array is
|
|
14
|
+
* tagged by what it was, so no two different props give the same data:
|
|
15
|
+
*
|
|
16
|
+
* - a `Value` is described by what core knows of it: a source by its kind, pointer kind, label,
|
|
17
|
+
* secrets key and payload; any other value only as derived, with the kind of its origin;
|
|
18
|
+
* - a `Date`, `RegExp`, `Map` or `Set` keeps its content;
|
|
19
|
+
* - an instance of another class keeps its class name and own enumerable fields;
|
|
20
|
+
* - a function or symbol becomes its text;
|
|
21
|
+
* - a reference back to an object that contains it becomes a cycle marker.
|
|
22
|
+
*/
|
|
23
|
+
function comparableProps(props) {
|
|
24
|
+
return asData(props, /* @__PURE__ */ new Set());
|
|
25
|
+
}
|
|
26
|
+
function asData(value, containing) {
|
|
27
|
+
if (typeof value === "function") return { function: String(value) };
|
|
28
|
+
if (typeof value === "symbol") return { symbol: String(value) };
|
|
29
|
+
if (typeof value !== "object" || value === null) return value;
|
|
30
|
+
if (containing.has(value)) return { cycle: true };
|
|
31
|
+
containing.add(value);
|
|
32
|
+
try {
|
|
33
|
+
return objectAsData(value, (inner) => asData(inner, containing));
|
|
34
|
+
} finally {
|
|
35
|
+
containing.delete(value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function objectAsData(value, inner) {
|
|
39
|
+
if (isValue(value)) {
|
|
40
|
+
const origin = originOf(value);
|
|
41
|
+
if (origin.kind !== "source") return { value: { derived: origin.kind } };
|
|
42
|
+
return { value: {
|
|
43
|
+
sourceKind: origin.sourceKind,
|
|
44
|
+
pointer: Reflect.get(value, POINTER),
|
|
45
|
+
label: origin.label,
|
|
46
|
+
secretsKey: origin.sourceKind === "secret" ? origin.secretsKey : void 0,
|
|
47
|
+
payload: inner(Reflect.get(value, "payload"))
|
|
48
|
+
} };
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(value)) return { array: value.map(inner) };
|
|
51
|
+
if (value instanceof Date) return { date: value.getTime() };
|
|
52
|
+
if (value instanceof RegExp) return { regexp: String(value) };
|
|
53
|
+
if (value instanceof Map) return { map: [...value].map(([key, entry]) => [inner(key), inner(entry)]) };
|
|
54
|
+
if (value instanceof Set) return { set: [...value].map(inner) };
|
|
55
|
+
const fields = Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, inner(entry)]));
|
|
56
|
+
if (isPlainObject(value)) return { object: fields };
|
|
57
|
+
return {
|
|
58
|
+
instance: value.constructor?.name,
|
|
59
|
+
fields
|
|
60
|
+
};
|
|
61
|
+
}
|
|
10
62
|
/** Routes each graph node to its extension descriptor (by node.extension/type) and runs provision → serialize → package → deploy in dependency order. */
|
|
11
63
|
var LowerError = class extends Error {
|
|
12
64
|
constructor(message) {
|
|
@@ -14,12 +66,20 @@ var LowerError = class extends Error {
|
|
|
14
66
|
this.name = "LowerError";
|
|
15
67
|
}
|
|
16
68
|
};
|
|
69
|
+
/** The `name` of the error `lower()` fails with when it builds a graph whose node addresses differ from `firstProcessNodeAddresses`. */
|
|
70
|
+
const GRAPH_CHANGED_ERROR = "GraphChangedError";
|
|
71
|
+
var GraphChangedError = class extends LowerError {
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = GRAPH_CHANGED_ERROR;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
17
77
|
function assertSameNodeAddresses(built, firstProcess) {
|
|
18
78
|
const onlyBuilt = built.filter((address) => !firstProcess.includes(address));
|
|
19
79
|
const onlyFirst = firstProcess.filter((address) => !built.includes(address));
|
|
20
80
|
if (onlyBuilt.length === 0 && onlyFirst.length === 0) return;
|
|
21
81
|
const list = (addresses) => addresses.length === 0 ? "none" : addresses.map((address) => `"${address}"`).join(", ");
|
|
22
|
-
throw new
|
|
82
|
+
throw 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.`);
|
|
23
83
|
}
|
|
24
84
|
/** 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. */
|
|
25
85
|
function resolveParam(node, serviceId, name, param, bound) {
|
|
@@ -408,6 +468,6 @@ function wrappedProviderError(error) {
|
|
|
408
468
|
return Predicate.isTagged(error, PROVIDER_FAILURE_TAG) && "cause" in error ? error.cause : void 0;
|
|
409
469
|
}
|
|
410
470
|
//#endregion
|
|
411
|
-
export {
|
|
471
|
+
export { connectionInputs as a, lower as c, resolveStateLayer as d, toProviderError as f, comparableProps as i, lowering as l, wrappedProviderError as m, LowerError as n, deploymentResult as o, transportedLowerInputs as p, buildConfig as r, joinDeployment as s, GRAPH_CHANGED_ERROR as t, mergedProviders as u };
|
|
412
472
|
|
|
413
|
-
//# sourceMappingURL=deploy-
|
|
473
|
+
//# sourceMappingURL=deploy-CSU0kr4j.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-NArSOken.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy.mjs"],"sourcesContent":["import { b as slotsOf, i as secretsKeys, p as isValueResource, r as nodeAddresses, t as Load } from \"./graph-C6Fqe2gn.mjs\";\nimport { i as readPreflightPayload, s as deserializeContainers } from \"./preflight-transport-C7_3abXW.mjs\";\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/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};\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 LowerError(`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 { LowerError, buildConfig, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };\n\n//# sourceMappingURL=deploy.mjs.map"],"mappings":";;;;;;;;;;AAUA,IAAI,aAAa,cAAc,MAAM;CACpC,YAAY,S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W,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
|
+
{"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,MAAM,OAAO;CACxD,IAAI,WAAW,IAAI,KAAK,GAAG,OAAO,EAAE,OAAO,KAAK;CAChD,WAAW,IAAI,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uB,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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "./graph-types-D4PrtP-l-B0uuchTl.mjs";
|
|
2
|
+
import "./graph-CUYXjK8S-BzL-mhjq.mjs";
|
|
3
|
+
import "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
4
|
+
import * as Provider from "alchemy/Provider";
|
|
5
|
+
//#region ../../0-framework/1-core/core/dist/deploy.d.mts
|
|
6
|
+
//#region src/comparable-props.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Resource props as plain data that `structuredClone` copies unchanged, so two props compare by
|
|
9
|
+
* content with `isDeepStrictEqual` even after one crossed a thread. Every object or array is
|
|
10
|
+
* tagged by what it was, so no two different props give the same data:
|
|
11
|
+
*
|
|
12
|
+
* - a `Value` is described by what core knows of it: a source by its kind, pointer kind, label,
|
|
13
|
+
* secrets key and payload; any other value only as derived, with the kind of its origin;
|
|
14
|
+
* - a `Date`, `RegExp`, `Map` or `Set` keeps its content;
|
|
15
|
+
* - an instance of another class keeps its class name and own enumerable fields;
|
|
16
|
+
* - a function or symbol becomes its text;
|
|
17
|
+
* - a reference back to an object that contains it becomes a cycle marker.
|
|
18
|
+
*/
|
|
19
|
+
declare function comparableProps(props: unknown): unknown;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/control/provider-error.d.ts
|
|
22
|
+
/** 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`. */
|
|
23
|
+
declare function toProviderError(cause: unknown): Provider.ProviderError;
|
|
24
|
+
/** The original error of a provider failure `toProviderError` wrapped, or `undefined` for any other error. */
|
|
25
|
+
declare function wrappedProviderError(error: unknown): unknown;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/resolve-values.d.ts
|
|
28
|
+
/** The `name` of the error a Load that takes what an earlier Load read fails with when it needs a root input field that Load did not read. */
|
|
29
|
+
declare const ROOT_INPUT_UNREAD_ERROR = "RootInputUnreadError";
|
|
30
|
+
//#endregion
|
|
31
|
+
export { wrappedProviderError as i, comparableProps as n, toProviderError as r, ROOT_INPUT_UNREAD_ERROR as t };
|
|
32
|
+
//# sourceMappingURL=deploy-DHgEJDpg.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-DHgEJDpg.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/deploy.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;iBAkBiB,gBAAgB;;;;iBAIhB,gBAAgB,iBAAiB,SAAS;;iBAE1C,qBAAqB;;;;cAIxB"}
|
package/dist/deploy.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as secretsKeys, r as nodeAddresses } from "./graph-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export { AlchemyStateLayer, ApplicationDescriptor, Artifact, AssembleInput, Bundle, DeployedEntity, DeployedNode, DeploymentResult, DevServer, LowerContext, LowerError, LowerOptions, LoweredResult, Lowering, Outputs, PackageInput, ProvisionEdge, ProvisionerDescriptor, ServeInput, ServiceLowering, buildConfig, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };
|
|
1
|
+
import { i as secretsKeys, r as nodeAddresses } from "./graph-CUYXjK8S-BzL-mhjq.mjs";
|
|
2
|
+
import { Et as transportedLowerInputs, F as LowerError, H as PackageInput, I as LowerOptions, L as LoweredResult, P as LowerContext, R as Lowering, S as GRAPH_CHANGED_ERROR, Tt as resolveStateLayer, V as Outputs, X as ProvisionEdge, Z as ProvisionerDescriptor, _ as DeployedNode, _t as joinDeployment, a as Artifact, b as DevServer, bt as mergedProviders, ct as buildConfig, g as DeployedEntity, i as ApplicationDescriptor, it as ServiceLowering, lt as connectionInputs, o as AssembleInput, pt as deploymentResult, rt as ServeInput, s as Bundle, t as AlchemyStateLayer, v as DeploymentResult, vt as lower, yt as lowering } from "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
3
|
+
import { i as wrappedProviderError, n as comparableProps, r as toProviderError, t as ROOT_INPUT_UNREAD_ERROR } from "./deploy-DHgEJDpg.mjs";
|
|
4
|
+
export { AlchemyStateLayer, ApplicationDescriptor, Artifact, AssembleInput, Bundle, DeployedEntity, DeployedNode, DeploymentResult, DevServer, GRAPH_CHANGED_ERROR, LowerContext, LowerError, LowerOptions, LoweredResult, Lowering, Outputs, PackageInput, ProvisionEdge, ProvisionerDescriptor, ROOT_INPUT_UNREAD_ERROR, ServeInput, ServiceLowering, buildConfig, comparableProps, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };
|
package/dist/deploy.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
export { LowerError, buildConfig, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };
|
|
1
|
+
import { E as secretsKeys, a as ROOT_INPUT_UNREAD_ERROR, y as nodeAddresses } from "./graph-D2WMLL43-CeiC5wdy.mjs";
|
|
2
|
+
import { a as connectionInputs, c as lower, d as resolveStateLayer, f as toProviderError, i as comparableProps, l as lowering, m as wrappedProviderError, n as LowerError, o as deploymentResult, p as transportedLowerInputs, r as buildConfig, s as joinDeployment, t as GRAPH_CHANGED_ERROR, u as mergedProviders } from "./deploy-CSU0kr4j.mjs";
|
|
3
|
+
export { GRAPH_CHANGED_ERROR, LowerError, ROOT_INPUT_UNREAD_ERROR, buildConfig, comparableProps, connectionInputs, deploymentResult, joinDeployment, lower, lowering, mergedProviders, nodeAddresses, resolveStateLayer, secretsKeys, toProviderError, transportedLowerInputs, wrappedProviderError };
|