@prisma/composer 0.39.0-dev.6 → 0.39.0-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/{app-config-Ubi4CftJ-DUSDjI2i.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +17 -15
  2. package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
  3. package/dist/{app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +10 -40
  4. package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
  5. package/dist/app-converge-CVlo9uw2-B-fdr0nr.mjs +88 -0
  6. package/dist/app-converge-CVlo9uw2-B-fdr0nr.mjs.map +1 -0
  7. package/dist/arktype.d.mts +7 -5
  8. package/dist/arktype.d.mts.map +1 -1
  9. package/dist/arktype.mjs +7 -5
  10. package/dist/arktype.mjs.map +1 -1
  11. package/dist/config-Bpi8QVLB.d.mts +1 -0
  12. package/dist/config.d.mts +2 -2
  13. package/dist/config.mjs +1 -1
  14. package/dist/control.d.mts +8 -23
  15. package/dist/control.d.mts.map +1 -1
  16. package/dist/control.mjs +4 -4
  17. package/dist/control.mjs.map +1 -1
  18. package/dist/{converge-in-process-BBBeood8-C7VG5b35.d.mts → converge-in-process-CTomEXaD-BnDylZP8.d.mts} +5 -5
  19. package/dist/{converge-in-process-BBBeood8-C7VG5b35.d.mts.map → converge-in-process-CTomEXaD-BnDylZP8.d.mts.map} +1 -1
  20. package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
  21. package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
  22. package/dist/{deploy-NArSOken.mjs → deploy-CSU0kr4j.mjs} +65 -5
  23. package/dist/{deploy-NArSOken.mjs.map → deploy-CSU0kr4j.mjs.map} +1 -1
  24. package/dist/deploy-DHgEJDpg.d.mts +32 -0
  25. package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
  26. package/dist/deploy.d.mts +4 -4
  27. package/dist/deploy.mjs +3 -3
  28. package/dist/{deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +4 -4
  29. package/dist/{deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts.map → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map} +1 -1
  30. package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +3 -3
  31. package/dist/{deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map} +1 -1
  32. package/dist/{describe-kind-Cpm_euxo-D9WDxl5C.mjs → describe-kind-Cpm_euxo-DsSPENQa.mjs} +3 -3
  33. package/dist/describe-kind-Cpm_euxo-DsSPENQa.mjs.map +1 -0
  34. package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
  35. package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
  36. package/dist/dev-converge-worker.d.mts +1 -0
  37. package/dist/dev-converge-worker.mjs +142 -0
  38. package/dist/dev-converge-worker.mjs.map +1 -0
  39. package/dist/{dev-current-BT66YKUB-CFI8HmP7.mjs → dev-current-ByY2RrbK-DbU6y3PF.mjs} +11 -7
  40. package/dist/dev-current-ByY2RrbK-DbU6y3PF.mjs.map +1 -0
  41. package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
  42. package/dist/{dev-environment-name-6eEr5PW8-6sPgQZG3.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
  43. package/dist/{dist-BxtsHOfP.mjs → dist-Cf_mZHaH.mjs} +2 -2
  44. package/dist/{dist-BxtsHOfP.mjs.map → dist-Cf_mZHaH.mjs.map} +1 -1
  45. package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
  46. package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
  47. package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
  48. package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
  49. package/dist/{execute-deploy-destroy-C67FX_2B-DIKGa3gS.mjs → execute-deploy-destroy-D1jnaYqU-RAlTx-NX.mjs} +246 -193
  50. package/dist/execute-deploy-destroy-D1jnaYqU-RAlTx-NX.mjs.map +1 -0
  51. package/dist/{execute-dev-CVjdm1y1-DyFJDp6x.mjs → execute-dev-BP0Shlpd-BNFvs2LF.mjs} +434 -261
  52. package/dist/execute-dev-BP0Shlpd-BNFvs2LF.mjs.map +1 -0
  53. package/dist/{execute-dev-current-D5ANAZnU-CJQEjEnc.mjs → execute-dev-current-B792f_1m-BYJ-Rl8m.mjs} +7 -7
  54. package/dist/{execute-dev-current-D5ANAZnU-CJQEjEnc.mjs.map → execute-dev-current-B792f_1m-BYJ-Rl8m.mjs.map} +1 -1
  55. package/dist/{execute-log-BpiGoJwe-DYQw_hSp.mjs → execute-log-BiRHQq6Q-BkQk0Kvo.mjs} +8 -8
  56. package/dist/{execute-log-BpiGoJwe-DYQw_hSp.mjs.map → execute-log-BiRHQq6Q-BkQk0Kvo.mjs.map} +1 -1
  57. package/dist/{graph-DU0omY5O-BHO71z0F.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
  58. package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
  59. package/dist/{graph-C6Fqe2gn-DMa2udEA.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +19 -10
  60. package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
  61. package/dist/{graph-types-Bzj1fahC-C8rOVj0c.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +15 -13
  62. package/dist/{graph-types-Bzj1fahC-C8rOVj0c.d.mts.map → graph-types-D4PrtP-l-B0uuchTl.d.mts.map} +1 -1
  63. package/dist/http.d.mts +2 -2
  64. package/dist/http.mjs +2 -2
  65. package/dist/{index-B8s0bLZY.d.mts → index-D8chHe55.d.mts} +3 -3
  66. package/dist/{index-B8s0bLZY.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
  67. package/dist/index.d.mts +5 -5
  68. package/dist/index.mjs +3 -3
  69. package/dist/internal-app-configuration-file.d.mts +5 -9
  70. package/dist/internal-app-configuration-file.d.mts.map +1 -1
  71. package/dist/internal-app-configuration-file.mjs +2 -2
  72. package/dist/internal-converge-contract.d.mts +6 -4
  73. package/dist/internal-converge-contract.d.mts.map +1 -1
  74. package/dist/internal-converge-contract.mjs +7 -5
  75. package/dist/internal-converge-contract.mjs.map +1 -1
  76. package/dist/internal-converge.d.mts +5 -4
  77. package/dist/internal-converge.mjs +4 -228
  78. package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
  79. package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
  80. package/dist/local-target-7KRsLMDO.d.mts +31 -0
  81. package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
  82. package/dist/{local-target-COdS1iNs.mjs → local-target-DhU1vaxd.mjs} +6 -6
  83. package/dist/{local-target-COdS1iNs.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
  84. package/dist/local-target.d.mts +3 -31
  85. package/dist/local-target.mjs +1 -1
  86. package/dist/{nextjs-DLyeRR7M-Z_xX74Cp.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
  87. package/dist/{nextjs-DLyeRR7M-Z_xX74Cp.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map} +1 -1
  88. package/dist/nextjs-control.d.mts +4 -4
  89. package/dist/nextjs.d.mts +1 -1
  90. package/dist/node-control.d.mts +3 -3
  91. package/dist/node.d.mts +2 -2
  92. package/dist/{pointer-DclJZFQi-DJa4t8Wa.d.mts → pointer-BX2KJ720-BxcfpaHP.d.mts} +7 -5
  93. package/dist/{pointer-DclJZFQi-DJa4t8Wa.d.mts.map → pointer-BX2KJ720-BxcfpaHP.d.mts.map} +1 -1
  94. package/dist/{preflight-transport-C7_3abXW-Bza_hn9G.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +5 -4
  95. package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
  96. package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +16 -4
  97. package/dist/{redaction-CjMYXtGp-CEQ5z1PK.mjs.map → redaction-DY6eDC12-W-FzW7_r.mjs.map} +1 -1
  98. package/dist/{redaction-CIaE4m9U-DJGrkcn3.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +58 -17
  99. package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.map +1 -0
  100. package/dist/report.d.mts +3 -3
  101. package/dist/report.mjs +2 -2
  102. package/dist/report.mjs.map +1 -1
  103. package/dist/service-rpc.d.mts +2 -2
  104. package/dist/service-rpc.mjs +2 -2
  105. package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
  106. package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
  107. package/dist/testing.d.mts +1 -1
  108. package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
  109. package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
  110. package/dist/zod.d.mts +6 -5
  111. package/dist/zod.d.mts.map +1 -1
  112. package/dist/zod.mjs +6 -5
  113. package/dist/zod.mjs.map +1 -1
  114. package/package.json +11 -11
  115. package/skills/prisma-composer-core-concepts/SKILL.md +13 -10
  116. package/src/exports/dev-converge-worker.ts +2 -0
  117. package/dist/app-config-Ubi4CftJ-DUSDjI2i.d.mts.map +0 -1
  118. package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +0 -1
  119. package/dist/config-BmRE_eTa.d.mts +0 -1
  120. package/dist/deploy-BW_F4Y9W.d.mts +0 -12
  121. package/dist/deploy-BW_F4Y9W.d.mts.map +0 -1
  122. package/dist/describe-kind-Cpm_euxo-D9WDxl5C.mjs.map +0 -1
  123. package/dist/dev-current-BT66YKUB-CFI8HmP7.mjs.map +0 -1
  124. package/dist/execute-deploy-destroy-C67FX_2B-DIKGa3gS.mjs.map +0 -1
  125. package/dist/execute-dev-CVjdm1y1-DyFJDp6x.mjs.map +0 -1
  126. package/dist/graph-C6Fqe2gn-DMa2udEA.mjs.map +0 -1
  127. package/dist/graph-DU0omY5O-BHO71z0F.d.mts.map +0 -1
  128. package/dist/internal-converge.mjs.map +0 -1
  129. package/dist/local-target.d.mts.map +0 -1
  130. package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +0 -1
  131. package/dist/redaction-CIaE4m9U-DJGrkcn3.d.mts.map +0 -1
  132. package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs +0 -236
  133. package/dist/run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map +0 -1
  134. package/dist/validate-environment-XwVDifWN-BhPOzWN8.mjs +0 -739
  135. package/dist/validate-environment-XwVDifWN-BhPOzWN8.mjs.map +0 -1
@@ -1,9 +1,7 @@
1
- import { t as AppConfigurationRead } from "./graph-types-Bzj1fahC-C8rOVj0c.mjs";
2
- import { R as NamedSecrets } from "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
3
- import "./config-BmRE_eTa.mjs";
4
- import "./index-B8s0bLZY.mjs";
5
- import "./redaction-CIaE4m9U-DJGrkcn3.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 { namedSecretsFromEnvironment, readAppConfigurationFile };
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-BTNkc0y8.d.mts"],"mappings":";;;;;;;;UAKU;WACC,sBAAsB;WACtB,mBAAmB,SAAS;WAC5B;;;iBAyBM,yBAAyB,KAAK,SAAS,sCAAsC;;iBAE7E,4BAA4B,KAAK,SAAS,sCAAsC"}
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 { a as readAppConfigurationFile, r as namedSecretsFromEnvironment } from "./app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs";
2
- export { namedSecretsFromEnvironment, readAppConfigurationFile };
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` and
7
- * `DeploymentResult`. Bump it only when one of them changes in a way the
8
- * other side cannot read; `converge-contract.test-d.ts` fails on any change.
9
- * Imports nothing, so a host can read it before loading the converge.
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":";;;;;;;;;;cASc"}
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-BjDlHXVU.mjs
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` and
6
- * `DeploymentResult`. Bump it only when one of them changes in a way the
7
- * other side cannot read; `converge-contract.test-d.ts` fails on any change.
8
- * Imports nothing, so a host can read it before loading the converge.
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-BjDlHXVU.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` and\n* `DeploymentResult`. Bump it only when one of them changes in a way the\n* other side cannot read; `converge-contract.test-d.ts` fails on any change.\n* Imports 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-BjDlHXVU.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,oBAAoB"}
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 { _t as lower } from "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
2
- import "./deploy-BW_F4Y9W.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-BBBeood8-C7VG5b35.mjs";
4
- export { type Converge, type ConvergeEvent, type ConvergeFailureReason, type ConvergeOutcome, type ConvergeRequest, type LoweredStack, convergeInProcess, lower };
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 { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
3
- import { f as wrappedProviderError, o as lower } from "./deploy-NArSOken.mjs";
4
- import * as Effect from "effect/Effect";
5
- import { isMainThread } from "node:worker_threads";
6
- import * as Alchemist from "alchemy/Alchemist";
7
- import * as Interaction from "alchemy/Interaction";
8
- import { recordOf } from "alchemy/Util/LogRecord";
9
- import * as Cause from "effect/Cause";
10
- import * as Exit from "effect/Exit";
11
- import * as Logger from "effect/Logger";
12
- //#region ../../0-framework/3-tooling/cli/dist/converge.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 };