@prisma/composer-cli 0.39.0-dev.11 → 0.39.0-dev.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{app-converge-bS1l9jIf-B1FOgxBQ.mjs → app-converge-CHMILMYi-Duhv9T-w.mjs} +5 -5
  2. package/dist/app-converge-CHMILMYi-Duhv9T-w.mjs.map +1 -0
  3. package/dist/{composer-config-QKdY85G--CEXrb2Uc.mjs → composer-config-aL0W4HPG-CTpDJKz4.mjs} +3 -3
  4. package/dist/composer-config-aL0W4HPG-CTpDJKz4.mjs.map +1 -0
  5. package/dist/{deploy-Br1yvLe3.mjs → deploy-Cu7Wtrf0.mjs} +6 -6
  6. package/dist/deploy-Cu7Wtrf0.mjs.map +1 -0
  7. package/dist/{dev-converge-messages-DML4rTz7-B6uxtpZG.mjs → dev-converge-messages-CElmPylA-6X7D08mQ.mjs} +6 -6
  8. package/dist/dev-converge-messages-CElmPylA-6X7D08mQ.mjs.map +1 -0
  9. package/dist/dev-converge-worker.mjs +4 -4
  10. package/dist/dev-converge-worker.mjs.map +1 -1
  11. package/dist/{dev-current-lAlj53eX-DvAHNZFo.mjs → dev-current-C7R8uqyQ-CgyoTX9q.mjs} +7 -7
  12. package/dist/dev-current-C7R8uqyQ-CgyoTX9q.mjs.map +1 -0
  13. package/dist/{dev-environment-name-6eEr5PW8-CCY7WNWz.mjs → dev-environment-name-6eEr5PW8-DSJ7HrEe.mjs} +2 -3
  14. package/dist/{dev-environment-name-6eEr5PW8-CCY7WNWz.mjs.map → dev-environment-name-6eEr5PW8-DSJ7HrEe.mjs.map} +1 -1
  15. package/dist/{dist-C0OGaDnj.mjs → dist-CZTXNHtS.mjs} +1 -2
  16. package/dist/{dist-C0OGaDnj.mjs.map → dist-CZTXNHtS.mjs.map} +1 -1
  17. package/dist/execute-deploy-destroy-BIRdFfwR-Czj9JB8M.mjs +517 -0
  18. package/dist/execute-deploy-destroy-BIRdFfwR-Czj9JB8M.mjs.map +1 -0
  19. package/dist/{execute-dev-DnVmNpc1-BzK9Qns_.mjs → execute-dev-D9PxdbV3-D-pdqLmO.mjs} +11 -13
  20. package/dist/execute-dev-D9PxdbV3-D-pdqLmO.mjs.map +1 -0
  21. package/dist/{execute-dev-current-CZdmxVQ4-DxDflvNG.mjs → execute-dev-current-BghQ0HLe-BY5COM8c.mjs} +6 -7
  22. package/dist/{execute-dev-current-CZdmxVQ4-DxDflvNG.mjs.map → execute-dev-current-BghQ0HLe-BY5COM8c.mjs.map} +1 -1
  23. package/dist/{family-DfwviKFj-CS1L-EvS.d.mts → family-5lQ0X01--mh7Vm2zv.d.mts} +74 -129
  24. package/dist/family-5lQ0X01--mh7Vm2zv.d.mts.map +1 -0
  25. package/dist/family.d.mts +1 -1
  26. package/dist/family.mjs +17 -11
  27. package/dist/family.mjs.map +1 -1
  28. package/dist/{list-deployed-D6vTzpWu.mjs → list-deployed-COZmPVO2.mjs} +3 -3
  29. package/dist/{list-deployed-D6vTzpWu.mjs.map → list-deployed-COZmPVO2.mjs.map} +1 -1
  30. package/dist/{local-target-CZzICh5R.mjs → local-target-bTjNRplR.mjs} +31 -3
  31. package/dist/local-target-bTjNRplR.mjs.map +1 -0
  32. package/dist/{redaction-DY6eDC12-BrK1aSN5.mjs → redaction-DHaXoToJ-zcuc7Sgf.mjs} +5 -5
  33. package/dist/redaction-DHaXoToJ-zcuc7Sgf.mjs.map +1 -0
  34. package/dist/{steps-BZXNqW6U-BM2Aa8Bp.mjs → steps-Det-FSAL-4BEaFT3G.mjs} +5 -118
  35. package/dist/steps-Det-FSAL-4BEaFT3G.mjs.map +1 -0
  36. package/dist/testing.d.mts +1 -1
  37. package/dist/{validate-environment-DCZiNSlR-idVge-kq.mjs → validate-environment-BevPErw8-BRVXeBjT.mjs} +6 -6
  38. package/dist/{validate-environment-DCZiNSlR-idVge-kq.mjs.map → validate-environment-BevPErw8-BRVXeBjT.mjs.map} +1 -1
  39. package/package.json +7 -8
  40. package/dist/app-config-CErnR6NK-DnKH4Kqc.mjs +0 -32
  41. package/dist/app-config-CErnR6NK-DnKH4Kqc.mjs.map +0 -1
  42. package/dist/app-converge-bS1l9jIf-B1FOgxBQ.mjs.map +0 -1
  43. package/dist/composer-config-QKdY85G--CEXrb2Uc.mjs.map +0 -1
  44. package/dist/deploy-Br1yvLe3.mjs.map +0 -1
  45. package/dist/dev-converge-messages-DML4rTz7-B6uxtpZG.mjs.map +0 -1
  46. package/dist/dev-current-lAlj53eX-DvAHNZFo.mjs.map +0 -1
  47. package/dist/execute-deploy-destroy-DN16ETAk-CzORriUO.mjs +0 -893
  48. package/dist/execute-deploy-destroy-DN16ETAk-CzORriUO.mjs.map +0 -1
  49. package/dist/execute-dev-DnVmNpc1-BzK9Qns_.mjs.map +0 -1
  50. package/dist/family-DfwviKFj-CS1L-EvS.d.mts.map +0 -1
  51. package/dist/local-target-CZzICh5R.mjs.map +0 -1
  52. package/dist/preflight-transport-2d6iIchu-ArIJUY1L.mjs +0 -56
  53. package/dist/preflight-transport-2d6iIchu-ArIJUY1L.mjs.map +0 -1
  54. package/dist/redaction-DY6eDC12-BrK1aSN5.mjs.map +0 -1
  55. package/dist/steps-BZXNqW6U-BM2Aa8Bp.mjs.map +0 -1
@@ -0,0 +1,517 @@
1
+ import { t as InternalError } from "./internal-error-Dfur7Zqt-B8J8e7ac.mjs";
2
+ import { f as nodeAddresses } from "./deploy-Cu7Wtrf0.mjs";
3
+ import { t as CliStructuredError } from "./errors-CVYwN2km.mjs";
4
+ import { a as redactError, c as redactUnsetPlatformVariable, o as redactSummary, r as credentialLookingValues, s as redactThrown, t as SecretRedaction } from "./redaction-DHaXoToJ-zcuc7Sgf.mjs";
5
+ import { n as ok, r as okVoid, t as notOk } from "./result-CttmabB6.mjs";
6
+ import { c as toStructured, n as convergeReasonsText, s as requireContainerForEnvironment } from "./dev-current-C7R8uqyQ-CgyoTX9q.mjs";
7
+ import { t as loadAppConvergeEntry } from "./app-converge-CHMILMYi-Duhv9T-w.mjs";
8
+ import { i as validateEnvironmentName, r as runPipeline } from "./validate-environment-BevPErw8-BRVXeBjT.mjs";
9
+ import { a as reportConvergeEvent, c as withComposerAdvice, i as refuseSecretsInRootInput, n as interactionMessages, o as stepTracker, s as toDeploymentSummary, t as capFailureCause } from "./steps-Det-FSAL-4BEaFT3G.mjs";
10
+ import * as fs from "node:fs";
11
+ import * as path from "node:path";
12
+ //#region ../../0-framework/3-tooling/cli/dist/run-report-HI2JqCSO.mjs
13
+ /** Names the file to write the run report to, when `--report` is not passed. */
14
+ const RUN_REPORT_FILE_ENV = "PRISMA_COMPOSER_REPORT_FILE";
15
+ function toRunReport(input) {
16
+ return {
17
+ version: 2,
18
+ outcome: input.failure === void 0 ? "succeeded" : "failed",
19
+ app: input.summary?.app ?? null,
20
+ environment: input.environment,
21
+ nodes: input.summary?.nodes ?? [],
22
+ failure: input.failure ?? null
23
+ };
24
+ }
25
+ /**
26
+ * The path to write to: the `--report` flag first, then the env var. Relative
27
+ * paths resolve against the deploy's cwd. `undefined` means no report was
28
+ * asked for, which is the common case and writes nothing.
29
+ */
30
+ function resolveRunReportPath(flag, env, cwd) {
31
+ const requested = flag !== void 0 && flag.length > 0 ? flag : env;
32
+ if (requested === void 0 || requested.length === 0) return void 0;
33
+ return path.resolve(cwd, requested);
34
+ }
35
+ /**
36
+ * Writes the report, creating the parent directory if needed. A write failure
37
+ * warns and returns false rather than failing a deploy that already
38
+ * converged — but it is never silent, because the operator asked for this
39
+ * file and a consumer is waiting on it.
40
+ */
41
+ function writeRunReport(filePath, report) {
42
+ try {
43
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
44
+ fs.writeFileSync(filePath, `${JSON.stringify(report, null, 2)}\n`);
45
+ return true;
46
+ } catch (error) {
47
+ const detail = error instanceof Error ? error.message : String(error);
48
+ console.warn(`\nCould not write the run report to ${filePath}: ${detail}`);
49
+ return false;
50
+ }
51
+ }
52
+ //#endregion
53
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-BIRdFfwR.mjs
54
+ /**
55
+ * The deploy/destroy executor — main.ts's pipeline orchestration with argv,
56
+ * console, and exit codes removed: typed inputs in, structured results out.
57
+ * Reached only by lazy import from deploy.ts/destroy.ts — this module's
58
+ * static graph transitively loads alchemy's provider tree, so the control
59
+ * entry must never import it statically.
60
+ */
61
+ const ALCHEMY_STATE_DIR = ".alchemy";
62
+ /** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */
63
+ function hasNoLocalDeployState(cwd) {
64
+ const stateDir = path.join(cwd, ALCHEMY_STATE_DIR);
65
+ return !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);
66
+ }
67
+ /** Times each step for the host's `onEvent`. A step still open when the run fails is closed as failed, innermost first. */
68
+ function stackSteps(onEvent) {
69
+ return stepTracker((step) => step.name === "assemble-service" ? `${step.name}:${step.address}` : step.name === "apply-resource" ? `${step.name}:${step.resourceId}` : step.name, onEvent);
70
+ }
71
+ async function executeDeploy(input, deps, cwd) {
72
+ const outcome = await runStackPipeline({
73
+ action: "deploy",
74
+ steps: stackSteps(input.onEvent)
75
+ }, {
76
+ entry: input.entry,
77
+ config: input.config,
78
+ name: input.name,
79
+ environment: input.environment ?? "production",
80
+ cwd,
81
+ deps,
82
+ reportId: input.reportId,
83
+ reportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),
84
+ signal: input.signal,
85
+ redaction: deps.redaction ?? new SecretRedaction(process.env)
86
+ });
87
+ if (!outcome.ok) return outcome;
88
+ return ok({ summary: outcome.value });
89
+ }
90
+ async function executeDestroy(input, deps, cwd) {
91
+ const outcome = await runStackPipeline({
92
+ action: "destroy",
93
+ steps: stackSteps(input.onEvent)
94
+ }, {
95
+ entry: input.entry,
96
+ config: input.config,
97
+ name: input.name,
98
+ environment: input.environment,
99
+ cwd,
100
+ deps,
101
+ reportId: void 0,
102
+ reportPath: void 0,
103
+ signal: input.signal,
104
+ redaction: deps.redaction ?? new SecretRedaction(process.env)
105
+ });
106
+ if (!outcome.ok) return outcome;
107
+ return okVoid();
108
+ }
109
+ /**
110
+ * Opens a session per extension that declares a reporter. A `begin` that
111
+ * throws costs that extension its reporting and nothing else — the deploy
112
+ * has not started, and refusing to run it because an observer failed would
113
+ * invert the relationship.
114
+ */
115
+ async function beginReporters(extensions, context, redaction) {
116
+ return (await Promise.all(extensions.map(async (extension) => {
117
+ if (extension.reporter === void 0) return void 0;
118
+ try {
119
+ const reporter = await extension.reporter.begin(context);
120
+ return reporter === void 0 ? void 0 : {
121
+ extensionId: extension.id,
122
+ reporter
123
+ };
124
+ } catch (error) {
125
+ const detail = error instanceof Error ? error.message : String(error);
126
+ console.warn(`\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);
127
+ return;
128
+ }
129
+ }))).filter((entry) => entry !== void 0);
130
+ }
131
+ /** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */
132
+ async function attachReporters(reporters, containers, redaction) {
133
+ await Promise.all(reporters.map(async ({ extensionId, reporter }) => {
134
+ try {
135
+ await reporter.attach({ container: containers.get(extensionId) });
136
+ } catch (error) {
137
+ const detail = error instanceof Error ? error.message : String(error);
138
+ console.warn(`\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);
139
+ }
140
+ }));
141
+ }
142
+ /** Every session's contribution to the apply's environment, so reporting that happens inside the apply can find the run. */
143
+ function reporterEnv(reporters, redaction) {
144
+ const env = {};
145
+ for (const { extensionId, reporter } of reporters) try {
146
+ Object.assign(env, reporter.childEnv());
147
+ } catch (error) {
148
+ const detail = error instanceof Error ? error.message : String(error);
149
+ console.warn(`\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);
150
+ }
151
+ return env;
152
+ }
153
+ /** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */
154
+ function truncate(value, limit) {
155
+ return value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;
156
+ }
157
+ /** An interrupted converge — reported as `cancelled`, never as `failed`. */
158
+ function wasInterrupted(failure) {
159
+ return failure.code === "DEPLOY.INTERRUPTED";
160
+ }
161
+ /**
162
+ * Ends every reporting session, whatever the run did. Sessions never reject
163
+ * by contract, but a buggy one must not turn a converged deploy into a
164
+ * failure — so this swallows anyway, and reports each session independently
165
+ * so one bad implementation cannot silence another.
166
+ */
167
+ async function finishReporters(reporters, outcome, redaction) {
168
+ const entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];
169
+ await Promise.all(reporters.map(async ({ reporter }) => {
170
+ try {
171
+ await reporter.finish({
172
+ ok: outcome.ok,
173
+ cancelled: outcome.cancelled,
174
+ failingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),
175
+ errorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),
176
+ entities
177
+ });
178
+ } catch (error) {
179
+ const detail = error instanceof Error ? error.message : String(error);
180
+ console.warn(`\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);
181
+ }
182
+ }));
183
+ }
184
+ /**
185
+ * Owns the reporting sessions around the pipeline: the inner run opens them
186
+ * once it knows which extensions are configured, and this closes them on
187
+ * every exit path — a returned failure, a success, or a thrown defect — as
188
+ * the `record` step, which also writes the run report.
189
+ * Nothing here can change what the pipeline returns.
190
+ */
191
+ async function runStackPipeline(run, opts) {
192
+ const steps = run.steps;
193
+ const reporters = [];
194
+ let outcome;
195
+ try {
196
+ outcome = await runStackPipelineInner(run, opts, reporters);
197
+ } catch (error) {
198
+ steps.closeOpen("failed");
199
+ steps.start({ name: "record" });
200
+ const thrown = redactThrown(error, opts.redaction);
201
+ await finishReporters(reporters, {
202
+ ok: false,
203
+ cancelled: false,
204
+ code: "DEPLOY.UNEXPECTED",
205
+ message: thrown.message
206
+ }, opts.redaction);
207
+ steps.finish({ name: "record" });
208
+ throw thrown;
209
+ }
210
+ if (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));
211
+ if (!outcome.ok) steps.closeOpen("failed");
212
+ steps.start({ name: "record" });
213
+ await finishReporters(reporters, outcome.ok ? {
214
+ ok: true,
215
+ cancelled: false,
216
+ summary: outcome.value
217
+ } : {
218
+ ok: false,
219
+ cancelled: wasInterrupted(outcome.failure),
220
+ code: outcome.failure.code,
221
+ message: outcome.failure.message
222
+ }, opts.redaction);
223
+ if (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({
224
+ summary: outcome.ok ? outcome.value : void 0,
225
+ environment: opts.environment,
226
+ failure: outcome.ok ? void 0 : {
227
+ code: outcome.failure.code,
228
+ message: outcome.failure.message
229
+ }
230
+ }))) steps.finish({ name: "record" });
231
+ else steps.fail({ name: "record" });
232
+ return outcome;
233
+ }
234
+ /** The pipeline both actions share: validate, load, assemble, resolve
235
+ * containers, then the in-process converge; deploy runs its preflight before
236
+ * the converge, and destroy its teardowns and container removals after it.
237
+ * The value is only ever a summary for deploy. */
238
+ async function runStackPipelineInner(run, opts, reporters) {
239
+ const { entry, config: composerConfig, name, environment, cwd, deps } = opts;
240
+ const { action } = run;
241
+ const steps = run.steps;
242
+ steps.start({ name: "prepare" });
243
+ try {
244
+ validateEnvironmentName(environment);
245
+ } catch (error) {
246
+ if (CliStructuredError.is(error)) return notOk(error);
247
+ throw error;
248
+ }
249
+ if (run.action === "destroy" && hasNoLocalDeployState(cwd)) run.steps.emit({
250
+ kind: "no-local-deploy-state",
251
+ cwd
252
+ });
253
+ const loaded = await prepareAppConvergeEntry(deps, path.dirname(path.resolve(cwd, composerConfig.file)));
254
+ if (!loaded.ok) return loaded;
255
+ const appConvergeEntry = loaded.value;
256
+ const platformCredentials = deps.credentials;
257
+ let pipeline;
258
+ let containers;
259
+ let alchemyStage;
260
+ const preflightPayloads = /* @__PURE__ */ new Map();
261
+ const unset = [];
262
+ try {
263
+ pipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {
264
+ runAssembler: deps.runAssembler,
265
+ readSecrets: action === "deploy",
266
+ redaction: opts.redaction,
267
+ onEvent: (event) => {
268
+ switch (event.kind) {
269
+ case "loaded":
270
+ steps.finish({ name: "prepare" });
271
+ steps.start({ name: "assemble" });
272
+ return;
273
+ case "service-started":
274
+ steps.start({
275
+ name: "assemble-service",
276
+ address: event.address
277
+ });
278
+ return;
279
+ case "service-assembled":
280
+ steps.finish({
281
+ name: "assemble-service",
282
+ address: event.address
283
+ }, event.data);
284
+ return;
285
+ }
286
+ }
287
+ }, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
288
+ why: "Destroy runs the same preparation as deploy before it locates the environment, and that preparation assembles the built app.",
289
+ fix: "Run the build, then retry the destroy.",
290
+ cause: error
291
+ }) : void 0);
292
+ steps.finish({ name: "assemble" });
293
+ const { graph, name: resolvedName } = pipeline;
294
+ const config = pipeline.configSource.value;
295
+ if (action === "deploy") refuseSecretsInRootInput(graph.appConfigurationRead, opts.redaction.knownSecrets, "A deploy sends every plain value Load read to the platform as plain configuration, and never sends a secret that way.");
296
+ steps.start({ name: "connect" });
297
+ if (action === "deploy") reporters.push(...await beginReporters(config.extensions, {
298
+ appName: resolvedName,
299
+ graph,
300
+ environment,
301
+ cwd,
302
+ reportId: opts.reportId,
303
+ credentials: platformCredentials
304
+ }, opts.redaction));
305
+ containers = /* @__PURE__ */ new Map();
306
+ for (const extension of config.extensions) {
307
+ if (extension.container === void 0) continue;
308
+ try {
309
+ if (action === "deploy") {
310
+ const instance = await extension.container.ensure({
311
+ appName: resolvedName,
312
+ environment
313
+ }, platformCredentials);
314
+ requireContainerForEnvironment(action, extension.id, extension.container, instance, environment);
315
+ containers.set(extension.id, instance);
316
+ } else {
317
+ const instance = await extension.container.locate({
318
+ appName: resolvedName,
319
+ environment
320
+ }, platformCredentials);
321
+ if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: "Deploy it first." });
322
+ requireContainerForEnvironment(action, extension.id, extension.container, instance, environment);
323
+ containers.set(extension.id, instance);
324
+ }
325
+ } catch (error) {
326
+ throw toStructured("DEPLOY.CONTAINER_FAILED", error);
327
+ }
328
+ }
329
+ await attachReporters(reporters, containers, opts.redaction);
330
+ alchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;
331
+ steps.finish({ name: "connect" });
332
+ if (run.action === "deploy") {
333
+ run.steps.start({ name: "preflight" });
334
+ let checked = 0;
335
+ const report = (reported) => {
336
+ checked += reported.checked;
337
+ unset.push(...reported.unset.map((variable) => redactUnsetPlatformVariable(variable, opts.redaction)));
338
+ };
339
+ for (const extension of config.extensions) {
340
+ if (extension.preflight === void 0) continue;
341
+ try {
342
+ const payload = await extension.preflight({
343
+ graph,
344
+ container: containers.get(extension.id),
345
+ environment,
346
+ configuration: pipeline.configuration,
347
+ secrets: pipeline.secrets,
348
+ credentials: platformCredentials,
349
+ report
350
+ });
351
+ if (payload !== void 0) preflightPayloads.set(extension.id, payload);
352
+ } catch (error) {
353
+ throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
354
+ }
355
+ }
356
+ run.steps.finish({ name: "preflight" }, {
357
+ checked,
358
+ unset: unset.length
359
+ });
360
+ if (unset.length > 0) run.steps.emit({
361
+ kind: "preflight-findings",
362
+ findings: { unset }
363
+ });
364
+ }
365
+ } catch (error) {
366
+ if (CliStructuredError.is(error)) return notOk(error);
367
+ throw error;
368
+ }
369
+ const converged = await convergeStack(action, opts, steps, pipeline, appConvergeEntry, {
370
+ containers,
371
+ stage: alchemyStage,
372
+ preflightPayloads,
373
+ findings: { unset },
374
+ env: action === "deploy" ? reporterEnv(reporters, opts.redaction) : {}
375
+ });
376
+ if (action === "deploy" || !converged.ok) return converged;
377
+ try {
378
+ for (const extension of pipeline.configSource.value.extensions) {
379
+ if (extension.teardown === void 0) continue;
380
+ try {
381
+ await extension.teardown({
382
+ container: containers.get(extension.id),
383
+ environment
384
+ });
385
+ } catch (error) {
386
+ throw toStructured("DEPLOY.TEARDOWN_FAILED", error);
387
+ }
388
+ }
389
+ for (const extension of pipeline.configSource.value.extensions) {
390
+ if (extension.container === void 0) continue;
391
+ const instance = containers.get(extension.id);
392
+ if (instance === void 0) continue;
393
+ try {
394
+ await extension.container.remove(instance, platformCredentials);
395
+ } catch (error) {
396
+ throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
397
+ }
398
+ }
399
+ } catch (error) {
400
+ if (CliStructuredError.is(error)) return notOk(error);
401
+ throw error;
402
+ }
403
+ return ok(void 0);
404
+ }
405
+ /** Loaded before anything is created, so a missing or incompatible install fails first. */
406
+ async function prepareAppConvergeEntry(deps, appDir) {
407
+ try {
408
+ return ok(deps.appConvergeEntry ?? await loadAppConvergeEntry(appDir));
409
+ } catch (error) {
410
+ if (CliStructuredError.is(error)) return notOk(error);
411
+ throw error;
412
+ }
413
+ }
414
+ const WORDS = {
415
+ deploy: {
416
+ action: "deploy",
417
+ Action: "Deploy"
418
+ },
419
+ destroy: {
420
+ action: "destroy",
421
+ Action: "Destroy"
422
+ }
423
+ };
424
+ /** The structured failure a converge that did not apply settles as. */
425
+ function convergeFailure(action, outcome, redact) {
426
+ const words = WORDS[action];
427
+ switch (outcome.kind) {
428
+ case "interrupted": return new CliStructuredError("DEPLOY.INTERRUPTED", `The ${words.action} was interrupted.`, {
429
+ why: "It stopped while Alchemy planned or applied it. Resources it had already changed stay as they are.",
430
+ fix: `${words.Action} again to finish.`
431
+ });
432
+ case "refused": return outcome.reason === "already-running" ? new CliStructuredError("DEPLOY.CONVERGE_RUNNING", "Another deploy, destroy or `prisma dev` converge is already running in this process.", {
433
+ why: `A ${words.action} sets the process's environment and working directory while Alchemy runs, so two cannot overlap.`,
434
+ fix: `Wait for the other one to finish, or run this ${words.action} in its own process.`
435
+ }) : new CliStructuredError("DEPLOY.WORKER_THREAD", `${words.Action} cannot run in a worker thread when its cwd is not the process working directory.`, {
436
+ why: "Alchemy reads `.env` and keeps `.alchemy` in the working directory, and a worker thread cannot change it.",
437
+ fix: `Call ${words.action} from the main thread, or with the process's working directory as its cwd.`
438
+ });
439
+ case "failed": {
440
+ const cause = capFailureCause(redact(withComposerAdvice(convergeReasonsText(outcome.reasons))));
441
+ return new CliStructuredError("DEPLOY.ENGINE_FAILED", `Alchemy could not ${words.action} the app.\n${cause}`, { meta: {
442
+ engineCause: cause,
443
+ reasons: outcome.reasons.map(({ tag, message }) => ({
444
+ tag,
445
+ message: redact(message)
446
+ }))
447
+ } });
448
+ }
449
+ }
450
+ return new CliStructuredError("DEPLOY.ENGINE_FAILED", "The converge ended with an outcome this Composer does not know.");
451
+ }
452
+ /**
453
+ * Lowers the app with the containers and preflight payloads this run
454
+ * resolved, then plans and applies `action` in this process. A deploy's
455
+ * report hook runs inside the apply, here, so its summary comes back as a
456
+ * value.
457
+ */
458
+ async function convergeStack(action, opts, steps, pipeline, entry, resolved) {
459
+ const { cwd, environment } = opts;
460
+ const config = pipeline.configSource.value;
461
+ const env = resolved.env;
462
+ opts.redaction.addCredentialLookingValues(credentialLookingValues(env));
463
+ const redact = (text) => opts.redaction.redact(text);
464
+ let summary;
465
+ const report = (result) => {
466
+ summary = toDeploymentSummary(result);
467
+ };
468
+ const root = pipeline.graph.root.node;
469
+ if (root.kind !== "module") throw new InternalError("runPipeline admitted a root that is not a module");
470
+ steps.start({ name: "apply" });
471
+ let stack;
472
+ try {
473
+ stack = entry.lower(root, config, {
474
+ name: pipeline.name,
475
+ environment,
476
+ appConfigurationRead: pipeline.graph.appConfigurationRead,
477
+ preparedNodeAddresses: nodeAddresses(pipeline.graph),
478
+ bundles: pipeline.assembled.bundles,
479
+ containers: resolved.containers,
480
+ preflightPayloads: resolved.preflightPayloads,
481
+ findings: resolved.findings,
482
+ credentials: opts.deps.credentials,
483
+ ...action === "deploy" ? { report } : {}
484
+ });
485
+ } catch (error) {
486
+ if (CliStructuredError.is(error)) return notOk(error);
487
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", redact(error instanceof Error ? error.message : String(error))));
488
+ }
489
+ const output = interactionMessages(steps, opts.redaction);
490
+ let outcome;
491
+ try {
492
+ outcome = await entry.converge({
493
+ operation: action,
494
+ stack,
495
+ stage: resolved.stage,
496
+ cwd,
497
+ env,
498
+ signal: opts.signal,
499
+ onEvent: (event) => reportConvergeEvent(steps, event, redact, (resource) => ({
500
+ name: "apply-resource",
501
+ ...resource
502
+ })),
503
+ output: (text) => output.push(text)
504
+ });
505
+ } catch (error) {
506
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", redact(`Alchemy could not ${action} the app.\n${error instanceof Error ? error.message : String(error)}`)));
507
+ } finally {
508
+ output.end();
509
+ }
510
+ if (outcome.kind !== "applied") return notOk(convergeFailure(action, outcome, redact));
511
+ steps.finish({ name: "apply" });
512
+ return ok(redactSummary(summary, opts.redaction));
513
+ }
514
+ //#endregion
515
+ export { executeDeploy, executeDestroy };
516
+
517
+ //# sourceMappingURL=execute-deploy-destroy-BIRdFfwR-Czj9JB8M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-deploy-destroy-BIRdFfwR-Czj9JB8M.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/run-report-HI2JqCSO.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-BIRdFfwR.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/run-report.ts\n/**\n* The run report: one deploy's outcome as JSON, for tools that consume a\n* deploy rather than watch one — the Prisma GitHub Action reads it to build a\n* pull-request comment carrying preview links.\n*\n* Deliberately separate from `deployment-summary.ts`, the summary the\n* operation returns as a value. This one is written where the operator asked\n* for it, survives the run, is written on the failure path too, and carries a\n* version so a consumer can depend on its shape.\n*/\n/** Bump when a change would break a consumer that reads the current shape. */\nconst RUN_REPORT_VERSION = 2;\n/** Names the file to write the run report to, when `--report` is not passed. */\nconst RUN_REPORT_FILE_ENV = \"PRISMA_COMPOSER_REPORT_FILE\";\nfunction toRunReport(input) {\n\treturn {\n\t\tversion: 2,\n\t\toutcome: input.failure === void 0 ? \"succeeded\" : \"failed\",\n\t\tapp: input.summary?.app ?? null,\n\t\tenvironment: input.environment,\n\t\tnodes: input.summary?.nodes ?? [],\n\t\tfailure: input.failure ?? null\n\t};\n}\n/**\n* The path to write to: the `--report` flag first, then the env var. Relative\n* paths resolve against the deploy's cwd. `undefined` means no report was\n* asked for, which is the common case and writes nothing.\n*/\nfunction resolveRunReportPath(flag, env, cwd) {\n\tconst requested = flag !== void 0 && flag.length > 0 ? flag : env;\n\tif (requested === void 0 || requested.length === 0) return void 0;\n\treturn path.resolve(cwd, requested);\n}\n/**\n* Writes the report, creating the parent directory if needed. A write failure\n* warns and returns false rather than failing a deploy that already\n* converged — but it is never silent, because the operator asked for this\n* file and a consumer is waiting on it.\n*/\nfunction writeRunReport(filePath, report) {\n\ttry {\n\t\tfs.mkdirSync(path.dirname(filePath), { recursive: true });\n\t\tfs.writeFileSync(filePath, `${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn true;\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not write the run report to ${filePath}: ${detail}`);\n\t\treturn false;\n\t}\n}\n//#endregion\nexport { writeRunReport as a, toRunReport as i, RUN_REPORT_VERSION as n, resolveRunReportPath as r, RUN_REPORT_FILE_ENV as t };\n\n//# sourceMappingURL=run-report-HI2JqCSO.mjs.map","import { i as runPipeline, t as validateEnvironmentName } from \"./validate-environment-BevPErw8.mjs\";\nimport { a as redactError, c as redactUnsetPlatformVariable, o as redactSummary, r as credentialLookingValues, s as redactThrown, t as SecretRedaction } from \"./redaction-DHaXoToJ.mjs\";\nimport { c as convergeReasonsText, d as toStructured, u as requireContainerForEnvironment } from \"./dev-current-C7R8uqyQ.mjs\";\nimport { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from \"./run-report-HI2JqCSO.mjs\";\nimport { t as loadAppConvergeEntry } from \"./app-converge-CHMILMYi.mjs\";\nimport { a as refuseSecretsInRootInput, c as withComposerAdvice, n as reportConvergeEvent, o as capFailureCause, r as stepTracker, s as toDeploymentSummary, t as interactionMessages } from \"./steps-Det-FSAL.mjs\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { nodeAddresses } from \"@internal/core/deploy\";\nimport { CliStructuredError, InternalError } from \"@internal/foundation/errors\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\n/** Times each step for the host's `onEvent`. A step still open when the run fails is closed as failed, innermost first. */\nfunction stackSteps(onEvent) {\n\treturn stepTracker((step) => step.name === \"assemble-service\" ? `${step.name}:${step.address}` : step.name === \"apply-resource\" ? `${step.name}:${step.resourceId}` : step.name, onEvent);\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline({\n\t\taction: \"deploy\",\n\t\tsteps: stackSteps(input.onEvent)\n\t}, {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment ?? \"production\",\n\t\tcwd,\n\t\tdeps,\n\t\treportId: input.reportId,\n\t\treportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),\n\t\tsignal: input.signal,\n\t\tredaction: deps.redaction ?? new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline({\n\t\taction: \"destroy\",\n\t\tsteps: stackSteps(input.onEvent)\n\t}, {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment,\n\t\tcwd,\n\t\tdeps,\n\t\treportId: void 0,\n\t\treportPath: void 0,\n\t\tsignal: input.signal,\n\t\tredaction: deps.redaction ?? new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/**\n* Opens a session per extension that declares a reporter. A `begin` that\n* throws costs that extension its reporting and nothing else — the deploy\n* has not started, and refusing to run it because an observer failed would\n* invert the relationship.\n*/\nasync function beginReporters(extensions, context, redaction) {\n\treturn (await Promise.all(extensions.map(async (extension) => {\n\t\tif (extension.reporter === void 0) return void 0;\n\t\ttry {\n\t\t\tconst reporter = await extension.reporter.begin(context);\n\t\t\treturn reporter === void 0 ? void 0 : {\n\t\t\t\textensionId: extension.id,\n\t\t\t\treporter\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);\n\t\t\treturn;\n\t\t}\n\t}))).filter((entry) => entry !== void 0);\n}\n/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */\nasync function attachReporters(reporters, containers, redaction) {\n\tawait Promise.all(reporters.map(async ({ extensionId, reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.attach({ container: containers.get(extensionId) });\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/** Every session's contribution to the apply's environment, so reporting that happens inside the apply can find the run. */\nfunction reporterEnv(reporters, redaction) {\n\tconst env = {};\n\tfor (const { extensionId, reporter } of reporters) try {\n\t\tObject.assign(env, reporter.childEnv());\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);\n\t}\n\treturn env;\n}\n/** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */\nfunction truncate(value, limit) {\n\treturn value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;\n}\n/** An interrupted converge — reported as `cancelled`, never as `failed`. */\nfunction wasInterrupted(failure) {\n\treturn failure.code === \"DEPLOY.INTERRUPTED\";\n}\n/**\n* Ends every reporting session, whatever the run did. Sessions never reject\n* by contract, but a buggy one must not turn a converged deploy into a\n* failure — so this swallows anyway, and reports each session independently\n* so one bad implementation cannot silence another.\n*/\nasync function finishReporters(reporters, outcome, redaction) {\n\tconst entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];\n\tawait Promise.all(reporters.map(async ({ reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.finish({\n\t\t\t\tok: outcome.ok,\n\t\t\t\tcancelled: outcome.cancelled,\n\t\t\t\tfailingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),\n\t\t\t\terrorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),\n\t\t\t\tentities\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/**\n* Owns the reporting sessions around the pipeline: the inner run opens them\n* once it knows which extensions are configured, and this closes them on\n* every exit path — a returned failure, a success, or a thrown defect — as\n* the `record` step, which also writes the run report.\n* Nothing here can change what the pipeline returns.\n*/\nasync function runStackPipeline(run, opts) {\n\tconst steps = run.steps;\n\tconst reporters = [];\n\tlet outcome;\n\ttry {\n\t\toutcome = await runStackPipelineInner(run, opts, reporters);\n\t} catch (error) {\n\t\tsteps.closeOpen(\"failed\");\n\t\tsteps.start({ name: \"record\" });\n\t\tconst thrown = redactThrown(error, opts.redaction);\n\t\tawait finishReporters(reporters, {\n\t\t\tok: false,\n\t\t\tcancelled: false,\n\t\t\tcode: \"DEPLOY.UNEXPECTED\",\n\t\t\tmessage: thrown.message\n\t\t}, opts.redaction);\n\t\tsteps.finish({ name: \"record\" });\n\t\tthrow thrown;\n\t}\n\tif (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));\n\tif (!outcome.ok) steps.closeOpen(\"failed\");\n\tsteps.start({ name: \"record\" });\n\tawait finishReporters(reporters, outcome.ok ? {\n\t\tok: true,\n\t\tcancelled: false,\n\t\tsummary: outcome.value\n\t} : {\n\t\tok: false,\n\t\tcancelled: wasInterrupted(outcome.failure),\n\t\tcode: outcome.failure.code,\n\t\tmessage: outcome.failure.message\n\t}, opts.redaction);\n\tif (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({\n\t\tsummary: outcome.ok ? outcome.value : void 0,\n\t\tenvironment: opts.environment,\n\t\tfailure: outcome.ok ? void 0 : {\n\t\t\tcode: outcome.failure.code,\n\t\t\tmessage: outcome.failure.message\n\t\t}\n\t}))) steps.finish({ name: \"record\" });\n\telse steps.fail({ name: \"record\" });\n\treturn outcome;\n}\n/** The pipeline both actions share: validate, load, assemble, resolve\n* containers, then the in-process converge; deploy runs its preflight before\n* the converge, and destroy its teardowns and container removals after it.\n* The value is only ever a summary for deploy. */\nasync function runStackPipelineInner(run, opts, reporters) {\n\tconst { entry, config: composerConfig, name, environment, cwd, deps } = opts;\n\tconst { action } = run;\n\tconst steps = run.steps;\n\tsteps.start({ name: \"prepare\" });\n\ttry {\n\t\tvalidateEnvironmentName(environment);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (run.action === \"destroy\" && hasNoLocalDeployState(cwd)) run.steps.emit({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tconst loaded = await prepareAppConvergeEntry(deps, path.dirname(path.resolve(cwd, composerConfig.file)));\n\tif (!loaded.ok) return loaded;\n\tconst appConvergeEntry = loaded.value;\n\tconst platformCredentials = deps.credentials;\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tconst unset = [];\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\treadSecrets: action === \"deploy\",\n\t\t\tredaction: opts.redaction,\n\t\t\tonEvent: (event) => {\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase \"loaded\":\n\t\t\t\t\t\tsteps.finish({ name: \"prepare\" });\n\t\t\t\t\t\tsteps.start({ name: \"assemble\" });\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-started\":\n\t\t\t\t\t\tsteps.start({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-assembled\":\n\t\t\t\t\t\tsteps.finish({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t}, event.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"Destroy runs the same preparation as deploy before it locates the environment, and that preparation assembles the built app.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tsteps.finish({ name: \"assemble\" });\n\t\tconst { graph, name: resolvedName } = pipeline;\n\t\tconst config = pipeline.configSource.value;\n\t\tif (action === \"deploy\") refuseSecretsInRootInput(graph.appConfigurationRead, opts.redaction.knownSecrets, \"A deploy sends every plain value Load read to the platform as plain configuration, and never sends a secret that way.\");\n\t\tsteps.start({ name: \"connect\" });\n\t\tif (action === \"deploy\") reporters.push(...await beginReporters(config.extensions, {\n\t\t\tappName: resolvedName,\n\t\t\tgraph,\n\t\t\tenvironment,\n\t\t\tcwd,\n\t\t\treportId: opts.reportId,\n\t\t\tcredentials: platformCredentials\n\t\t}, opts.redaction));\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") {\n\t\t\t\t\tconst instance = await extension.container.ensure({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, platformCredentials);\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t} else {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, platformCredentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tawait attachReporters(reporters, containers, opts.redaction);\n\t\talchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;\n\t\tsteps.finish({ name: \"connect\" });\n\t\tif (run.action === \"deploy\") {\n\t\t\trun.steps.start({ name: \"preflight\" });\n\t\t\tlet checked = 0;\n\t\t\tconst report = (reported) => {\n\t\t\t\tchecked += reported.checked;\n\t\t\t\tunset.push(...reported.unset.map((variable) => redactUnsetPlatformVariable(variable, opts.redaction)));\n\t\t\t};\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.preflight === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst payload = await extension.preflight({\n\t\t\t\t\t\tgraph,\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tconfiguration: pipeline.configuration,\n\t\t\t\t\t\tsecrets: pipeline.secrets,\n\t\t\t\t\t\tcredentials: platformCredentials,\n\t\t\t\t\t\treport\n\t\t\t\t\t});\n\t\t\t\t\tif (payload !== void 0) preflightPayloads.set(extension.id, payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t\trun.steps.finish({ name: \"preflight\" }, {\n\t\t\t\tchecked,\n\t\t\t\tunset: unset.length\n\t\t\t});\n\t\t\tif (unset.length > 0) run.steps.emit({\n\t\t\t\tkind: \"preflight-findings\",\n\t\t\t\tfindings: { unset }\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tconst converged = await convergeStack(action, opts, steps, pipeline, appConvergeEntry, {\n\t\tcontainers,\n\t\tstage: alchemyStage,\n\t\tpreflightPayloads,\n\t\tfindings: { unset },\n\t\tenv: action === \"deploy\" ? reporterEnv(reporters, opts.redaction) : {}\n\t});\n\tif (action === \"deploy\" || !converged.ok) return converged;\n\ttry {\n\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\tif (extension.teardown === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.teardown({\n\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\tenvironment\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\tconst instance = containers.get(extension.id);\n\t\t\tif (instance === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.container.remove(instance, platformCredentials);\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\treturn ok(void 0);\n}\n/** Loaded before anything is created, so a missing or incompatible install fails first. */\nasync function prepareAppConvergeEntry(deps, appDir) {\n\ttry {\n\t\treturn ok(deps.appConvergeEntry ?? await loadAppConvergeEntry(appDir));\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\nconst WORDS = {\n\tdeploy: {\n\t\taction: \"deploy\",\n\t\tAction: \"Deploy\"\n\t},\n\tdestroy: {\n\t\taction: \"destroy\",\n\t\tAction: \"Destroy\"\n\t}\n};\n/** The structured failure a converge that did not apply settles as. */\nfunction convergeFailure(action, outcome, redact) {\n\tconst words = WORDS[action];\n\tswitch (outcome.kind) {\n\t\tcase \"interrupted\": return new CliStructuredError(\"DEPLOY.INTERRUPTED\", `The ${words.action} was interrupted.`, {\n\t\t\twhy: \"It stopped while Alchemy planned or applied it. Resources it had already changed stay as they are.\",\n\t\t\tfix: `${words.Action} again to finish.`\n\t\t});\n\t\tcase \"refused\": return outcome.reason === \"already-running\" ? new CliStructuredError(\"DEPLOY.CONVERGE_RUNNING\", \"Another deploy, destroy or `prisma dev` converge is already running in this process.\", {\n\t\t\twhy: `A ${words.action} sets the process's environment and working directory while Alchemy runs, so two cannot overlap.`,\n\t\t\tfix: `Wait for the other one to finish, or run this ${words.action} in its own process.`\n\t\t}) : new CliStructuredError(\"DEPLOY.WORKER_THREAD\", `${words.Action} cannot run in a worker thread when its cwd is not the process working directory.`, {\n\t\t\twhy: \"Alchemy reads `.env` and keeps `.alchemy` in the working directory, and a worker thread cannot change it.\",\n\t\t\tfix: `Call ${words.action} from the main thread, or with the process's working directory as its cwd.`\n\t\t});\n\t\tcase \"failed\": {\n\t\t\tconst cause = capFailureCause(redact(withComposerAdvice(convergeReasonsText(outcome.reasons))));\n\t\t\treturn new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `Alchemy could not ${words.action} the app.\\n${cause}`, { meta: {\n\t\t\t\tengineCause: cause,\n\t\t\t\treasons: outcome.reasons.map(({ tag, message }) => ({\n\t\t\t\t\ttag,\n\t\t\t\t\tmessage: redact(message)\n\t\t\t\t}))\n\t\t\t} });\n\t\t}\n\t}\n\treturn new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", \"The converge ended with an outcome this Composer does not know.\");\n}\n/**\n* Lowers the app with the containers and preflight payloads this run\n* resolved, then plans and applies `action` in this process. A deploy's\n* report hook runs inside the apply, here, so its summary comes back as a\n* value.\n*/\nasync function convergeStack(action, opts, steps, pipeline, entry, resolved) {\n\tconst { cwd, environment } = opts;\n\tconst config = pipeline.configSource.value;\n\tconst env = resolved.env;\n\topts.redaction.addCredentialLookingValues(credentialLookingValues(env));\n\tconst redact = (text) => opts.redaction.redact(text);\n\tlet summary;\n\tconst report = (result) => {\n\t\tsummary = toDeploymentSummary(result);\n\t};\n\tconst root = pipeline.graph.root.node;\n\tif (root.kind !== \"module\") throw new InternalError(\"runPipeline admitted a root that is not a module\");\n\tsteps.start({ name: \"apply\" });\n\tlet stack;\n\ttry {\n\t\tstack = entry.lower(root, config, {\n\t\t\tname: pipeline.name,\n\t\t\tenvironment,\n\t\t\tappConfigurationRead: pipeline.graph.appConfigurationRead,\n\t\t\tpreparedNodeAddresses: nodeAddresses(pipeline.graph),\n\t\t\tbundles: pipeline.assembled.bundles,\n\t\t\tcontainers: resolved.containers,\n\t\t\tpreflightPayloads: resolved.preflightPayloads,\n\t\t\tfindings: resolved.findings,\n\t\t\tcredentials: opts.deps.credentials,\n\t\t\t...action === \"deploy\" ? { report } : {}\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", redact(error instanceof Error ? error.message : String(error))));\n\t}\n\tconst output = interactionMessages(steps, opts.redaction);\n\tlet outcome;\n\ttry {\n\t\toutcome = await entry.converge({\n\t\t\toperation: action,\n\t\t\tstack,\n\t\t\tstage: resolved.stage,\n\t\t\tcwd,\n\t\t\tenv,\n\t\t\tsignal: opts.signal,\n\t\t\tonEvent: (event) => reportConvergeEvent(steps, event, redact, (resource) => ({\n\t\t\t\tname: \"apply-resource\",\n\t\t\t\t...resource\n\t\t\t})),\n\t\t\toutput: (text) => output.push(text)\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", redact(`Alchemy could not ${action} the app.\\n${error instanceof Error ? error.message : String(error)}`)));\n\t} finally {\n\t\toutput.end();\n\t}\n\tif (outcome.kind !== \"applied\") return notOk(convergeFailure(action, outcome, redact));\n\tsteps.finish({ name: \"apply\" });\n\treturn ok(redactSummary(summary, opts.redaction));\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-BIRdFfwR.mjs.map"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,sBAAsB;AAC5B,SAAS,YAAY,OAAO;CAC3B,OAAO;EACN,SAAS;EACT,SAAS,MAAM,YAAY,KAAK,IAAI,cAAc;EAClD,KAAK,MAAM,SAAS,OAAO;EAC3B,aAAa,MAAM;EACnB,OAAO,MAAM,SAAS,SAAS,CAAC;EAChC,SAAS,MAAM,WAAW;CAC3B;AACD;;;;;;AAMA,SAAS,qBAAqB,MAAM,KAAK,KAAK;CAC7C,MAAM,YAAY,SAAS,KAAK,KAAK,KAAK,SAAS,IAAI,OAAO;CAC9D,IAAI,cAAc,KAAK,KAAK,UAAU,WAAW,GAA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X;GACA,OAAO,SAAS;GAChB;GACA;GACA,QAAQ,KAAK;GACb,UAAU,UAAU,oBAAoB,OAAO,OAAO,SAAS,cAAc;IAC5E,MAAM;IACN,GAAG;GACJ,EAAE;GACF,SAAS,SAAS,OAAO,KAAK,IAAI;EACnC,CAAC;CACF,SAAS,OAAO;EACf,OAAO,MAAM,IAAI,mBAAmB,wBAAwB,OAAO,qBAAqB,OAAO,aAAa,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,CAAC,CAAC;CACvK,UAAU;EACT,OAAO,IAAI;CACZ;CACA,IAAI,QAAQ,SAAS,WAAW,OAAO,MAAM,gBAAgB,QAAQ,SAAS,MAAM,CAAC;CACrF,MAAM,OAAO,EAAE,MAAM,QAAQ,CAAC;CAC9B,OAAO,GAAG,cAAc,SAAS,KAAK,SAAS,CAAC;AACjD"}
@@ -1,17 +1,16 @@
1
1
  import { t as InternalError } from "./internal-error-Dfur7Zqt-B8J8e7ac.mjs";
2
- import { f as nodeAddresses, p as secretsKeys, u as ROOT_INPUT_UNREAD_ERROR } from "./deploy-Br1yvLe3.mjs";
2
+ import { f as nodeAddresses, p as secretsKeys, u as ROOT_INPUT_UNREAD_ERROR } from "./deploy-Cu7Wtrf0.mjs";
3
3
  import { t as CliStructuredError } from "./errors-CVYwN2km.mjs";
4
- import { a as redactError, i as redactDevEvent, s as redactThrown, t as SecretRedaction } from "./redaction-DY6eDC12-BrK1aSN5.mjs";
5
- import { r as devEnvironmentDir } from "./app-config-CErnR6NK-DnKH4Kqc.mjs";
4
+ import { a as redactError, i as redactDevEvent, s as redactThrown, t as SecretRedaction } from "./redaction-DHaXoToJ-zcuc7Sgf.mjs";
6
5
  import { n as ok, t as notOk } from "./result-CttmabB6.mjs";
7
- import { c as toStructured, n as convergeReasonsText, s as requireContainerForEnvironment } from "./dev-current-lAlj53eX-DvAHNZFo.mjs";
6
+ import { c as toStructured, n as convergeReasonsText, s as requireContainerForEnvironment } from "./dev-current-C7R8uqyQ-CgyoTX9q.mjs";
8
7
  import { t as valueReadsChangeText } from "./value-reads-change-text-DcRCv7Zy-Ca8m3bal.mjs";
9
- import { t as loadAppConvergeEntry } from "./app-converge-bS1l9jIf-B1FOgxBQ.mjs";
10
- import { a as valueReadsSnapshot, i as thrownResult, o as holdingConvergeProcess, r as isWorkerMessage } from "./dev-converge-messages-DML4rTz7-B6uxtpZG.mjs";
11
- import { t as resolveLocalTargets } from "./local-target-CZzICh5R.mjs";
12
- import { i as validateEnvironmentName, r as runPipeline } from "./validate-environment-DCZiNSlR-idVge-kq.mjs";
13
- import { c as removeLeftoverAppConfigurationFiles, m as withComposerAdvice, n as reportConvergeEvent, o as refuseSecretsInPlainVariables, r as stepTracker, s as refuseSecretsInRootInput, t as interactionMessages } from "./steps-BZXNqW6U-BM2Aa8Bp.mjs";
14
- import { n as requireDevEnvironmentName, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-CCY7WNWz.mjs";
8
+ import { r as devEnvironmentDir, t as resolveLocalTargets } from "./local-target-bTjNRplR.mjs";
9
+ import { t as loadAppConvergeEntry } from "./app-converge-CHMILMYi-Duhv9T-w.mjs";
10
+ import { a as valueReadsSnapshot, i as thrownResult, o as holdingConvergeProcess, r as isWorkerMessage } from "./dev-converge-messages-CElmPylA-6X7D08mQ.mjs";
11
+ import { i as validateEnvironmentName, r as runPipeline } from "./validate-environment-BevPErw8-BRVXeBjT.mjs";
12
+ import { a as reportConvergeEvent, c as withComposerAdvice, i as refuseSecretsInRootInput, n as interactionMessages, o as stepTracker, r as refuseSecretsInPlainVariables } from "./steps-Det-FSAL-4BEaFT3G.mjs";
13
+ import { n as requireDevEnvironmentName, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-DSJ7HrEe.mjs";
15
14
  import * as fs from "node:fs";
16
15
  import * as path from "node:path";
17
16
  import { join, relative, resolve, sep } from "node:path";
@@ -1602,7 +1601,7 @@ var esm_default = {
1602
1601
  FSWatcher
1603
1602
  };
1604
1603
  //#endregion
1605
- //#region ../../0-framework/3-tooling/cli/dist/execute-dev-DnVmNpc1.mjs
1604
+ //#region ../../0-framework/3-tooling/cli/dist/execute-dev-D9PxdbV3.mjs
1606
1605
  /**
1607
1606
  * Local-dev spec § 6 `watch.ts`: watches each assembled bundle's declared
1608
1607
  * `watch` paths and every authoring module (ADR-0056) — a directory watched
@@ -2060,7 +2059,6 @@ async function executeDevInner(input, deps, cwd, redaction) {
2060
2059
  const { onEvent } = input;
2061
2060
  const environment = input.environment ?? "dev";
2062
2061
  const devDir = path.join(cwd, devEnvironmentDir(environment));
2063
- removeLeftoverAppConfigurationFiles(cwd);
2064
2062
  let pipeline;
2065
2063
  let resolved;
2066
2064
  let definitionFiles;
@@ -2539,4 +2537,4 @@ async function executeDevInner(input, deps, cwd, redaction) {
2539
2537
  //#endregion
2540
2538
  export { executeDev };
2541
2539
 
2542
- //# sourceMappingURL=execute-dev-DnVmNpc1-BzK9Qns_.mjs.map
2540
+ //# sourceMappingURL=execute-dev-D9PxdbV3-D-pdqLmO.mjs.map