alchemy 2.0.0-beta.84 → 2.0.0-beta.85

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 (758) hide show
  1. package/THIRD_PARTY_LICENSES.md +2 -2
  2. package/bin/cli.js +14 -6
  3. package/bin/register-oxc.js +16 -12
  4. package/lib/AdoptPolicy.d.ts +73 -0
  5. package/lib/AdoptPolicy.d.ts.map +1 -1
  6. package/lib/AdoptPolicy.js +54 -0
  7. package/lib/AdoptPolicy.js.map +1 -1
  8. package/lib/Alchemist/AuthRegistry.d.ts +31 -0
  9. package/lib/Alchemist/AuthRegistry.d.ts.map +1 -0
  10. package/lib/Alchemist/AuthRegistry.js +95 -0
  11. package/lib/Alchemist/AuthRegistry.js.map +1 -0
  12. package/lib/Alchemist/Drift.d.ts +70 -0
  13. package/lib/Alchemist/Drift.d.ts.map +1 -0
  14. package/lib/Alchemist/Drift.js +54 -0
  15. package/lib/Alchemist/Drift.js.map +1 -0
  16. package/lib/Alchemist/Entrypoint.d.ts +27 -3
  17. package/lib/Alchemist/Entrypoint.d.ts.map +1 -1
  18. package/lib/Alchemist/Entrypoint.js +34 -3
  19. package/lib/Alchemist/Entrypoint.js.map +1 -1
  20. package/lib/Alchemist/Errors.d.ts +1 -1
  21. package/lib/Alchemist/Errors.d.ts.map +1 -1
  22. package/lib/Alchemist/Errors.js +1 -1
  23. package/lib/Alchemist/Errors.js.map +1 -1
  24. package/lib/Alchemist/Logs.d.ts +46 -0
  25. package/lib/Alchemist/Logs.d.ts.map +1 -0
  26. package/lib/Alchemist/{routes/logs.js → Logs.js} +21 -26
  27. package/lib/Alchemist/Logs.js.map +1 -0
  28. package/lib/Alchemist/Nuke.d.ts +69 -0
  29. package/lib/Alchemist/Nuke.d.ts.map +1 -0
  30. package/lib/Alchemist/Nuke.js +35 -0
  31. package/lib/Alchemist/Nuke.js.map +1 -0
  32. package/lib/Alchemist/Operations.d.ts +168 -0
  33. package/lib/Alchemist/Operations.d.ts.map +1 -0
  34. package/lib/Alchemist/Operations.js +165 -0
  35. package/lib/Alchemist/Operations.js.map +1 -0
  36. package/lib/Alchemist/Profile.d.ts +132 -0
  37. package/lib/Alchemist/Profile.d.ts.map +1 -0
  38. package/lib/Alchemist/{routes/profile.js → Profile.js} +20 -21
  39. package/lib/Alchemist/Profile.js.map +1 -0
  40. package/lib/Alchemist/{routes/provider.d.ts → Provider.d.ts} +4 -4
  41. package/lib/Alchemist/Provider.d.ts.map +1 -0
  42. package/lib/Alchemist/{routes/provider.js → Provider.js} +7 -6
  43. package/lib/Alchemist/Provider.js.map +1 -0
  44. package/lib/Alchemist/Runtime.d.ts +10 -6
  45. package/lib/Alchemist/Runtime.d.ts.map +1 -1
  46. package/lib/Alchemist/Runtime.js +38 -2
  47. package/lib/Alchemist/Runtime.js.map +1 -1
  48. package/lib/Alchemist/{routes/state.d.ts → State.d.ts} +36 -16
  49. package/lib/Alchemist/State.d.ts.map +1 -0
  50. package/lib/Alchemist/{routes/state.js → State.js} +50 -15
  51. package/lib/Alchemist/State.js.map +1 -0
  52. package/lib/Alchemist/index.d.ts +11 -10
  53. package/lib/Alchemist/index.d.ts.map +1 -1
  54. package/lib/Alchemist/index.js +10 -9
  55. package/lib/Alchemist/index.js.map +1 -1
  56. package/lib/Apply.d.ts +2 -8
  57. package/lib/Apply.d.ts.map +1 -1
  58. package/lib/Apply.js +364 -184
  59. package/lib/Apply.js.map +1 -1
  60. package/lib/Auth/AuthProvider.d.ts +24 -11
  61. package/lib/Auth/AuthProvider.d.ts.map +1 -1
  62. package/lib/Auth/AuthProvider.js +28 -12
  63. package/lib/Auth/AuthProvider.js.map +1 -1
  64. package/lib/Auth/BrowserOAuth.d.ts +6 -8
  65. package/lib/Auth/BrowserOAuth.d.ts.map +1 -1
  66. package/lib/Auth/BrowserOAuth.js +25 -41
  67. package/lib/Auth/BrowserOAuth.js.map +1 -1
  68. package/lib/Auth/Credentials.d.ts.map +1 -1
  69. package/lib/Auth/Credentials.js +2 -2
  70. package/lib/Auth/Credentials.js.map +1 -1
  71. package/lib/Auth/Demand.d.ts +4 -4
  72. package/lib/Auth/Demand.d.ts.map +1 -1
  73. package/lib/Auth/Demand.js +16 -10
  74. package/lib/Auth/Demand.js.map +1 -1
  75. package/lib/Auth/Env.d.ts +2 -1
  76. package/lib/Auth/Env.d.ts.map +1 -1
  77. package/lib/Auth/Env.js +4 -2
  78. package/lib/Auth/Env.js.map +1 -1
  79. package/lib/Auth/Inspect.d.ts +2 -2
  80. package/lib/Auth/Inspect.d.ts.map +1 -1
  81. package/lib/Auth/Inspect.js +3 -1
  82. package/lib/Auth/Inspect.js.map +1 -1
  83. package/lib/Auth/Lock.d.ts.map +1 -1
  84. package/lib/Auth/Lock.js +4 -8
  85. package/lib/Auth/Lock.js.map +1 -1
  86. package/lib/Auth/OAuthFlow.d.ts +3 -12
  87. package/lib/Auth/OAuthFlow.d.ts.map +1 -1
  88. package/lib/Auth/OAuthFlow.js +7 -17
  89. package/lib/Auth/OAuthFlow.js.map +1 -1
  90. package/lib/Auth/Paths.d.ts +2 -1
  91. package/lib/Auth/Paths.d.ts.map +1 -1
  92. package/lib/Auth/Paths.js +3 -2
  93. package/lib/Auth/Paths.js.map +1 -1
  94. package/lib/Auth/Profile.d.ts +10 -0
  95. package/lib/Auth/Profile.d.ts.map +1 -1
  96. package/lib/Auth/Profile.js +19 -2
  97. package/lib/Auth/Profile.js.map +1 -1
  98. package/lib/Auth/Registry.d.ts +20 -0
  99. package/lib/Auth/Registry.d.ts.map +1 -0
  100. package/lib/Auth/Registry.js +17 -0
  101. package/lib/Auth/Registry.js.map +1 -0
  102. package/lib/Auth/Resolve.d.ts +34 -2
  103. package/lib/Auth/Resolve.d.ts.map +1 -1
  104. package/lib/Auth/Resolve.js +51 -3
  105. package/lib/Auth/Resolve.js.map +1 -1
  106. package/lib/Auth/StoredAuthProvider.d.ts +1 -1
  107. package/lib/Auth/StoredAuthProvider.d.ts.map +1 -1
  108. package/lib/Auth/StoredAuthProvider.js +1 -2
  109. package/lib/Auth/StoredAuthProvider.js.map +1 -1
  110. package/lib/Binding.d.ts.map +1 -1
  111. package/lib/Binding.js +3 -1
  112. package/lib/Binding.js.map +1 -1
  113. package/lib/Bundle/Bundle.d.ts +5 -0
  114. package/lib/Bundle/Bundle.d.ts.map +1 -1
  115. package/lib/Bundle/Bundle.js +36 -6
  116. package/lib/Bundle/Bundle.js.map +1 -1
  117. package/lib/Bundle/NamespaceImportPlugin.d.ts +55 -0
  118. package/lib/Bundle/NamespaceImportPlugin.d.ts.map +1 -0
  119. package/lib/Bundle/NamespaceImportPlugin.js +226 -0
  120. package/lib/Bundle/NamespaceImportPlugin.js.map +1 -0
  121. package/lib/Bundle/index.d.ts +1 -0
  122. package/lib/Bundle/index.d.ts.map +1 -1
  123. package/lib/Bundle/index.js +1 -0
  124. package/lib/Bundle/index.js.map +1 -1
  125. package/lib/Cli/Format.d.ts.map +1 -1
  126. package/lib/Cli/Format.js +2 -1
  127. package/lib/Cli/Format.js.map +1 -1
  128. package/lib/Cli/GlobalLog.d.ts +72 -26
  129. package/lib/Cli/GlobalLog.d.ts.map +1 -1
  130. package/lib/Cli/GlobalLog.js +151 -59
  131. package/lib/Cli/GlobalLog.js.map +1 -1
  132. package/lib/Cli/LoggingCli.d.ts.map +1 -1
  133. package/lib/Cli/LoggingCli.js +24 -18
  134. package/lib/Cli/LoggingCli.js.map +1 -1
  135. package/lib/Cli/PlainCliFormatter.d.ts.map +1 -1
  136. package/lib/Cli/PlainCliFormatter.js +4 -1
  137. package/lib/Cli/PlainCliFormatter.js.map +1 -1
  138. package/lib/Cli/Present.d.ts +14 -0
  139. package/lib/Cli/Present.d.ts.map +1 -0
  140. package/lib/Cli/Present.js +22 -0
  141. package/lib/Cli/Present.js.map +1 -0
  142. package/lib/Cli/SigilRenderer.d.ts +58 -0
  143. package/lib/Cli/SigilRenderer.d.ts.map +1 -0
  144. package/lib/Cli/SigilRenderer.js +39 -0
  145. package/lib/Cli/SigilRenderer.js.map +1 -0
  146. package/lib/Cli/checkVersion.d.ts +11 -14
  147. package/lib/Cli/checkVersion.d.ts.map +1 -1
  148. package/lib/Cli/checkVersion.js +19 -77
  149. package/lib/Cli/checkVersion.js.map +1 -1
  150. package/lib/Cli/commands/confirm.d.ts +2 -2
  151. package/lib/Cli/commands/confirm.d.ts.map +1 -1
  152. package/lib/Cli/commands/confirm.js +3 -3
  153. package/lib/Cli/commands/confirm.js.map +1 -1
  154. package/lib/Cli/commands/deploy.d.ts +4 -4
  155. package/lib/Cli/commands/deploy.d.ts.map +1 -1
  156. package/lib/Cli/commands/deploy.js +40 -39
  157. package/lib/Cli/commands/deploy.js.map +1 -1
  158. package/lib/Cli/commands/dev.d.ts.map +1 -1
  159. package/lib/Cli/commands/dev.js +41 -3
  160. package/lib/Cli/commands/dev.js.map +1 -1
  161. package/lib/Cli/commands/drift.d.ts +2 -2
  162. package/lib/Cli/commands/drift.d.ts.map +1 -1
  163. package/lib/Cli/commands/drift.js +14 -13
  164. package/lib/Cli/commands/drift.js.map +1 -1
  165. package/lib/Cli/commands/errors.d.ts.map +1 -1
  166. package/lib/Cli/commands/errors.js +2 -1
  167. package/lib/Cli/commands/errors.js.map +1 -1
  168. package/lib/Cli/commands/instrument.d.ts +15 -5
  169. package/lib/Cli/commands/instrument.d.ts.map +1 -1
  170. package/lib/Cli/commands/instrument.js +33 -8
  171. package/lib/Cli/commands/instrument.js.map +1 -1
  172. package/lib/Cli/commands/logs.d.ts +1 -1
  173. package/lib/Cli/commands/logs.d.ts.map +1 -1
  174. package/lib/Cli/commands/logs.js +22 -22
  175. package/lib/Cli/commands/logs.js.map +1 -1
  176. package/lib/Cli/commands/nuke.d.ts +3 -2
  177. package/lib/Cli/commands/nuke.d.ts.map +1 -1
  178. package/lib/Cli/commands/nuke.js +19 -17
  179. package/lib/Cli/commands/nuke.js.map +1 -1
  180. package/lib/Cli/commands/profile/commands.d.ts +3 -2
  181. package/lib/Cli/commands/profile/commands.d.ts.map +1 -1
  182. package/lib/Cli/commands/profile/commands.js +26 -27
  183. package/lib/Cli/commands/profile/commands.js.map +1 -1
  184. package/lib/Cli/commands/profile/flows.d.ts +6 -5
  185. package/lib/Cli/commands/profile/flows.d.ts.map +1 -1
  186. package/lib/Cli/commands/profile/flows.js +19 -17
  187. package/lib/Cli/commands/profile/flows.js.map +1 -1
  188. package/lib/Cli/commands/profile/hub.d.ts +1 -2
  189. package/lib/Cli/commands/profile/hub.d.ts.map +1 -1
  190. package/lib/Cli/commands/profile/hub.js +15 -17
  191. package/lib/Cli/commands/profile/hub.js.map +1 -1
  192. package/lib/Cli/commands/provider.d.ts +3 -1
  193. package/lib/Cli/commands/provider.d.ts.map +1 -1
  194. package/lib/Cli/commands/provider.js +4 -4
  195. package/lib/Cli/commands/provider.js.map +1 -1
  196. package/lib/Cli/commands/render.d.ts +2 -4
  197. package/lib/Cli/commands/render.d.ts.map +1 -1
  198. package/lib/Cli/commands/render.js +33 -56
  199. package/lib/Cli/commands/render.js.map +1 -1
  200. package/lib/Cli/commands/state.d.ts +1 -2
  201. package/lib/Cli/commands/state.d.ts.map +1 -1
  202. package/lib/Cli/commands/state.js +74 -27
  203. package/lib/Cli/commands/state.js.map +1 -1
  204. package/lib/Cli/components/capabilities.d.ts +4 -0
  205. package/lib/Cli/components/capabilities.d.ts.map +1 -0
  206. package/lib/Cli/components/capabilities.js +18 -0
  207. package/lib/Cli/components/capabilities.js.map +1 -0
  208. package/lib/Cli/components/types.d.ts +2 -81
  209. package/lib/Cli/components/types.d.ts.map +1 -1
  210. package/lib/Cli/components/types.js +1 -3
  211. package/lib/Cli/components/types.js.map +1 -1
  212. package/lib/Cli/components/ui/Environment.d.ts +3 -3
  213. package/lib/Cli/components/ui/Environment.d.ts.map +1 -1
  214. package/lib/Cli/components/ui/Environment.js.map +1 -1
  215. package/lib/Cli/components/ui/Interactive.d.ts +17 -4
  216. package/lib/Cli/components/ui/Interactive.d.ts.map +1 -1
  217. package/lib/Cli/components/ui/Interactive.js +7 -11
  218. package/lib/Cli/components/ui/Interactive.js.map +1 -1
  219. package/lib/Cli/components/ui/Layout.d.ts +1 -1
  220. package/lib/Cli/components/ui/Layout.d.ts.map +1 -1
  221. package/lib/Cli/components/ui/Layout.js +1 -1
  222. package/lib/Cli/components/ui/Layout.js.map +1 -1
  223. package/lib/Cli/components/ui/Typography.d.ts +1 -1
  224. package/lib/Cli/components/ui/Typography.d.ts.map +1 -1
  225. package/lib/Cli/components/ui/Typography.js +1 -1
  226. package/lib/Cli/components/ui/Typography.js.map +1 -1
  227. package/lib/Cli/components/ui/index.d.ts +2 -2
  228. package/lib/Cli/components/ui/index.js +2 -2
  229. package/lib/Cli/components/view/ApprovePlan.d.ts +1 -1
  230. package/lib/Cli/components/view/ApprovePlan.d.ts.map +1 -1
  231. package/lib/Cli/components/view/ApprovePlan.js +2 -1
  232. package/lib/Cli/components/view/ApprovePlan.js.map +1 -1
  233. package/lib/Cli/components/view/Format.d.ts +5 -0
  234. package/lib/Cli/components/view/Format.d.ts.map +1 -0
  235. package/lib/Cli/components/view/Format.js +39 -0
  236. package/lib/Cli/components/view/Format.js.map +1 -0
  237. package/lib/Cli/components/view/Help.d.ts +2 -2
  238. package/lib/Cli/components/view/Help.d.ts.map +1 -1
  239. package/lib/Cli/components/view/Help.js +7 -5
  240. package/lib/Cli/components/view/Help.js.map +1 -1
  241. package/lib/Cli/components/view/Logo.js +1 -1
  242. package/lib/Cli/components/view/Logo.js.map +1 -1
  243. package/lib/Cli/components/view/Nuke.d.ts +8 -9
  244. package/lib/Cli/components/view/Nuke.d.ts.map +1 -1
  245. package/lib/Cli/components/view/Nuke.js +49 -52
  246. package/lib/Cli/components/view/Nuke.js.map +1 -1
  247. package/lib/Cli/components/view/PlanDecision.d.ts +1 -1
  248. package/lib/Cli/components/view/PlanDecision.d.ts.map +1 -1
  249. package/lib/Cli/components/view/PlanDecision.js +1 -1
  250. package/lib/Cli/components/view/PlanDecision.js.map +1 -1
  251. package/lib/Cli/components/view/PlanRow.js +1 -1
  252. package/lib/Cli/components/view/PlanRow.js.map +1 -1
  253. package/lib/Cli/components/view/PlanTree.d.ts +1 -1
  254. package/lib/Cli/components/view/PlanTree.d.ts.map +1 -1
  255. package/lib/Cli/components/view/PlanTree.js +1 -1
  256. package/lib/Cli/components/view/PlanView.js +1 -1
  257. package/lib/Cli/components/view/PlanView.js.map +1 -1
  258. package/lib/Cli/components/view/Profile.d.ts +1 -1
  259. package/lib/Cli/components/view/Profile.js +2 -2
  260. package/lib/Cli/components/view/Profile.js.map +1 -1
  261. package/lib/Cli/components/view/ProfileDashboard.d.ts +4 -4
  262. package/lib/Cli/components/view/ProfileDashboard.d.ts.map +1 -1
  263. package/lib/Cli/components/view/ProfileDashboard.js +9 -8
  264. package/lib/Cli/components/view/ProfileDashboard.js.map +1 -1
  265. package/lib/Cli/components/view/Prompts.d.ts +3 -3
  266. package/lib/Cli/components/view/Prompts.d.ts.map +1 -1
  267. package/lib/Cli/components/view/Prompts.js +11 -18
  268. package/lib/Cli/components/view/Prompts.js.map +1 -1
  269. package/lib/Cli/components/view/Runtime.d.ts +5 -5
  270. package/lib/Cli/components/view/Runtime.d.ts.map +1 -1
  271. package/lib/Cli/components/view/Runtime.js +136 -219
  272. package/lib/Cli/components/view/Runtime.js.map +1 -1
  273. package/lib/Cli/components/view/SigilCli.d.ts +2 -2
  274. package/lib/Cli/components/view/SigilCli.d.ts.map +1 -1
  275. package/lib/Cli/components/view/SigilCli.js +7 -7
  276. package/lib/Cli/components/view/SigilCli.js.map +1 -1
  277. package/lib/Cli/components/view/StateExplorer.d.ts +1 -1
  278. package/lib/Cli/components/view/StateExplorer.d.ts.map +1 -1
  279. package/lib/Cli/components/view/StateExplorer.js +2 -1
  280. package/lib/Cli/components/view/StateExplorer.js.map +1 -1
  281. package/lib/Cli/components/view/statusStyle.d.ts +2 -2
  282. package/lib/Cli/components/view/statusStyle.d.ts.map +1 -1
  283. package/lib/Cli/components/view/statusStyle.js +1 -1
  284. package/lib/Cli/components/view/statusStyle.js.map +1 -1
  285. package/lib/Cli/exec.d.ts +6 -1
  286. package/lib/Cli/exec.d.ts.map +1 -1
  287. package/lib/Cli/exec.js +29 -34
  288. package/lib/Cli/exec.js.map +1 -1
  289. package/lib/Cli/main.d.ts.map +1 -1
  290. package/lib/Cli/main.js +35 -26
  291. package/lib/Cli/main.js.map +1 -1
  292. package/lib/Cli/selectCli.d.ts +2 -2
  293. package/lib/Cli/selectCli.d.ts.map +1 -1
  294. package/lib/Cli/selectCli.js +2 -2
  295. package/lib/Cli/selectCli.js.map +1 -1
  296. package/lib/Command/Command.js +1 -1
  297. package/lib/Command/Command.js.map +1 -1
  298. package/lib/Command/Dev.d.ts +58 -4
  299. package/lib/Command/Dev.d.ts.map +1 -1
  300. package/lib/Command/Dev.js +87 -30
  301. package/lib/Command/Dev.js.map +1 -1
  302. package/lib/Command/Local.d.ts +1 -1
  303. package/lib/Command/Memo.js +1 -1
  304. package/lib/Command/Memo.js.map +1 -1
  305. package/lib/Command/Providers.d.ts +1 -1
  306. package/lib/Command/Providers.d.ts.map +1 -1
  307. package/lib/Contributions.d.ts +2 -3
  308. package/lib/Contributions.d.ts.map +1 -1
  309. package/lib/Contributions.js +38 -6
  310. package/lib/Contributions.js.map +1 -1
  311. package/lib/DNS/Adapter.d.ts +204 -0
  312. package/lib/DNS/Adapter.d.ts.map +1 -0
  313. package/lib/DNS/Adapter.js +112 -0
  314. package/lib/DNS/Adapter.js.map +1 -0
  315. package/lib/DNS/index.d.ts +2 -0
  316. package/lib/DNS/index.d.ts.map +1 -0
  317. package/lib/DNS/index.js +2 -0
  318. package/lib/DNS/index.js.map +1 -0
  319. package/lib/Deploy.d.ts +7 -2
  320. package/lib/Deploy.d.ts.map +1 -1
  321. package/lib/Deploy.js +8 -3
  322. package/lib/Deploy.js.map +1 -1
  323. package/lib/Destroy.d.ts +5 -8
  324. package/lib/Destroy.d.ts.map +1 -1
  325. package/lib/Destroy.js +10 -7
  326. package/lib/Destroy.js.map +1 -1
  327. package/lib/Diff.d.ts.map +1 -1
  328. package/lib/Diff.js +14 -4
  329. package/lib/Diff.js.map +1 -1
  330. package/lib/Drift.d.ts +7 -7
  331. package/lib/Drift.d.ts.map +1 -1
  332. package/lib/Drift.js +184 -101
  333. package/lib/Drift.js.map +1 -1
  334. package/lib/EvalStack.d.ts +23 -0
  335. package/lib/EvalStack.d.ts.map +1 -0
  336. package/lib/EvalStack.js +47 -0
  337. package/lib/EvalStack.js.map +1 -0
  338. package/lib/Events.d.ts +210 -0
  339. package/lib/Events.d.ts.map +1 -0
  340. package/lib/Events.js +244 -0
  341. package/lib/Events.js.map +1 -0
  342. package/lib/Interaction.d.ts +159 -48
  343. package/lib/Interaction.d.ts.map +1 -1
  344. package/lib/Interaction.js +139 -58
  345. package/lib/Interaction.js.map +1 -1
  346. package/lib/Local/LocalProvider.d.ts.map +1 -1
  347. package/lib/Local/LocalProvider.js +31 -9
  348. package/lib/Local/LocalProvider.js.map +1 -1
  349. package/lib/Local/RpcProvider.d.ts.map +1 -1
  350. package/lib/Local/RpcProvider.js +10 -1
  351. package/lib/Local/RpcProvider.js.map +1 -1
  352. package/lib/Local/RpcProviderProxy.d.ts +16 -0
  353. package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
  354. package/lib/Local/RpcProviderProxy.js +19 -10
  355. package/lib/Local/RpcProviderProxy.js.map +1 -1
  356. package/lib/Local/RpcSerialization.d.ts +3 -2
  357. package/lib/Local/RpcSerialization.d.ts.map +1 -1
  358. package/lib/Local/RpcSerialization.js +13 -10
  359. package/lib/Local/RpcSerialization.js.map +1 -1
  360. package/lib/Local/RpcServer.d.ts +2 -1
  361. package/lib/Local/RpcServer.d.ts.map +1 -1
  362. package/lib/Local/RpcServer.js +19 -14
  363. package/lib/Local/RpcServer.js.map +1 -1
  364. package/lib/Local/RpcServerBun.d.ts.map +1 -1
  365. package/lib/Local/RpcServerBun.js +8 -4
  366. package/lib/Local/RpcServerBun.js.map +1 -1
  367. package/lib/Local/RpcServerEnvironment.d.ts +2 -3
  368. package/lib/Local/RpcServerEnvironment.d.ts.map +1 -1
  369. package/lib/Local/RpcServerEnvironment.js +2 -2
  370. package/lib/Local/RpcServerEnvironment.js.map +1 -1
  371. package/lib/Local/RpcServerNode.d.ts.map +1 -1
  372. package/lib/Local/RpcServerNode.js +5 -1
  373. package/lib/Local/RpcServerNode.js.map +1 -1
  374. package/lib/Local/RpcServerSession.d.ts +1 -1
  375. package/lib/Local/RpcServerSession.d.ts.map +1 -1
  376. package/lib/Local/RpcServerSession.js.map +1 -1
  377. package/lib/Local/RpcSpawner.d.ts +6 -8
  378. package/lib/Local/RpcSpawner.d.ts.map +1 -1
  379. package/lib/Local/RpcSpawner.js +45 -36
  380. package/lib/Local/RpcSpawner.js.map +1 -1
  381. package/lib/Local/Sidecar.d.ts +23 -0
  382. package/lib/Local/Sidecar.d.ts.map +1 -1
  383. package/lib/Local/Sidecar.js +14 -9
  384. package/lib/Local/Sidecar.js.map +1 -1
  385. package/lib/Nuke.d.ts +5 -23
  386. package/lib/Nuke.d.ts.map +1 -1
  387. package/lib/Nuke.js +48 -13
  388. package/lib/Nuke.js.map +1 -1
  389. package/lib/Output.d.ts +19 -1
  390. package/lib/Output.d.ts.map +1 -1
  391. package/lib/Output.js +96 -3
  392. package/lib/Output.js.map +1 -1
  393. package/lib/Plan.d.ts +5 -1
  394. package/lib/Plan.d.ts.map +1 -1
  395. package/lib/Plan.js +111 -33
  396. package/lib/Plan.js.map +1 -1
  397. package/lib/Platform.d.ts.map +1 -1
  398. package/lib/Platform.js +31 -7
  399. package/lib/Platform.js.map +1 -1
  400. package/lib/Provider.d.ts +45 -0
  401. package/lib/Provider.d.ts.map +1 -1
  402. package/lib/Provider.js +2 -2
  403. package/lib/Provider.js.map +1 -1
  404. package/lib/Report.d.ts +17 -195
  405. package/lib/Report.d.ts.map +1 -1
  406. package/lib/Report.js +39 -12
  407. package/lib/Report.js.map +1 -1
  408. package/lib/Runtime/ManagedHttpShutdown.d.ts +17 -0
  409. package/lib/Runtime/ManagedHttpShutdown.d.ts.map +1 -1
  410. package/lib/Runtime/ManagedHttpShutdown.js +11 -2
  411. package/lib/Runtime/ManagedHttpShutdown.js.map +1 -1
  412. package/lib/RuntimeContext.js +1 -1
  413. package/lib/RuntimeContext.js.map +1 -1
  414. package/lib/Stack.d.ts +49 -29
  415. package/lib/Stack.d.ts.map +1 -1
  416. package/lib/Stack.js +25 -31
  417. package/lib/Stack.js.map +1 -1
  418. package/lib/State/BucketState.d.ts.map +1 -1
  419. package/lib/State/BucketState.js +43 -14
  420. package/lib/State/BucketState.js.map +1 -1
  421. package/lib/State/LocalState.d.ts.map +1 -1
  422. package/lib/State/LocalState.js +3 -3
  423. package/lib/State/LocalState.js.map +1 -1
  424. package/lib/State/Provisioning.d.ts +5 -0
  425. package/lib/State/Provisioning.d.ts.map +1 -1
  426. package/lib/State/Provisioning.js +3 -1
  427. package/lib/State/Provisioning.js.map +1 -1
  428. package/lib/State/ResourceState.d.ts +2 -0
  429. package/lib/State/ResourceState.d.ts.map +1 -1
  430. package/lib/State/State.d.ts +26 -0
  431. package/lib/State/State.d.ts.map +1 -1
  432. package/lib/State/StateEncoding.d.ts +7 -0
  433. package/lib/State/StateEncoding.d.ts.map +1 -1
  434. package/lib/State/StateEncoding.js +19 -0
  435. package/lib/State/StateEncoding.js.map +1 -1
  436. package/lib/State/index.js +2 -2
  437. package/lib/State/index.js.map +1 -1
  438. package/lib/Telemetry/Layer.d.ts +2 -5
  439. package/lib/Telemetry/Layer.d.ts.map +1 -1
  440. package/lib/Telemetry/Layer.js +3 -23
  441. package/lib/Telemetry/Layer.js.map +1 -1
  442. package/lib/Telemetry/Metrics.d.ts +1 -1
  443. package/lib/Telemetry/Metrics.d.ts.map +1 -1
  444. package/lib/TelemetryRelay.js +1 -1
  445. package/lib/TelemetryRelay.js.map +1 -1
  446. package/lib/TelemetryRuntime.d.ts +1 -1
  447. package/lib/TelemetryRuntime.d.ts.map +1 -1
  448. package/lib/TelemetryRuntime.js +4 -3
  449. package/lib/TelemetryRuntime.js.map +1 -1
  450. package/lib/Util/ConsoleSink.d.ts +23 -2
  451. package/lib/Util/ConsoleSink.d.ts.map +1 -1
  452. package/lib/Util/ConsoleSink.js +54 -14
  453. package/lib/Util/ConsoleSink.js.map +1 -1
  454. package/lib/Util/LogAnnotation.d.ts +19 -0
  455. package/lib/Util/LogAnnotation.d.ts.map +1 -0
  456. package/lib/Util/LogAnnotation.js +19 -0
  457. package/lib/Util/LogAnnotation.js.map +1 -0
  458. package/lib/Util/LogRecord.d.ts +281 -0
  459. package/lib/Util/LogRecord.d.ts.map +1 -0
  460. package/lib/Util/LogRecord.js +267 -0
  461. package/lib/Util/LogRecord.js.map +1 -0
  462. package/lib/Util/Node.d.ts +9 -0
  463. package/lib/Util/Node.d.ts.map +1 -1
  464. package/lib/Util/Node.js +10 -6
  465. package/lib/Util/Node.js.map +1 -1
  466. package/lib/Util/PlatformServices.d.ts +3 -2
  467. package/lib/Util/PlatformServices.d.ts.map +1 -1
  468. package/lib/Util/PlatformServices.js +6 -2
  469. package/lib/Util/PlatformServices.js.map +1 -1
  470. package/lib/Util/ResourceOutput.d.ts +18 -10
  471. package/lib/Util/ResourceOutput.d.ts.map +1 -1
  472. package/lib/Util/ResourceOutput.js +22 -23
  473. package/lib/Util/ResourceOutput.js.map +1 -1
  474. package/lib/Util/Shutdown.d.ts +10 -0
  475. package/lib/Util/Shutdown.d.ts.map +1 -0
  476. package/lib/Util/Shutdown.js +32 -0
  477. package/lib/Util/Shutdown.js.map +1 -0
  478. package/lib/Util/Terminal.d.ts +2 -4
  479. package/lib/Util/Terminal.d.ts.map +1 -1
  480. package/lib/Util/Terminal.js +3 -11
  481. package/lib/Util/Terminal.js.map +1 -1
  482. package/lib/Util/TraceParent.d.ts +32 -0
  483. package/lib/Util/TraceParent.d.ts.map +1 -0
  484. package/lib/Util/TraceParent.js +42 -0
  485. package/lib/Util/TraceParent.js.map +1 -0
  486. package/lib/Util/base64.d.ts +7 -0
  487. package/lib/Util/base64.d.ts.map +1 -0
  488. package/lib/Util/base64.js +24 -0
  489. package/lib/Util/base64.js.map +1 -0
  490. package/lib/Util/cached-function.d.ts +5 -0
  491. package/lib/Util/cached-function.d.ts.map +1 -1
  492. package/lib/Util/cached-function.js +13 -8
  493. package/lib/Util/cached-function.js.map +1 -1
  494. package/lib/Util/data.d.ts +1 -1
  495. package/lib/Util/data.d.ts.map +1 -1
  496. package/lib/Util/data.js +1 -1
  497. package/lib/Util/data.js.map +1 -1
  498. package/lib/Util/equal.d.ts.map +1 -1
  499. package/lib/Util/equal.js +3 -2
  500. package/lib/Util/equal.js.map +1 -1
  501. package/lib/Util/extraFiles.d.ts.map +1 -1
  502. package/lib/Util/extraFiles.js +5 -5
  503. package/lib/Util/extraFiles.js.map +1 -1
  504. package/lib/Util/interactive.js +1 -1
  505. package/lib/Website/AstroOutput.d.ts +42 -0
  506. package/lib/Website/AstroOutput.d.ts.map +1 -0
  507. package/lib/Website/AstroOutput.js +34 -0
  508. package/lib/Website/AstroOutput.js.map +1 -0
  509. package/lib/Website/FrontendCore.d.ts +1 -1
  510. package/lib/Workflows.d.ts +9 -0
  511. package/lib/Workflows.d.ts.map +1 -1
  512. package/lib/Workflows.js +8 -0
  513. package/lib/Workflows.js.map +1 -1
  514. package/lib/index.d.ts +1 -0
  515. package/lib/index.d.ts.map +1 -1
  516. package/lib/index.js +1 -0
  517. package/lib/index.js.map +1 -1
  518. package/package.json +21 -28
  519. package/src/AdoptPolicy.ts +76 -0
  520. package/src/Alchemist/AuthRegistry.ts +164 -0
  521. package/src/Alchemist/Drift.ts +103 -0
  522. package/src/Alchemist/Entrypoint.ts +51 -3
  523. package/src/Alchemist/Errors.ts +1 -1
  524. package/src/Alchemist/{routes/logs.ts → Logs.ts} +28 -30
  525. package/src/Alchemist/Nuke.ts +90 -0
  526. package/src/Alchemist/Operations.ts +309 -0
  527. package/src/Alchemist/{routes/profile.ts → Profile.ts} +22 -22
  528. package/src/Alchemist/{routes/provider.ts → Provider.ts} +7 -6
  529. package/src/Alchemist/Runtime.ts +46 -12
  530. package/src/Alchemist/{routes/state.ts → State.ts} +78 -21
  531. package/src/Alchemist/index.ts +32 -15
  532. package/src/Apply.ts +513 -274
  533. package/src/Auth/AuthProvider.ts +76 -23
  534. package/src/Auth/BrowserOAuth.ts +37 -60
  535. package/src/Auth/Credentials.ts +2 -4
  536. package/src/Auth/Demand.ts +27 -18
  537. package/src/Auth/Env.ts +13 -8
  538. package/src/Auth/Inspect.ts +5 -2
  539. package/src/Auth/Lock.ts +4 -8
  540. package/src/Auth/OAuthFlow.ts +12 -26
  541. package/src/Auth/Paths.ts +3 -2
  542. package/src/Auth/Profile.ts +30 -2
  543. package/src/Auth/Registry.ts +27 -0
  544. package/src/Auth/Resolve.ts +75 -3
  545. package/src/Auth/StoredAuthProvider.ts +1 -2
  546. package/src/Binding.ts +3 -4
  547. package/src/Bundle/Bundle.ts +58 -7
  548. package/src/Bundle/NamespaceImportPlugin.ts +259 -0
  549. package/src/Bundle/index.ts +1 -0
  550. package/src/Cli/Format.ts +2 -1
  551. package/src/Cli/GlobalLog.ts +206 -68
  552. package/src/Cli/LoggingCli.ts +33 -20
  553. package/src/Cli/PlainCliFormatter.ts +4 -1
  554. package/src/Cli/Present.ts +34 -0
  555. package/src/Cli/SigilRenderer.ts +75 -0
  556. package/src/Cli/checkVersion.ts +25 -78
  557. package/src/Cli/commands/confirm.ts +3 -3
  558. package/src/Cli/commands/deploy.ts +53 -44
  559. package/src/Cli/commands/dev.ts +65 -7
  560. package/src/Cli/commands/drift.ts +20 -16
  561. package/src/Cli/commands/errors.ts +2 -3
  562. package/src/Cli/commands/instrument.ts +39 -8
  563. package/src/Cli/commands/logs.ts +22 -30
  564. package/src/Cli/commands/nuke.ts +25 -26
  565. package/src/Cli/commands/profile/commands.ts +34 -34
  566. package/src/Cli/commands/profile/flows.ts +26 -20
  567. package/src/Cli/commands/profile/hub.ts +16 -18
  568. package/src/Cli/commands/provider.ts +4 -4
  569. package/src/Cli/commands/render.ts +43 -71
  570. package/src/Cli/commands/state.ts +113 -33
  571. package/src/Cli/components/capabilities.ts +20 -0
  572. package/src/Cli/components/types.ts +13 -99
  573. package/src/Cli/components/ui/Environment.tsx +5 -5
  574. package/src/Cli/components/ui/Interactive.tsx +24 -15
  575. package/src/Cli/components/ui/Layout.tsx +1 -1
  576. package/src/Cli/components/ui/Typography.tsx +1 -1
  577. package/src/Cli/components/ui/index.ts +2 -2
  578. package/src/Cli/components/view/ApprovePlan.tsx +2 -1
  579. package/src/Cli/components/view/Format.tsx +58 -0
  580. package/src/Cli/components/view/Help.tsx +14 -17
  581. package/src/Cli/components/view/Logo.tsx +1 -1
  582. package/src/Cli/components/view/Nuke.tsx +74 -49
  583. package/src/Cli/components/view/PlanDecision.tsx +1 -1
  584. package/src/Cli/components/view/PlanRow.tsx +1 -1
  585. package/src/Cli/components/view/PlanTree.ts +2 -2
  586. package/src/Cli/components/view/PlanView.tsx +2 -2
  587. package/src/Cli/components/view/Profile.tsx +2 -2
  588. package/src/Cli/components/view/ProfileDashboard.tsx +12 -11
  589. package/src/Cli/components/view/Prompts.tsx +37 -75
  590. package/src/Cli/components/view/Runtime.tsx +132 -238
  591. package/src/Cli/components/view/SigilCli.tsx +12 -12
  592. package/src/Cli/components/view/StateExplorer.tsx +2 -1
  593. package/src/Cli/components/view/statusStyle.ts +2 -2
  594. package/src/Cli/exec.ts +48 -41
  595. package/src/Cli/main.ts +52 -33
  596. package/src/Cli/selectCli.ts +3 -3
  597. package/src/Command/Command.ts +1 -1
  598. package/src/Command/Dev.ts +129 -36
  599. package/src/Command/Memo.ts +1 -1
  600. package/src/Contributions.ts +42 -8
  601. package/src/DNS/Adapter.ts +289 -0
  602. package/src/DNS/index.ts +1 -0
  603. package/src/Deploy.ts +11 -3
  604. package/src/Destroy.ts +19 -13
  605. package/src/Diff.ts +17 -4
  606. package/src/Drift.ts +256 -127
  607. package/src/EvalStack.ts +97 -0
  608. package/src/Events.ts +296 -0
  609. package/src/Interaction.ts +332 -97
  610. package/src/Local/LocalProvider.ts +40 -9
  611. package/src/Local/RpcProvider.ts +11 -1
  612. package/src/Local/RpcProviderProxy.ts +29 -21
  613. package/src/Local/RpcSerialization.ts +32 -17
  614. package/src/Local/RpcServer.ts +25 -17
  615. package/src/Local/RpcServerBun.ts +10 -6
  616. package/src/Local/RpcServerEnvironment.ts +2 -2
  617. package/src/Local/RpcServerNode.ts +8 -1
  618. package/src/Local/RpcServerSession.ts +2 -2
  619. package/src/Local/RpcSpawner.ts +61 -37
  620. package/src/Local/Sidecar.ts +10 -1
  621. package/src/Nuke.ts +66 -43
  622. package/src/Output.ts +120 -7
  623. package/src/Plan.ts +140 -52
  624. package/src/Platform.ts +47 -18
  625. package/src/Provider.ts +48 -3
  626. package/src/Report.ts +77 -275
  627. package/src/Runtime/ManagedHttpShutdown.ts +21 -4
  628. package/src/RuntimeContext.ts +1 -1
  629. package/src/Stack.ts +113 -135
  630. package/src/State/BucketState.ts +53 -21
  631. package/src/State/LocalState.ts +7 -9
  632. package/src/State/Provisioning.ts +8 -1
  633. package/src/State/ResourceState.ts +2 -0
  634. package/src/State/State.ts +30 -0
  635. package/src/State/StateEncoding.ts +22 -0
  636. package/src/State/index.ts +2 -2
  637. package/src/Telemetry/Layer.ts +3 -24
  638. package/src/Telemetry/Metrics.ts +1 -1
  639. package/src/TelemetryRelay.ts +1 -1
  640. package/src/TelemetryRuntime.ts +8 -8
  641. package/src/Util/ConsoleSink.ts +76 -13
  642. package/src/Util/LogAnnotation.ts +18 -0
  643. package/src/Util/LogRecord.ts +386 -0
  644. package/src/Util/Node.ts +20 -6
  645. package/src/Util/PlatformServices.ts +17 -4
  646. package/src/Util/ResourceOutput.ts +26 -25
  647. package/src/Util/Shutdown.ts +52 -0
  648. package/src/Util/Terminal.ts +3 -20
  649. package/src/Util/TraceParent.ts +70 -0
  650. package/src/Util/base64.ts +22 -0
  651. package/src/Util/cached-function.ts +30 -19
  652. package/src/Util/data.ts +2 -2
  653. package/src/Util/equal.ts +3 -2
  654. package/src/Util/extraFiles.ts +9 -8
  655. package/src/Util/interactive.ts +1 -1
  656. package/src/Website/AstroOutput.ts +83 -0
  657. package/src/Workflows.ts +11 -0
  658. package/src/index.ts +1 -0
  659. package/lib/Alchemist/Progress.d.ts +0 -16
  660. package/lib/Alchemist/Progress.d.ts.map +0 -1
  661. package/lib/Alchemist/Progress.js +0 -123
  662. package/lib/Alchemist/Progress.js.map +0 -1
  663. package/lib/Alchemist/Session.d.ts +0 -116
  664. package/lib/Alchemist/Session.d.ts.map +0 -1
  665. package/lib/Alchemist/Session.js +0 -212
  666. package/lib/Alchemist/Session.js.map +0 -1
  667. package/lib/Alchemist/routes/drift.d.ts +0 -55
  668. package/lib/Alchemist/routes/drift.d.ts.map +0 -1
  669. package/lib/Alchemist/routes/drift.js +0 -52
  670. package/lib/Alchemist/routes/drift.js.map +0 -1
  671. package/lib/Alchemist/routes/logs.d.ts +0 -41
  672. package/lib/Alchemist/routes/logs.d.ts.map +0 -1
  673. package/lib/Alchemist/routes/logs.js.map +0 -1
  674. package/lib/Alchemist/routes/nuke.d.ts +0 -46
  675. package/lib/Alchemist/routes/nuke.d.ts.map +0 -1
  676. package/lib/Alchemist/routes/nuke.js +0 -80
  677. package/lib/Alchemist/routes/nuke.js.map +0 -1
  678. package/lib/Alchemist/routes/profile.d.ts +0 -133
  679. package/lib/Alchemist/routes/profile.d.ts.map +0 -1
  680. package/lib/Alchemist/routes/profile.js.map +0 -1
  681. package/lib/Alchemist/routes/provider.d.ts.map +0 -1
  682. package/lib/Alchemist/routes/provider.js.map +0 -1
  683. package/lib/Alchemist/routes/stack.d.ts +0 -95
  684. package/lib/Alchemist/routes/stack.d.ts.map +0 -1
  685. package/lib/Alchemist/routes/stack.js +0 -73
  686. package/lib/Alchemist/routes/stack.js.map +0 -1
  687. package/lib/Alchemist/routes/state.d.ts.map +0 -1
  688. package/lib/Alchemist/routes/state.js.map +0 -1
  689. package/lib/Cli/CliKit/CliKit.d.ts +0 -92
  690. package/lib/Cli/CliKit/CliKit.d.ts.map +0 -1
  691. package/lib/Cli/CliKit/CliKit.js +0 -27
  692. package/lib/Cli/CliKit/CliKit.js.map +0 -1
  693. package/lib/Cli/CliKit/index.d.ts +0 -9
  694. package/lib/Cli/CliKit/index.d.ts.map +0 -1
  695. package/lib/Cli/CliKit/index.js +0 -9
  696. package/lib/Cli/CliKit/index.js.map +0 -1
  697. package/lib/Cli/CliKit/interaction.d.ts +0 -13
  698. package/lib/Cli/CliKit/interaction.d.ts.map +0 -1
  699. package/lib/Cli/CliKit/interaction.js +0 -17
  700. package/lib/Cli/CliKit/interaction.js.map +0 -1
  701. package/lib/Cli/CliKit/layer.d.ts +0 -7
  702. package/lib/Cli/CliKit/layer.d.ts.map +0 -1
  703. package/lib/Cli/CliKit/layer.js +0 -33
  704. package/lib/Cli/CliKit/layer.js.map +0 -1
  705. package/lib/Local/DevLog.d.ts +0 -32
  706. package/lib/Local/DevLog.d.ts.map +0 -1
  707. package/lib/Local/DevLog.js +0 -112
  708. package/lib/Local/DevLog.js.map +0 -1
  709. package/lib/Test/Alchemy.d.ts +0 -79
  710. package/lib/Test/Alchemy.d.ts.map +0 -1
  711. package/lib/Test/Alchemy.js +0 -193
  712. package/lib/Test/Alchemy.js.map +0 -1
  713. package/lib/Test/Bun.d.ts +0 -69
  714. package/lib/Test/Bun.d.ts.map +0 -1
  715. package/lib/Test/Bun.js +0 -126
  716. package/lib/Test/Bun.js.map +0 -1
  717. package/lib/Test/Core.d.ts +0 -277
  718. package/lib/Test/Core.d.ts.map +0 -1
  719. package/lib/Test/Core.js +0 -362
  720. package/lib/Test/Core.js.map +0 -1
  721. package/lib/Test/Http.d.ts +0 -109
  722. package/lib/Test/Http.d.ts.map +0 -1
  723. package/lib/Test/Http.js +0 -123
  724. package/lib/Test/Http.js.map +0 -1
  725. package/lib/Test/TestState.d.ts +0 -12
  726. package/lib/Test/TestState.d.ts.map +0 -1
  727. package/lib/Test/TestState.js +0 -15
  728. package/lib/Test/TestState.js.map +0 -1
  729. package/lib/Test/Vitest.d.ts +0 -60
  730. package/lib/Test/Vitest.d.ts.map +0 -1
  731. package/lib/Test/Vitest.js +0 -132
  732. package/lib/Test/Vitest.js.map +0 -1
  733. package/lib/Test/index.d.ts +0 -3
  734. package/lib/Test/index.d.ts.map +0 -1
  735. package/lib/Test/index.js +0 -3
  736. package/lib/Test/index.js.map +0 -1
  737. package/lib/Util/FileLogger.d.ts +0 -7
  738. package/lib/Util/FileLogger.d.ts.map +0 -1
  739. package/lib/Util/FileLogger.js +0 -16
  740. package/lib/Util/FileLogger.js.map +0 -1
  741. package/src/Alchemist/Progress.ts +0 -167
  742. package/src/Alchemist/Session.ts +0 -415
  743. package/src/Alchemist/routes/drift.ts +0 -87
  744. package/src/Alchemist/routes/nuke.ts +0 -131
  745. package/src/Alchemist/routes/stack.ts +0 -173
  746. package/src/Cli/CliKit/CliKit.ts +0 -159
  747. package/src/Cli/CliKit/index.ts +0 -41
  748. package/src/Cli/CliKit/interaction.ts +0 -19
  749. package/src/Cli/CliKit/layer.ts +0 -44
  750. package/src/Local/DevLog.ts +0 -122
  751. package/src/Test/Alchemy.ts +0 -334
  752. package/src/Test/Bun.ts +0 -230
  753. package/src/Test/Core.ts +0 -785
  754. package/src/Test/Http.ts +0 -201
  755. package/src/Test/TestState.ts +0 -35
  756. package/src/Test/Vitest.ts +0 -239
  757. package/src/Test/index.ts +0 -2
  758. package/src/Util/FileLogger.ts +0 -20
@@ -1,277 +0,0 @@
1
- /** @effect-diagnostics anyUnknownInErrorContext:off */
2
- import * as Config from "effect/Config";
3
- import * as Effect from "effect/Effect";
4
- import * as HttpClient from "effect/http/HttpClient";
5
- import * as Layer from "effect/Layer";
6
- import * as Option from "effect/Option";
7
- import * as Scope from "effect/Scope";
8
- import { AlchemyContext } from "../AlchemyContext.ts";
9
- import { ArtifactStore } from "../Artifacts.ts";
10
- import type { Input } from "../Input.ts";
11
- import * as Interaction from "../Interaction.ts";
12
- import * as RpcProviderProxy from "../Local/RpcProviderProxy.ts";
13
- import * as RpcSpawner from "../Local/RpcSpawner.ts";
14
- import * as Plan from "../Plan.ts";
15
- import type { ResourceSelection, SelectionOutput } from "../ResourceSelection.ts";
16
- import { type CompiledStack, Stack, type StackEffect, type StackServices } from "../Stack.ts";
17
- import { Stage } from "../Stage.ts";
18
- import * as State from "../State/index.ts";
19
- /**
20
- * Configuration shared by every test in a file. Pass to `Test.make(...)`.
21
- */
22
- export interface MakeOptions<ROut = any> {
23
- /** Provider layer for the stack — e.g. `AWS.providers()`, `Cloudflare.providers()`. */
24
- providers: Layer.Layer<ROut, never, StackServices>;
25
- /** State store for top-level `deploy(Stack)` / `destroy(Stack)`; defaults to {@link State.localState}. */
26
- state?: Layer.Layer<State.State, never, StackServices>;
27
- /** Override the current profile; otherwise resolved from env or the built-in `default`. */
28
- profile?: string;
29
- /**
30
- * Default stage for deploy/destroy. Defaults to `test_$USER` (or
31
- * `test_$USERNAME` on Windows, `test_unknown` if neither is set) so two
32
- * people running the same suite against one account don't collide.
33
- * Does **not** read `$ALCHEMY_STAGE` — that is the CLI deploy/dev stage.
34
- */
35
- stage?: string;
36
- /**
37
- * Engine-level adoption policy for this test run. When `true`, resources
38
- * without prior state will be adopted from the cloud via `provider.read`
39
- * (matching the CLI's `--adopt` flag). Defaults to `false`.
40
- */
41
- adopt?: boolean;
42
- /**
43
- * Run providers in local-dev mode (matching the CLI's `alchemy dev` flag).
44
- * When `true`, resources like Cloudflare Workers run locally via workerd
45
- * instead of being deployed to the cloud. When omitted, falls back to the
46
- * `ALCHEMY_DEV` environment variable (`"1"` / `"true"` enable it).
47
- *
48
- * {@link ALCHEMY_TEST_DEV} (`ALCHEMY_TEST_DEV=1`) overrides this — use it
49
- * to force an entire existing live suite through local providers without
50
- * editing each `Test.make({ dev: true })`.
51
- */
52
- dev?: boolean;
53
- /**
54
- * Run local providers behind the RPC sidecar proxy, matching the process
55
- * topology of the real `alchemy dev` command: an {@link RpcProviderProxy}
56
- * is installed, so `RpcProvider.providerServicesEffect` layers (e.g.
57
- * Cloudflare's `localRuntimeServices()`) are EMPTY in the test process and
58
- * RPC-backed providers run their lifecycle in a spawned sidecar process.
59
- *
60
- * Defaults to the resolved `dev` flag — dev tests run the real `alchemy
61
- * dev` topology unless they opt out. In-process dev (`sidecar: false`)
62
- * masks missing main-process lifecycle dependencies (the class of bug
63
- * behind #1007, where D1's local migrations only failed under `alchemy
64
- * dev`); it remains available because it IS still a real production path —
65
- * a plain `alchemy deploy` deleting a `providerMode: "local"` state row
66
- * runs the local provider in-process — and because in-process runs are
67
- * easier to debug.
68
- *
69
- * Fully lazy: only the proxy facade is installed up front. The spawner
70
- * HTTP server starts — and a sidecar child process is forked — on the
71
- * first provider session request (a deploy/destroy building an RPC-backed
72
- * local provider); a dev file that never does starts no processes at all.
73
- * Once started, the sidecar lives for the whole test file (its own scope,
74
- * closed by the adapter's final cleanup hook), so `beforeAll(deploy(Stack))`
75
- * + per-test requests work the same way they do under a real `alchemy dev`
76
- * session.
77
- *
78
- * Pass an object to run the sidecar with options: `omitEnv` lists prefixes
79
- * of environment variables the sidecar must not inherit (e.g.
80
- * `["CLOUDFLARE_"]` to exercise credential-free dev while the shell
81
- * exports credentials).
82
- */
83
- sidecar?: boolean | SidecarOptions;
84
- }
85
- /** Options for the dev sidecar process — see {@link MakeOptions.sidecar}. */
86
- export interface SidecarOptions {
87
- /** Prefixes of environment variables withheld from the sidecar. */
88
- readonly omitEnv?: ReadonlyArray<string>;
89
- }
90
- /**
91
- * The RPC sidecar topology used by the real `alchemy dev` command, in one
92
- * process-local layer: an {@link RpcSpawner} HTTP server that forks sidecar
93
- * processes on demand, and an {@link RpcProviderProxy} pointed at it.
94
- */
95
- export declare const sidecarProxy: (options: {
96
- profile?: string;
97
- omitEnv?: ReadonlyArray<string>;
98
- }) => Layer.Layer<RpcProviderProxy.RpcProviderProxy | RpcSpawner.RpcSpawner, import("effect/http/HttpServerError").ServeError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | HttpClient.HttpClient>;
99
- /**
100
- * Force every `Test.make` into (or out of) local-dev mode, regardless of
101
- * the file's `dev` option. Unset leaves the option / `ALCHEMY_DEV` fallback
102
- * in place. Accepts the usual truthy/falsey strings (`true`/`1`/`yes`/`on`,
103
- * `false`/`0`/`no`/`off`).
104
- */
105
- export declare const ALCHEMY_TEST_DEV: Config.Config<Option.Option<boolean>>;
106
- /** The `ALCHEMY_TEST_DEV` override, if the env var is set. */
107
- export declare const alchemyTestDevOverride: () => Option.Option<boolean>;
108
- /** Resolve the effective `dev` flag: `ALCHEMY_TEST_DEV`, then options, then `ALCHEMY_DEV`. */
109
- export declare const resolveDev: (options: {
110
- dev?: boolean;
111
- }) => boolean;
112
- /** Resolve the effective `sidecar` flag: defaults to the resolved `dev` flag. */
113
- export declare const resolveSidecar: (options: MakeOptions) => boolean;
114
- /**
115
- * Default test stage: `ALCHEMY_TEST_STAGE`, then `test_$USER` (or
116
- * `test_$USERNAME` / `test_unknown`). Set an explicit test stage to isolate
117
- * concurrent worktrees that share a cloud account.
118
- * Matches the CLI's `live_$USER` / `dev_$USER` per-developer isolation.
119
- */
120
- export declare const defaultStage: () => string;
121
- /** File-level stage: a string override, otherwise {@link defaultStage}. */
122
- export declare const resolveStage: (options: {
123
- stage?: string;
124
- }) => string;
125
- /**
126
- * The sidecar runtime handed to each adapter's `make(...)`.
127
- *
128
- * `provide` installs a lazy {@link RpcProviderProxy} facade into an effect.
129
- * Installing the facade is free: the spawner HTTP server only starts (and,
130
- * downstream of it, a sidecar child process is only forked) when a provider
131
- * actually requests a session — i.e. when a deploy/destroy builds an
132
- * RPC-backed local provider. A dev file that never does starts nothing.
133
- *
134
- * The spawner (and the sidecar children it forks) is a PROCESS-WIDE
135
- * SINGLETON shared by every test file, refcounted per handle: all files run
136
- * in one bun process, and a per-file sidecar means a per-file bun child that
137
- * imports the entire alchemy + distilled module graph — dozens of concurrent
138
- * files at hundreds of MB each OOMs the machine. Stack isolation is
139
- * preserved because each RPC session carries its own stack environment (see
140
- * `SESSION_ENV_PARAM` in Local/RpcServerEnvironment.ts) and the child builds
141
- * a provider context per stack. The singleton's scope closes when the LAST
142
- * handle closes; `Test.make` runs at collection time (before any test), so
143
- * the refcount cannot dip to zero while later files still need it. Adapters
144
- * run `close` from the same final cleanup hook that closes the shared scope.
145
- */
146
- export interface SidecarHandle {
147
- readonly provide: <A, E, R>(eff: Effect.Effect<A, E, R>) => Effect.Effect<A, any, any>;
148
- readonly close: Effect.Effect<void>;
149
- }
150
- /** Payload-free counts; observing them never starts the singleton. */
151
- export declare const sidecarDiagnostics: Effect.Effect<{
152
- sessions: number;
153
- testSessions: number;
154
- owners: number;
155
- connections: number;
156
- singletons: number;
157
- reservations: number;
158
- started: number;
159
- }, never, never>;
160
- export declare const makeSidecarHandle: <ROut = any>(options: MakeOptions<ROut>) => SidecarHandle | undefined;
161
- export type TestEffect<A, Req = never> = StackEffect<A, any, Req>;
162
- /**
163
- * Build the per-test runtime and return a self-contained Effect.
164
- *
165
- * Mirrors {@link "../bin/alchemy.js"} composition: ConfigProvider via
166
- * `loadConfigProvider` + `withProfileOverride`, an empty `AuthProviders`
167
- * registry that the user's `providers` layer populates, the platform layers,
168
- * and the configured state store. Adapters wrap this into runner-specific
169
- * thunks (`bun.test` -> `runPromise`, `it.live` -> as-is).
170
- *
171
- * When `scope` is provided, scoped resources (like the Cloudflare dev
172
- * sidecar) survive past this effect and are tied to the lifetime of the
173
- * provided scope instead. The runner is responsible for closing it.
174
- *
175
- * When `scope` is omitted, the effect runs with `Effect.scoped` and any
176
- * scoped resources are torn down as soon as it resolves.
177
- */
178
- export declare const toEffect: <A, ROut = any>(effect: TestEffect<A>, options: MakeOptions<ROut>, scope?: Scope.Scope, sidecar?: SidecarHandle) => Effect.Effect<A, any, never>;
179
- /** Promise wrapper around {@link toEffect} for `bun.test`-style runners. */
180
- export declare const run: <A, ROut = any>(effect: TestEffect<A>, options: MakeOptions<ROut>, scope?: Scope.Scope, sidecar?: SidecarHandle) => Promise<A>;
181
- /**
182
- * Wrap an effect so it runs with `options.providers` + a placeholder Stack +
183
- * Stage in scope. Used by `test.provider` so user code can call provider SDK
184
- * APIs (e.g. `DynamoDB.describeTable`) directly inside the test body.
185
- */
186
- export declare const withProviders: <A, E, R, ROut>(effect: Effect.Effect<A, E, R>, options: MakeOptions<ROut>, stackName: string) => Effect.Effect<A, E, Exclude<R, ROut | Stack | Stage>>;
187
- /**
188
- * Curried `deploy` for the test factory: bakes in the configured stage and
189
- * adds the telemetry layer the CLI uses, so `beforeAll(deploy(Stack))` works
190
- * the same way as `alchemy deploy`.
191
- *
192
- * `scope`, when supplied, is forwarded down so the dev sidecar (and other
193
- * scoped resources) lives until the caller closes it instead of dying as
194
- * soon as `deploy` resolves. The test harness uses this to keep workerd
195
- * alive across `beforeAll` → tests → `afterAll`.
196
- */
197
- export interface DeployCallOptions extends Plan.MakePlanOptions {
198
- stage?: string;
199
- scope?: Scope.Scope;
200
- }
201
- export type DeployResult<A> = Effect.Effect<Input.Resolve<A>, Effect.Error<ReturnType<typeof deployStack<A>>>, Effect.Services<ReturnType<typeof deployStack<A>>>>;
202
- export interface FilteredDeployCallOptions extends Omit<DeployCallOptions, keyof ResourceSelection>, ResourceSelection {
203
- }
204
- type FullDeployCall = [options?: DeployCallOptions];
205
- /**
206
- * Filtered deploys return void; the whole declaration still evaluates.
207
- * With an explicit output type, filtering also requires the Call tuple type.
208
- */
209
- export interface Deploy {
210
- <A, Call extends [options?: FilteredDeployCallOptions] = FullDeployCall>(stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, ...call: Call): DeployResult<SelectionOutput<A, Call[0]>>;
211
- }
212
- export declare function deploy<A, Call extends [options?: FilteredDeployCallOptions] = FullDeployCall>(options: MakeOptions, stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, ...call: Call): DeployResult<SelectionOutput<A, Call[0]>>;
213
- declare const deployStack: <A>(options: MakeOptions, stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, callOptions?: FilteredDeployCallOptions) => Effect.Effect<Input.Resolve<A> | undefined, import("../Auth/AuthProvider.ts").AuthError | Config.ConfigError | import("../Auth/Demand.ts").CredentialsRequired | import("../Apply.ts").DestroyError | import("../Output.ts").InvalidReferenceError | import("../Output.ts").MissingSourceError | import("../Auth/AuthProvider.ts").NeedsReauth | import("effect/PlatformError").PlatformError | State.StateStoreError, AlchemyContext | ArtifactStore | import("effect/FileSystem").FileSystem | Interaction.Interaction | import("effect/Path").Path | State.State>;
214
- /** Bind test-file options and the shared runtime scope without erasing output types. */
215
- export declare const makeDeploy: (options: MakeOptions, scope: Scope.Scope) => Deploy;
216
- export declare const destroy: (options: MakeOptions, stack: TestEffect<CompiledStack, Stage | AlchemyContext>, callOptions?: {
217
- stage?: string;
218
- scope?: Scope.Scope;
219
- include?: never;
220
- exclude?: never;
221
- }) => Effect.Effect<undefined, import("../Auth/AuthProvider.ts").AuthError | Config.ConfigError | import("../Auth/Demand.ts").CredentialsRequired | import("../Apply.ts").DestroyError | import("../Output.ts").InvalidReferenceError | import("../Output.ts").MissingSourceError | import("../Auth/AuthProvider.ts").NeedsReauth | import("effect/PlatformError").PlatformError | State.StateStoreError, AlchemyContext | ArtifactStore | import("effect/FileSystem").FileSystem | Interaction.Interaction | import("effect/Path").Path | State.State>;
222
- /**
223
- * In-test scratch stack handed to `test.provider(name, (stack) => ...)`.
224
- *
225
- * Each scratch stack owns a private state store that is shared between
226
- * successive `deploy`/`destroy` calls AND visible to the user's test body
227
- * (so `yield* State` / `state.get(...)` see the same store the deploys
228
- * mutated). This makes create / update / replace / delete paths exercisable
229
- * without polluting other tests in the same file.
230
- *
231
- * When the adapter can name the test file (the alchemy-test runner), the
232
- * store is DURABLE — rows live under `.alchemy/state/{file}-{test}/{stage}`
233
- * on disk. Durability is what makes an interrupted destroy recoverable: the
234
- * engine persists a `deleting` row before every `provider.delete` and only
235
- * drops it on success, so a run killed mid-delete (e.g. the runner's
236
- * teardown-abandonment after a test timeout) leaves resumable rows that the
237
- * NEXT run's leading `stack.destroy()` (or the `Effect.ensuring` teardown)
238
- * picks up and drains. An in-memory scratch dies with the process, silently
239
- * orphaning every cloud resource whose delete was still in flight.
240
- */
241
- export interface ScratchStack<ROut = any> {
242
- readonly name: string;
243
- /** Stage this scratch deploys to ({@link resolveStage} of the file options). */
244
- readonly stage: string;
245
- /** The shared in-memory state Layer for this scratch. @internal */
246
- readonly state: Layer.Layer<State.State, never, never>;
247
- /** Filters leave other rows and stack outputs untouched; declaration still runs. */
248
- deploy<A, E, R, Call extends [options?: Plan.FilteredPlanOptions] = []>(effect: Effect.Effect<A, E, R>, ...call: Call): Effect.Effect<SelectionOutput<Input.Resolve<A>, Call[0]>, any, Exclude<R, ROut | StackServices>>;
249
- /**
250
- * Build a plan against the scratch's shared state WITHOUT applying it.
251
- *
252
- * Use this to assert on the planned action for a resource (e.g. that a
253
- * downstream dependency stays `noop` when only an upstream resource
254
- * changes) without mutating the cloud. Plans run against whatever state
255
- * prior `deploy(...)` calls persisted.
256
- */
257
- plan<A, E, R, Call extends [options?: Plan.FilteredPlanOptions] = []>(effect: Effect.Effect<A, E, R>, ...call: Call): Effect.Effect<Plan.Plan<SelectionOutput<A, Call[0]>>, any, Exclude<R, ROut | StackServices>>;
258
- destroy(options?: {
259
- include?: never;
260
- exclude?: never;
261
- }): Effect.Effect<void, any, never>;
262
- }
263
- /**
264
- * Build a fresh `ScratchStack` for `test.provider`.
265
- *
266
- * With `file` (the registration-time test file, supplied by the
267
- * alchemy-test adapter): the store is the durable `.alchemy/state` local
268
- * store and the stack name is namespaced by file so interrupted destroys
269
- * leave resumable rows for the next run (see {@link ScratchStack}).
270
- *
271
- * Without `file` (bun/vitest adapters, which cannot name their file at
272
- * registration time): falls back to a private in-memory store — isolated,
273
- * but discarded with the process.
274
- */
275
- export declare const scratchStack: <ROut>(options: MakeOptions<ROut>, name: string, file?: string) => ScratchStack<ROut>;
276
- export {};
277
- //# sourceMappingURL=Core.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Core.d.ts","sourceRoot":"","sources":["../../src/Test/Core.ts"],"names":[],"mappings":"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"}
package/lib/Test/Core.js DELETED
@@ -1,362 +0,0 @@
1
- /** @effect-diagnostics anyUnknownInErrorContext:off */
2
- import * as Config from "effect/Config";
3
- import { ConfigProvider } from "effect/ConfigProvider";
4
- import * as Context from "effect/Context";
5
- import * as Effect from "effect/Effect";
6
- import * as Exit from "effect/Exit";
7
- import * as FetchHttpClient from "effect/http/FetchHttpClient";
8
- import * as HttpClient from "effect/http/HttpClient";
9
- import * as Layer from "effect/Layer";
10
- import * as Option from "effect/Option";
11
- import * as Scope from "effect/Scope";
12
- import { AdoptPolicy } from "../AdoptPolicy.js";
13
- import { AlchemyContext, AlchemyContextLive } from "../AlchemyContext.js";
14
- import { apply } from "../Apply.js";
15
- import { ArtifactStore, provideFreshArtifactStore } from "../Artifacts.js";
16
- import { AuthProviders } from "../Auth/AuthProvider.js";
17
- import { CredentialsStoreLive } from "../Auth/Credentials.js";
18
- import { ProfileStoreLive } from "../Auth/Profile.js";
19
- import { withProfileOverride } from "../Auth/Resolve.js";
20
- import { userStage } from "../Cli/commands/flags.js";
21
- import { LoggingCli } from "../Cli/LoggingCli.js";
22
- import * as Contributions from "../Contributions.js";
23
- import { deploy as _deploy } from "../Deploy.js";
24
- import { destroy as _destroy } from "../Destroy.js";
25
- import * as Interaction from "../Interaction.js";
26
- import * as RpcProviderProxy from "../Local/RpcProviderProxy.js";
27
- import * as RpcSpawner from "../Local/RpcSpawner.js";
28
- import { ALCHEMY_DEV } from "../Phase.js";
29
- import * as Plan from "../Plan.js";
30
- import { make as makeStack, Stack, } from "../Stack.js";
31
- import { Stage } from "../Stage.js";
32
- import * as State from "../State/index.js";
33
- import { TelemetryLive } from "../Telemetry/Layer.js";
34
- import { loadConfigProvider, StackConfigOverrides } from "../Util/ConfigProvider.js";
35
- import { PlatformServices } from "../Util/PlatformServices.js";
36
- /**
37
- * The RPC sidecar topology used by the real `alchemy dev` command, in one
38
- * process-local layer: an {@link RpcSpawner} HTTP server that forks sidecar
39
- * processes on demand, and an {@link RpcProviderProxy} pointed at it.
40
- */
41
- export const sidecarProxy = (options) => Layer.unwrap(Effect.map(RpcSpawner.RpcSpawner, (spawner) => RpcProviderProxy.layer(spawner.url))).pipe(Layer.provideMerge(RpcSpawner.layerServer({
42
- profile: options.profile ?? process.env.ALCHEMY_PROFILE,
43
- envFile: undefined,
44
- omitEnv: options.omitEnv,
45
- })));
46
- /**
47
- * Force every `Test.make` into (or out of) local-dev mode, regardless of
48
- * the file's `dev` option. Unset leaves the option / `ALCHEMY_DEV` fallback
49
- * in place. Accepts the usual truthy/falsey strings (`true`/`1`/`yes`/`on`,
50
- * `false`/`0`/`no`/`off`).
51
- */
52
- export const ALCHEMY_TEST_DEV = Config.Boolean("ALCHEMY_TEST_DEV").pipe(Config.option);
53
- /** The `ALCHEMY_TEST_DEV` override, if the env var is set. */
54
- export const alchemyTestDevOverride = () => Effect.runSync(ALCHEMY_TEST_DEV);
55
- /** Resolve the effective `dev` flag: `ALCHEMY_TEST_DEV`, then options, then `ALCHEMY_DEV`. */
56
- export const resolveDev = (options) => {
57
- const override = alchemyTestDevOverride();
58
- if (Option.isSome(override))
59
- return override.value;
60
- if (options.dev !== undefined)
61
- return options.dev;
62
- return Effect.runSync(ALCHEMY_DEV);
63
- };
64
- /** Resolve the effective `sidecar` flag: defaults to the resolved `dev` flag. */
65
- export const resolveSidecar = (options) => options.sidecar === undefined ? resolveDev(options) : options.sidecar !== false;
66
- /** The sidecar's withheld env prefixes, sorted so equal sets share a key. */
67
- const sidecarOmitEnv = (options) => typeof options.sidecar === "object" ? [...(options.sidecar.omitEnv ?? [])].sort() : [];
68
- /**
69
- * Default test stage: `ALCHEMY_TEST_STAGE`, then `test_$USER` (or
70
- * `test_$USERNAME` / `test_unknown`). Set an explicit test stage to isolate
71
- * concurrent worktrees that share a cloud account.
72
- * Matches the CLI's `live_$USER` / `dev_$USER` per-developer isolation.
73
- */
74
- export const defaultStage = () => process.env.ALCHEMY_TEST_STAGE || Effect.runSync(userStage("test"));
75
- /** File-level stage: a string override, otherwise {@link defaultStage}. */
76
- export const resolveStage = (options) =>
77
- // Configured stacks carry a cross-stack reference proxy, not a stage override.
78
- typeof options.stage === "string" ? options.stage : defaultStage();
79
- const sidecarSingletons = new Map();
80
- /** Payload-free counts; observing them never starts the singleton. */
81
- export const sidecarDiagnostics = Effect.gen(function* () {
82
- const instances = [...sidecarSingletons.values()];
83
- const counts = { sessions: 0, testSessions: 0, owners: 0, connections: 0 };
84
- for (const instance of instances) {
85
- if (instance.proxy === undefined)
86
- continue;
87
- const current = yield* instance.proxy.diagnostics;
88
- counts.sessions += current.sessions;
89
- counts.testSessions += current.testSessions;
90
- counts.owners += current.owners;
91
- counts.connections += current.connections;
92
- }
93
- return {
94
- singletons: instances.length,
95
- reservations: instances.reduce((sum, instance) => sum + instance.refs, 0),
96
- started: instances.filter((instance) => instance.proxy !== undefined).length,
97
- ...counts,
98
- };
99
- });
100
- export const makeSidecarHandle = (options) => {
101
- if (!resolveSidecar(options))
102
- return undefined;
103
- const profile = options.profile ?? process.env.ALCHEMY_PROFILE ?? "";
104
- const omitEnv = sidecarOmitEnv(options);
105
- // Files only share a sidecar when it was started with the same environment.
106
- const key = JSON.stringify([profile, omitEnv]);
107
- let singleton = sidecarSingletons.get(key);
108
- if (singleton === undefined) {
109
- singleton = {
110
- real: sidecarProxy({ profile: options.profile, omitEnv }),
111
- memoMap: Layer.makeMemoMapUnsafe(),
112
- scope: Scope.makeUnsafe("sequential"),
113
- refs: 0,
114
- };
115
- sidecarSingletons.set(key, singleton);
116
- }
117
- singleton.refs += 1;
118
- let runtime = {
119
- instance: singleton,
120
- owner: RpcProviderProxy.makeSessionOwner(),
121
- contexts: new Set(),
122
- };
123
- const lazy = Layer.effect(RpcProviderProxy.RpcProviderProxy, Effect.gen(function* () {
124
- if (runtime === undefined) {
125
- return yield* Effect.die("Test sidecar handle is closed");
126
- }
127
- // Never pin the singleton to a file's scope, artifacts, or layer builds.
128
- const context = {
129
- ambient: Context.omit(Scope.Scope, ArtifactStore, Layer.CurrentMemoMap)(yield* Effect.context()),
130
- };
131
- if (runtime === undefined) {
132
- return yield* Effect.die("Test sidecar handle is closed");
133
- }
134
- runtime.contexts.add(context);
135
- return RpcProviderProxy.RpcProviderProxy.of({
136
- diagnostics: Effect.suspend(() => runtime?.instance.proxy?.diagnostics ??
137
- Effect.succeed({
138
- sessions: 0,
139
- testSessions: 0,
140
- owners: 0,
141
- connections: 0,
142
- })),
143
- serverDiagnostics: Effect.suspend(() => runtime?.instance.proxy?.serverDiagnostics ?? Effect.succeed(undefined)),
144
- get: Effect.fn(function* (providersUrl, providerName) {
145
- if (runtime === undefined) {
146
- return yield* Effect.die("Test sidecar handle is closed");
147
- }
148
- const { instance, owner } = runtime;
149
- let proxy = instance.proxy;
150
- if (proxy === undefined) {
151
- const built = yield* Layer.buildWithMemoMap(instance.real, instance.memoMap, instance.scope).pipe(Effect.provideContext(context.ambient), Scope.provide(instance.scope), Effect.orDie);
152
- proxy = Context.get(built, RpcProviderProxy.RpcProviderProxy);
153
- instance.proxy = proxy;
154
- }
155
- context.ambient = undefined;
156
- runtime?.contexts.delete(context);
157
- // A handle may have closed while the singleton was building.
158
- return yield* proxy.get(providersUrl, providerName, owner);
159
- }),
160
- });
161
- }));
162
- return {
163
- provide: (eff) => Effect.provide(eff, lazy),
164
- close: Effect.suspend(() => {
165
- if (runtime === undefined)
166
- return Effect.void;
167
- const { instance, owner, contexts } = runtime;
168
- runtime = undefined;
169
- for (const context of contexts)
170
- context.ambient = undefined;
171
- contexts.clear();
172
- return RpcProviderProxy.closeSessionOwner(owner).pipe(Effect.ensuring(Effect.suspend(() => {
173
- instance.refs -= 1;
174
- if (instance.refs > 0)
175
- return Effect.void;
176
- if (sidecarSingletons.get(key) === instance)
177
- sidecarSingletons.delete(key);
178
- instance.proxy = undefined;
179
- return Scope.close(instance.scope, Exit.void);
180
- })));
181
- }).pipe(Effect.uninterruptible, Effect.ignore),
182
- };
183
- };
184
- const overrideAlchemyContext = (overrides) => Layer.effect(AlchemyContext, AlchemyContext.pipe(Effect.map((ctx) => ({ ...ctx, ...overrides }))));
185
- const testDev = Option.getOrElse(alchemyTestDevOverride(), () => false);
186
- /**
187
- * Every provider's test services (e.g. AWS's Floci emulator), applied under
188
- * {@link ALCHEMY_TEST_DEV} only.
189
- */
190
- const testServices = testDev
191
- ? await Effect.runPromise(Contributions.load().pipe(Effect.flatMap((providers) => Effect.forEach(providers, (provider) => provider.testServices
192
- ? Contributions.resolve(provider, "testServices", provider.testServices)
193
- : Effect.succeed(undefined))), Effect.map((services) => services.filter((service) => service !== undefined)), Effect.provide(PlatformServices)))
194
- : [];
195
- if (testDev) {
196
- // Emulators rewrite WebSocket invoke URLs onto their self-signed gateway;
197
- // Bun/Node would otherwise reject the upgrade. Scoped to ALCHEMY_TEST_DEV
198
- // only.
199
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
200
- // Set here — before the RPC spawner or any vite child forks — so the whole
201
- // dev process tree inherits it.
202
- for (const services of testServices) {
203
- for (const [key, value] of Object.entries(services.env ?? {}))
204
- process.env[key] ??= value;
205
- }
206
- }
207
- /** The test services' layers, closest wins over the stack's own. */
208
- const testServicesLayer = testServices.length === 0
209
- ? undefined
210
- : testServices
211
- .map((services) => services.layer)
212
- .reduce((merged, layer) => Layer.merge(merged, layer));
213
- const provideTestServices = (effect) =>
214
- // Test services override services already present in R.
215
- testServicesLayer === undefined
216
- ? effect
217
- : // oxlint-disable-next-line effecttsgo/unsafe-effect-type-assertion -- the layer overrides services already present in R
218
- Effect.provide(effect, testServicesLayer);
219
- const testHttp = Layer.effect(HttpClient.HttpClient, Effect.map(HttpClient.HttpClient, (client) => testServices.reduce((mapped, services) => services.mapRequest ? HttpClient.mapRequest(mapped, services.mapRequest) : mapped, client))).pipe(Layer.provide(FetchHttpClient.layer));
220
- const platformLayer = () => Layer.mergeAll(PlatformServices, testDev ? testHttp : FetchHttpClient.layer, Layer.provide(ProfileStoreLive, PlatformServices), Layer.provide(CredentialsStoreLive, PlatformServices));
221
- const alchemyLayer = Layer.mergeAll(LoggingCli, Interaction.layerNonInteractive(), AlchemyContextLive);
222
- /**
223
- * Build the per-test runtime and return a self-contained Effect.
224
- *
225
- * Mirrors {@link "../bin/alchemy.js"} composition: ConfigProvider via
226
- * `loadConfigProvider` + `withProfileOverride`, an empty `AuthProviders`
227
- * registry that the user's `providers` layer populates, the platform layers,
228
- * and the configured state store. Adapters wrap this into runner-specific
229
- * thunks (`bun.test` -> `runPromise`, `it.live` -> as-is).
230
- *
231
- * When `scope` is provided, scoped resources (like the Cloudflare dev
232
- * sidecar) survive past this effect and are tied to the lifetime of the
233
- * provided scope instead. The runner is responsible for closing it.
234
- *
235
- * When `scope` is omitted, the effect runs with `Effect.scoped` and any
236
- * scoped resources are torn down as soon as it resolves.
237
- */
238
- export const toEffect = (effect, options, scope, sidecar) => {
239
- const base = Effect.gen(function* () {
240
- const cfg = yield* loadConfigProvider(Option.none());
241
- const configProvider = withProfileOverride(cfg, options.profile);
242
- // `ALCHEMY_TEST_DEV=1` forces local providers AND points the test
243
- // process's distilled AWS clients at the emulator. Otherwise
244
- // out-of-band `describeTable` / `getFunction` calls still hit the
245
- // live account and fail with ResourceNotFound. Existing
246
- // `Test.make({ dev: true })` files are unchanged (mixed
247
- // `Alchemy.remote()` suites keep their live SDK).
248
- const body = sidecar ? sidecar.provide(effect) : effect;
249
- const locally = testDev ? provideTestServices(body) : body;
250
- return yield* locally.pipe(provideFreshArtifactStore, Effect.provideService(ConfigProvider, configProvider), Effect.provideService(StackConfigOverrides, { profile: options.profile }));
251
- }).pipe(Effect.provideService(AdoptPolicy, options.adopt ?? false), Effect.provide(overrideAlchemyContext({ dev: resolveDev(options) })),
252
- // `options.state` (e.g. `Cloudflare.state()`) itself requires
253
- // `AuthProviders` to read credentials, so AuthProviders must be provided
254
- // AFTER the state layer or the state layer's requirement is never
255
- // satisfied — which surfaces as `Service not found: AuthProviders`.
256
- Effect.provide(options.state ?? State.localState()), Effect.provideService(AuthProviders, {}), Effect.provide(Layer.provideMerge(alchemyLayer, platformLayer())));
257
- return (scope === undefined ? Effect.scoped(base) : Scope.provide(base, scope));
258
- };
259
- /** Promise wrapper around {@link toEffect} for `bun.test`-style runners. */
260
- export const run = (effect, options, scope, sidecar) => Effect.runPromise(toEffect(effect, options, scope, sidecar));
261
- /**
262
- * Wrap an effect so it runs with `options.providers` + a placeholder Stack +
263
- * Stage in scope. Used by `test.provider` so user code can call provider SDK
264
- * APIs (e.g. `DynamoDB.describeTable`) directly inside the test body.
265
- */
266
- export const withProviders = (effect, options, stackName) => {
267
- // Closest wins: when `ALCHEMY_TEST_DEV=1`, pin the test body's
268
- // distilled AWS clients to the emulator BEFORE `options.providers`
269
- // (which still carries the live `AWSEnvironment`).
270
- const body = testDev ? provideTestServices(effect) : effect;
271
- const stage = resolveStage(options);
272
- // oxlint-disable-next-line effecttsgo/unsafe-effect-type-assertion -- providers layer is typed `any`; requirements are satisfied by it
273
- return body.pipe(Effect.provide(options.providers.pipe(Layer.provideMerge(Layer.succeed(Stack, {
274
- name: stackName,
275
- stage,
276
- resources: {},
277
- bindings: {},
278
- actions: {},
279
- })), Layer.provideMerge(Layer.succeed(Stage, stage)))));
280
- };
281
- export function deploy(options, stack, callOptions) {
282
- return deployStack(options, stack, callOptions);
283
- }
284
- const deployStack = (options, stack, callOptions) => _deploy({
285
- stack: stack,
286
- stage: callOptions?.stage ?? resolveStage(options),
287
- dev: resolveDev(options),
288
- scope: callOptions?.scope,
289
- force: callOptions?.force,
290
- include: callOptions?.include,
291
- exclude: callOptions?.exclude,
292
- }).pipe(Effect.provide(TelemetryLive));
293
- /** Bind test-file options and the shared runtime scope without erasing output types. */
294
- export const makeDeploy = (options, scope) => {
295
- function run(stack, callOptions) {
296
- return deployStack(options, stack, { ...callOptions, scope });
297
- }
298
- return run;
299
- };
300
- export const destroy = (options, stack, callOptions) => _destroy({
301
- include: callOptions?.include,
302
- exclude: callOptions?.exclude,
303
- stack: stack,
304
- stage: callOptions?.stage ?? resolveStage(options),
305
- dev: resolveDev(options),
306
- scope: callOptions?.scope,
307
- }).pipe(Effect.provide(TelemetryLive));
308
- const sanitizeStackName = (name) => name.replaceAll(/[^a-zA-Z0-9_]/g, "-").replace(/-+/g, "-");
309
- /**
310
- * Turn a test-file path (relative to the run root) into a stack-name
311
- * namespace: `test/AWS/Website/Router.test.ts` -> `AWS/Website/Router`.
312
- * Test names repeat across files (e.g. "create and delete bucket with
313
- * default props"), so the durable per-test store MUST be namespaced by file
314
- * or two concurrently-running same-named tests would read, write and — far
315
- * worse — destroy each other's rows.
316
- */
317
- const scratchNamespace = (file) => file.replace(/^test[/\\]/, "").replace(/\.test\.ts$/, "");
318
- /**
319
- * Build a fresh `ScratchStack` for `test.provider`.
320
- *
321
- * With `file` (the registration-time test file, supplied by the
322
- * alchemy-test adapter): the store is the durable `.alchemy/state` local
323
- * store and the stack name is namespaced by file so interrupted destroys
324
- * leave resumable rows for the next run (see {@link ScratchStack}).
325
- *
326
- * Without `file` (bun/vitest adapters, which cannot name their file at
327
- * registration time): falls back to a private in-memory store — isolated,
328
- * but discarded with the process.
329
- */
330
- export const scratchStack = (options, name, file) => {
331
- const stage = resolveStage(options);
332
- const stackName = sanitizeStackName(file === undefined ? name : `${scratchNamespace(file)}-${name}`);
333
- const stateLayer = file === undefined
334
- ? Layer.succeed(State.State, State.InMemoryService({}))
335
- : Layer.provide(State.localState(), PlatformServices);
336
- // `withProviders` already pins the test body to the test services, but the
337
- // stack program and its later plan/apply phase run under the providers'
338
- // live services. Pin both phases separately: Actions execute during apply,
339
- // after the stack program has finished. This override must be inside
340
- // `compiled.services` so Effect's closest-layer precedence selects the test
341
- // services for Action data-plane calls.
342
- const pinToTestServices = (effect) => testDev ? provideTestServices(effect) : effect;
343
- const buildAndApply = (effect, planOptions) => pinToTestServices(effect).pipe(makeStack({ name: stackName, providers: options.providers, state: stateLayer }), Effect.flatMap((compiled) => Plan.make(compiled, planOptions ?? {}).pipe(Effect.flatMap(apply), pinToTestServices, Effect.provide(compiled.services))), Effect.provideService(Stage, stage), provideFreshArtifactStore);
344
- const buildPlan = (effect, planOptions) => pinToTestServices(effect).pipe(makeStack({ name: stackName, providers: options.providers, state: stateLayer }), Effect.flatMap((compiled) => pinToTestServices(Plan.make(compiled, planOptions ?? {})).pipe(Effect.provide(compiled.services))), Effect.provideService(Stage, stage), provideFreshArtifactStore);
345
- return {
346
- name: stackName,
347
- stage,
348
- state: stateLayer,
349
- deploy: ((effect, planOptions) => buildAndApply(effect, planOptions)),
350
- plan: ((effect, planOptions) => buildPlan(effect, planOptions)),
351
- destroy: (callOptions) => callOptions?.include !== undefined || callOptions?.exclude !== undefined
352
- ? Effect.die(new Plan.InvalidResourceSelection({ message: "Filtered destroy is not supported." }))
353
- : Plan.destroy({ name: stackName, stage }).pipe(Effect.flatMap(apply), Effect.asVoid, Effect.provide(stateLayer.pipe(Layer.provideMerge(options.providers), Layer.provideMerge(Layer.succeed(Stack, {
354
- name: stackName,
355
- stage,
356
- resources: {},
357
- bindings: {},
358
- actions: {},
359
- })), Layer.provideMerge(Layer.succeed(Stage, stage)))), provideFreshArtifactStore),
360
- };
361
- };
362
- //# sourceMappingURL=Core.js.map