@prisma/composer 0.36.0 → 0.37.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-DNnd7Zu--BQ1vHaMK.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +46 -6
- package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
- package/dist/arktype.d.mts +20 -6
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +45 -6
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-CDkq5Ayl.d.mts +1 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
- package/dist/config.d.mts +16 -3
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -1
- package/dist/control.d.mts +6 -174
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-CmiYExQA.mjs +373 -0
- package/dist/deploy-CmiYExQA.mjs.map +1 -0
- package/dist/deploy-DQyaIoNe.d.mts +2 -0
- package/dist/deploy.d.mts +4 -3
- package/dist/deploy.mjs +3 -364
- package/dist/{deployment-summary-CDHdLtnO-DrE7GsHq.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +10 -23
- package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +3 -3
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts.map → deployment-summary-p88NV5m5-BJOosgmI.d.mts.map} +1 -1
- package/dist/{secret-DoWGmN7m-DO5Brq1Y.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +29 -2
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
- package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
- package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
- package/dist/{dist-CZ_yEZ7F.mjs → dist-C7SnNTD3.mjs} +11 -4
- package/dist/dist-C7SnNTD3.mjs.map +1 -0
- package/dist/errors-0e8IVwzi.mjs.map +1 -1
- package/dist/{execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +60 -29
- package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
- package/dist/{execute-dev-BUk-XWBJ-ZHX5A8cR.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +99 -44
- package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
- package/dist/{graph-MGOZJdDt-CyI8-9r7.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +637 -199
- package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
- package/dist/{graph-BzTSXnoQ-BvGVq0bm.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
- package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
- package/dist/{graph-types-DfsG9Rkg-D_ARjMo7.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +253 -120
- package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-D89ftK2z.d.mts → index-DWQ6BSgm.d.mts} +3 -3
- package/dist/index-DWQ6BSgm.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/internal-app-configuration-file.d.mts +19 -0
- package/dist/internal-app-configuration-file.d.mts.map +1 -0
- package/dist/internal-app-configuration-file.mjs +2 -0
- package/dist/{local-target-DySKw61w.mjs → local-target-Dd8FJEb5.mjs} +5 -3
- package/dist/{local-target-DySKw61w.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/local-target.d.mts.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs-control.mjs +2 -2
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts +42 -0
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts.map +1 -0
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-Dl_MWw4g-BZaLckHp.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -12
- package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/{validate-environment-CEhUSEg2-DmAtiQhe.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +113 -13
- package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
- package/dist/zod.d.mts +30 -0
- package/dist/zod.d.mts.map +1 -0
- package/dist/zod.mjs +39 -0
- package/dist/zod.mjs.map +1 -0
- package/package.json +31 -18
- package/skills/prisma-composer-core-concepts/SKILL.md +49 -23
- package/src/exports/config.ts +1 -0
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/src/exports/zod.ts +1 -0
- package/dist/app-config-DNnd7Zu--BQ1vHaMK.d.mts.map +0 -1
- package/dist/config-RKyUvtGC.d.mts +0 -1
- package/dist/deploy-RKyUvtGC.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-CDHdLtnO-DrE7GsHq.mjs.map +0 -1
- package/dist/dist-CZ_yEZ7F.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs.map +0 -1
- package/dist/execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map +0 -1
- package/dist/graph-BzTSXnoQ-BvGVq0bm.d.mts.map +0 -1
- package/dist/graph-MGOZJdDt-CyI8-9r7.mjs.map +0 -1
- package/dist/graph-types-DfsG9Rkg-D_ARjMo7.d.mts.map +0 -1
- package/dist/index-D89ftK2z.d.mts.map +0 -1
- package/dist/run-alchemy-Dl_MWw4g-BZaLckHp.mjs.map +0 -1
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
- package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
- package/dist/validate-environment-CEhUSEg2-DmAtiQhe.mjs.map +0 -1
package/dist/control.d.mts
CHANGED
|
@@ -1,84 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import "./index-
|
|
5
|
-
import "./
|
|
6
|
-
|
|
7
|
-
//#region ../../0-framework/3-tooling/cli/dist/composer-config-BJrPWlDx.d.mts
|
|
8
|
-
//#region src/composer-config.d.ts
|
|
9
|
-
/** Composer's configuration and the `prisma.config.ts` that declares it. */
|
|
10
|
-
interface ComposerConfigSource {
|
|
11
|
-
/** The `composer` section: the `composer` property of that file's default export. */
|
|
12
|
-
readonly value: PrismaAppConfig;
|
|
13
|
-
/** The declaring `prisma.config.ts`. The deploy's generated stack file imports it. A relative path resolves against the operation's `cwd`. */
|
|
14
|
-
readonly file: string;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region ../../0-framework/0-foundation/foundation/dist/result.d.mts
|
|
18
|
-
//#region src/result.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Represents a successful result containing a value.
|
|
21
|
-
*/
|
|
22
|
-
interface Ok<T> {
|
|
23
|
-
readonly ok: true;
|
|
24
|
-
readonly value: T;
|
|
25
|
-
assertOk(): T;
|
|
26
|
-
assertNotOk(): never;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Represents an unsuccessful result containing failure details.
|
|
30
|
-
*/
|
|
31
|
-
interface NotOk<F> {
|
|
32
|
-
readonly ok: false;
|
|
33
|
-
readonly failure: F;
|
|
34
|
-
assertOk(): never;
|
|
35
|
-
assertNotOk(): F;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* A discriminated union representing either success (Ok) or failure (NotOk).
|
|
39
|
-
*
|
|
40
|
-
* @typeParam T - The success value type
|
|
41
|
-
* @typeParam F - The failure details type
|
|
42
|
-
*/
|
|
43
|
-
type Result<T, F> = Ok<T> | NotOk<F>;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-CcIkmpk0.d.mts
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/operations/shared.d.ts
|
|
48
|
-
/** A running service's dotted address plus its local URL — what `dev` reports
|
|
49
|
-
* as the front door and `log` reports as the tailable services. */
|
|
50
|
-
interface ServiceEndpoint {
|
|
51
|
-
readonly address: string;
|
|
52
|
-
readonly url: string;
|
|
53
|
-
/** The dev server the service runs in place of its artifact, as its build adapter displays it (`next dev`) — absent for a service that runs its artifact (ADR-0056). */
|
|
54
|
-
readonly devServer?: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Where a failed execution left its artifacts — details of the CURRENT
|
|
58
|
-
* execution mechanism (a spawned deploy-engine child driving a generated
|
|
59
|
-
* stack file), for hosts that want to print a reproduce hint. The mechanism
|
|
60
|
-
* is not part of the surface's contract, so these fields may change or
|
|
61
|
-
* disappear if the mechanism does; branch on `code`/`message`/`cause` for
|
|
62
|
-
* anything durable.
|
|
63
|
-
*/
|
|
64
|
-
interface ExecutionDiagnostics {
|
|
65
|
-
/** The child's exit status; undefined means the spawn itself threw, or the
|
|
66
|
-
* child was killed by a signal (`signal` then names it). */
|
|
67
|
-
readonly exitCode: number | undefined;
|
|
68
|
-
/** The signal that killed the child, when one did. A signal-killed converge
|
|
69
|
-
* is an abort the user asked for, not a failure of the deploy — a host
|
|
70
|
-
* should report it as an interruption and print no reproduce hint. */
|
|
71
|
-
readonly signal?: string | undefined;
|
|
72
|
-
readonly stackFilePath: string;
|
|
73
|
-
readonly reproduceCommand: string;
|
|
74
|
-
readonly cwd: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Reads the execution diagnostics an engine-failure error carries in
|
|
78
|
-
* `meta.diagnostics`; undefined for every other failure.
|
|
79
|
-
*/
|
|
80
|
-
declare function executionDiagnostics(f: CliStructuredError): ExecutionDiagnostics | undefined;
|
|
81
|
-
//#endregion
|
|
1
|
+
import { At as CliStructuredError } from "./graph-types-DRe9UUOp-C85Yr-sJ.mjs";
|
|
2
|
+
import "./config-CDkq5Ayl.mjs";
|
|
3
|
+
import { n as DeploymentSummary, t as DeployedNodeSummary } from "./deployment-summary-p88NV5m5-BJOosgmI.mjs";
|
|
4
|
+
import "./index-DWQ6BSgm.mjs";
|
|
5
|
+
import { a as ExecutionDiagnostics, c as executionDiagnostics, d as Result, i as DevSession, l as NotOk, n as DevEvent, o as ServiceEndpoint, r as DevInput, s as dev, t as ComposerConfigSource, u as Ok } from "./redaction-Bf8FvTFH-BTsKD9B5.mjs";
|
|
6
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-BPnQtqnQ.d.mts
|
|
82
7
|
//#region src/operations/deploy.d.ts
|
|
83
8
|
/** A deploy step. `assemble-service` steps run inside `assemble`, one per service. */
|
|
84
9
|
type DeployStep = {
|
|
@@ -137,99 +62,6 @@ interface DeploySuccess {
|
|
|
137
62
|
}
|
|
138
63
|
declare function deploy(input: DeployInput): Promise<Result<DeploySuccess, CliStructuredError>>;
|
|
139
64
|
//#endregion
|
|
140
|
-
//#region src/operations/dev.d.ts
|
|
141
|
-
type DevEvent =
|
|
142
|
-
/** Initial front door + after each successful re-converge. */
|
|
143
|
-
{
|
|
144
|
-
readonly kind: 'ready';
|
|
145
|
-
readonly endpoints: readonly ServiceEndpoint[];
|
|
146
|
-
} | {
|
|
147
|
-
readonly kind: 'unwatchable';
|
|
148
|
-
readonly address: string;
|
|
149
|
-
} | {
|
|
150
|
-
readonly kind: 'rebuild-failed';
|
|
151
|
-
readonly message: string;
|
|
152
|
-
} |
|
|
153
|
-
/** The file watcher itself errored (EMFILE, a vanished directory); the session keeps running. */
|
|
154
|
-
{
|
|
155
|
-
readonly kind: 'watch-error';
|
|
156
|
-
readonly message: string;
|
|
157
|
-
} |
|
|
158
|
-
/** `prisma.config.ts` changed. The session keeps the config it started with and stops rebuilding until it is restarted. */
|
|
159
|
-
{
|
|
160
|
-
readonly kind: 'config-changed';
|
|
161
|
-
readonly file: string;
|
|
162
|
-
} |
|
|
163
|
-
/** The app keeps running, still watching. */
|
|
164
|
-
{
|
|
165
|
-
readonly kind: 'converge-failed';
|
|
166
|
-
readonly stackFilePath: string;
|
|
167
|
-
readonly reproduceCommand: string;
|
|
168
|
-
readonly cwd: string;
|
|
169
|
-
} |
|
|
170
|
-
/** Once per service that runs its build adapter's dev server, before the first converge (ADR-0056). `cwd` is absolute. */
|
|
171
|
-
{
|
|
172
|
-
readonly kind: 'dev-server';
|
|
173
|
-
readonly address: string;
|
|
174
|
-
readonly command: string;
|
|
175
|
-
readonly cwd: string;
|
|
176
|
-
} |
|
|
177
|
-
/** A reconverge changed a dev server's environment, so the emulator restarted it. */
|
|
178
|
-
{
|
|
179
|
-
readonly kind: 'dev-server-restarted';
|
|
180
|
-
readonly address: string;
|
|
181
|
-
readonly command: string;
|
|
182
|
-
} |
|
|
183
|
-
/** One line a dev server wrote, while the session runs. */
|
|
184
|
-
{
|
|
185
|
-
readonly kind: 'dev-server-output';
|
|
186
|
-
readonly address: string;
|
|
187
|
-
readonly line: string;
|
|
188
|
-
} | {
|
|
189
|
-
readonly kind: 'stopping';
|
|
190
|
-
} |
|
|
191
|
-
/** One service refused to stop during stop(); teardown continues and `stopped` still follows. */
|
|
192
|
-
{
|
|
193
|
-
readonly kind: 'stop-error';
|
|
194
|
-
readonly message: string;
|
|
195
|
-
} | {
|
|
196
|
-
readonly kind: 'stopped';
|
|
197
|
-
};
|
|
198
|
-
interface DevInput {
|
|
199
|
-
/**
|
|
200
|
-
* Composer's configuration: the `composer` section of `prisma.config.ts` and that file. The operation does not look for a config file; it refuses a section the CLI would refuse, before any work starts.
|
|
201
|
-
*/
|
|
202
|
-
readonly config: ComposerConfigSource;
|
|
203
|
-
/** The entry module, resolved against `cwd`. Overrides the `entry` in `config`; without either the operation fails with `CONFIG.ENTRY_MISSING`. */
|
|
204
|
-
readonly entry?: string | undefined;
|
|
205
|
-
readonly name?: string | undefined;
|
|
206
|
-
/** The environment to run as: a complete local copy of the app with its own services, databases and buckets. Defaults to `dev`. */
|
|
207
|
-
readonly environment?: string | undefined;
|
|
208
|
-
/** Deletes the environment's local copy of the app, and its data, before starting. Other environments are untouched. */
|
|
209
|
-
readonly fresh?: boolean | undefined;
|
|
210
|
-
/**
|
|
211
|
-
* Return once every service answers and leave the app running, with no
|
|
212
|
-
* watch loop: the session is already closed and stopping it stops nothing.
|
|
213
|
-
* `devStop` stops the app later.
|
|
214
|
-
*/
|
|
215
|
-
readonly detach?: boolean | undefined;
|
|
216
|
-
readonly cwd?: string | undefined;
|
|
217
|
-
readonly onEvent?: ((event: DevEvent) => void) | undefined;
|
|
218
|
-
}
|
|
219
|
-
/** A running dev session. The operation NEVER touches process signal handlers —
|
|
220
|
-
* the host owns signals (and must evict alchemy's import-time SIGINT/SIGTERM
|
|
221
|
-
* listeners before installing its own; see run-dev.ts). */
|
|
222
|
-
interface DevSession {
|
|
223
|
-
/** The initial front door, already merged across attachments. */
|
|
224
|
-
readonly endpoints: readonly ServiceEndpoint[];
|
|
225
|
-
/** Stop the watch loop and the app's services (emulators and data stay up).
|
|
226
|
-
* Idempotent; emits 'stopping'/'stopped'; resolves `closed`. A no-op for a detached session. */
|
|
227
|
-
stop(): Promise<void>;
|
|
228
|
-
/** Settles when the session has fully stopped (via stop()); already settled for a detached session. */
|
|
229
|
-
readonly closed: Promise<void>;
|
|
230
|
-
}
|
|
231
|
-
declare function dev(input: DevInput): Promise<Result<DevSession, CliStructuredError>>;
|
|
232
|
-
//#endregion
|
|
233
65
|
//#region src/operations/dev-current.d.ts
|
|
234
66
|
interface DevUrlInput {
|
|
235
67
|
/** Composer's configuration: the `composer` section of `prisma.config.ts` and that file. It names the extensions whose local targets recorded the app. */
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-BPnQtqnQ.d.mts","../../../0-framework/3-tooling/cli/dist/control.d.mts"],"mappings":";;;;;;;;KAMK;WACM;;WAEA;WACA;;KAEN;WACM;WACA,MAAM;;WAEN;WACA,MAAM;WACN;WACA;;WAEA,OAAO,SAAS;;UAIjB;;;;WAIC,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;;;;;;WAOA;;;;;;;WAOA;;WAEA,YAAY,OAAO;;UAEpB;;;WAGC,SAAS;;WAET;;iBAEM,OAAO,OAAO,cAAc,QAAQ,OAAO,eAAe;;;UAOjE;;WAEC,QAAQ;;WAER;;WAEA;;WAEA;;UAED;WACC;;WAEA;;WAEA;;WAEA;;WAEA;;UAED;WACC,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;UAED;;WAEC;;WAEA;;WAEA;aACE;aACA;;;;iBAII,OAAO,OAAO,cAAc,QAAQ,OAAO,QAAQ;;iBAEnD,QAAQ,OAAO,eAAe,QAAQ,OAAO,YAAY;;;;KC5GrE;;;WAGM;WACA;;UAED;;;;WAIC,QAAQ;;WAER;WACA;;WAEA;WACA;;WAEA,YAAY,OAAO;;iBAEb,QAAQ,OAAO,eAAe,QAAQ,aAAe;;;UAG5D;WACC;WACA;;KAEN;;;WAGM;WACA;;;;;WAKA;WACA;;UAED;;;;;WAKC,QAAQ;;WAER;WACA;;WAEA;;WAEA;;WAEA;WACA;;WAEA,SAAS;WACT,YAAY,OAAO;;UAEpB;;WAEC;;;WAGA,mBAAmB;;WAEnB,OAAO,cAAc;;iBAEf,IAAI,OAAO,WAAW,QAAQ,OAAS,aAAa;;;;cAIvD;;cAEA;UACJ;;WAEC;WACA;;;;;;;UAOD;WACC;WACA;;WAEA;WACA;WACA,gBAAgB;WAChB,SAAS"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
2
|
-
import { a as executionDiagnostics, i as devUrl, l as notOk, n as dev, o as executorLoadFailure, r as devStop, t as deploy } from "./dev-current-
|
|
3
|
-
import { n as RUN_REPORT_VERSION, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-
|
|
2
|
+
import { a as executionDiagnostics, i as devUrl, l as notOk, n as dev, o as executorLoadFailure, r as devStop, t as deploy } from "./dev-current-D0Kn6Mf4-DDWYu-3j.mjs";
|
|
3
|
+
import { n as RUN_REPORT_VERSION, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-Cc8rV1CX.mjs";
|
|
4
4
|
//#region ../../0-framework/3-tooling/cli/dist/control.mjs
|
|
5
5
|
/**
|
|
6
6
|
* The programmatic `destroy` operation (`@prisma/composer/control`): typed
|
|
@@ -21,7 +21,7 @@ async function destroyWithDeps(input, deps) {
|
|
|
21
21
|
const cwd = input.cwd ?? process.cwd();
|
|
22
22
|
let executor;
|
|
23
23
|
try {
|
|
24
|
-
executor = await import("./execute-deploy-destroy-
|
|
24
|
+
executor = await import("./execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs");
|
|
25
25
|
} catch (error) {
|
|
26
26
|
return notOk(executorLoadFailure("destroy", error));
|
|
27
27
|
}
|
|
@@ -43,7 +43,7 @@ async function logWithDeps(input, deps) {
|
|
|
43
43
|
const cwd = input.cwd ?? process.cwd();
|
|
44
44
|
let executor;
|
|
45
45
|
try {
|
|
46
|
-
executor = await import("./execute-log-
|
|
46
|
+
executor = await import("./execute-log-Dm3DkQQP-BSjoy6Wd.mjs");
|
|
47
47
|
} catch (error) {
|
|
48
48
|
return notOk(executorLoadFailure("log", error));
|
|
49
49
|
}
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/control.mjs"],"sourcesContent":["import { c as executionDiagnostics, l as executorLoadFailure, n as devUrl, o as deploy, r as dev, t as devStop } from \"./dev-current-
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/control.mjs"],"sourcesContent":["import { c as executionDiagnostics, l as executorLoadFailure, n as devUrl, o as deploy, r as dev, t as devStop } from \"./dev-current-D0Kn6Mf4.mjs\";\nimport { n as RUN_REPORT_VERSION, t as RUN_REPORT_FILE_ENV } from \"./run-report-CmBz2-xc.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk } from \"@internal/foundation/result\";\n//#region src/operations/destroy.ts\n/**\n* The programmatic `destroy` operation (`@prisma/composer/control`): typed\n* input, structured result, no argv, no console, no process.exit. No CLI\n* command wraps it. The executor\n* loads lazily, so importing this module executes nothing; an executor that\n* fails to load comes back as a structured failure, never a throw out of\n* the host.\n*/\nasync function destroy(input) {\n\treturn destroyWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, for the unit tests.\n* Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function destroyWithDeps(input, deps) {\n\tif (typeof input.environment !== \"string\" || input.environment.length === 0) return notOk(environmentRequired());\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-Dh1CQ9X6.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"destroy\", error));\n\t}\n\treturn executor.executeDestroy(input, deps, cwd);\n}\nfunction environmentRequired() {\n\treturn new CliStructuredError(\"DEPLOY.ENVIRONMENT_REQUIRED\", \"destroy needs the name of the environment to destroy.\", {\n\t\twhy: \"Destroy never defaults to production, so a call without a name has no target.\",\n\t\tfix: \"Pass `environment`, for example `destroy({ environment: 'staging', config })`.\"\n\t});\n}\n//#endregion\n//#region src/operations/log.ts\nasync function log(input) {\n\treturn logWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, for the unit tests.\n* Deliberately NOT re-exported through `./control` — the seam\n* mirrors internal types and is not part of the published surface. */\nasync function logWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-log-Dm3DkQQP.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"log\", error));\n\t}\n\treturn executor.executeLog(input, deps, cwd);\n}\n//#endregion\nexport { RUN_REPORT_FILE_ENV, RUN_REPORT_VERSION, deploy, destroy, dev, devStop, devUrl, executionDiagnostics, log };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;AAaA,eAAe,QAAQ,OAAO;CAC7B,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACjC;;;;AAIA,eAAe,gBAAgB,OAAO,MAAM;CAC3C,IAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,YAAY,WAAW,GAAG,OAAO,MAAM,oBAAoB,CAAC;CAC/G,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,WAAW,KAAK,CAAC;CACnD;CACA,OAAO,SAAS,eAAe,OAAO,MAAM,GAAG;AAChD;AACA,SAAS,sBAAsB;CAC9B,OAAO,IAAI,mBAAmB,+BAA+B,yDAAyD;EACrH,KAAK;EACL,KAAK;CACN,CAAC;AACF;AAGA,eAAe,IAAI,OAAO;CACzB,OAAO,YAAY,OAAO,CAAC,CAAC;AAC7B;;;;AAIA,eAAe,YAAY,OAAO,MAAM;CACvC,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,OAAO,KAAK,CAAC;CAC/C;CACA,OAAO,SAAS,WAAW,OAAO,MAAM,GAAG;AAC5C"}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { S as slotsOf, l as isParamSource, m as nodeAddresses, t as Load } from "./graph-Bqr7PSGl-BM-M-TlO.mjs";
|
|
2
|
+
import { r as deserializeContainers } from "./container-transport-HcvNOGZL-twPi2TIv.mjs";
|
|
3
|
+
import * as Alchemy from "alchemy";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
//#region ../../0-framework/1-core/core/dist/deploy.mjs
|
|
7
|
+
var LowerError = class extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "LowerError";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function assertSameNodeAddresses(built, firstProcess) {
|
|
14
|
+
const onlyBuilt = built.filter((address) => !firstProcess.includes(address));
|
|
15
|
+
const onlyFirst = firstProcess.filter((address) => !built.includes(address));
|
|
16
|
+
if (onlyBuilt.length === 0 && onlyFirst.length === 0) return;
|
|
17
|
+
const list = (addresses) => addresses.length === 0 ? "none" : addresses.map((address) => `"${address}"`).join(", ");
|
|
18
|
+
throw new LowerError(`The deploy's second process built a different graph from the one Composer checked in its first process. Only in the second process: ${list(onlyBuilt)}. Only in the first process: ${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.`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolves one SERVICE-OWN param to its config value. The full resolution
|
|
22
|
+
* order across both value channels:
|
|
23
|
+
*
|
|
24
|
+
* 1. A param claiming BOTH a provision-time binding and a `provision` need
|
|
25
|
+
* (ADR-0031) is a loud error — two sources for one value.
|
|
26
|
+
* 2. A provision-time binding (a schema-validated literal, or an opaque
|
|
27
|
+
* `ParamSource` the target resolves at boot per ADR-0019) beats the
|
|
28
|
+
* declared `default`.
|
|
29
|
+
* 3. A framework-minted `provision` need is resolved per dependency EDGE
|
|
30
|
+
* against the consumer extension's registry — that path fills CONNECTION
|
|
31
|
+
* params in `buildConfig`'s inputs loop, never this function. A
|
|
32
|
+
* service-own param has no edge to mint against, so an unbound need here
|
|
33
|
+
* falls through like any unbound param.
|
|
34
|
+
* 4. The `default`, else absent (only legal when `optional`), else a loud
|
|
35
|
+
* error naming the param, the service, and the fix.
|
|
36
|
+
*/
|
|
37
|
+
function resolveParam(node, serviceId, name, param, bound) {
|
|
38
|
+
if (bound !== void 0) {
|
|
39
|
+
if (param.provision !== void 0) throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") has two sources claiming one value: a provision-time binding (${isParamSource(bound) ? "a param source" : "a literal value"}) AND a framework provision need ("${String(param.provision.brand)}") on its declaration — remove the binding or drop the \`provision\` facet.`);
|
|
40
|
+
if (isParamSource(bound)) return bound;
|
|
41
|
+
const result = param.schema["~standard"].validate(bound);
|
|
42
|
+
if (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.`);
|
|
43
|
+
if (result.issues !== void 0) {
|
|
44
|
+
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
45
|
+
throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") received an invalid provision-time value: ${messages}`);
|
|
46
|
+
}
|
|
47
|
+
return result.value;
|
|
48
|
+
}
|
|
49
|
+
if (param.default !== void 0) return param.default;
|
|
50
|
+
if (param.optional === true) return void 0;
|
|
51
|
+
throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") has no default, is not optional, and was not bound at provision — bind it with a literal value or a param source (e.g. envParam('NAME')) on its provision() call, or give it a default.`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Assembles a service's typed Config. Connection params come from the
|
|
55
|
+
* dependency edge's lowered outputs — or, for a param carrying a `provision`
|
|
56
|
+
* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints
|
|
57
|
+
* it, the producer hands nothing over. The service's own params resolve via
|
|
58
|
+
* `resolveParam` (provision-time binding, then default, then loud
|
|
59
|
+
* unbound-required failure).
|
|
60
|
+
*
|
|
61
|
+
* This is also where the connection contract is enforced: a producer that fails to
|
|
62
|
+
* supply a required param its consumer's connection declares fails the deploy
|
|
63
|
+
* here, naming the edge, rather than reaching the consumer as `undefined`.
|
|
64
|
+
*/
|
|
65
|
+
function buildConfig(node, id, graph, lowered, provisioned) {
|
|
66
|
+
const inputs = slotConnectionParams(node, id, graph, lowered, provisioned);
|
|
67
|
+
const boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));
|
|
68
|
+
const service = {};
|
|
69
|
+
for (const [name, param] of Object.entries(node.params)) {
|
|
70
|
+
const value = resolveParam(node, id, name, param, boundParams.get(name));
|
|
71
|
+
if (value !== void 0) service[name] = value;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
service,
|
|
75
|
+
inputs
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The connection params of each of a service's or resource's dependency
|
|
80
|
+
* slots, resolved against the producer's lowered outputs or the minted
|
|
81
|
+
* `provisioned` value, with the connection contract enforced (see `buildConfig`).
|
|
82
|
+
*/
|
|
83
|
+
function connectionInputs(ctx) {
|
|
84
|
+
return slotConnectionParams(ctx.node, ctx.id, ctx.graph, ctx.lowered, ctx.provisioned);
|
|
85
|
+
}
|
|
86
|
+
function slotConnectionParams(node, id, graph, lowered, provisioned) {
|
|
87
|
+
const inputs = {};
|
|
88
|
+
for (const [inputName, inputNode] of Object.entries(node.inputs)) {
|
|
89
|
+
const edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === "dependency");
|
|
90
|
+
const producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};
|
|
91
|
+
const values = {};
|
|
92
|
+
for (const [name, param] of Object.entries(inputNode.connection.params)) {
|
|
93
|
+
if (param.provision !== void 0) {
|
|
94
|
+
values[name] = provisioned.get(`${id}.${inputName}`);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const value = producedOutputs[name];
|
|
98
|
+
if (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.`);
|
|
99
|
+
values[name] = value;
|
|
100
|
+
}
|
|
101
|
+
inputs[inputName] = values;
|
|
102
|
+
}
|
|
103
|
+
return inputs;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Joins resolved report entries back to their graph nodes — the last step of a
|
|
107
|
+
* deploy report, run inside the Action with apply's resolved values.
|
|
108
|
+
*
|
|
109
|
+
* The entries cross Alchemy's action-input boundary, so they carry addresses
|
|
110
|
+
* and plain entities only; the graph is held by closure on this side. That
|
|
111
|
+
* split is why this join exists at all, and it is what keeps functions and
|
|
112
|
+
* Standard Schemas (which a node carries, and which the plan's input hash
|
|
113
|
+
* would have to serialize) out of the input.
|
|
114
|
+
*
|
|
115
|
+
* Skips an address the graph no longer holds: entries are data, the graph is
|
|
116
|
+
* truth.
|
|
117
|
+
*/
|
|
118
|
+
function joinDeployment(graph, entries) {
|
|
119
|
+
const nodes = [];
|
|
120
|
+
for (const entry of entries) {
|
|
121
|
+
const node = graph.nodes.find((n) => n.id === entry.address)?.node;
|
|
122
|
+
if (node === void 0 || node.kind !== "service" && node.kind !== "resource") continue;
|
|
123
|
+
nodes.push({
|
|
124
|
+
address: entry.address,
|
|
125
|
+
node,
|
|
126
|
+
entities: entry.entities
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return nodes;
|
|
130
|
+
}
|
|
131
|
+
function missingBundleError(id) {
|
|
132
|
+
return new LowerError(`No bundle provided for service "${id}" (opts.bundles["${id}"] is required).`);
|
|
133
|
+
}
|
|
134
|
+
/** The message `prisma dev` structures as `DEV.DEV_SERVER_UNSUPPORTED` (ADR-0056). */
|
|
135
|
+
function noReserveError(id, extension, type) {
|
|
136
|
+
return new LowerError(`service "${id}" runs a dev server but its descriptor (${extension}/${type}) has no \`reserve\` step`);
|
|
137
|
+
}
|
|
138
|
+
function unassembledWithBundleError(address) {
|
|
139
|
+
return new LowerError(`"${address}" is listed in opts.unassembled and also has a bundle in opts.bundles — a service is either assembled or not.`);
|
|
140
|
+
}
|
|
141
|
+
function unassembledNotServiceError(address) {
|
|
142
|
+
return new LowerError(`"${address}" is listed in opts.unassembled but is not a service in the graph.`);
|
|
143
|
+
}
|
|
144
|
+
function duplicateExtensionError(id) {
|
|
145
|
+
return new LowerError(`Extension "${id}" is listed more than once in \`extensions\` — each extension id must be unique.`);
|
|
146
|
+
}
|
|
147
|
+
/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */
|
|
148
|
+
function extensionsById(config) {
|
|
149
|
+
const map = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const extension of config.extensions) {
|
|
151
|
+
if (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));
|
|
152
|
+
map.set(extension.id, extension);
|
|
153
|
+
}
|
|
154
|
+
return Effect.succeed(map);
|
|
155
|
+
}
|
|
156
|
+
function unknownExtensionError(extension, id) {
|
|
157
|
+
return 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).`);
|
|
158
|
+
}
|
|
159
|
+
function unknownNodeTypeError(extension, type) {
|
|
160
|
+
return new LowerError(`Extension "${extension.id}" has no descriptor for node type "${type}" (known: ${Object.keys(extension.nodes).join(", ")}).`);
|
|
161
|
+
}
|
|
162
|
+
/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */
|
|
163
|
+
function unknownProvisionerError(extension, brand, edgeId) {
|
|
164
|
+
const known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(", ") : "(none registered)";
|
|
165
|
+
return new LowerError(`Extension "${extension.id}" has no provisioner for need "${String(brand)}" (needed by edge "${edgeId}") (known: ${known}).`);
|
|
166
|
+
}
|
|
167
|
+
/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */
|
|
168
|
+
function crossExtensionProvisionError(edgeId) {
|
|
169
|
+
return new LowerError(`Provisioned edge "${edgeId}" spans two extensions — cross-extension provisioned edges aren't supported yet.`);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* More than one provisioned param on one connection (ADR-0031). One edge mints
|
|
173
|
+
* ONE value, keyed by edge id, so a second need on the same connection would
|
|
174
|
+
* silently receive the first's value under the first's brand.
|
|
175
|
+
*/
|
|
176
|
+
function multipleProvisionedParamsError(edgeId, names) {
|
|
177
|
+
return new LowerError(`Connection input "${edgeId}" declares more than one provisioned param (${names.join(", ")}) — only one provisioned param per connection is supported.`);
|
|
178
|
+
}
|
|
179
|
+
function wrongKindError(extension, type, expected, got) {
|
|
180
|
+
return new LowerError(`Extension "${extension}"'s descriptor for node type "${type}" is a "${got}" descriptor — this node needs a "${expected}" descriptor.`);
|
|
181
|
+
}
|
|
182
|
+
/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */
|
|
183
|
+
function descriptorFor(extensions, node, id) {
|
|
184
|
+
const extension = extensions.get(node.extension);
|
|
185
|
+
if (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));
|
|
186
|
+
const descriptor = extension.nodes[node.type];
|
|
187
|
+
if (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));
|
|
188
|
+
if (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
|
|
189
|
+
return Effect.succeed(descriptor);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The state-layer precedence a deploy resolves to: an explicit opts.state
|
|
193
|
+
* always wins; failing that, the config's own (required) state descriptor,
|
|
194
|
+
* created with its owning extension's resolved container (`undefined` when
|
|
195
|
+
* that extension declared none). A pure function so the precedence is
|
|
196
|
+
* testable without booting Alchemy.
|
|
197
|
+
*/
|
|
198
|
+
function resolveStateLayer(opts, config, containers) {
|
|
199
|
+
return opts.state ?? config.state.create(containers.get(config.state.extension));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* All configured extensions' providers merged, config array order — an
|
|
203
|
+
* extension without `providers` is skipped; no used-extensions-only
|
|
204
|
+
* filtering (ADR-0017's pinned providers rule).
|
|
205
|
+
*/
|
|
206
|
+
function mergedProviders(config) {
|
|
207
|
+
const [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);
|
|
208
|
+
return first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
|
|
212
|
+
* Fails with LowerError or whatever an extension's lowering raises — the error type is open.
|
|
213
|
+
*/
|
|
214
|
+
function lowering(root, config, opts) {
|
|
215
|
+
return Effect.gen(function* () {
|
|
216
|
+
const graph = Load(root, {
|
|
217
|
+
id: opts.name,
|
|
218
|
+
...opts.environment !== void 0 ? { environment: { name: opts.environment } } : {},
|
|
219
|
+
...opts.appConfigurationRead !== void 0 ? { appConfigurationRead: opts.appConfigurationRead } : {}
|
|
220
|
+
});
|
|
221
|
+
if (opts.firstProcessNodeAddresses !== void 0) assertSameNodeAddresses(nodeAddresses(graph), opts.firstProcessNodeAddresses);
|
|
222
|
+
const extensions = yield* extensionsById(config);
|
|
223
|
+
const containers = deserializeContainers(config.extensions, process.env);
|
|
224
|
+
const lowered = /* @__PURE__ */ new Map();
|
|
225
|
+
const entries = [];
|
|
226
|
+
const provisioned = /* @__PURE__ */ new Map();
|
|
227
|
+
const applications = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const descriptor of config.extensions) {
|
|
229
|
+
if (descriptor.application === void 0) continue;
|
|
230
|
+
const appCtx = {
|
|
231
|
+
id: graph.root.id,
|
|
232
|
+
address: "",
|
|
233
|
+
node: graph.root.node,
|
|
234
|
+
graph,
|
|
235
|
+
opts,
|
|
236
|
+
application: void 0,
|
|
237
|
+
container: containers.get(descriptor.id),
|
|
238
|
+
lowered,
|
|
239
|
+
provisioned
|
|
240
|
+
};
|
|
241
|
+
applications.set(descriptor.id, yield* descriptor.application.provision(appCtx));
|
|
242
|
+
}
|
|
243
|
+
for (const edge of graph.edges) {
|
|
244
|
+
if (edge.kind !== "dependency") continue;
|
|
245
|
+
const consumer = graph.nodes.find((n) => n.id === edge.to)?.node;
|
|
246
|
+
if (consumer === void 0 || consumer.kind !== "service" && consumer.kind !== "resource") continue;
|
|
247
|
+
const slot = slotsOf(consumer)[edge.input];
|
|
248
|
+
if (slot === void 0) continue;
|
|
249
|
+
const provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);
|
|
250
|
+
if (provisionedParams.length === 0) continue;
|
|
251
|
+
const edgeId = `${edge.to}.${edge.input}`;
|
|
252
|
+
if (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));
|
|
253
|
+
const need = provisionedParams[0]?.[1].provision;
|
|
254
|
+
if (need === void 0) continue;
|
|
255
|
+
const provider = graph.nodes.find((n) => n.id === edge.from)?.node;
|
|
256
|
+
if (provider === void 0 || provider.kind !== "service" && provider.kind !== "resource") continue;
|
|
257
|
+
if (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));
|
|
258
|
+
const extension = extensions.get(consumer.extension);
|
|
259
|
+
if (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));
|
|
260
|
+
const provisioner = extension.provisions?.get(need.brand);
|
|
261
|
+
if (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));
|
|
262
|
+
const ref = yield* provisioner.provision({
|
|
263
|
+
app: graph.root.id,
|
|
264
|
+
edgeId,
|
|
265
|
+
consumerAddress: edge.to,
|
|
266
|
+
providerAddress: edge.from,
|
|
267
|
+
input: edge.input,
|
|
268
|
+
need
|
|
269
|
+
});
|
|
270
|
+
provisioned.set(edgeId, ref);
|
|
271
|
+
}
|
|
272
|
+
const unassembled = new Set(opts.unassembled ?? []);
|
|
273
|
+
for (const address of unassembled) {
|
|
274
|
+
if (address in opts.bundles) return yield* Effect.fail(unassembledWithBundleError(address));
|
|
275
|
+
const found = graph.nodes.find((n) => n.id === address);
|
|
276
|
+
if (found === void 0 || found.node.kind !== "service") return yield* Effect.fail(unassembledNotServiceError(address));
|
|
277
|
+
}
|
|
278
|
+
const services = /* @__PURE__ */ new Map();
|
|
279
|
+
const ctxFor = (id, node) => ({
|
|
280
|
+
id,
|
|
281
|
+
address: id,
|
|
282
|
+
node,
|
|
283
|
+
graph,
|
|
284
|
+
opts,
|
|
285
|
+
application: applications.get(node.extension),
|
|
286
|
+
container: containers.get(node.extension),
|
|
287
|
+
lowered,
|
|
288
|
+
provisioned,
|
|
289
|
+
services
|
|
290
|
+
});
|
|
291
|
+
for (const { id, node } of graph.nodes) {
|
|
292
|
+
if (node.kind !== "service") continue;
|
|
293
|
+
const descriptor = yield* descriptorFor(extensions, node, id);
|
|
294
|
+
if (descriptor.kind !== "service") continue;
|
|
295
|
+
services.set(id, yield* descriptor.provision(ctxFor(id, node)));
|
|
296
|
+
}
|
|
297
|
+
for (const { id, node } of graph.nodes) {
|
|
298
|
+
if (node.kind === "module") continue;
|
|
299
|
+
if (node.kind === "dependency") continue;
|
|
300
|
+
const ctx = ctxFor(id, node);
|
|
301
|
+
const descriptor = yield* descriptorFor(extensions, node, id);
|
|
302
|
+
if (descriptor.kind === "resource") {
|
|
303
|
+
const result = yield* descriptor(ctx);
|
|
304
|
+
lowered.set(id, result.outputs);
|
|
305
|
+
entries.push({
|
|
306
|
+
address: id,
|
|
307
|
+
entities: result.entities
|
|
308
|
+
});
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (descriptor.kind !== "service") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
|
|
312
|
+
const service = node;
|
|
313
|
+
const provisionedNode = services.get(id);
|
|
314
|
+
const typedConfig = buildConfig(service, id, graph, lowered, provisioned);
|
|
315
|
+
const serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);
|
|
316
|
+
if (unassembled.has(id)) {
|
|
317
|
+
if (descriptor.reserve === void 0) return yield* Effect.fail(noReserveError(id, node.extension, node.type));
|
|
318
|
+
const result = yield* descriptor.reserve(ctx, provisionedNode, serialized);
|
|
319
|
+
lowered.set(id, result.outputs);
|
|
320
|
+
entries.push({
|
|
321
|
+
address: id,
|
|
322
|
+
entities: result.entities
|
|
323
|
+
});
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const bundle = opts.bundles[id];
|
|
327
|
+
if (bundle === void 0) return yield* Effect.fail(missingBundleError(id));
|
|
328
|
+
const artifact = yield* descriptor.package(ctx, {
|
|
329
|
+
assembled: {
|
|
330
|
+
dir: bundle.dir,
|
|
331
|
+
entry: bundle.entry
|
|
332
|
+
},
|
|
333
|
+
address: id
|
|
334
|
+
});
|
|
335
|
+
const result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);
|
|
336
|
+
lowered.set(id, result.outputs);
|
|
337
|
+
entries.push({
|
|
338
|
+
address: id,
|
|
339
|
+
entities: result.entities
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
if (opts.report !== void 0) {
|
|
343
|
+
const report = opts.report;
|
|
344
|
+
yield* Alchemy.Action("composer-deployment-report", (input) => Effect.sync(() => {
|
|
345
|
+
report({
|
|
346
|
+
app: opts.name,
|
|
347
|
+
nodes: joinDeployment(graph, input.entries)
|
|
348
|
+
});
|
|
349
|
+
}))({
|
|
350
|
+
nonce: Date.now(),
|
|
351
|
+
entries
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The whole-stack wrapper: Load → route each node through the config's
|
|
358
|
+
* extension registries → an Alchemy Stack (the default export the alchemy
|
|
359
|
+
* CLI consumes).
|
|
360
|
+
*/
|
|
361
|
+
function lower(root, config, opts) {
|
|
362
|
+
const stackEffect = Effect.orDie(lowering(root, config, opts));
|
|
363
|
+
const containers = deserializeContainers(config.extensions, process.env);
|
|
364
|
+
const providers = opts.providers ?? mergedProviders(config);
|
|
365
|
+
return Alchemy.Stack(opts.name, {
|
|
366
|
+
providers,
|
|
367
|
+
state: resolveStateLayer(opts, config, containers)
|
|
368
|
+
}, stackEffect);
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
371
|
+
export { lower as a, resolveStateLayer as c, joinDeployment as i, buildConfig as n, lowering as o, connectionInputs as r, mergedProviders as s, LowerError as t };
|
|
372
|
+
|
|
373
|
+
//# sourceMappingURL=deploy-CmiYExQA.mjs.map
|