@prisma/composer 0.39.0-dev.7 → 0.39.0-dev.9
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-DmCj4luV-BC36-MeB.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +17 -15
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
- package/dist/{app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +10 -40
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
- package/dist/app-converge-C6Zrg2xM-D0k4EIJY.mjs +88 -0
- package/dist/app-converge-C6Zrg2xM-D0k4EIJY.mjs.map +1 -0
- package/dist/config-Bpi8QVLB.d.mts +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/control.d.mts +8 -23
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/{converge-in-process-BBBeood8-BCIPOG8X.d.mts → converge-in-process-CTomEXaD-BnDylZP8.d.mts} +5 -5
- package/dist/{converge-in-process-BBBeood8-BCIPOG8X.d.mts.map → converge-in-process-CTomEXaD-BnDylZP8.d.mts.map} +1 -1
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
- package/dist/{deploy-B2kxaH5E.mjs → deploy-CSU0kr4j.mjs} +65 -5
- package/dist/{deploy-B2kxaH5E.mjs.map → deploy-CSU0kr4j.mjs.map} +1 -1
- package/dist/deploy-DHgEJDpg.d.mts +32 -0
- package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{deployment-summary-6LgQDUuu-Dp8kwMs_.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +4 -4
- package/dist/{deployment-summary-6LgQDUuu-Dp8kwMs_.d.mts.map → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map} +1 -1
- package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +3 -3
- package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map} +1 -1
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
- package/dist/dev-converge-worker.d.mts +1 -0
- package/dist/dev-converge-worker.mjs +142 -0
- package/dist/dev-converge-worker.mjs.map +1 -0
- package/dist/{dev-current-gQnmjB4V-BaNhcGpK.mjs → dev-current-EqQbrtj5-Dda1xCjU.mjs} +11 -7
- package/dist/dev-current-EqQbrtj5-Dda1xCjU.mjs.map +1 -0
- package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
- package/dist/{dist-CyrEbDx6.mjs → dist-Cf_mZHaH.mjs} +2 -2
- package/dist/{dist-CyrEbDx6.mjs.map → dist-Cf_mZHaH.mjs.map} +1 -1
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
- package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
- package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-DKbsBkqK-BWXh0zXQ.mjs → execute-deploy-destroy-DKEmb8WI-Cad08hR1.mjs} +246 -193
- package/dist/execute-deploy-destroy-DKEmb8WI-Cad08hR1.mjs.map +1 -0
- package/dist/{execute-dev-DVCWURmI-Cp3i7Hrp.mjs → execute-dev-C42niIFY-Cl5XzBy3.mjs} +434 -261
- package/dist/execute-dev-C42niIFY-Cl5XzBy3.mjs.map +1 -0
- package/dist/{execute-dev-current-Dt_9srY2-COEgQ9h4.mjs → execute-dev-current-AVT4zQ8F-WFr1pM2p.mjs} +7 -7
- package/dist/{execute-dev-current-Dt_9srY2-COEgQ9h4.mjs.map → execute-dev-current-AVT4zQ8F-WFr1pM2p.mjs.map} +1 -1
- package/dist/{execute-log-B34AeU97-CkJiGdIc.mjs → execute-log-DCe9fk1t-vVIgGSSi.mjs} +8 -8
- package/dist/{execute-log-B34AeU97-CkJiGdIc.mjs.map → execute-log-DCe9fk1t-vVIgGSSi.mjs.map} +1 -1
- package/dist/{graph-1ILOBl8O-DBaUZL2D.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
- package/dist/{graph-C6Fqe2gn-qJQBxs_C.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +18 -9
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
- package/dist/{graph-types-CaH3flhT-DgrCdRA3.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +13 -11
- package/dist/{graph-types-CaH3flhT-DgrCdRA3.d.mts.map → graph-types-D4PrtP-l-B0uuchTl.d.mts.map} +1 -1
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-Cnbf_d0q.d.mts → index-D8chHe55.d.mts} +3 -3
- package/dist/{index-Cnbf_d0q.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/internal-app-configuration-file.d.mts +5 -9
- package/dist/internal-app-configuration-file.d.mts.map +1 -1
- package/dist/internal-app-configuration-file.mjs +2 -2
- package/dist/internal-converge-contract.d.mts +6 -4
- package/dist/internal-converge-contract.d.mts.map +1 -1
- package/dist/internal-converge-contract.mjs +7 -5
- package/dist/internal-converge-contract.mjs.map +1 -1
- package/dist/internal-converge.d.mts +5 -4
- package/dist/internal-converge.mjs +4 -228
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
- package/dist/local-target-7KRsLMDO.d.mts +31 -0
- package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
- package/dist/{local-target-COdS1iNs.mjs → local-target-DhU1vaxd.mjs} +6 -6
- package/dist/{local-target-COdS1iNs.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
- package/dist/local-target.d.mts +3 -31
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-CSKy5tFv.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-CSKy5tFv.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{preflight-transport-C7_3abXW-Bza_hn9G.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +5 -4
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
- package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +16 -4
- package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs.map → redaction-DY6eDC12-W-FzW7_r.mjs.map} +1 -1
- package/dist/{redaction-CIaE4m9U-DyJoGPRw.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +58 -17
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +2 -2
- package/dist/report.mjs.map +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
- package/package.json +11 -11
- package/skills/prisma-composer-core-concepts/SKILL.md +8 -8
- package/src/exports/dev-converge-worker.ts +2 -0
- package/dist/app-config-DmCj4luV-BC36-MeB.d.mts.map +0 -1
- package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +0 -1
- package/dist/config-vv8LBErH.d.mts +0 -1
- package/dist/deploy-w-BcRS8b.d.mts +0 -12
- package/dist/deploy-w-BcRS8b.d.mts.map +0 -1
- package/dist/dev-current-gQnmjB4V-BaNhcGpK.mjs.map +0 -1
- package/dist/execute-deploy-destroy-DKbsBkqK-BWXh0zXQ.mjs.map +0 -1
- package/dist/execute-dev-DVCWURmI-Cp3i7Hrp.mjs.map +0 -1
- package/dist/graph-1ILOBl8O-DBaUZL2D.d.mts.map +0 -1
- package/dist/graph-C6Fqe2gn-qJQBxs_C.mjs.map +0 -1
- package/dist/internal-converge.mjs.map +0 -1
- package/dist/local-target.d.mts.map +0 -1
- package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +0 -1
- package/dist/redaction-CIaE4m9U-DyJoGPRw.d.mts.map +0 -1
- package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs +0 -236
- package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map +0 -1
- package/dist/validate-environment-XwVDifWN-D14WhSH0.mjs +0 -739
- package/dist/validate-environment-XwVDifWN-D14WhSH0.mjs.map +0 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { t as AppConfigurationRead } from "./graph-types-
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
|
|
5
|
-
import "./redaction-CIaE4m9U-DyJoGPRw.mjs";
|
|
6
|
-
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-BTNkc0y8.d.mts
|
|
1
|
+
import { t as AppConfigurationRead } from "./graph-types-D4PrtP-l-B0uuchTl.mjs";
|
|
2
|
+
import "./index-D8chHe55.mjs";
|
|
3
|
+
import "./redaction-Dn7BRdaP-BcLSPhLV.mjs";
|
|
4
|
+
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file.d.mts
|
|
7
5
|
//#region src/app-configuration-file.d.ts
|
|
8
6
|
/** What the app configuration file holds: what the first process's Load read, the plain platform variable texts, and the graph's node addresses. */
|
|
9
7
|
interface AppConfigurationFile {
|
|
@@ -13,8 +11,6 @@ interface AppConfigurationFile {
|
|
|
13
11
|
}
|
|
14
12
|
/** Second process: the app configuration file the first process named in its environment. */
|
|
15
13
|
declare function readAppConfigurationFile(env: Readonly<Record<string, string | undefined>>): AppConfigurationFile;
|
|
16
|
-
/** Second process, under `prisma dev`: the named secrets the first process handed it. */
|
|
17
|
-
declare function namedSecretsFromEnvironment(env: Readonly<Record<string, string | undefined>>): NamedSecrets;
|
|
18
14
|
//#endregion
|
|
19
|
-
export {
|
|
15
|
+
export { readAppConfigurationFile };
|
|
20
16
|
//# sourceMappingURL=internal-app-configuration-file.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-app-configuration-file.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file
|
|
1
|
+
{"version":3,"file":"internal-app-configuration-file.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file.d.mts"],"mappings":";;;;;;UAIU;WACC,sBAAsB;WACtB,mBAAmB,SAAS;WAC5B;;;iBAGM,yBAAyB,KAAK,SAAS,sCAAsC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { r as readAppConfigurationFile } from "./app-configuration-file-D0rB5g65-CdMrjkCc.mjs";
|
|
2
|
+
export { readAppConfigurationFile };
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* The version of the shapes the `prisma` host and the app's
|
|
5
5
|
* `@prisma/composer` pass each other through `internal/converge`:
|
|
6
|
-
* `LowerOptions`, `ConvergeRequest`, `ConvergeOutcome`, `ConvergeEvent
|
|
7
|
-
* `DeploymentResult
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `LowerOptions`, `ConvergeRequest`, `ConvergeOutcome`, `ConvergeEvent`,
|
|
7
|
+
* `DeploymentResult`, and the functions the entry exports (`lower`,
|
|
8
|
+
* `convergeInProcess`, `localTargetProviders`, `devState`). Bump it only
|
|
9
|
+
* when one of them changes in a way the other side cannot read;
|
|
10
|
+
* `converge-contract.test-d.ts` fails on any change to the shapes. Imports
|
|
11
|
+
* nothing, so a host can read it before loading the converge.
|
|
10
12
|
*/
|
|
11
13
|
declare const CONVERGE_CONTRACT = 2;
|
|
12
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-converge-contract.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/converge-contract.d.mts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal-converge-contract.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/converge-contract.d.mts"],"mappings":";;;;;;;;;;;;cAWc"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
//#region ../../0-framework/3-tooling/cli/dist/converge-contract-
|
|
1
|
+
//#region ../../0-framework/3-tooling/cli/dist/converge-contract-DrO0Jt9l.mjs
|
|
2
2
|
/**
|
|
3
3
|
* The version of the shapes the `prisma` host and the app's
|
|
4
4
|
* `@prisma/composer` pass each other through `internal/converge`:
|
|
5
|
-
* `LowerOptions`, `ConvergeRequest`, `ConvergeOutcome`, `ConvergeEvent
|
|
6
|
-
* `DeploymentResult
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* `LowerOptions`, `ConvergeRequest`, `ConvergeOutcome`, `ConvergeEvent`,
|
|
6
|
+
* `DeploymentResult`, and the functions the entry exports (`lower`,
|
|
7
|
+
* `convergeInProcess`, `localTargetProviders`, `devState`). Bump it only
|
|
8
|
+
* when one of them changes in a way the other side cannot read;
|
|
9
|
+
* `converge-contract.test-d.ts` fails on any change to the shapes. Imports
|
|
10
|
+
* nothing, so a host can read it before loading the converge.
|
|
9
11
|
*/
|
|
10
12
|
const CONVERGE_CONTRACT = 2;
|
|
11
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-converge-contract.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/converge-contract-
|
|
1
|
+
{"version":3,"file":"internal-converge-contract.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/converge-contract-DrO0Jt9l.mjs"],"sourcesContent":["//#region src/converge-contract.ts\n/**\n* The version of the shapes the `prisma` host and the app's\n* `@prisma/composer` pass each other through `internal/converge`:\n* `LowerOptions`, `ConvergeRequest`, `ConvergeOutcome`, `ConvergeEvent`,\n* `DeploymentResult`, and the functions the entry exports (`lower`,\n* `convergeInProcess`, `localTargetProviders`, `devState`). Bump it only\n* when one of them changes in a way the other side cannot read;\n* `converge-contract.test-d.ts` fails on any change to the shapes. Imports\n* nothing, so a host can read it before loading the converge.\n*/\nconst CONVERGE_CONTRACT = 2;\n//#endregion\nexport { CONVERGE_CONTRACT as t };\n\n//# sourceMappingURL=converge-contract-DrO0Jt9l.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,oBAAoB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./deploy-
|
|
3
|
-
import { a as ConvergeRequest, i as ConvergeOutcome, n as ConvergeEvent, o as LoweredStack, r as ConvergeFailureReason, s as convergeInProcess, t as Converge } from "./converge-in-process-
|
|
4
|
-
|
|
1
|
+
import { vt as lower } from "./app-config-DriAu5RU-C8hYpR38.mjs";
|
|
2
|
+
import "./deploy-DHgEJDpg.mjs";
|
|
3
|
+
import { a as ConvergeRequest, i as ConvergeOutcome, n as ConvergeEvent, o as LoweredStack, r as ConvergeFailureReason, s as convergeInProcess, t as Converge } from "./converge-in-process-CTomEXaD-BnDylZP8.mjs";
|
|
4
|
+
import { n as localTargetProviders, t as devState } from "./local-target-7KRsLMDO.mjs";
|
|
5
|
+
export { type Converge, type ConvergeEvent, type ConvergeFailureReason, type ConvergeOutcome, type ConvergeRequest, type LoweredStack, convergeInProcess, devState, localTargetProviders, lower };
|
|
@@ -1,228 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { isMainThread } from "node:worker_threads";
|
|
6
|
-
import * as Alchemist from "alchemy/Alchemist";
|
|
7
|
-
import * as Interaction from "alchemy/Interaction";
|
|
8
|
-
import { recordOf } from "alchemy/Util/LogRecord";
|
|
9
|
-
import * as Cause from "effect/Cause";
|
|
10
|
-
import * as Exit from "effect/Exit";
|
|
11
|
-
import * as Logger from "effect/Logger";
|
|
12
|
-
//#region ../../0-framework/3-tooling/cli/dist/converge.mjs
|
|
13
|
-
/**
|
|
14
|
-
* Runs a lowered stack's plan and apply in this process through Alchemy's
|
|
15
|
-
* programmatic API (`alchemy/Alchemist`). Alchemy's typed events and log
|
|
16
|
-
* lines come back as {@link ConvergeEvent}s, and what Alchemy writes to the
|
|
17
|
-
* terminal itself goes to the request's `output`, so the caller renders
|
|
18
|
-
* progress in its own format.
|
|
19
|
-
*
|
|
20
|
-
* Published as `@prisma/composer/internal/converge`: the CLI loads it from
|
|
21
|
-
* the app's install, so it runs on the app's copy of alchemy and effect.
|
|
22
|
-
*/
|
|
23
|
-
const FINISHED = /* @__PURE__ */ new Set([
|
|
24
|
-
"created",
|
|
25
|
-
"updated",
|
|
26
|
-
"adopted",
|
|
27
|
-
"deleted",
|
|
28
|
-
"orphaned",
|
|
29
|
-
"replaced",
|
|
30
|
-
"ran",
|
|
31
|
-
"skipped"
|
|
32
|
-
]);
|
|
33
|
-
function phaseOf(status) {
|
|
34
|
-
if (status === "pending") return "pending";
|
|
35
|
-
if (status === "fail") return "failed";
|
|
36
|
-
return FINISHED.has(status) ? "done" : "running";
|
|
37
|
-
}
|
|
38
|
-
/** Alchemy's typed event as a converge event; undefined for the events Composer does not show. */
|
|
39
|
-
function toConvergeEvent(event) {
|
|
40
|
-
switch (event.type) {
|
|
41
|
-
case "apply.resource.status": return {
|
|
42
|
-
kind: "resource",
|
|
43
|
-
fqn: event.fqn,
|
|
44
|
-
resourceType: event.resourceType,
|
|
45
|
-
status: event.status,
|
|
46
|
-
phase: phaseOf(event.status),
|
|
47
|
-
...event.message === void 0 ? {} : { message: event.message }
|
|
48
|
-
};
|
|
49
|
-
case "apply.resource.note": return {
|
|
50
|
-
kind: "log",
|
|
51
|
-
severity: event.kind === void 0 ? "info" : "verbose",
|
|
52
|
-
text: `${event.fqn}: ${event.message}`
|
|
53
|
-
};
|
|
54
|
-
default: return;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const SEVERITY_OF = {
|
|
58
|
-
info: "info",
|
|
59
|
-
warn: "warn",
|
|
60
|
-
error: "warn",
|
|
61
|
-
fatal: "warn"
|
|
62
|
-
};
|
|
63
|
-
/** Alchemy's log lines at info and above, as Alchemy's console sink would print them. Typed events are left to `Alchemist.onEvent`. */
|
|
64
|
-
function logEvents(emit) {
|
|
65
|
-
return Logger.make((options) => {
|
|
66
|
-
const record = recordOf(options);
|
|
67
|
-
const severity = SEVERITY_OF[record.level];
|
|
68
|
-
if (severity === void 0) return;
|
|
69
|
-
if (record.kind === "log") {
|
|
70
|
-
const fqn = record.attributes["fqn"];
|
|
71
|
-
emit({
|
|
72
|
-
kind: "log",
|
|
73
|
-
severity,
|
|
74
|
-
text: `${typeof fqn === "string" ? `${fqn}: ` : ""}${record.data.message}`
|
|
75
|
-
});
|
|
76
|
-
if (record.data.cause !== null) emit({
|
|
77
|
-
kind: "log",
|
|
78
|
-
severity,
|
|
79
|
-
text: record.data.cause
|
|
80
|
-
});
|
|
81
|
-
} else if (record.kind === "output") emit({
|
|
82
|
-
kind: "log",
|
|
83
|
-
severity: "verbose",
|
|
84
|
-
text: record.data.text
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function textOf(value) {
|
|
89
|
-
if (typeof value === "string") return value;
|
|
90
|
-
try {
|
|
91
|
-
const json = JSON.stringify(value);
|
|
92
|
-
if (json !== void 0) return json;
|
|
93
|
-
} catch {}
|
|
94
|
-
return String(value);
|
|
95
|
-
}
|
|
96
|
-
function isRecord(value) {
|
|
97
|
-
return typeof value === "object" && value !== null;
|
|
98
|
-
}
|
|
99
|
-
/** One error as a reason. A wrapped provider failure reports the error it wraps, and a structured error reports its code as its tag. */
|
|
100
|
-
function reasonOf(error) {
|
|
101
|
-
if (!isRecord(error)) return {
|
|
102
|
-
tag: "Unknown",
|
|
103
|
-
message: textOf(error)
|
|
104
|
-
};
|
|
105
|
-
const wrapped = wrappedProviderError(error);
|
|
106
|
-
if (wrapped !== void 0) return reasonOf(wrapped);
|
|
107
|
-
const message = typeof error["message"] === "string" ? error["message"] : void 0;
|
|
108
|
-
return {
|
|
109
|
-
tag: CliStructuredError.is(error) ? error.code : typeof error["_tag"] === "string" ? error["_tag"] : error instanceof Error ? error.name : "Unknown",
|
|
110
|
-
message: message ?? textOf(error)
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/** The errors a converge failed with, one per distinct error, interruptions left out. */
|
|
114
|
-
function failureReasons(cause) {
|
|
115
|
-
const reasons = cause.reasons.flatMap((reason) => {
|
|
116
|
-
if (Cause.isInterruptReason(reason)) return [];
|
|
117
|
-
return [reasonOf(Cause.isFailReason(reason) ? reason.error : reason.defect)];
|
|
118
|
-
});
|
|
119
|
-
const unique = new Map(reasons.map((reason) => [`${reason.tag}\0${reason.message}`, reason]));
|
|
120
|
-
return unique.size > 0 ? [...unique.values()] : [{
|
|
121
|
-
tag: "Unknown",
|
|
122
|
-
message: Cause.pretty(cause)
|
|
123
|
-
}];
|
|
124
|
-
}
|
|
125
|
-
/** One flag per process, shared by every copy of this module, so two apps' installs in one host cannot converge at once. */
|
|
126
|
-
const RUNNING = Symbol.for("prisma.composer.converge.running");
|
|
127
|
-
const flag = blindCast(globalThis);
|
|
128
|
-
/**
|
|
129
|
-
* Sets the process state Alchemy reads for the length of `run`, and restores
|
|
130
|
-
* it on every exit path: the variables in `env`, then the working directory.
|
|
131
|
-
* A directory that cannot be restored never leaves a variable behind and
|
|
132
|
-
* never changes what `run` returned.
|
|
133
|
-
*/
|
|
134
|
-
async function withProcessState(env, cwd, run) {
|
|
135
|
-
const previousEnv = Object.keys(env).map((name) => [name, process.env[name]]);
|
|
136
|
-
const previousCwd = process.cwd();
|
|
137
|
-
let changedDirectory = false;
|
|
138
|
-
try {
|
|
139
|
-
for (const [name, value] of Object.entries(env)) if (value === void 0) delete process.env[name];
|
|
140
|
-
else process.env[name] = value;
|
|
141
|
-
if (previousCwd !== cwd) {
|
|
142
|
-
process.chdir(cwd);
|
|
143
|
-
changedDirectory = true;
|
|
144
|
-
}
|
|
145
|
-
return await run();
|
|
146
|
-
} finally {
|
|
147
|
-
for (const [name, value] of previousEnv) if (value === void 0) delete process.env[name];
|
|
148
|
-
else process.env[name] = value;
|
|
149
|
-
if (changedDirectory) try {
|
|
150
|
-
process.chdir(previousCwd);
|
|
151
|
-
} catch {}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/** A stream for Alchemy's terminal output that hands each write to `write`; it reports the terminal's size and colours as stderr does. */
|
|
155
|
-
function writingTo(write) {
|
|
156
|
-
const stream = Object.create(process.stderr);
|
|
157
|
-
stream.write = (chunk) => {
|
|
158
|
-
try {
|
|
159
|
-
write(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8"));
|
|
160
|
-
} catch {}
|
|
161
|
-
return true;
|
|
162
|
-
};
|
|
163
|
-
return stream;
|
|
164
|
-
}
|
|
165
|
-
function program(request, emit) {
|
|
166
|
-
const terminal = request.output === void 0 ? process.stderr : writingTo(request.output);
|
|
167
|
-
return Effect.gen(function* () {
|
|
168
|
-
const plan = yield* Alchemist.plan({
|
|
169
|
-
stack: request.stack,
|
|
170
|
-
operation: request.operation,
|
|
171
|
-
stage: request.stage,
|
|
172
|
-
updateStateStore: true
|
|
173
|
-
});
|
|
174
|
-
yield* Alchemist.apply(plan);
|
|
175
|
-
}).pipe(Alchemist.onEvent((event) => Effect.sync(() => {
|
|
176
|
-
const converted = toConvergeEvent(event);
|
|
177
|
-
if (converted !== void 0) emit(converted);
|
|
178
|
-
})), Effect.scoped, Effect.provide(Logger.layer([logEvents(emit)])), Effect.provide(Interaction.layerNonInteractive({
|
|
179
|
-
stdout: terminal,
|
|
180
|
-
stderr: terminal
|
|
181
|
-
})), Effect.provide(Alchemist.layer()));
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Plans and applies `stack` in this process, as `alchemy deploy --yes` would.
|
|
185
|
-
* The plan's scope, and the state-store lease it holds, closes before this
|
|
186
|
-
* returns, including when `signal` interrupts it. One converge runs at a time
|
|
187
|
-
* per process, across every install of this module: a second call while one
|
|
188
|
-
* runs is refused.
|
|
189
|
-
*/
|
|
190
|
-
const convergeInProcess = async (request) => {
|
|
191
|
-
if (flag[RUNNING] === true) return {
|
|
192
|
-
kind: "refused",
|
|
193
|
-
reason: "already-running"
|
|
194
|
-
};
|
|
195
|
-
if (!isMainThread && process.cwd() !== request.cwd) return {
|
|
196
|
-
kind: "refused",
|
|
197
|
-
reason: "worker-thread"
|
|
198
|
-
};
|
|
199
|
-
const emit = (event) => {
|
|
200
|
-
try {
|
|
201
|
-
request.onEvent?.(event);
|
|
202
|
-
} catch {}
|
|
203
|
-
};
|
|
204
|
-
try {
|
|
205
|
-
flag[RUNNING] = true;
|
|
206
|
-
const effect = program(request, emit);
|
|
207
|
-
return await withProcessState(request.env, request.cwd, async () => {
|
|
208
|
-
const exit = await Effect.runPromiseExit(effect, request.signal === void 0 ? void 0 : { signal: request.signal });
|
|
209
|
-
if (Exit.isSuccess(exit)) return { kind: "applied" };
|
|
210
|
-
if (Cause.hasInterruptsOnly(exit.cause)) return { kind: "interrupted" };
|
|
211
|
-
return {
|
|
212
|
-
kind: "failed",
|
|
213
|
-
reasons: failureReasons(exit.cause)
|
|
214
|
-
};
|
|
215
|
-
});
|
|
216
|
-
} catch (error) {
|
|
217
|
-
return {
|
|
218
|
-
kind: "failed",
|
|
219
|
-
reasons: [reasonOf(error)]
|
|
220
|
-
};
|
|
221
|
-
} finally {
|
|
222
|
-
flag[RUNNING] = false;
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
//#endregion
|
|
226
|
-
export { convergeInProcess, lower };
|
|
227
|
-
|
|
228
|
-
//# sourceMappingURL=internal-converge.mjs.map
|
|
1
|
+
import { c as lower } from "./deploy-CSU0kr4j.mjs";
|
|
2
|
+
import { t as convergeInProcess } from "./converge-in-process-x89zb2MF-Dvj-J8xo.mjs";
|
|
3
|
+
import { n as localTargetProviders, t as devState } from "./local-target-DhU1vaxd.mjs";
|
|
4
|
+
export { convergeInProcess, devState, localTargetProviders, lower };
|