@prisma/composer 0.6.0-dev.14 → 0.6.0-dev.15
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-CFsSXEVj-B242oUnm.d.mts → app-config-aIrriqVU-D6lJHzh2.d.mts} +42 -17
- package/dist/app-config-aIrriqVU-D6lJHzh2.d.mts.map +1 -0
- package/dist/bin.mjs +950 -12
- package/dist/bin.mjs.map +1 -1
- package/dist/config-CL7Jbve2.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/container-transport-DKmKg5JQ-CoY4XPma.mjs +30 -0
- package/dist/container-transport-DKmKg5JQ-CoY4XPma.mjs.map +1 -0
- package/dist/control.d.mts +3 -216
- package/dist/control.mjs +1 -69
- package/dist/deploy-CL7Jbve2.d.mts +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/deploy.mjs +1 -1
- package/dist/{deployment-summary-r47O6kFr-CcMYVOn5.mjs → deployment-summary-DswOl_9E-C03NJ98H.mjs} +2 -2
- package/dist/{deployment-summary-r47O6kFr-CcMYVOn5.mjs.map → deployment-summary-DswOl_9E-C03NJ98H.mjs.map} +1 -1
- package/dist/{dist-C5rZnr4n.mjs → dist-C0dNEgS-.mjs} +2 -2
- package/dist/{dist-C5rZnr4n.mjs.map → dist-C0dNEgS-.mjs.map} +1 -1
- package/dist/{errors-0e8IVwzi.mjs → errors-DkXcnjPx.mjs} +3 -2
- package/dist/{errors-0e8IVwzi.mjs.map → errors-DkXcnjPx.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs → execute-deploy-destroy-DfVJUICu-AMM8CwgV.mjs} +30 -19
- package/dist/execute-deploy-destroy-DfVJUICu-AMM8CwgV.mjs.map +1 -0
- package/dist/{execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs → execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs} +29 -19
- package/dist/execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs.map +1 -0
- package/dist/{execute-dev-DLYyduEM-88uyvrbj.mjs → execute-dev-BMTFWfFc-B1whS-Rr.mjs} +25 -23
- package/dist/{execute-dev-DLYyduEM-88uyvrbj.mjs.map → execute-dev-BMTFWfFc-B1whS-Rr.mjs.map} +1 -1
- package/dist/{execute-dev-DLYyduEM-BuUGTm0g.mjs → execute-dev-BMTFWfFc-BoKbcFVF.mjs} +29 -20
- package/dist/{execute-dev-DLYyduEM-BuUGTm0g.mjs.map → execute-dev-BMTFWfFc-BoKbcFVF.mjs.map} +1 -1
- package/dist/{execute-log-VIOL4DBz-DBPH8By4.mjs → execute-log-Cay9hlKW-B0tmRtrY.mjs} +11 -7
- package/dist/execute-log-Cay9hlKW-B0tmRtrY.mjs.map +1 -0
- package/dist/{execute-log-VIOL4DBz-DKodBrxS.mjs → execute-log-Cay9hlKW-DrMeVOXq.mjs} +9 -7
- package/dist/execute-log-Cay9hlKW-DrMeVOXq.mjs.map +1 -0
- package/dist/family-DkH0si4D-Uov_MuHV.d.mts +27 -0
- package/dist/family-DkH0si4D-Uov_MuHV.d.mts.map +1 -0
- package/dist/family.d.mts +53 -0
- package/dist/family.d.mts.map +1 -0
- package/dist/family.mjs +839 -0
- package/dist/family.mjs.map +1 -0
- package/dist/{graph-BJgUfGB0-kvgFzT4q.mjs → graph-BJgUfGB0-7fmubS_y.mjs} +2 -2
- package/dist/{graph-BJgUfGB0-kvgFzT4q.mjs.map → graph-BJgUfGB0-7fmubS_y.mjs.map} +1 -1
- package/dist/{graph-types-N6brq1zY-1VMNwtkJ.d.mts → graph-DqklX5Sf-CdNH3lA7.d.mts} +17 -2
- package/dist/graph-DqklX5Sf-CdNH3lA7.d.mts.map +1 -0
- package/dist/{index-DryPyF9U.d.mts → index-DuF5iI3i.d.mts} +2 -3
- package/dist/index-DuF5iI3i.d.mts.map +1 -0
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +2 -2
- package/dist/{local-target-DnA2E8IN.mjs → local-target-D3u_wuNF.mjs} +2 -2
- package/dist/{local-target-DnA2E8IN.mjs.map → local-target-D3u_wuNF.mjs.map} +1 -1
- package/dist/{local-target-DuSyWeYc.mjs → local-target-H0IWu_FM.mjs} +2 -2
- package/dist/{local-target-DuSyWeYc.mjs.map → local-target-H0IWu_FM.mjs.map} +1 -1
- package/dist/local-target.d.mts +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/log-DRnnWupy-9jbzL64M.d.mts +324 -0
- package/dist/log-DRnnWupy-9jbzL64M.d.mts.map +1 -0
- package/dist/{result-CzGChwbZ.mjs → log-DfT2hHqi-CDp9nfI5.mjs} +85 -90
- package/dist/log-DfT2hHqi-CDp9nfI5.mjs.map +1 -0
- package/dist/{nextjs-DLyeRR7M-DZODs9tk.d.mts → nextjs-DLyeRR7M-BfUbLXwr.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-DZODs9tk.d.mts.map → nextjs-DLyeRR7M-BfUbLXwr.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{pipeline-D3QoVzAB-D_ufjg3N.mjs → pipeline-AoW8zq4I-C6Qe0VaZ.mjs} +161 -42
- package/dist/{pipeline-D3QoVzAB-D_ufjg3N.mjs.map → pipeline-AoW8zq4I-C6Qe0VaZ.mjs.map} +1 -1
- package/dist/{pipeline-D3QoVzAB-Ci2aJ2mE.mjs → pipeline-AoW8zq4I-DM74ygtH.mjs} +164 -43
- package/dist/pipeline-AoW8zq4I-DM74ygtH.mjs.map +1 -0
- package/dist/report.d.mts +2 -2
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{shared-CCaR42wo-BvegvmA_.mjs → result-B4XjxVK6.mjs} +127 -8
- package/dist/result-B4XjxVK6.mjs.map +1 -0
- package/dist/{result-CFqJKiqg.mjs → result-wonf1deB.mjs} +4 -18
- package/dist/result-wonf1deB.mjs.map +1 -0
- package/dist/run-alchemy-D44OZlyB-DA7s331N.mjs +93 -0
- package/dist/run-alchemy-D44OZlyB-DA7s331N.mjs.map +1 -0
- package/dist/run-alchemy-D44OZlyB-DeDTFsB6.mjs +93 -0
- package/dist/run-alchemy-D44OZlyB-DeDTFsB6.mjs.map +1 -0
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +54 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +150 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +12 -11
- package/src/exports/family.ts +14 -0
- package/src/exports/testing.ts +1 -0
- package/dist/app-config-CFsSXEVj-B242oUnm.d.mts.map +0 -1
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs +0 -401
- package/dist/cli-B3sWzFlb-CxEIzKsQ.mjs.map +0 -1
- package/dist/config-ku5b_2YD.d.mts +0 -1
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs +0 -75
- package/dist/container-transport-DKmKg5JQ-BMRhx5w-.mjs.map +0 -1
- package/dist/control.d.mts.map +0 -1
- package/dist/control.mjs.map +0 -1
- package/dist/deploy-ku5b_2YD.d.mts +0 -1
- package/dist/execute-deploy-destroy-IT4vGkMc-YM1Cv6cu.mjs.map +0 -1
- package/dist/execute-deploy-destroy-IT4vGkMc-oO8yjHPH.mjs.map +0 -1
- package/dist/execute-log-VIOL4DBz-DBPH8By4.mjs.map +0 -1
- package/dist/execute-log-VIOL4DBz-DKodBrxS.mjs.map +0 -1
- package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts +0 -18
- package/dist/graph-DqklX5Sf-BNS2aO1j.d.mts.map +0 -1
- package/dist/graph-types-N6brq1zY-1VMNwtkJ.d.mts.map +0 -1
- package/dist/index-DryPyF9U.d.mts.map +0 -1
- package/dist/pipeline-D3QoVzAB-Ci2aJ2mE.mjs.map +0 -1
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs +0 -30
- package/dist/render-error-DsPN5qfr-CkVGj9uP.mjs.map +0 -1
- package/dist/result-CFqJKiqg.mjs.map +0 -1
- package/dist/result-CzGChwbZ.mjs.map +0 -1
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs +0 -48
- package/dist/run-alchemy-hghRtddF-CQHOzlrW.mjs.map +0 -1
- package/dist/shared-CCaR42wo-BvegvmA_.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-DkXcnjPx.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/errors.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { n as assertNever, r as isInternalError, t as InternalError } from \"./internal-error-BIc-ehme.mjs\";\n//#region src/defined.ts\n/**\n* Returns an object with the key/value if value is defined, otherwise an empty object.\n*\n* Use with spread to conditionally include optional properties while satisfying\n* exactOptionalPropertyTypes. This is explicit about which properties are optional\n* and won't inadvertently strip other undefined values.\n*\n* @example\n* ```typescript\n* // Instead of:\n* const obj = {\n* required: 'value',\n* ...(optional ? { optional } : {}),\n* };\n*\n* // Use:\n* const obj = {\n* required: 'value',\n* ...ifDefined('optional', optional),\n* };\n* ```\n*/\nfunction ifDefined(key, value) {\n\treturn value !== void 0 ? blindCast({ [key]: value }) : {};\n}\n//#endregion\n//#region src/cli-structured-error.ts\n/**\n* Structured CLI error that contains all information needed for error envelopes.\n* Call sites throw these errors with full context.\n*\n* A `CliStructuredError` is a `StructuredError` (see\n* `./structured-error.ts`): `code` is a dotted\n* `NAMESPACE.SUBCODE` string, and the namespace prefix is the error's\n* category — there is no separate `domain` field. See ADR 239 in\n* prisma/prisma and composer's ADR-0044 for the namespace taxonomy.\n*/\nvar CliStructuredError = class extends Error {\n\tcode;\n\tseverity;\n\tconstructor(code, summary, options) {\n\t\tsuper(summary, options?.cause !== void 0 ? { cause: options.cause } : void 0);\n\t\tthis.name = \"CliStructuredError\";\n\t\tthis.code = code;\n\t\tthis.severity = options?.severity ?? \"error\";\n\t\tconst fix = options?.fix === options?.why ? void 0 : options?.fix;\n\t\tconst where = options?.where ? {\n\t\t\t...ifDefined(\"path\", options.where.path),\n\t\t\t...ifDefined(\"line\", options.where.line)\n\t\t} : void 0;\n\t\tObject.assign(this, {\n\t\t\t...ifDefined(\"why\", options?.why),\n\t\t\t...ifDefined(\"fix\", fix),\n\t\t\t...ifDefined(\"where\", where),\n\t\t\t...ifDefined(\"meta\", options?.meta),\n\t\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t\t});\n\t}\n\t/**\n\t* Converts this error to a CLI error envelope for output formatting.\n\t*/\n\ttoEnvelope() {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: this.code,\n\t\t\tseverity: this.severity,\n\t\t\tsummary: this.message,\n\t\t\t...ifDefined(\"why\", this.why),\n\t\t\t...ifDefined(\"fix\", this.fix),\n\t\t\t...ifDefined(\"where\", this.where),\n\t\t\t...ifDefined(\"meta\", this.meta),\n\t\t\t...ifDefined(\"docsUrl\", this.docsUrl)\n\t\t};\n\t}\n\t/**\n\t* Type guard to check if an error is a CliStructuredError.\n\t* Uses duck-typing to work across module boundaries where instanceof may fail.\n\t*/\n\tstatic is(error) {\n\t\tif (!(error instanceof Error)) return false;\n\t\tconst candidate = blindCast(error);\n\t\treturn candidate.name === \"CliStructuredError\" && typeof candidate.code === \"string\" && typeof candidate.toEnvelope === \"function\";\n\t}\n};\n//#endregion\n//#region src/structured-error.ts\nconst STRUCTURED_CODE_RE = /^[A-Z][A-Z0-9]*\\.[A-Z][A-Z0-9_]*$/;\nfunction isStructuredError(e) {\n\treturn typeof e === \"object\" && e !== null && \"code\" in e && typeof e.code === \"string\" && STRUCTURED_CODE_RE.test(e.code) && \"message\" in e && typeof e.message === \"string\";\n}\nfunction structuredError(code, message, options) {\n\tconst error = options?.cause !== void 0 ? new Error(message, { cause: options.cause }) : new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"StructuredError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\t...ifDefined(\"why\", options?.why),\n\t\t...ifDefined(\"fix\", options?.fix),\n\t\t...ifDefined(\"where\", options?.where),\n\t\t...ifDefined(\"severity\", options?.severity),\n\t\t...ifDefined(\"meta\", options?.meta),\n\t\t...ifDefined(\"docsUrl\", options?.docsUrl)\n\t});\n}\nconst DOCS_BASE = `https://docs.prisma.io/docs/orm/next/reference/error-reference`;\nfunction docsUrlFor(code) {\n\treturn `${DOCS_BASE}#${code}`;\n}\n//#endregion\nexport { CliStructuredError, DOCS_BASE, InternalError, assertNever, docsUrlFor, isInternalError, isStructuredError, structuredError };\n\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,UAAU,KAAK,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;AAC1D;;;;;;;;;;;AAaA,IAAI,qBAAqB,cAAc,MAAM;CAC5C;CACA;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,SAAS,SAAS,UAAU,KAAK,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAK,CAAC;EAC5E,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,WAAW,SAAS,YAAY;EACrC,MAAM,MAAM,SAAS,QAAQ,SAAS,MAAM,KAAK,IAAI,SAAS;EAC9D,MAAM,QAAQ,SAAS,QAAQ;GAC9B,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;GACvC,GAAG,UAAU,QAAQ,QAAQ,MAAM,IAAI;EACxC,IAAI,KAAK;EACT,OAAO,OAAO,MAAM;GACnB,GAAG,UAAU,OAAO,SAAS,GAAG;GAChC,GAAG,UAAU,OAAO,GAAG;GACvB,GAAG,UAAU,SAAS,KAAK;GAC3B,GAAG,UAAU,QAAQ,SAAS,IAAI;GAClC,GAAG,UAAU,WAAW,SAAS,OAAO;EACzC,CAAC;CACF;;;;CAIA,aAAa;EACZ,OAAO;GACN,IAAI;GACJ,MAAM,KAAK;GACX,UAAU,KAAK;GACf,SAAS,KAAK;GACd,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,OAAO,KAAK,GAAG;GAC5B,GAAG,UAAU,SAAS,KAAK,KAAK;GAChC,GAAG,UAAU,QAAQ,KAAK,IAAI;GAC9B,GAAG,UAAU,WAAW,KAAK,OAAO;EACrC;CACD;;;;;CAKA,OAAO,GAAG,OAAO;EAChB,IAAI,EAAE,iBAAiB,QAAQ,OAAO;EACtC,MAAM,YAAY,UAAU,KAAK;EACjC,OAAO,UAAU,SAAS,wBAAwB,OAAO,UAAU,SAAS,YAAY,OAAO,UAAU,eAAe;CACzH;AACD;AAuBA,MAAM,YAAY"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as CliStructuredError } from "./errors-
|
|
1
|
+
import { t as CliStructuredError } from "./errors-DkXcnjPx.mjs";
|
|
2
2
|
import { t as containerEnv } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
3
|
+
import { d as toStructured } from "./log-DfT2hHqi-CDp9nfI5.mjs";
|
|
4
|
+
import { n as ok, r as okVoid, t as notOk } from "./result-wonf1deB.mjs";
|
|
5
|
+
import { n as alchemyInvocation, r as spawnAlchemy } from "./run-alchemy-D44OZlyB-DeDTFsB6.mjs";
|
|
6
|
+
import { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-DswOl_9E-C03NJ98H.mjs";
|
|
7
|
+
import { n as runPipeline } from "./pipeline-AoW8zq4I-DM74ygtH.mjs";
|
|
7
8
|
import * as fs from "node:fs";
|
|
8
9
|
import * as path from "node:path";
|
|
9
10
|
import { spawnSync } from "node:child_process";
|
|
@@ -63,7 +64,7 @@ function writeStackFile(input) {
|
|
|
63
64
|
}
|
|
64
65
|
const GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);
|
|
65
66
|
//#endregion
|
|
66
|
-
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-
|
|
67
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DfVJUICu.mjs
|
|
67
68
|
/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */
|
|
68
69
|
function validateStageName(stage) {
|
|
69
70
|
const result = spawnSync("git", ["check-ref-format", `refs/heads/${stage}`], { stdio: "ignore" });
|
|
@@ -128,7 +129,8 @@ async function runStackPipeline(action, opts) {
|
|
|
128
129
|
try {
|
|
129
130
|
pipeline = await runPipeline(entry, name, cwd, {
|
|
130
131
|
runAssembler: deps.runAssembler,
|
|
131
|
-
config: deps.config
|
|
132
|
+
config: deps.config,
|
|
133
|
+
configPath: deps.configPath
|
|
132
134
|
}, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
|
|
133
135
|
why: "destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.",
|
|
134
136
|
fix: "Run the build, then retry the destroy.",
|
|
@@ -142,12 +144,12 @@ async function runStackPipeline(action, opts) {
|
|
|
142
144
|
if (action === "deploy") containers.set(extension.id, await extension.container.ensure({
|
|
143
145
|
appName: resolvedName,
|
|
144
146
|
stage
|
|
145
|
-
}));
|
|
147
|
+
}, deps.credentials));
|
|
146
148
|
else {
|
|
147
149
|
const instance = await extension.container.locate({
|
|
148
150
|
appName: resolvedName,
|
|
149
151
|
stage
|
|
150
|
-
});
|
|
152
|
+
}, deps.credentials);
|
|
151
153
|
if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : ""}.`, { fix: "Deploy it first." });
|
|
152
154
|
containers.set(extension.id, instance);
|
|
153
155
|
}
|
|
@@ -164,7 +166,8 @@ async function runStackPipeline(action, opts) {
|
|
|
164
166
|
await extension.preflight({
|
|
165
167
|
graph,
|
|
166
168
|
container: containers.get(extension.id),
|
|
167
|
-
stage
|
|
169
|
+
stage,
|
|
170
|
+
credentials: deps.credentials
|
|
168
171
|
});
|
|
169
172
|
} catch (error) {
|
|
170
173
|
throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
|
|
@@ -189,19 +192,16 @@ async function runStackPipeline(action, opts) {
|
|
|
189
192
|
return notOk(toStructured("DEPLOY.STACK_WRITE_FAILED", error));
|
|
190
193
|
}
|
|
191
194
|
const reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;
|
|
192
|
-
let
|
|
195
|
+
let outcome;
|
|
193
196
|
try {
|
|
194
|
-
|
|
197
|
+
outcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({
|
|
195
198
|
command: action,
|
|
196
199
|
stackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,
|
|
197
200
|
cwd,
|
|
198
201
|
stage: alchemyStage,
|
|
199
202
|
containerEnv: containerEnv(containers),
|
|
200
|
-
env: {
|
|
201
|
-
|
|
202
|
-
[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
|
|
203
|
-
}
|
|
204
|
-
});
|
|
203
|
+
env: { [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath }
|
|
204
|
+
}));
|
|
205
205
|
} catch (error) {
|
|
206
206
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
207
207
|
return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", error instanceof Error ? error.message : String(error), {
|
|
@@ -214,6 +214,17 @@ async function runStackPipeline(action, opts) {
|
|
|
214
214
|
} }
|
|
215
215
|
}));
|
|
216
216
|
}
|
|
217
|
+
if (outcome.signal !== null) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {
|
|
218
|
+
signal: outcome.signal,
|
|
219
|
+
diagnostics: {
|
|
220
|
+
exitCode: void 0,
|
|
221
|
+
signal: outcome.signal,
|
|
222
|
+
stackFilePath: stackPath,
|
|
223
|
+
reproduceCommand,
|
|
224
|
+
cwd
|
|
225
|
+
}
|
|
226
|
+
} }));
|
|
227
|
+
const status = outcome.exitCode ?? 1;
|
|
217
228
|
if (status !== 0) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} exited with status ${status}.`, { meta: {
|
|
218
229
|
exitCode: status,
|
|
219
230
|
diagnostics: {
|
|
@@ -241,7 +252,7 @@ async function runStackPipeline(action, opts) {
|
|
|
241
252
|
const instance = containers.get(extension.id);
|
|
242
253
|
if (instance === void 0) continue;
|
|
243
254
|
try {
|
|
244
|
-
await extension.container.remove(instance);
|
|
255
|
+
await extension.container.remove(instance, deps.credentials);
|
|
245
256
|
} catch (error) {
|
|
246
257
|
throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
|
|
247
258
|
}
|
|
@@ -262,4 +273,4 @@ async function runStackPipeline(action, opts) {
|
|
|
262
273
|
//#endregion
|
|
263
274
|
export { executeDeploy, executeDestroy };
|
|
264
275
|
|
|
265
|
-
//# sourceMappingURL=execute-deploy-destroy-
|
|
276
|
+
//# sourceMappingURL=execute-deploy-destroy-DfVJUICu-AMM8CwgV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-deploy-destroy-DfVJUICu-AMM8CwgV.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DfVJUICu.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configPath);\n\treturn `// Generated by \\`prisma-composer deploy\\`/\\`prisma-composer destroy\\` — overwritten on every\n// run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:\n//\n// alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\nimport { lower } from '@prisma/composer/deploy';\nimport { deploymentReport } from '@prisma/composer/report';\nimport config from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\nexport { renderStackFile as n, writeStackFile as r, GENERATED_STACK_RELATIVE_PATH as t };\n\n//# sourceMappingURL=generate-stack-BL6htaQb.mjs.map","import { r as toStructured } from \"./shared-BTnATsqm.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation } from \"./run-alchemy-D44OZlyB.mjs\";\nimport { r as writeStackFile, t as GENERATED_STACK_RELATIVE_PATH } from \"./generate-stack-BL6htaQb.mjs\";\nimport { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-DswOl_9E.mjs\";\nimport { n as runPipeline } from \"./pipeline-AoW8zq4I.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { spawnSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { containerEnv } from \"@internal/core/config\";\n//#region src/validate-stage.ts\n/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */\nfunction validateStageName(stage) {\n\tconst result = spawnSync(\"git\", [\"check-ref-format\", `refs/heads/${stage}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliStructuredError(\"DEPLOY.STAGE_UNVALIDATABLE\", `git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (result.status !== 0) throw new CliStructuredError(\"DEPLOY.STAGE_INVALID\", `Invalid --stage \"${stage}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${stage}\").`);\n}\n//#endregion\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}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.stage,\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps\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(\"destroy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.target.kind === \"stage\" ? input.target.stage : void 0,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipeline(action, opts) {\n\tconst { entry, name, stage, cwd, onEvent, deps } = opts;\n\tif (stage !== void 0) try {\n\t\tvalidateStageName(stage);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, cwd, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\tconfig: deps.config,\n\t\t\tconfigPath: deps.configPath\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tconst { config, graph, name: resolvedName } = pipeline;\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\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\tstage\n\t\t\t\t}, deps.credentials));\n\t\t\t\telse {\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\tstage\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : \"\"}.`, { fix: \"Deploy it first.\" });\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\tconst pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;\n\t\tif (pinnedStage === void 0) throw new CliStructuredError(\"DEPLOY.SCOPE_MISSING\", \"The configured deploy target supplied no deploy scope (its container defines no alchemyStage), so Alchemy has no stage to run under.\", { fix: action === \"deploy\" ? \"Pass --stage <name> to choose the deploy scope explicitly.\" : \"destroy --production needs a target whose container supplies the production deploy scope.\" });\n\t\talchemyStage = pinnedStage;\n\t\tif (action === \"deploy\") for (const extension of config.extensions) {\n\t\t\tif (extension.preflight === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.preflight({\n\t\t\t\t\tgraph,\n\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\tstage,\n\t\t\t\t\tcredentials: deps.credentials\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_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\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\ttry {\n\t\ttry {\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigPath: pipeline.configPath,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({\n\t\t\t\tcommand: action,\n\t\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\t\tcwd,\n\t\t\t\tstage: alchemyStage,\n\t\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\t\tenv: { [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath }\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand,\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} exited with status ${status}.`, { meta: {\n\t\t\texitCode: status,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: status,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tstage\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance, deps.credentials);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(readDeploymentSummary(resultFilePath));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t} catch {}\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-DfVJUICu.mjs.map"],"mappings":";;;;;;;;;;;;;AAIA,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;;AAEvB,SAAS,wBAAwB,cAAc,QAAQ;CACtD,MAAM,MAAM,KAAK,SAAS,cAAc,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACxE,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,MAAM,OAAO;CACrB,OAAO,KAAK,UAAU,KAAK;AAC5B;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,MAAM,OAAO,GAAG,EAAE,WAAW,MAAM,OAAO,KAAK,EAAE;AACnE;AACA,SAAS,cAAc,OAAO;CAC7B,MAAM,QAAQ,CAAC;CACf,MAAM,KAAK,WAAW,MAAM,MAAM,IAAI,EAAE,EAAE;CAC1C,MAAM,KAAK,cAAc;CACzB,KAAK,MAAM,CAAC,IAAI,WAAW,OAAO,QAAQ,MAAM,UAAU,OAAO,GAAG,MAAM,KAAK,OAAO,MAAM,EAAE,EAAE,IAAI,aAAa,MAAM,EAAE,EAAE;CAC3H,MAAM,KAAK,MAAM;CACjB,MAAM,KAAK,6BAA6B;CACxC,OAAO,MAAM,KAAK,IAAI;AACvB;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,eAAe,KAAK,KAAK,MAAM,KAAK,aAAa;CACvD,MAAM,YAAY,wBAAwB,cAAc,MAAM,SAAS;CACvE,MAAM,eAAe,wBAAwB,cAAc,MAAM,UAAU;CAC3E,OAAO;2DACmD,MAAM,MAAM,GAAG,EAAE;;sBAEtD,cAAc,GA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KAC5D,SAAS,OAAO;MACf,MAAM,aAAa,kCAAkC,KAAK;KAC3D;IACD;GACD;EACD,SAAS,OAAO;GACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;GACpD,MAAM;EACP;EACA,IAAI,WAAW,UAAU,OAAO,GAAG,sBAAsB,cAAc,CAAC;EACxE,OAAO,GAAG,KAAK,CAAC;CACjB,UAAU;EACT,IAAI;GACH,GAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;EAC1C,QAAQ,CAAC;CACV;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
1
|
+
import { c as CliStructuredError, d as blindCast, n as ok, r as okVoid, s as toStructured, t as notOk } from "./result-B4XjxVK6.mjs";
|
|
2
|
+
import { n as alchemyInvocation, r as spawnAlchemy } from "./run-alchemy-D44OZlyB-DA7s331N.mjs";
|
|
3
|
+
import { n as runPipeline } from "./pipeline-AoW8zq4I-C6Qe0VaZ.mjs";
|
|
4
|
+
import { t as containerEnv } from "./container-transport-DKmKg5JQ-CoY4XPma.mjs";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
@@ -61,7 +61,7 @@ function writeStackFile(input) {
|
|
|
61
61
|
}
|
|
62
62
|
const GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);
|
|
63
63
|
//#endregion
|
|
64
|
-
//#region ../../0-framework/3-tooling/cli/dist/deployment-summary-
|
|
64
|
+
//#region ../../0-framework/3-tooling/cli/dist/deployment-summary-DswOl_9E.mjs
|
|
65
65
|
/**
|
|
66
66
|
* The deploy result's cross-process protocol, whole in one place: the
|
|
67
67
|
* serializable shape, the env var that names the carrier file, the writer the
|
|
@@ -104,7 +104,7 @@ function readDeploymentSummary(resultFilePath) {
|
|
|
104
104
|
return blindCast(parsed);
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
|
-
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-
|
|
107
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DfVJUICu.mjs
|
|
108
108
|
/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */
|
|
109
109
|
function validateStageName(stage) {
|
|
110
110
|
const result = spawnSync("git", ["check-ref-format", `refs/heads/${stage}`], { stdio: "ignore" });
|
|
@@ -169,7 +169,8 @@ async function runStackPipeline(action, opts) {
|
|
|
169
169
|
try {
|
|
170
170
|
pipeline = await runPipeline(entry, name, cwd, {
|
|
171
171
|
runAssembler: deps.runAssembler,
|
|
172
|
-
config: deps.config
|
|
172
|
+
config: deps.config,
|
|
173
|
+
configPath: deps.configPath
|
|
173
174
|
}, action === "destroy" ? (error) => new CliStructuredError("DEPLOY.BUILD_REQUIRED", error.message, {
|
|
174
175
|
why: "destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.",
|
|
175
176
|
fix: "Run the build, then retry the destroy.",
|
|
@@ -183,12 +184,12 @@ async function runStackPipeline(action, opts) {
|
|
|
183
184
|
if (action === "deploy") containers.set(extension.id, await extension.container.ensure({
|
|
184
185
|
appName: resolvedName,
|
|
185
186
|
stage
|
|
186
|
-
}));
|
|
187
|
+
}, deps.credentials));
|
|
187
188
|
else {
|
|
188
189
|
const instance = await extension.container.locate({
|
|
189
190
|
appName: resolvedName,
|
|
190
191
|
stage
|
|
191
|
-
});
|
|
192
|
+
}, deps.credentials);
|
|
192
193
|
if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : ""}.`, { fix: "Deploy it first." });
|
|
193
194
|
containers.set(extension.id, instance);
|
|
194
195
|
}
|
|
@@ -205,7 +206,8 @@ async function runStackPipeline(action, opts) {
|
|
|
205
206
|
await extension.preflight({
|
|
206
207
|
graph,
|
|
207
208
|
container: containers.get(extension.id),
|
|
208
|
-
stage
|
|
209
|
+
stage,
|
|
210
|
+
credentials: deps.credentials
|
|
209
211
|
});
|
|
210
212
|
} catch (error) {
|
|
211
213
|
throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
|
|
@@ -230,19 +232,16 @@ async function runStackPipeline(action, opts) {
|
|
|
230
232
|
return notOk(toStructured("DEPLOY.STACK_WRITE_FAILED", error));
|
|
231
233
|
}
|
|
232
234
|
const reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;
|
|
233
|
-
let
|
|
235
|
+
let outcome;
|
|
234
236
|
try {
|
|
235
|
-
|
|
237
|
+
outcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({
|
|
236
238
|
command: action,
|
|
237
239
|
stackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,
|
|
238
240
|
cwd,
|
|
239
241
|
stage: alchemyStage,
|
|
240
242
|
containerEnv: containerEnv(containers),
|
|
241
|
-
env: {
|
|
242
|
-
|
|
243
|
-
[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
|
|
244
|
-
}
|
|
245
|
-
});
|
|
243
|
+
env: { [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath }
|
|
244
|
+
}));
|
|
246
245
|
} catch (error) {
|
|
247
246
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
248
247
|
return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", error instanceof Error ? error.message : String(error), {
|
|
@@ -255,6 +254,17 @@ async function runStackPipeline(action, opts) {
|
|
|
255
254
|
} }
|
|
256
255
|
}));
|
|
257
256
|
}
|
|
257
|
+
if (outcome.signal !== null) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {
|
|
258
|
+
signal: outcome.signal,
|
|
259
|
+
diagnostics: {
|
|
260
|
+
exitCode: void 0,
|
|
261
|
+
signal: outcome.signal,
|
|
262
|
+
stackFilePath: stackPath,
|
|
263
|
+
reproduceCommand,
|
|
264
|
+
cwd
|
|
265
|
+
}
|
|
266
|
+
} }));
|
|
267
|
+
const status = outcome.exitCode ?? 1;
|
|
258
268
|
if (status !== 0) return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", `alchemy ${action} exited with status ${status}.`, { meta: {
|
|
259
269
|
exitCode: status,
|
|
260
270
|
diagnostics: {
|
|
@@ -282,7 +292,7 @@ async function runStackPipeline(action, opts) {
|
|
|
282
292
|
const instance = containers.get(extension.id);
|
|
283
293
|
if (instance === void 0) continue;
|
|
284
294
|
try {
|
|
285
|
-
await extension.container.remove(instance);
|
|
295
|
+
await extension.container.remove(instance, deps.credentials);
|
|
286
296
|
} catch (error) {
|
|
287
297
|
throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
|
|
288
298
|
}
|
|
@@ -303,4 +313,4 @@ async function runStackPipeline(action, opts) {
|
|
|
303
313
|
//#endregion
|
|
304
314
|
export { executeDeploy, executeDestroy };
|
|
305
315
|
|
|
306
|
-
//# sourceMappingURL=execute-deploy-destroy-
|
|
316
|
+
//# sourceMappingURL=execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-deploy-destroy-DfVJUICu-quUQ08T8.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/generate-stack-BL6htaQb.mjs","../../../0-framework/3-tooling/cli/dist/deployment-summary-DswOl_9E.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-DfVJUICu.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configPath);\n\treturn `// Generated by \\`prisma-composer deploy\\`/\\`prisma-composer destroy\\` — overwritten on every\n// run; do not edit by hand. Independently runnable from ${quote(input.cwd)}:\n//\n// alchemy deploy ${GENERATED_DIR}/${GENERATED_FILE}\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\nimport { lower } from '@prisma/composer/deploy';\nimport { deploymentReport } from '@prisma/composer/report';\nimport config from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\nexport { renderStackFile as n, writeStackFile as r, GENERATED_STACK_RELATIVE_PATH as t };\n\n//# sourceMappingURL=generate-stack-BL6htaQb.mjs.map","import * as fs from \"node:fs\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/deployment-summary.ts\n/**\n* The deploy result's cross-process protocol, whole in one place: the\n* serializable shape, the env var that names the carrier file, the writer the\n* report hook calls from inside the alchemy child, and the reader the deploy\n* operation runs after the child exits. `DeploymentResult` itself cannot\n* cross the boundary — its `DeployedNode` entries hold live graph-node\n* references (ADR-0033) — so the writer projects it down to what CAN.\n*\n* The summary is best-effort by contract: the writer never fails the child\n* over it, and the reader maps absent or malformed to `undefined`.\n*/\n/** Env var the deploy operation sets on the alchemy child: when present,\n* the report hook also writes the JSON DeploymentSummary there. */\nconst DEPLOYMENT_RESULT_FILE_ENV = \"PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE\";\n/** Pure projection: keeps app + each node's address/entities, drops the in-process `node`. */\nfunction toDeploymentSummary(result) {\n\treturn {\n\t\tapp: result.app,\n\t\tnodes: result.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities\n\t\t}))\n\t};\n}\n/**\n* Writer half, called by the report hook inside the alchemy child: when the\n* env var names a file, write the summary there. Best-effort — a write\n* failure must not fail a deploy that already converged, so it is swallowed.\n*/\nfunction writeDeploymentSummaryFile(result) {\n\tconst file = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (file === void 0 || file.length === 0) return;\n\ttry {\n\t\tfs.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));\n\t} catch {}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Reader half, run by the deploy operation after the child exits. Absent or\n* malformed → undefined — the summary is best-effort, never a deploy failure.\n*/\nfunction readDeploymentSummary(resultFilePath) {\n\tlet raw;\n\ttry {\n\t\traw = fs.readFileSync(resultFilePath, \"utf8\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tif (!isRecord(parsed) || typeof parsed[\"app\"] !== \"string\" || !Array.isArray(parsed[\"nodes\"])) return;\n\tfor (const node of parsed[\"nodes\"]) {\n\t\tif (!isRecord(node) || typeof node[\"address\"] !== \"string\" || !Array.isArray(node[\"entities\"])) return;\n\t\tfor (const entity of node[\"entities\"]) if (!isRecord(entity) || typeof entity[\"kind\"] !== \"string\" || typeof entity[\"id\"] !== \"string\") return;\n\t}\n\treturn blindCast(parsed);\n}\n//#endregion\nexport { readDeploymentSummary as n, writeDeploymentSummaryFile as r, DEPLOYMENT_RESULT_FILE_ENV as t };\n\n//# sourceMappingURL=deployment-summary-DswOl_9E.mjs.map","import { r as toStructured } from \"./shared-BTnATsqm.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation } from \"./run-alchemy-D44OZlyB.mjs\";\nimport { r as writeStackFile, t as GENERATED_STACK_RELATIVE_PATH } from \"./generate-stack-BL6htaQb.mjs\";\nimport { n as readDeploymentSummary, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-DswOl_9E.mjs\";\nimport { n as runPipeline } from \"./pipeline-AoW8zq4I.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { spawnSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { containerEnv } from \"@internal/core/config\";\n//#region src/validate-stage.ts\n/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */\nfunction validateStageName(stage) {\n\tconst result = spawnSync(\"git\", [\"check-ref-format\", `refs/heads/${stage}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliStructuredError(\"DEPLOY.STAGE_UNVALIDATABLE\", `git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (result.status !== 0) throw new CliStructuredError(\"DEPLOY.STAGE_INVALID\", `Invalid --stage \"${stage}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${stage}\").`);\n}\n//#endregion\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}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.stage,\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps\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(\"destroy\", {\n\t\tentry: input.entry,\n\t\tname: input.name,\n\t\tstage: input.target.kind === \"stage\" ? input.target.stage : void 0,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipeline(action, opts) {\n\tconst { entry, name, stage, cwd, onEvent, deps } = opts;\n\tif (stage !== void 0) try {\n\t\tvalidateStageName(stage);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, cwd, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\tconfig: deps.config,\n\t\t\tconfigPath: deps.configPath\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tconst { config, graph, name: resolvedName } = pipeline;\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\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\tstage\n\t\t\t\t}, deps.credentials));\n\t\t\t\telse {\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\tstage\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : \"\"}.`, { fix: \"Deploy it first.\" });\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\tconst pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;\n\t\tif (pinnedStage === void 0) throw new CliStructuredError(\"DEPLOY.SCOPE_MISSING\", \"The configured deploy target supplied no deploy scope (its container defines no alchemyStage), so Alchemy has no stage to run under.\", { fix: action === \"deploy\" ? \"Pass --stage <name> to choose the deploy scope explicitly.\" : \"destroy --production needs a target whose container supplies the production deploy scope.\" });\n\t\talchemyStage = pinnedStage;\n\t\tif (action === \"deploy\") for (const extension of config.extensions) {\n\t\t\tif (extension.preflight === void 0) continue;\n\t\t\ttry {\n\t\t\t\tawait extension.preflight({\n\t\t\t\t\tgraph,\n\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\tstage,\n\t\t\t\t\tcredentials: deps.credentials\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_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\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\ttry {\n\t\ttry {\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigPath: pipeline.configPath,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst reproduceCommand = `alchemy ${action} ${GENERATED_STACK_RELATIVE_PATH} --yes --stage ${alchemyStage}`;\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({\n\t\t\t\tcommand: action,\n\t\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\t\tcwd,\n\t\t\t\tstage: alchemyStage,\n\t\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\t\tenv: { [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath }\n\t\t\t}));\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand,\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} exited with status ${status}.`, { meta: {\n\t\t\texitCode: status,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: status,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tstage\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.config.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance, deps.credentials);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(readDeploymentSummary(resultFilePath));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t} catch {}\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-DfVJUICu.mjs.map"],"mappings":";;;;;;;;;;AAIA,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;;AAEvB,SAAS,wBAAwB,cAAc,QAAQ;CACtD,MAAM,MAAM,KAAK,SAAS,cAAc,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACxE,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,KAAK;AACzC;AACA,SAAS,MAAM,OAAO;CACrB,OAAO,KAAK,UAAU,KAAK;AAC5B;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,UAAU,MAAM,OAAO,GAAG,EAAE,WAAW,MAAM,OAAO,KAAK,EAAE;AACnE;AACA,SAAS,cAAc,OAAO;CAC7B,MAAM,QAAQ,CAAC;CACf,MAAM,KAAK,WAAW,MAAM,MAAM,IAAI,EAAE,EAAE;CAC1C,MAAM,KAAK,cAAc;CACzB,KAAK,MAAM,CAAC,IAAI,WAAW,OAAO,QAAQ,MAAM,UAAU,OAAO,GAAG,MAAM,KAAK,OAAO,MAAM,EAAE,EAAE,IA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AAc,CAAC;EACxE,OAAO,GAAG,KAAK,CAAC;CACjB,UAAU;EACT,IAAI;GACH,GAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;EAC1C,QAAQ,CAAC;CACV;AACD"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as resolveLocalTargets } from "./local-target-
|
|
6
|
-
import { t as runAlchemy } from "./run-alchemy-hghRtddF-CQHOzlrW.mjs";
|
|
7
|
-
import { n as runPipeline } from "./pipeline-D3QoVzAB-Ci2aJ2mE.mjs";
|
|
8
|
-
import { t as withEmulatorRetry } from "./emulator-retry-DGonap4g-S8BNrXFD.mjs";
|
|
1
|
+
import { c as CliStructuredError, n as ok, s as toStructured, t as notOk } from "./result-B4XjxVK6.mjs";
|
|
2
|
+
import { n as alchemyInvocation, r as spawnAlchemy } from "./run-alchemy-D44OZlyB-DA7s331N.mjs";
|
|
3
|
+
import { n as runPipeline } from "./pipeline-AoW8zq4I-C6Qe0VaZ.mjs";
|
|
4
|
+
import { t as containerEnv } from "./container-transport-DKmKg5JQ-CoY4XPma.mjs";
|
|
5
|
+
import { n as withEmulatorRetry, r as DEV_DIR, t as resolveLocalTargets } from "./local-target-H0IWu_FM.mjs";
|
|
9
6
|
import * as fs from "node:fs";
|
|
10
7
|
import * as path from "node:path";
|
|
11
8
|
import { join, relative, resolve, sep } from "node:path";
|
|
@@ -1564,7 +1561,7 @@ var esm_default = {
|
|
|
1564
1561
|
FSWatcher
|
|
1565
1562
|
};
|
|
1566
1563
|
//#endregion
|
|
1567
|
-
//#region ../../0-framework/3-tooling/cli/dist/execute-dev-
|
|
1564
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-dev-BMTFWfFc.mjs
|
|
1568
1565
|
/**
|
|
1569
1566
|
* Local-dev spec § 6 `generate-dev-stack.ts`: like generate-stack.ts but at
|
|
1570
1567
|
* `.prisma-composer/dev/alchemy.run.ts`, always Alchemy stage `dev`, using
|
|
@@ -1771,7 +1768,8 @@ async function executeDev(input, deps, cwd) {
|
|
|
1771
1768
|
try {
|
|
1772
1769
|
const pipelineDeps = {
|
|
1773
1770
|
runAssembler: deps.runAssembler,
|
|
1774
|
-
config: deps.config
|
|
1771
|
+
config: deps.config,
|
|
1772
|
+
configPath: deps.configPath
|
|
1775
1773
|
};
|
|
1776
1774
|
pipeline = await runPipeline(input.entry, input.name, cwd, pipelineDeps);
|
|
1777
1775
|
const { config, graph, name } = pipeline;
|
|
@@ -1824,7 +1822,7 @@ async function executeDev(input, deps, cwd) {
|
|
|
1824
1822
|
throw error;
|
|
1825
1823
|
}
|
|
1826
1824
|
const reproduceCommand = `alchemy deploy ${DEV_STACK_RELATIVE_PATH} --yes --stage dev`;
|
|
1827
|
-
const converge = () => {
|
|
1825
|
+
const converge = async () => {
|
|
1828
1826
|
let stackPath;
|
|
1829
1827
|
try {
|
|
1830
1828
|
stackPath = writeDevStackFile({
|
|
@@ -1837,15 +1835,15 @@ async function executeDev(input, deps, cwd) {
|
|
|
1837
1835
|
} catch (error) {
|
|
1838
1836
|
throw toStructured("DEV.STACK_WRITE_FAILED", error);
|
|
1839
1837
|
}
|
|
1840
|
-
let
|
|
1838
|
+
let outcome;
|
|
1841
1839
|
try {
|
|
1842
|
-
|
|
1840
|
+
outcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({
|
|
1843
1841
|
command: "deploy",
|
|
1844
1842
|
stackFileRelativePath: DEV_STACK_RELATIVE_PATH,
|
|
1845
1843
|
cwd,
|
|
1846
1844
|
stage: "dev",
|
|
1847
1845
|
containerEnv: containerEnv(containers)
|
|
1848
|
-
});
|
|
1846
|
+
}));
|
|
1849
1847
|
} catch (error) {
|
|
1850
1848
|
if (CliStructuredError.is(error)) throw error;
|
|
1851
1849
|
throw new CliStructuredError("DEV.CONVERGE_FAILED", failureMessage(error), {
|
|
@@ -1859,21 +1857,23 @@ async function executeDev(input, deps, cwd) {
|
|
|
1859
1857
|
});
|
|
1860
1858
|
}
|
|
1861
1859
|
return {
|
|
1862
|
-
|
|
1860
|
+
outcome,
|
|
1863
1861
|
stackPath
|
|
1864
1862
|
};
|
|
1865
1863
|
};
|
|
1866
1864
|
let first;
|
|
1867
1865
|
try {
|
|
1868
|
-
first = converge();
|
|
1866
|
+
first = await converge();
|
|
1869
1867
|
} catch (error) {
|
|
1870
1868
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
1871
1869
|
throw error;
|
|
1872
1870
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1871
|
+
const firstStatus = first.outcome.signal !== null ? null : first.outcome.exitCode ?? 1;
|
|
1872
|
+
if (firstStatus !== 0) return notOk(new CliStructuredError("DEV.CONVERGE_FAILED", first.outcome.signal !== null ? `alchemy deploy was interrupted by ${first.outcome.signal}.` : `alchemy deploy exited with status ${String(firstStatus)}.`, { meta: {
|
|
1873
|
+
...first.outcome.signal !== null ? { signal: first.outcome.signal } : { exitCode: firstStatus },
|
|
1875
1874
|
diagnostics: {
|
|
1876
|
-
exitCode:
|
|
1875
|
+
exitCode: firstStatus ?? void 0,
|
|
1876
|
+
...first.outcome.signal !== null ? { signal: first.outcome.signal } : {},
|
|
1877
1877
|
stackFilePath: first.stackPath,
|
|
1878
1878
|
reproduceCommand,
|
|
1879
1879
|
cwd
|
|
@@ -1921,7 +1921,8 @@ async function executeDev(input, deps, cwd) {
|
|
|
1921
1921
|
});
|
|
1922
1922
|
const watchDeps = {
|
|
1923
1923
|
runAssembler: deps.runAssembler,
|
|
1924
|
-
config: deps.config
|
|
1924
|
+
config: deps.config,
|
|
1925
|
+
configPath: deps.configPath
|
|
1925
1926
|
};
|
|
1926
1927
|
watch = startWatch(targets, () => {
|
|
1927
1928
|
(async () => {
|
|
@@ -1934,13 +1935,14 @@ async function executeDev(input, deps, cwd) {
|
|
|
1934
1935
|
name: rePipeline.name,
|
|
1935
1936
|
assembled: rePipeline.assembled
|
|
1936
1937
|
});
|
|
1937
|
-
|
|
1938
|
+
const outcome = await (deps.alchemy ?? spawnAlchemy)(alchemyInvocation({
|
|
1938
1939
|
command: "deploy",
|
|
1939
1940
|
stackFileRelativePath: DEV_STACK_RELATIVE_PATH,
|
|
1940
1941
|
cwd,
|
|
1941
1942
|
stage: "dev",
|
|
1942
1943
|
containerEnv: containerEnv(containers)
|
|
1943
|
-
})
|
|
1944
|
+
}));
|
|
1945
|
+
if (outcome.signal !== null || outcome.exitCode !== 0) {
|
|
1944
1946
|
emit({
|
|
1945
1947
|
kind: "converge-failed",
|
|
1946
1948
|
stackFilePath: stackPath,
|
|
@@ -2006,4 +2008,4 @@ async function executeDev(input, deps, cwd) {
|
|
|
2006
2008
|
//#endregion
|
|
2007
2009
|
export { executeDev };
|
|
2008
2010
|
|
|
2009
|
-
//# sourceMappingURL=execute-dev-
|
|
2011
|
+
//# sourceMappingURL=execute-dev-BMTFWfFc-B1whS-Rr.mjs.map
|