alchemy 2.0.0-beta.36 → 2.0.0-beta.38

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 (741) hide show
  1. package/bin/exec.js +646 -104
  2. package/bin/exec.js.map +1 -1
  3. package/lib/AWS/AutoScaling/LaunchTemplate.d.ts +1 -1
  4. package/lib/AWS/CloudWatch/common.d.ts +1 -1
  5. package/lib/AWS/Credentials.d.ts.map +1 -1
  6. package/lib/AWS/Credentials.js +1 -2
  7. package/lib/AWS/Credentials.js.map +1 -1
  8. package/lib/AWS/DynamoDB/Stream.d.ts.map +1 -1
  9. package/lib/AWS/DynamoDB/Stream.js +1 -1
  10. package/lib/AWS/DynamoDB/Stream.js.map +1 -1
  11. package/lib/AWS/EC2/Instance.d.ts +1 -1
  12. package/lib/AWS/EC2/hosted.d.ts +1 -1
  13. package/lib/AWS/EC2/hosted.d.ts.map +1 -1
  14. package/lib/AWS/EC2/hosted.js +3 -5
  15. package/lib/AWS/EC2/hosted.js.map +1 -1
  16. package/lib/AWS/ECS/Task.d.ts +1 -1
  17. package/lib/AWS/ECS/Task.d.ts.map +1 -1
  18. package/lib/AWS/ECS/Task.js +3 -5
  19. package/lib/AWS/ECS/Task.js.map +1 -1
  20. package/lib/AWS/Endpoint.d.ts.map +1 -1
  21. package/lib/AWS/Endpoint.js +1 -2
  22. package/lib/AWS/Endpoint.js.map +1 -1
  23. package/lib/AWS/Environment.d.ts +2 -2
  24. package/lib/AWS/EventBridge/EventSource.d.ts.map +1 -1
  25. package/lib/AWS/EventBridge/EventSource.js +1 -1
  26. package/lib/AWS/EventBridge/EventSource.js.map +1 -1
  27. package/lib/AWS/Kinesis/StreamEventSource.d.ts.map +1 -1
  28. package/lib/AWS/Kinesis/StreamEventSource.js +1 -1
  29. package/lib/AWS/Kinesis/StreamEventSource.js.map +1 -1
  30. package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
  31. package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
  32. package/lib/AWS/Lambda/Function.d.ts +1 -1
  33. package/lib/AWS/Lambda/Function.d.ts.map +1 -1
  34. package/lib/AWS/Lambda/Function.js +29 -13
  35. package/lib/AWS/Lambda/Function.js.map +1 -1
  36. package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
  37. package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
  38. package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
  39. package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
  40. package/lib/AWS/Organizations/common.d.ts +1 -1
  41. package/lib/AWS/Providers.d.ts.map +1 -1
  42. package/lib/AWS/Providers.js +21 -3
  43. package/lib/AWS/Providers.js.map +1 -1
  44. package/lib/AWS/Region.d.ts +1 -1
  45. package/lib/AWS/Region.d.ts.map +1 -1
  46. package/lib/AWS/Region.js +2 -3
  47. package/lib/AWS/Region.js.map +1 -1
  48. package/lib/AWS/S3/Bucket.d.ts.map +1 -1
  49. package/lib/AWS/S3/Bucket.js +5 -2
  50. package/lib/AWS/S3/Bucket.js.map +1 -1
  51. package/lib/AWS/S3/BucketNotifications.d.ts.map +1 -1
  52. package/lib/AWS/S3/BucketNotifications.js +1 -1
  53. package/lib/AWS/S3/BucketNotifications.js.map +1 -1
  54. package/lib/AWS/SNS/TopicEventSource.d.ts.map +1 -1
  55. package/lib/AWS/SNS/TopicEventSource.js +1 -1
  56. package/lib/AWS/SNS/TopicEventSource.js.map +1 -1
  57. package/lib/AWS/SQS/Queue.d.ts.map +1 -1
  58. package/lib/AWS/SQS/Queue.js +23 -5
  59. package/lib/AWS/SQS/Queue.js.map +1 -1
  60. package/lib/Action.d.ts +77 -0
  61. package/lib/Action.d.ts.map +1 -0
  62. package/lib/Action.js +89 -0
  63. package/lib/Action.js.map +1 -0
  64. package/lib/AlchemyContext.d.ts +1 -1
  65. package/lib/Apply.d.ts.map +1 -1
  66. package/lib/Apply.js +228 -4
  67. package/lib/Apply.js.map +1 -1
  68. package/lib/Artifacts.d.ts +1 -1
  69. package/lib/Artifacts.d.ts.map +1 -1
  70. package/lib/Artifacts.js +1 -1
  71. package/lib/Artifacts.js.map +1 -1
  72. package/lib/Auth/AuthProvider.js +1 -1
  73. package/lib/Auth/AuthProvider.js.map +1 -1
  74. package/lib/Auth/Env.d.ts.map +1 -1
  75. package/lib/Auth/Env.js +4 -12
  76. package/lib/Auth/Env.js.map +1 -1
  77. package/lib/Binding.d.ts.map +1 -1
  78. package/lib/Binding.js +5 -5
  79. package/lib/Binding.js.map +1 -1
  80. package/lib/Build/Command.d.ts +1 -1
  81. package/lib/Build/Memo.d.ts +1 -1
  82. package/lib/Bundle/Docker.d.ts +3 -3
  83. package/lib/Bundle/Docker.js +1 -1
  84. package/lib/Bundle/Docker.js.map +1 -1
  85. package/lib/Bundle/TempRoot.d.ts +3 -3
  86. package/lib/Cli/Event.d.ts +1 -1
  87. package/lib/Cli/Event.d.ts.map +1 -1
  88. package/lib/Cli/NamespaceTree.d.ts +11 -5
  89. package/lib/Cli/NamespaceTree.d.ts.map +1 -1
  90. package/lib/Cli/NamespaceTree.js +28 -1
  91. package/lib/Cli/NamespaceTree.js.map +1 -1
  92. package/lib/Cli/commands/_shared.d.ts +1 -1
  93. package/lib/Cli/commands/_shared.js +2 -2
  94. package/lib/Cli/commands/_shared.js.map +1 -1
  95. package/lib/Cli/commands/aws.d.ts +1 -1
  96. package/lib/Cli/commands/cloudflare.d.ts +2 -2
  97. package/lib/Cli/commands/cloudflare.d.ts.map +1 -1
  98. package/lib/Cli/commands/deploy.d.ts +9 -9
  99. package/lib/Cli/commands/deploy.js +1 -1
  100. package/lib/Cli/commands/deploy.js.map +1 -1
  101. package/lib/Cli/commands/login.d.ts +1 -1
  102. package/lib/Cli/commands/logs.d.ts +1 -1
  103. package/lib/Cli/commands/logs.js.map +1 -1
  104. package/lib/Cli/commands/profile.d.ts +1 -3
  105. package/lib/Cli/commands/profile.d.ts.map +1 -1
  106. package/lib/Cli/commands/state.d.ts +1 -1
  107. package/lib/Cli/commands/state.d.ts.map +1 -1
  108. package/lib/Cli/commands/tail.d.ts +1 -1
  109. package/lib/Cli/commands/tail.js.map +1 -1
  110. package/lib/Cli/tui/components/Plan.d.ts.map +1 -1
  111. package/lib/Cli/tui/components/Plan.js +27 -13
  112. package/lib/Cli/tui/components/Plan.js.map +1 -1
  113. package/lib/Cli/tui/components/PlanProgress.d.ts +8 -1
  114. package/lib/Cli/tui/components/PlanProgress.d.ts.map +1 -1
  115. package/lib/Cli/tui/components/PlanProgress.js +95 -16
  116. package/lib/Cli/tui/components/PlanProgress.js.map +1 -1
  117. package/lib/Cloudflare/Access.js +0 -1
  118. package/lib/Cloudflare/Access.js.map +1 -1
  119. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.d.ts +54 -0
  120. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.d.ts.map +1 -0
  121. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.js +17 -0
  122. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.js.map +1 -0
  123. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts +37 -0
  124. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts.map +1 -0
  125. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js +45 -0
  126. package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js.map +1 -0
  127. package/lib/Cloudflare/AnalyticsEngine/index.d.ts +3 -0
  128. package/lib/Cloudflare/AnalyticsEngine/index.d.ts.map +1 -0
  129. package/lib/Cloudflare/AnalyticsEngine/index.js +3 -0
  130. package/lib/Cloudflare/AnalyticsEngine/index.js.map +1 -0
  131. package/lib/Cloudflare/Artifacts/ArtifactsBinding.js +1 -1
  132. package/lib/Cloudflare/Artifacts/ArtifactsBinding.js.map +1 -1
  133. package/lib/Cloudflare/CloudflareEnvironment.d.ts +1 -1
  134. package/lib/Cloudflare/Container/Container.js +0 -1
  135. package/lib/Cloudflare/Container/Container.js.map +1 -1
  136. package/lib/Cloudflare/Container/ContainerApplication.d.ts +1 -1
  137. package/lib/Cloudflare/Container/ContainerApplication.d.ts.map +1 -1
  138. package/lib/Cloudflare/Container/ContainerApplication.js +4 -6
  139. package/lib/Cloudflare/Container/ContainerApplication.js.map +1 -1
  140. package/lib/Cloudflare/Container/ContainerBinding.js +2 -2
  141. package/lib/Cloudflare/Container/ContainerBinding.js.map +1 -1
  142. package/lib/Cloudflare/D1/D1Connection.d.ts +47 -3
  143. package/lib/Cloudflare/D1/D1Connection.d.ts.map +1 -1
  144. package/lib/Cloudflare/D1/D1Connection.js +62 -5
  145. package/lib/Cloudflare/D1/D1Connection.js.map +1 -1
  146. package/lib/Cloudflare/D1/D1Database.d.ts +1 -1
  147. package/lib/Cloudflare/D1/D1SqlFile.d.ts +2 -2
  148. package/lib/Cloudflare/Email/EmailAddress.d.ts +45 -0
  149. package/lib/Cloudflare/Email/EmailAddress.d.ts.map +1 -0
  150. package/lib/Cloudflare/Email/EmailAddress.js +99 -0
  151. package/lib/Cloudflare/Email/EmailAddress.js.map +1 -0
  152. package/lib/Cloudflare/Email/EmailRouting.d.ts +42 -0
  153. package/lib/Cloudflare/Email/EmailRouting.d.ts.map +1 -0
  154. package/lib/Cloudflare/Email/EmailRouting.js +89 -0
  155. package/lib/Cloudflare/Email/EmailRouting.js.map +1 -0
  156. package/lib/Cloudflare/Email/EmailRule.d.ts +80 -0
  157. package/lib/Cloudflare/Email/EmailRule.d.ts.map +1 -0
  158. package/lib/Cloudflare/Email/EmailRule.js +110 -0
  159. package/lib/Cloudflare/Email/EmailRule.js.map +1 -0
  160. package/lib/Cloudflare/Email/SendEmail.d.ts +74 -0
  161. package/lib/Cloudflare/Email/SendEmail.d.ts.map +1 -0
  162. package/lib/Cloudflare/Email/SendEmail.js +19 -0
  163. package/lib/Cloudflare/Email/SendEmail.js.map +1 -0
  164. package/lib/Cloudflare/Email/SendEmailBinding.d.ts +64 -0
  165. package/lib/Cloudflare/Email/SendEmailBinding.d.ts.map +1 -0
  166. package/lib/Cloudflare/Email/SendEmailBinding.js +54 -0
  167. package/lib/Cloudflare/Email/SendEmailBinding.js.map +1 -0
  168. package/lib/Cloudflare/Email/index.d.ts +6 -0
  169. package/lib/Cloudflare/Email/index.d.ts.map +1 -0
  170. package/lib/Cloudflare/Email/index.js +6 -0
  171. package/lib/Cloudflare/Email/index.js.map +1 -0
  172. package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts +1 -1
  173. package/lib/Cloudflare/Images/ImagesBinding.js +1 -1
  174. package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -1
  175. package/lib/Cloudflare/KV/KVNamespaceBinding.js +1 -1
  176. package/lib/Cloudflare/KV/KVNamespaceBinding.js.map +1 -1
  177. package/lib/Cloudflare/Local/Sidecar.d.ts +1 -1
  178. package/lib/Cloudflare/Local/SidecarHandlers.d.ts +1 -1
  179. package/lib/Cloudflare/Local/SidecarHandlers.js +9 -1
  180. package/lib/Cloudflare/Local/SidecarHandlers.js.map +1 -1
  181. package/lib/Cloudflare/Local/SidecarServer.js +1 -1
  182. package/lib/Cloudflare/Local/SidecarServer.js.map +1 -1
  183. package/lib/Cloudflare/Providers.d.ts.map +1 -1
  184. package/lib/Cloudflare/Providers.js +9 -1
  185. package/lib/Cloudflare/Providers.js.map +1 -1
  186. package/lib/Cloudflare/Queue/QueueBinding.js +1 -1
  187. package/lib/Cloudflare/Queue/QueueBinding.js.map +1 -1
  188. package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
  189. package/lib/Cloudflare/R2/R2Bucket.js +16 -0
  190. package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
  191. package/lib/Cloudflare/R2/R2BucketBinding.js +1 -1
  192. package/lib/Cloudflare/R2/R2BucketBinding.js.map +1 -1
  193. package/lib/Cloudflare/SecretsStore/SecretBinding.js +1 -1
  194. package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
  195. package/lib/Cloudflare/StateStore/Api.d.ts +7 -2
  196. package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
  197. package/lib/Cloudflare/StateStore/Api.js +23 -1
  198. package/lib/Cloudflare/StateStore/Api.js.map +1 -1
  199. package/lib/Cloudflare/StateStore/State.d.ts +2 -2
  200. package/lib/Cloudflare/StateStore/Store.d.ts +16 -1
  201. package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
  202. package/lib/Cloudflare/StateStore/Store.js +22 -5
  203. package/lib/Cloudflare/StateStore/Store.js.map +1 -1
  204. package/lib/Cloudflare/Workers/Assets.d.ts +2 -2
  205. package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
  206. package/lib/Cloudflare/Workers/Assets.js +5 -4
  207. package/lib/Cloudflare/Workers/Assets.js.map +1 -1
  208. package/lib/Cloudflare/Workers/CronEventSource.d.ts +35 -0
  209. package/lib/Cloudflare/Workers/CronEventSource.d.ts.map +1 -0
  210. package/lib/Cloudflare/Workers/CronEventSource.js +55 -0
  211. package/lib/Cloudflare/Workers/CronEventSource.js.map +1 -0
  212. package/lib/Cloudflare/Workers/InferEnv.d.ts +37 -2
  213. package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
  214. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
  215. package/lib/Cloudflare/Workers/LocalWorkerProvider.js +2 -1
  216. package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
  217. package/lib/Cloudflare/Workers/Rpc.d.ts +76 -3
  218. package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
  219. package/lib/Cloudflare/Workers/Rpc.js +197 -13
  220. package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
  221. package/lib/Cloudflare/Workers/Worker.d.ts +24 -4
  222. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  223. package/lib/Cloudflare/Workers/Worker.js +187 -45
  224. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  225. package/lib/Cloudflare/Workers/WorkerBundle.d.ts +1 -1
  226. package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
  227. package/lib/Cloudflare/Workers/WorkerBundle.js +19 -11
  228. package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
  229. package/lib/Cloudflare/Workers/WorkerName.d.ts +1 -1
  230. package/lib/Cloudflare/Workers/Workflow.d.ts +50 -47
  231. package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
  232. package/lib/Cloudflare/Workers/Workflow.js +43 -37
  233. package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
  234. package/lib/Cloudflare/Workers/index.d.ts +1 -0
  235. package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
  236. package/lib/Cloudflare/Workers/index.js +1 -0
  237. package/lib/Cloudflare/Workers/index.js.map +1 -1
  238. package/lib/Cloudflare/index.d.ts +2 -0
  239. package/lib/Cloudflare/index.d.ts.map +1 -1
  240. package/lib/Cloudflare/index.js +2 -0
  241. package/lib/Cloudflare/index.js.map +1 -1
  242. package/lib/Construct.d.ts +3 -3
  243. package/lib/Construct.d.ts.map +1 -1
  244. package/lib/Construct.js.map +1 -1
  245. package/lib/Deploy.d.ts +5 -2
  246. package/lib/Deploy.d.ts.map +1 -1
  247. package/lib/Deploy.js +2 -2
  248. package/lib/Deploy.js.map +1 -1
  249. package/lib/Destroy.d.ts +5 -2
  250. package/lib/Destroy.d.ts.map +1 -1
  251. package/lib/Destroy.js +3 -2
  252. package/lib/Destroy.js.map +1 -1
  253. package/lib/Drizzle/Providers.d.ts +1 -1
  254. package/lib/Drizzle/Schema.d.ts +1 -1
  255. package/lib/GitHub/Providers.d.ts +1 -1
  256. package/lib/Http.d.ts +1 -1
  257. package/lib/Http.d.ts.map +1 -1
  258. package/lib/Http.js +1 -1
  259. package/lib/Http.js.map +1 -1
  260. package/lib/Namespace.d.ts.map +1 -1
  261. package/lib/Namespace.js +3 -4
  262. package/lib/Namespace.js.map +1 -1
  263. package/lib/Neon/Branch.d.ts +2 -2
  264. package/lib/Neon/Branch.d.ts.map +1 -1
  265. package/lib/Neon/Branch.js +59 -27
  266. package/lib/Neon/Branch.js.map +1 -1
  267. package/lib/Neon/Credentials.d.ts +2 -2
  268. package/lib/Neon/Credentials.d.ts.map +1 -1
  269. package/lib/Neon/Credentials.js +2 -2
  270. package/lib/Neon/Credentials.js.map +1 -1
  271. package/lib/Neon/NeonEnvironment.d.ts +1 -1
  272. package/lib/Neon/Project.d.ts +25 -1
  273. package/lib/Neon/Project.d.ts.map +1 -1
  274. package/lib/Neon/Project.js +121 -42
  275. package/lib/Neon/Project.js.map +1 -1
  276. package/lib/Neon/Providers.d.ts +1 -1
  277. package/lib/Neon/SqlFile.d.ts +2 -2
  278. package/lib/Output.d.ts +47 -8
  279. package/lib/Output.d.ts.map +1 -1
  280. package/lib/Output.js +106 -7
  281. package/lib/Output.js.map +1 -1
  282. package/lib/PhysicalName.d.ts +1 -1
  283. package/lib/Plan.d.ts +36 -1
  284. package/lib/Plan.d.ts.map +1 -1
  285. package/lib/Plan.js +284 -37
  286. package/lib/Plan.js.map +1 -1
  287. package/lib/Platform.d.ts.map +1 -1
  288. package/lib/Platform.js +22 -9
  289. package/lib/Platform.js.map +1 -1
  290. package/lib/Provider.d.ts +1 -1
  291. package/lib/Provider.d.ts.map +1 -1
  292. package/lib/Provider.js +1 -1
  293. package/lib/Provider.js.map +1 -1
  294. package/lib/Random.d.ts +1 -1
  295. package/lib/Random.d.ts.map +1 -1
  296. package/lib/Random.js +1 -1
  297. package/lib/Random.js.map +1 -1
  298. package/lib/Ref.d.ts +4 -1
  299. package/lib/Ref.d.ts.map +1 -1
  300. package/lib/Ref.js +1 -1
  301. package/lib/Ref.js.map +1 -1
  302. package/lib/Resource.d.ts +8 -0
  303. package/lib/Resource.d.ts.map +1 -1
  304. package/lib/Resource.js +12 -25
  305. package/lib/Resource.js.map +1 -1
  306. package/lib/Runtime.d.ts +24 -0
  307. package/lib/Runtime.d.ts.map +1 -0
  308. package/lib/Runtime.js +31 -0
  309. package/lib/Runtime.js.map +1 -0
  310. package/lib/RuntimeContext.d.ts +3 -1
  311. package/lib/RuntimeContext.d.ts.map +1 -1
  312. package/lib/RuntimeContext.js.map +1 -1
  313. package/lib/Secret.d.ts +50 -0
  314. package/lib/Secret.d.ts.map +1 -0
  315. package/lib/Secret.js +23 -0
  316. package/lib/Secret.js.map +1 -0
  317. package/lib/Serverless/Function.d.ts +9 -1
  318. package/lib/Serverless/Function.d.ts.map +1 -1
  319. package/lib/Sidecar/RpcClient.d.ts +1 -1
  320. package/lib/Sidecar/RpcPaths.d.ts +1 -1
  321. package/lib/Sidecar/RpcServer.d.ts +1 -1
  322. package/lib/Sidecar/RpcServices.d.ts +1 -1
  323. package/lib/Stack.d.ts +20 -6
  324. package/lib/Stack.d.ts.map +1 -1
  325. package/lib/Stack.js +35 -23
  326. package/lib/Stack.js.map +1 -1
  327. package/lib/State/ActionState.d.ts +48 -0
  328. package/lib/State/ActionState.d.ts.map +1 -0
  329. package/lib/State/ActionState.js +1 -0
  330. package/lib/State/ActionState.js.map +1 -0
  331. package/lib/State/HttpStateApi.d.ts +15 -1
  332. package/lib/State/HttpStateApi.d.ts.map +1 -1
  333. package/lib/State/HttpStateApi.js +11 -0
  334. package/lib/State/HttpStateApi.js.map +1 -1
  335. package/lib/State/HttpStateStore.d.ts.map +1 -1
  336. package/lib/State/HttpStateStore.js +12 -1
  337. package/lib/State/HttpStateStore.js.map +1 -1
  338. package/lib/State/InMemoryState.d.ts +2 -2
  339. package/lib/State/InMemoryState.d.ts.map +1 -1
  340. package/lib/State/InMemoryState.js +12 -6
  341. package/lib/State/InMemoryState.js.map +1 -1
  342. package/lib/State/LocalState.d.ts +2 -2
  343. package/lib/State/LocalState.d.ts.map +1 -1
  344. package/lib/State/LocalState.js +11 -2
  345. package/lib/State/LocalState.js.map +1 -1
  346. package/lib/State/ResourceState.d.ts +5 -0
  347. package/lib/State/ResourceState.d.ts.map +1 -1
  348. package/lib/State/State.d.ts +31 -2
  349. package/lib/State/State.d.ts.map +1 -1
  350. package/lib/State/State.js +2 -0
  351. package/lib/State/State.js.map +1 -1
  352. package/lib/State/index.d.ts +1 -0
  353. package/lib/State/index.d.ts.map +1 -1
  354. package/lib/State/index.js +1 -0
  355. package/lib/State/index.js.map +1 -1
  356. package/lib/Test/Bun.d.ts.map +1 -1
  357. package/lib/Test/Bun.js +30 -7
  358. package/lib/Test/Bun.js.map +1 -1
  359. package/lib/Test/Core.d.ts +19 -4
  360. package/lib/Test/Core.d.ts.map +1 -1
  361. package/lib/Test/Core.js +33 -12
  362. package/lib/Test/Core.js.map +1 -1
  363. package/lib/Test/Vitest.d.ts.map +1 -1
  364. package/lib/Test/Vitest.js +24 -5
  365. package/lib/Test/Vitest.js.map +1 -1
  366. package/lib/Util/FileLogger.d.ts +1 -1
  367. package/lib/Util/LocalhostDns.d.ts +14 -10
  368. package/lib/Util/LocalhostDns.d.ts.map +1 -1
  369. package/lib/Util/LocalhostDns.js +27 -36
  370. package/lib/Util/LocalhostDns.js.map +1 -1
  371. package/lib/Util/effect.d.ts +7 -0
  372. package/lib/Util/effect.d.ts.map +1 -1
  373. package/lib/Util/effect.js +10 -4
  374. package/lib/Util/effect.js.map +1 -1
  375. package/lib/Util/exec.d.ts.map +1 -0
  376. package/lib/Util/exec.js.map +1 -0
  377. package/lib/Util/hash.d.ts +8 -0
  378. package/lib/Util/hash.d.ts.map +1 -0
  379. package/lib/Util/hash.js +11 -0
  380. package/lib/Util/hash.js.map +1 -0
  381. package/lib/Util/ignore.d.ts +40 -0
  382. package/lib/Util/ignore.d.ts.map +1 -0
  383. package/lib/Util/ignore.js +591 -0
  384. package/lib/Util/ignore.js.map +1 -0
  385. package/lib/Variable.d.ts +29 -0
  386. package/lib/Variable.d.ts.map +1 -0
  387. package/lib/Variable.js +9 -0
  388. package/lib/Variable.js.map +1 -0
  389. package/lib/index.d.ts +4 -0
  390. package/lib/index.d.ts.map +1 -1
  391. package/lib/index.js +4 -0
  392. package/lib/index.js.map +1 -1
  393. package/lib/tsconfig.test.tsbuildinfo +1 -1
  394. package/package.json +22 -29
  395. package/src/AWS/Credentials.ts +1 -2
  396. package/src/AWS/DynamoDB/Stream.ts +1 -4
  397. package/src/AWS/EC2/hosted.ts +14 -16
  398. package/src/AWS/ECS/Task.ts +14 -16
  399. package/src/AWS/Endpoint.ts +2 -5
  400. package/src/AWS/EventBridge/EventSource.ts +1 -4
  401. package/src/AWS/Kinesis/StreamEventSource.ts +1 -4
  402. package/src/AWS/Lambda/Function.ts +47 -23
  403. package/src/AWS/Providers.ts +22 -3
  404. package/src/AWS/Region.ts +2 -3
  405. package/src/AWS/S3/Bucket.ts +7 -2
  406. package/src/AWS/S3/BucketNotifications.ts +1 -4
  407. package/src/AWS/SNS/TopicEventSource.ts +1 -4
  408. package/src/AWS/SQS/Queue.ts +40 -6
  409. package/src/Action.ts +280 -0
  410. package/src/Apply.ts +359 -24
  411. package/src/Artifacts.ts +2 -4
  412. package/src/Auth/AuthProvider.ts +1 -1
  413. package/src/Auth/Env.ts +12 -20
  414. package/src/Binding.ts +5 -9
  415. package/src/Bundle/Docker.ts +1 -1
  416. package/src/Cli/Event.ts +4 -0
  417. package/src/Cli/NamespaceTree.ts +52 -5
  418. package/src/Cli/commands/_shared.ts +2 -2
  419. package/src/Cli/commands/deploy.ts +1 -1
  420. package/src/Cli/commands/logs.ts +4 -4
  421. package/src/Cli/commands/tail.ts +4 -4
  422. package/src/Cli/tui/components/Plan.tsx +65 -17
  423. package/src/Cli/tui/components/PlanProgress.tsx +142 -32
  424. package/src/Cloudflare/Access.ts +1 -1
  425. package/src/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.ts +82 -0
  426. package/src/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.ts +106 -0
  427. package/src/Cloudflare/AnalyticsEngine/index.ts +2 -0
  428. package/src/Cloudflare/Artifacts/ArtifactsBinding.ts +1 -1
  429. package/src/Cloudflare/Container/Container.ts +1 -1
  430. package/src/Cloudflare/Container/ContainerApplication.ts +4 -6
  431. package/src/Cloudflare/Container/ContainerBinding.ts +2 -2
  432. package/src/Cloudflare/D1/D1Connection.ts +95 -12
  433. package/src/Cloudflare/Email/EmailAddress.ts +155 -0
  434. package/src/Cloudflare/Email/EmailRouting.ts +138 -0
  435. package/src/Cloudflare/Email/EmailRule.ts +210 -0
  436. package/src/Cloudflare/Email/SendEmail.ts +95 -0
  437. package/src/Cloudflare/Email/SendEmailBinding.ts +124 -0
  438. package/src/Cloudflare/Email/index.ts +5 -0
  439. package/src/Cloudflare/Images/ImagesBinding.ts +1 -1
  440. package/src/Cloudflare/KV/KVNamespaceBinding.ts +1 -1
  441. package/src/Cloudflare/Local/SidecarHandlers.ts +9 -1
  442. package/src/Cloudflare/Local/SidecarServer.ts +1 -1
  443. package/src/Cloudflare/Providers.ts +14 -0
  444. package/src/Cloudflare/Queue/QueueBinding.ts +1 -1
  445. package/src/Cloudflare/R2/R2Bucket.ts +31 -0
  446. package/src/Cloudflare/R2/R2BucketBinding.ts +1 -1
  447. package/src/Cloudflare/SecretsStore/SecretBinding.ts +1 -1
  448. package/src/Cloudflare/StateStore/Api.ts +34 -1
  449. package/src/Cloudflare/StateStore/Store.ts +40 -10
  450. package/src/Cloudflare/Workers/Assets.ts +5 -6
  451. package/src/Cloudflare/Workers/CronEventSource.ts +89 -0
  452. package/src/Cloudflare/Workers/InferEnv.ts +94 -20
  453. package/src/Cloudflare/Workers/LocalWorkerProvider.ts +9 -1
  454. package/src/Cloudflare/Workers/Rpc.ts +227 -18
  455. package/src/Cloudflare/Workers/Worker.ts +294 -65
  456. package/src/Cloudflare/Workers/WorkerBundle.ts +19 -11
  457. package/src/Cloudflare/Workers/Workflow.ts +76 -72
  458. package/src/Cloudflare/Workers/index.ts +1 -0
  459. package/src/Cloudflare/index.ts +2 -0
  460. package/src/Construct.ts +3 -7
  461. package/src/Deploy.ts +5 -1
  462. package/src/Destroy.ts +6 -1
  463. package/src/Http.ts +1 -1
  464. package/src/Namespace.ts +4 -4
  465. package/src/Neon/Branch.ts +93 -59
  466. package/src/Neon/Credentials.ts +2 -2
  467. package/src/Neon/Project.ts +193 -64
  468. package/src/Output.ts +129 -18
  469. package/src/Plan.ts +375 -36
  470. package/src/Platform.ts +26 -11
  471. package/src/Provider.ts +8 -3
  472. package/src/Random.ts +1 -1
  473. package/src/Ref.ts +10 -5
  474. package/src/Resource.ts +24 -25
  475. package/src/Runtime.ts +38 -0
  476. package/src/RuntimeContext.ts +1 -0
  477. package/src/Secret.ts +87 -0
  478. package/src/Serverless/Function.ts +10 -1
  479. package/src/Stack.ts +62 -35
  480. package/src/State/ActionState.ts +51 -0
  481. package/src/State/HttpStateApi.ts +21 -0
  482. package/src/State/HttpStateStore.ts +27 -2
  483. package/src/State/InMemoryState.ts +31 -10
  484. package/src/State/LocalState.ts +28 -4
  485. package/src/State/ResourceState.ts +5 -0
  486. package/src/State/State.ts +38 -2
  487. package/src/State/index.ts +1 -0
  488. package/src/Test/Bun.ts +43 -7
  489. package/src/Test/Core.ts +33 -11
  490. package/src/Test/Vitest.ts +33 -4
  491. package/src/Util/LocalhostDns.ts +30 -36
  492. package/src/Util/effect.ts +29 -4
  493. package/src/Util/hash.ts +14 -0
  494. package/src/Util/ignore.ts +815 -0
  495. package/src/Variable.ts +44 -0
  496. package/src/index.ts +9 -0
  497. package/lib/Agent/Agent.d.ts +0 -9
  498. package/lib/Agent/Agent.d.ts.map +0 -1
  499. package/lib/Agent/Agent.js +0 -10
  500. package/lib/Agent/Agent.js.map +0 -1
  501. package/lib/Agent/Aspect.d.ts +0 -51
  502. package/lib/Agent/Aspect.d.ts.map +0 -1
  503. package/lib/Agent/Aspect.js +0 -45
  504. package/lib/Agent/Aspect.js.map +0 -1
  505. package/lib/Agent/AspectGraph.d.ts +0 -45
  506. package/lib/Agent/AspectGraph.d.ts.map +0 -1
  507. package/lib/Agent/AspectGraph.js +0 -39
  508. package/lib/Agent/AspectGraph.js.map +0 -1
  509. package/lib/Agent/ContextPlugin.d.ts +0 -8
  510. package/lib/Agent/ContextPlugin.d.ts.map +0 -1
  511. package/lib/Agent/ContextPlugin.js +0 -3
  512. package/lib/Agent/ContextPlugin.js.map +0 -1
  513. package/lib/Agent/Plugin.d.ts +0 -18
  514. package/lib/Agent/Plugin.d.ts.map +0 -1
  515. package/lib/Agent/Plugin.js +0 -8
  516. package/lib/Agent/Plugin.js.map +0 -1
  517. package/lib/Agent/chat/channel.d.ts +0 -9
  518. package/lib/Agent/chat/channel.d.ts.map +0 -1
  519. package/lib/Agent/chat/channel.js +0 -10
  520. package/lib/Agent/chat/channel.js.map +0 -1
  521. package/lib/Agent/chat/event.d.ts +0 -32
  522. package/lib/Agent/chat/event.d.ts.map +0 -1
  523. package/lib/Agent/chat/event.js +0 -32
  524. package/lib/Agent/chat/event.js.map +0 -1
  525. package/lib/Agent/chat/message.d.ts +0 -22
  526. package/lib/Agent/chat/message.d.ts.map +0 -1
  527. package/lib/Agent/chat/message.js +0 -31
  528. package/lib/Agent/chat/message.js.map +0 -1
  529. package/lib/Agent/chat/service.d.ts +0 -102
  530. package/lib/Agent/chat/service.d.ts.map +0 -1
  531. package/lib/Agent/chat/service.js +0 -79
  532. package/lib/Agent/chat/service.js.map +0 -1
  533. package/lib/Agent/chat/thread.d.ts +0 -13
  534. package/lib/Agent/chat/thread.d.ts.map +0 -1
  535. package/lib/Agent/chat/thread.js +0 -16
  536. package/lib/Agent/chat/thread.js.map +0 -1
  537. package/lib/Agent/coding/bash.d.ts +0 -36
  538. package/lib/Agent/coding/bash.d.ts.map +0 -1
  539. package/lib/Agent/coding/bash.js +0 -170
  540. package/lib/Agent/coding/bash.js.map +0 -1
  541. package/lib/Agent/coding/edit.d.ts +0 -31
  542. package/lib/Agent/coding/edit.d.ts.map +0 -1
  543. package/lib/Agent/coding/edit.js +0 -90
  544. package/lib/Agent/coding/edit.js.map +0 -1
  545. package/lib/Agent/coding/glob.d.ts +0 -23
  546. package/lib/Agent/coding/glob.d.ts.map +0 -1
  547. package/lib/Agent/coding/glob.js +0 -78
  548. package/lib/Agent/coding/glob.js.map +0 -1
  549. package/lib/Agent/coding/grep.d.ts +0 -26
  550. package/lib/Agent/coding/grep.d.ts.map +0 -1
  551. package/lib/Agent/coding/grep.js +0 -105
  552. package/lib/Agent/coding/grep.js.map +0 -1
  553. package/lib/Agent/coding/index.d.ts +0 -8
  554. package/lib/Agent/coding/index.d.ts.map +0 -1
  555. package/lib/Agent/coding/index.js +0 -8
  556. package/lib/Agent/coding/index.js.map +0 -1
  557. package/lib/Agent/coding/read.d.ts +0 -27
  558. package/lib/Agent/coding/read.d.ts.map +0 -1
  559. package/lib/Agent/coding/read.js +0 -89
  560. package/lib/Agent/coding/read.js.map +0 -1
  561. package/lib/Agent/coding/readlints.d.ts +0 -19
  562. package/lib/Agent/coding/readlints.d.ts.map +0 -1
  563. package/lib/Agent/coding/readlints.js +0 -53
  564. package/lib/Agent/coding/readlints.js.map +0 -1
  565. package/lib/Agent/coding/write.d.ts +0 -22
  566. package/lib/Agent/coding/write.d.ts.map +0 -1
  567. package/lib/Agent/coding/write.js +0 -53
  568. package/lib/Agent/coding/write.js.map +0 -1
  569. package/lib/Agent/fs/file.d.ts +0 -12
  570. package/lib/Agent/fs/file.d.ts.map +0 -1
  571. package/lib/Agent/fs/file.js +0 -8
  572. package/lib/Agent/fs/file.js.map +0 -1
  573. package/lib/Agent/fs/folder.d.ts +0 -5
  574. package/lib/Agent/fs/folder.d.ts.map +0 -1
  575. package/lib/Agent/fs/folder.js +0 -3
  576. package/lib/Agent/fs/folder.js.map +0 -1
  577. package/lib/Agent/index.d.ts +0 -9
  578. package/lib/Agent/index.d.ts.map +0 -1
  579. package/lib/Agent/index.js +0 -9
  580. package/lib/Agent/index.js.map +0 -1
  581. package/lib/Agent/llm/error.d.ts +0 -208
  582. package/lib/Agent/llm/error.d.ts.map +0 -1
  583. package/lib/Agent/llm/error.js +0 -209
  584. package/lib/Agent/llm/error.js.map +0 -1
  585. package/lib/Agent/llm/index.d.ts +0 -5
  586. package/lib/Agent/llm/index.d.ts.map +0 -1
  587. package/lib/Agent/llm/index.js +0 -5
  588. package/lib/Agent/llm/index.js.map +0 -1
  589. package/lib/Agent/llm/llm.d.ts +0 -32
  590. package/lib/Agent/llm/llm.d.ts.map +0 -1
  591. package/lib/Agent/llm/llm.js +0 -74
  592. package/lib/Agent/llm/llm.js.map +0 -1
  593. package/lib/Agent/llm/stream-collectors.d.ts +0 -46
  594. package/lib/Agent/llm/stream-collectors.d.ts.map +0 -1
  595. package/lib/Agent/llm/stream-collectors.js +0 -33
  596. package/lib/Agent/llm/stream-collectors.js.map +0 -1
  597. package/lib/Agent/llm/stream-text-part.d.ts +0 -5
  598. package/lib/Agent/llm/stream-text-part.d.ts.map +0 -1
  599. package/lib/Agent/llm/stream-text-part.js +0 -4
  600. package/lib/Agent/llm/stream-text-part.js.map +0 -1
  601. package/lib/Agent/lsp/client.d.ts +0 -122
  602. package/lib/Agent/lsp/client.d.ts.map +0 -1
  603. package/lib/Agent/lsp/client.js +0 -180
  604. package/lib/Agent/lsp/client.js.map +0 -1
  605. package/lib/Agent/lsp/diagnostics.d.ts +0 -16
  606. package/lib/Agent/lsp/diagnostics.d.ts.map +0 -1
  607. package/lib/Agent/lsp/diagnostics.js +0 -48
  608. package/lib/Agent/lsp/diagnostics.js.map +0 -1
  609. package/lib/Agent/lsp/jsonrpc.d.ts +0 -90
  610. package/lib/Agent/lsp/jsonrpc.d.ts.map +0 -1
  611. package/lib/Agent/lsp/jsonrpc.js +0 -178
  612. package/lib/Agent/lsp/jsonrpc.js.map +0 -1
  613. package/lib/Agent/lsp/manager.d.ts +0 -38
  614. package/lib/Agent/lsp/manager.d.ts.map +0 -1
  615. package/lib/Agent/lsp/manager.js +0 -98
  616. package/lib/Agent/lsp/manager.js.map +0 -1
  617. package/lib/Agent/lsp/servers.d.ts +0 -28
  618. package/lib/Agent/lsp/servers.d.ts.map +0 -1
  619. package/lib/Agent/lsp/servers.js +0 -21
  620. package/lib/Agent/lsp/servers.js.map +0 -1
  621. package/lib/Agent/process/driver.d.ts +0 -10
  622. package/lib/Agent/process/driver.d.ts.map +0 -1
  623. package/lib/Agent/process/driver.js +0 -153
  624. package/lib/Agent/process/driver.js.map +0 -1
  625. package/lib/Agent/process/issue-service.d.ts +0 -44
  626. package/lib/Agent/process/issue-service.d.ts.map +0 -1
  627. package/lib/Agent/process/issue-service.js +0 -28
  628. package/lib/Agent/process/issue-service.js.map +0 -1
  629. package/lib/Agent/process/issue-tools.d.ts +0 -28
  630. package/lib/Agent/process/issue-tools.d.ts.map +0 -1
  631. package/lib/Agent/process/issue-tools.js +0 -28
  632. package/lib/Agent/process/issue-tools.js.map +0 -1
  633. package/lib/Agent/process/issue.d.ts +0 -16
  634. package/lib/Agent/process/issue.d.ts.map +0 -1
  635. package/lib/Agent/process/issue.js +0 -17
  636. package/lib/Agent/process/issue.js.map +0 -1
  637. package/lib/Agent/process/organization.d.ts +0 -4
  638. package/lib/Agent/process/organization.d.ts.map +0 -1
  639. package/lib/Agent/process/organization.js +0 -3
  640. package/lib/Agent/process/organization.js.map +0 -1
  641. package/lib/Agent/process/process.d.ts +0 -5
  642. package/lib/Agent/process/process.d.ts.map +0 -1
  643. package/lib/Agent/process/process.js +0 -3
  644. package/lib/Agent/process/process.js.map +0 -1
  645. package/lib/Agent/process/reply.d.ts +0 -16
  646. package/lib/Agent/process/reply.d.ts.map +0 -1
  647. package/lib/Agent/process/reply.js +0 -18
  648. package/lib/Agent/process/reply.js.map +0 -1
  649. package/lib/Agent/process/task.d.ts +0 -25
  650. package/lib/Agent/process/task.d.ts.map +0 -1
  651. package/lib/Agent/process/task.js +0 -26
  652. package/lib/Agent/process/task.js.map +0 -1
  653. package/lib/Agent/tool/index.d.ts +0 -4
  654. package/lib/Agent/tool/index.d.ts.map +0 -1
  655. package/lib/Agent/tool/index.js +0 -4
  656. package/lib/Agent/tool/index.js.map +0 -1
  657. package/lib/Agent/tool/parameter.d.ts +0 -12
  658. package/lib/Agent/tool/parameter.d.ts.map +0 -1
  659. package/lib/Agent/tool/parameter.js +0 -6
  660. package/lib/Agent/tool/parameter.js.map +0 -1
  661. package/lib/Agent/tool/result.d.ts +0 -17
  662. package/lib/Agent/tool/result.d.ts.map +0 -1
  663. package/lib/Agent/tool/result.js +0 -6
  664. package/lib/Agent/tool/result.js.map +0 -1
  665. package/lib/Agent/tool/tool.d.ts +0 -32
  666. package/lib/Agent/tool/tool.d.ts.map +0 -1
  667. package/lib/Agent/tool/tool.js +0 -16
  668. package/lib/Agent/tool/tool.js.map +0 -1
  669. package/lib/Agent/util/command-validator.d.ts +0 -12
  670. package/lib/Agent/util/command-validator.d.ts.map +0 -1
  671. package/lib/Agent/util/command-validator.js +0 -74
  672. package/lib/Agent/util/command-validator.js.map +0 -1
  673. package/lib/Agent/util/exec.d.ts.map +0 -1
  674. package/lib/Agent/util/exec.js.map +0 -1
  675. package/lib/Agent/util/parser.d.ts +0 -5
  676. package/lib/Agent/util/parser.d.ts.map +0 -1
  677. package/lib/Agent/util/parser.js +0 -41
  678. package/lib/Agent/util/parser.js.map +0 -1
  679. package/lib/Agent/util/replace.d.ts +0 -38
  680. package/lib/Agent/util/replace.d.ts.map +0 -1
  681. package/lib/Agent/util/replace.js +0 -458
  682. package/lib/Agent/util/replace.js.map +0 -1
  683. package/lib/Agent/util/ripgrep.d.ts +0 -109
  684. package/lib/Agent/util/ripgrep.d.ts.map +0 -1
  685. package/lib/Agent/util/ripgrep.js +0 -221
  686. package/lib/Agent/util/ripgrep.js.map +0 -1
  687. package/lib/Neon/api.d.ts +0 -258
  688. package/lib/Neon/api.d.ts.map +0 -1
  689. package/lib/Neon/api.js +0 -215
  690. package/lib/Neon/api.js.map +0 -1
  691. package/src/Agent/Agent.ts +0 -26
  692. package/src/Agent/Aspect.ts +0 -173
  693. package/src/Agent/AspectGraph.ts +0 -98
  694. package/src/Agent/ContextPlugin.ts +0 -18
  695. package/src/Agent/Plugin.ts +0 -29
  696. package/src/Agent/chat/channel.ts +0 -26
  697. package/src/Agent/chat/event.ts +0 -43
  698. package/src/Agent/chat/message.ts +0 -35
  699. package/src/Agent/chat/service.ts +0 -133
  700. package/src/Agent/chat/thread.ts +0 -17
  701. package/src/Agent/coding/bash.ts +0 -197
  702. package/src/Agent/coding/edit.ts +0 -152
  703. package/src/Agent/coding/glob.ts +0 -96
  704. package/src/Agent/coding/grep.ts +0 -143
  705. package/src/Agent/coding/index.ts +0 -7
  706. package/src/Agent/coding/read.ts +0 -119
  707. package/src/Agent/coding/readlints.ts +0 -78
  708. package/src/Agent/coding/write.ts +0 -79
  709. package/src/Agent/fs/file.ts +0 -22
  710. package/src/Agent/fs/folder.ts +0 -16
  711. package/src/Agent/index.ts +0 -9
  712. package/src/Agent/llm/error.ts +0 -330
  713. package/src/Agent/llm/index.ts +0 -4
  714. package/src/Agent/llm/llm.ts +0 -131
  715. package/src/Agent/llm/stream-collectors.ts +0 -58
  716. package/src/Agent/llm/stream-text-part.ts +0 -7
  717. package/src/Agent/lsp/client.ts +0 -293
  718. package/src/Agent/lsp/diagnostics.ts +0 -64
  719. package/src/Agent/lsp/jsonrpc.ts +0 -317
  720. package/src/Agent/lsp/manager.ts +0 -213
  721. package/src/Agent/lsp/servers.ts +0 -37
  722. package/src/Agent/process/driver.ts +0 -168
  723. package/src/Agent/process/issue-service.ts +0 -48
  724. package/src/Agent/process/issue-tools.ts +0 -33
  725. package/src/Agent/process/issue.ts +0 -22
  726. package/src/Agent/process/organization.ts +0 -16
  727. package/src/Agent/process/process.ts +0 -16
  728. package/src/Agent/process/reply.ts +0 -21
  729. package/src/Agent/process/task.ts +0 -34
  730. package/src/Agent/tool/index.ts +0 -3
  731. package/src/Agent/tool/parameter.ts +0 -35
  732. package/src/Agent/tool/result.ts +0 -51
  733. package/src/Agent/tool/tool.ts +0 -74
  734. package/src/Agent/util/command-validator.ts +0 -98
  735. package/src/Agent/util/parser.ts +0 -39
  736. package/src/Agent/util/replace.ts +0 -559
  737. package/src/Agent/util/ripgrep.ts +0 -256
  738. package/src/Neon/api.ts +0 -579
  739. /package/lib/{Agent/util → Util}/exec.d.ts +0 -0
  740. /package/lib/{Agent/util → Util}/exec.js +0 -0
  741. /package/src/{Agent/util → Util}/exec.ts +0 -0
package/bin/exec.js CHANGED
@@ -1,4 +1,3 @@
1
- import { createRequire } from "node:module";
2
1
  import * as ConfigProvider from "effect/ConfigProvider";
3
2
  import * as Effect from "effect/Effect";
4
3
  import * as Layer from "effect/Layer";
@@ -12,6 +11,8 @@ import * as Redacted from "effect/Redacted";
12
11
  import path from "pathe";
13
12
  import * as Config from "effect/Config";
14
13
  import os from "node:os";
14
+ import * as dns from "node:dns";
15
+ import * as undici from "undici";
15
16
  import * as Console from "effect/Console";
16
17
  import * as Logger from "effect/Logger";
17
18
  import * as Option from "effect/Option";
@@ -23,9 +24,11 @@ import * as Deferred from "effect/Deferred";
23
24
  import { pipe } from "effect/Function";
24
25
  import { SingleShotGen } from "effect/Utils";
25
26
  import { pipeArguments } from "effect/Pipeable";
27
+ import "effect/Scope";
26
28
  import * as Duration from "effect/Duration";
27
29
  import * as Exit from "effect/Exit";
28
30
  import * as Metric from "effect/Metric";
31
+ import { createHash } from "node:crypto";
29
32
  import * as Argument from "effect/unstable/cli/Argument";
30
33
  import * as CliError from "effect/unstable/cli/CliError";
31
34
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -152,22 +155,16 @@ const isLocalhost = (hostname) => hostname === "localhost" || hostname === "[::1
152
155
  const installLocalhostDns = () => {
153
156
  if (installed) return;
154
157
  installed = true;
155
- if (typeof globalThis.Bun !== "undefined") return;
156
- try {
157
- const require = createRequire(import.meta.url);
158
- const undici = require("undici");
159
- const dns = require("node:dns");
160
- undici.setGlobalDispatcher(new undici.Agent({ connect: { lookup: (hostname, options, cb) => {
161
- if (isLocalhost(hostname)) {
162
- if (options && options.all) return cb(null, [{
163
- address: "127.0.0.1",
164
- family: 4
165
- }]);
166
- return cb(null, "127.0.0.1", 4);
167
- }
168
- return dns.lookup(hostname, options, cb);
169
- } } }));
170
- } catch {}
158
+ undici.setGlobalDispatcher(new undici.Agent({ connect: { lookup: (hostname, options, cb) => {
159
+ if (isLocalhost(hostname)) {
160
+ if (options && options.all) return cb(null, [{
161
+ address: "127.0.0.1",
162
+ family: 4
163
+ }]);
164
+ return cb(null, "127.0.0.1", 4);
165
+ }
166
+ return dns.lookup(hostname, options, cb);
167
+ } } }));
171
168
  };
172
169
 
173
170
  //#endregion
@@ -358,18 +355,7 @@ var Cli = class extends EffectContext.Service()("CLI") {};
358
355
  //#region lib/Ref.js
359
356
  const RefMetadata = Symbol.for("alchemy/RefMetadata");
360
357
  const isRef = (s) => s && s[RefMetadata] !== void 0;
361
- const getRefMetadata = (ref$1) => ref$1[RefMetadata];
362
- const ref = ({ stack, id, stage: stage$1 }) => {
363
- const ref$1 = new Proxy({}, { get: (_, prop) => {
364
- if (prop === RefMetadata) return {
365
- stack,
366
- stage: stage$1,
367
- id
368
- };
369
- return of(ref$1)[prop];
370
- } });
371
- return ref$1;
372
- };
358
+ const getRefMetadata = (ref) => ref[RefMetadata];
373
359
 
374
360
  //#endregion
375
361
  //#region lib/FQN.js
@@ -479,11 +465,22 @@ const loadConfigProvider = (envFile$1) => {
479
465
 
480
466
  //#endregion
481
467
  //#region lib/Util/effect.js
468
+ const effectClass = ((impl) => impl === void 0 ? (innerImpl) => effectClass(innerImpl) : Object.assign(class {
469
+ static asEffect() {
470
+ return impl;
471
+ }
472
+ static [Symbol.iterator]() {
473
+ return new SingleShotGen(this.asEffect());
474
+ }
475
+ static pipe(...fns) {
476
+ return pipeArguments(this, fns);
477
+ }
478
+ }, impl));
482
479
  const taggedFunction = (tag$1, fn) => {
483
480
  const overrides = {
484
- asEffect: () => tag$1.asEffect(),
481
+ asEffect: () => tag$1,
485
482
  [Symbol.iterator]: () => tag$1[Symbol.iterator](),
486
- pipe: (...fns) => pipeArguments(tag$1.asEffect(), fns),
483
+ pipe: (...fns) => pipeArguments(tag$1, fns),
487
484
  toString: () => `${tag$1.toString()}.${fn.name}`
488
485
  };
489
486
  return new Proxy(fn, {
@@ -505,34 +502,38 @@ const fileLogger = Effect.fnUntraced(function* (...segments) {
505
502
 
506
503
  //#endregion
507
504
  //#region lib/Stack.js
508
- const Stack = Object.assign(taggedFunction(EffectContext.Service()("Stack"), (stackName, options, eff) => eff.pipe(make$1({
509
- name: stackName,
510
- ...options
511
- }), (eff$1) => Object.assign(eff$1, { stage: new Proxy({}, { get: (_, stage$1) => ref({
512
- stack: stackName,
513
- stage: stage$1,
514
- id: stackName
515
- }) }) }))));
505
+ const Stack = Object.assign(taggedFunction(EffectContext.Service()("Stack"), (stackName, options, eff) => {
506
+ if (!stackName) return (stackName$1) => Object.assign(stackRef(stackName$1).pipe(effectClass), {
507
+ stage: createStageProxy(stackName$1),
508
+ make: (options$1, eff$1) => Stack(stackName$1, options$1, eff$1)
509
+ });
510
+ return eff.pipe(make$1({
511
+ name: stackName,
512
+ ...options
513
+ }), (eff$1) => Object.assign(eff$1, { stage: createStageProxy(stackName) }));
514
+ }));
515
+ const createStageProxy = (stackName) => new Proxy({}, { get: (_, stage$1) => stackRef(stackName, { stage: stage$1 }) });
516
516
  const StackName = Stack.use((stack) => Effect.succeed(stack.name));
517
517
  const make$1 = (options) => (effect) => Effect.scope.pipe(Effect.flatMap((scope) => {
518
518
  if (options.state == null) return Effect.die(/* @__PURE__ */ new Error(`Stack "${options.name}" is missing a state store. Add a \`state\` layer to the stack options, e.g.:\n Alchemy.Stack("${options.name}", {\n providers: Cloudflare.providers(),\n state: Cloudflare.state(), // <-- required\n }, ...)\nSee https://v2.alchemy.run/concepts/state-store for available state stores.`));
519
519
  if (options.providers == null) return Effect.die(/* @__PURE__ */ new Error(`Stack "${options.name}" is missing a providers layer. Add a \`providers\` layer to the stack options, e.g.:\n Alchemy.Stack("${options.name}", {\n providers: Cloudflare.providers(), // <-- required\n state: Cloudflare.state(),\n }, ...)`));
520
- return options.providers.pipe(Layer.provideMerge(options.state), Layer.provideMerge(Layer.effect(Stack, Stage.asEffect().pipe(Effect.map((stage$1) => options.stack ?? {
520
+ return options.providers.pipe(Layer.provideMerge(options.state), Layer.provideMerge(Layer.effect(Stack, Stage.pipe(Effect.map((stage$1) => options.stack ?? {
521
521
  name: options.name,
522
522
  stage: stage$1,
523
523
  resources: {},
524
- bindings: {}
524
+ bindings: {},
525
+ actions: {}
525
526
  })))), Layer.buildWithScope(scope));
526
527
  }), Effect.flatMap((context) => Effect.all([
527
528
  effect,
528
- Stack.asEffect(),
529
+ Stack,
529
530
  Effect.context()
530
531
  ]).pipe(Effect.map(([output, stack, services$1]) => ({
531
532
  ...stack,
532
533
  output,
533
534
  services: EffectContext.merge(services$1, context)
534
535
  })), Effect.provideContext(context))));
535
- const CurrentStack = Effect.serviceOption(Stack).asEffect().pipe(Effect.map(Option.getOrUndefined));
536
+ const CurrentStack = Effect.serviceOption(Stack).pipe(Effect.map(Option.getOrUndefined));
536
537
  const platform = Layer.mergeAll(PlatformServices, FetchHttpClient.layer, Logger.layer([fileLogger("out")], { mergeWithExisting: true }), Layer.provide(ProfileLive, PlatformServices), Layer.provide(CredentialsStoreLive, PlatformServices));
537
538
 
538
539
  //#endregion
@@ -553,6 +554,7 @@ const CurrentRuntimeContext = Effect.serviceOption(RuntimeContext).pipe(Effect.m
553
554
 
554
555
  //#endregion
555
556
  //#region lib/State/State.js
557
+ const isActionState = (s) => !!s && s.kind === "action";
556
558
  var State = class extends EffectContext.Service()("alchemy/State") {};
557
559
 
558
560
  //#endregion
@@ -578,13 +580,13 @@ var BaseExpr = class {
578
580
  return this;
579
581
  }
580
582
  [Symbol.iterator]() {
581
- return new SingleShotGen(this);
583
+ return new SingleShotGen(this.asEffect());
582
584
  }
583
585
  asEffect() {
584
586
  return this.bind(this.toString());
585
587
  }
586
588
  bind(id) {
587
- return RuntimeContext.asEffect().pipe(Effect.flatMap((ctx) => Effect.map(ctx.set(id, this), (key) => ctx.get(key))));
589
+ return RuntimeContext.pipe(Effect.flatMap((ctx) => Effect.map(ctx.set(id, this), (key) => ctx.get(key))));
588
590
  }
589
591
  pipe(...fns) {
590
592
  return pipe(this, ...fns);
@@ -667,6 +669,28 @@ var EffectExpr = class extends BaseExpr {
667
669
  return `${this.expr[inspect]()}.mapEffect(${this.f.toString()})`;
668
670
  }
669
671
  };
672
+ const isNamedExpr = (node) => node?.kind === "NamedExpr";
673
+ /**
674
+ * Wraps another `Expr` and overrides its `toString()` / inspect output.
675
+ *
676
+ * `BaseExpr` derives the binding id from `this.toString()`, so
677
+ * wrapping an expression in `NamedExpr` makes that derived id stable and
678
+ * caller-controlled (e.g. an env var name like `"API_KEY"`).
679
+ */
680
+ var NamedExpr = class extends BaseExpr {
681
+ expr;
682
+ bindingName;
683
+ kind = "NamedExpr";
684
+ constructor(expr, bindingName) {
685
+ super();
686
+ this.expr = expr;
687
+ this.bindingName = bindingName;
688
+ return proxy(this);
689
+ }
690
+ [inspect]() {
691
+ return this.bindingName;
692
+ }
693
+ };
670
694
  const isAllExpr = (node) => node?.kind === "AllExpr";
671
695
  var AllExpr = class extends BaseExpr {
672
696
  outs;
@@ -697,6 +721,39 @@ var RefExpr = class extends BaseExpr {
697
721
  return `ref(${this.resourceId}, { stack: ${this.stack}, stage: ${this.stage} })`;
698
722
  }
699
723
  };
724
+ const isStackRefExpr = (node) => node?.kind === "StackRefExpr";
725
+ /**
726
+ * A reference to the persisted output of a Stack at `(stack, stage)`.
727
+ *
728
+ * Resolved at evaluation time by reading `state.getOutput({ stack,
729
+ * stage })`. Distinct from {@link RefExpr}, which references a
730
+ * single resource's attributes within a stack/stage. `stage` may be
731
+ * `undefined`, in which case it falls back to the current stage.
732
+ */
733
+ var StackRefExpr = class extends BaseExpr {
734
+ stack;
735
+ stage;
736
+ kind = "StackRefExpr";
737
+ constructor(stack, stage$1) {
738
+ super();
739
+ this.stack = stack;
740
+ this.stage = stage$1;
741
+ return proxy(this);
742
+ }
743
+ [inspect]() {
744
+ return `stackRef(${this.stack}${this.stage ? `, { stage: ${this.stage} }` : ""})`;
745
+ }
746
+ };
747
+ /**
748
+ * Build an `Output<A>` referencing the persisted output of another
749
+ * Stack. The returned Effect resolves to a lazy `Output<A>` whose
750
+ * value is read from the state store at plan/apply time.
751
+ *
752
+ * Returns `Effect<Output<A>>` (not `Output<A>` directly) so that
753
+ * `yield* Output.stackRef(...)` reads ergonomically inside an Effect
754
+ * generator and lines up with `Resource.ref` and `Stack.stage.<name>`.
755
+ */
756
+ const stackRef = (stack, options = {}) => Effect.succeed(new StackRefExpr(stack, options.stage));
700
757
  function proxy(self) {
701
758
  const target = Object.assign(() => {}, self);
702
759
  if (inspect in self) Object.defineProperty(target, inspect, {
@@ -705,7 +762,9 @@ function proxy(self) {
705
762
  });
706
763
  const proxy$1 = new Proxy(target, {
707
764
  has: (_, prop) => prop === ExprSymbol || prop === inspect ? true : prop in self,
708
- get: (target$1, prop) => prop === Symbol.toPrimitive ? (hint) => hint === "number" ? NaN : self.toString() : prop === ExprSymbol ? self : prop === inspect ? target$1[inspect] : isResourceExpr(self) && self.stables && prop in self.stables ? self.stables[prop] : prop === "apply" ? self[prop] : prop in self ? typeof self[prop] === "function" && !("kind" in self) ? new PropExpr(proxy$1, prop) : self[prop] : new PropExpr(proxy$1, prop),
765
+ get: (target$1, prop) => prop === Symbol.toPrimitive ? (hint) => {
766
+ throw new Error(`Cannot coerce Output<${self[inspect]()}> to a ${hint === "number" ? "number" : "string"} via JS coercion. Use Output.interpolate\`...\` or Output.map(output, fn) to compose Outputs — the value isn't known until deploy time.`);
767
+ } : prop === ExprSymbol ? self : prop === inspect ? target$1[inspect] : isResourceExpr(self) && self.stables && prop in self.stables ? self.stables[prop] : prop === "apply" ? self[prop] : prop in self ? typeof self[prop] === "function" && !("kind" in self) ? new PropExpr(proxy$1, prop) : self[prop] : new PropExpr(proxy$1, prop),
709
768
  apply: (_, thisArg, args) => {
710
769
  if (isPropExpr(self)) {
711
770
  if (self.identifier === "apply") return new ApplyExpr(self.expr, args[0]);
@@ -740,6 +799,7 @@ const evaluate = (expr, upstream$1) => Effect.gen(function* () {
740
799
  else if (isEffectExpr(expr)) return yield* expr.f(yield* evaluate(expr.expr, upstream$1));
741
800
  else if (isAllExpr(expr)) return yield* Effect.all(expr.outs.map((out) => evaluate(out, upstream$1)));
742
801
  else if (isPropExpr(expr)) return (yield* evaluate(expr.expr, upstream$1))?.[expr.identifier];
802
+ else if (isNamedExpr(expr)) return yield* evaluate(expr.expr, upstream$1);
743
803
  else if (isRefExpr(expr)) {
744
804
  const state = yield* State;
745
805
  const stack = expr.stack ?? (yield* Stack).name;
@@ -755,7 +815,22 @@ const evaluate = (expr, upstream$1) => Effect.gen(function* () {
755
815
  stage: stage$1,
756
816
  resourceId: expr.resourceId
757
817
  }));
758
- return resource.attr;
818
+ return resource.attr ?? resource.output;
819
+ } else if (isStackRefExpr(expr)) {
820
+ const state = yield* State;
821
+ const stack = expr.stack;
822
+ const stage$1 = expr.stage ?? (yield* Stage);
823
+ const output = yield* state.getOutput({
824
+ stack,
825
+ stage: stage$1
826
+ });
827
+ if (output == null) return yield* Effect.fail(new InvalidReferenceError({
828
+ message: `Reference to stack '${stack}' at stage '${stage$1}' not found. Have you deployed stage '${stage$1}' of '${stack}'?`,
829
+ stack,
830
+ stage: stage$1,
831
+ resourceId: stack
832
+ }));
833
+ return output;
759
834
  }
760
835
  }
761
836
  if (Array.isArray(expr)) return yield* Effect.all(expr.map((item) => evaluate(item, upstream$1)));
@@ -776,7 +851,7 @@ const upstream = (expr) => {
776
851
  else if (isResourceExpr(expr)) return { [expr.src.FQN]: expr.src };
777
852
  else if (isPropExpr(expr)) return upstream(expr.expr);
778
853
  else if (isAllExpr(expr)) return Object.assign({}, ...expr.outs.map((out) => upstream(out)));
779
- else if (isEffectExpr(expr) || isApplyExpr(expr)) return upstream(expr.expr);
854
+ else if (isEffectExpr(expr) || isApplyExpr(expr) || isNamedExpr(expr)) return upstream(expr.expr);
780
855
  else if (Array.isArray(expr)) return expr.map(upstream).reduce(toObject, {});
781
856
  else if (typeof expr === "object" && expr !== null) return Object.values(expr).map((v) => upstream(v)).reduce(toObject, {});
782
857
  return {};
@@ -922,6 +997,19 @@ const recordOutcome = (baseAttrs, status, duration) => {
922
997
  return Effect.all([Metric.update(Metric.withAttributes(resourceCounter, attrs), 1), Metric.update(Metric.withAttributes(resourceDuration, attrs), duration)], { discard: true });
923
998
  };
924
999
 
1000
+ //#endregion
1001
+ //#region lib/Action.js
1002
+ const isAction = (value) => typeof value === "object" && value !== null && value?.Kind === "action";
1003
+
1004
+ //#endregion
1005
+ //#region lib/Util/hash.js
1006
+ /**
1007
+ * Stable hash of a resolved Task input. Wrapped in `Effect.sync` so the
1008
+ * call participates in the Effect runtime (tracing/interruption) per the
1009
+ * Effect-platform conventions.
1010
+ */
1011
+ const hashInput = (input) => Effect.sync(() => createHash("sha256").update(JSON.stringify(input ?? null)).digest("hex"));
1012
+
925
1013
  //#endregion
926
1014
  //#region lib/Util/scc.js
927
1015
  /**
@@ -1000,6 +1088,7 @@ const findCycleMembers = (edges) => {
1000
1088
  const make = (stack, options = {}) => Effect.gen(function* () {
1001
1089
  const state = yield* State;
1002
1090
  const resources = Object.values(stack.resources);
1091
+ const actions = Object.values(stack.actions ?? {});
1003
1092
  const stackName = stack.name;
1004
1093
  const stage$1 = stack.stage;
1005
1094
  const shouldAdopt = Effect.gen(function* () {
@@ -1022,15 +1111,17 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1022
1111
  })), { concurrency: "unbounded" });
1023
1112
  const resolvedResources = {};
1024
1113
  const resolveResource = (resourceExpr) => Effect.gen(function* () {
1114
+ if (isAction(resourceExpr.src)) return resourceExpr;
1025
1115
  return yield* resolvedResources[resourceExpr.src.FQN] ??= yield* Effect.cached(Effect.gen(function* () {
1026
1116
  const resource = resourceExpr.src;
1027
1117
  const provider = yield* findProviderByType(resource.Type);
1028
1118
  const props = yield* resolveInput(resource.Props);
1029
- const oldState = yield* state.get({
1119
+ const persisted = yield* state.get({
1030
1120
  stack: stackName,
1031
1121
  stage: stage$1,
1032
1122
  fqn: resource.FQN
1033
1123
  });
1124
+ const oldState = isActionState(persisted) ? void 0 : persisted;
1034
1125
  if (!oldState || oldState.status === "creating") return resourceExpr;
1035
1126
  const oldProps = oldState.status === "updating" ? oldState.old.props : oldState.props;
1036
1127
  const oldBindings = oldState.bindings ?? [];
@@ -1074,23 +1165,76 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1074
1165
  return hasOutputs(upstream$1) ? expr : yield* expr.f(upstream$1);
1075
1166
  } else if (isAllExpr(expr)) return yield* Effect.all(expr.outs.map(resolveOutput), { concurrency: "unbounded" });
1076
1167
  else if (isLiteralExpr(expr)) return expr.value;
1077
- return yield* Effect.die(/* @__PURE__ */ new Error("Not implemented yet"));
1168
+ else if (isRefExpr(expr)) {
1169
+ const refStack = expr.stack ?? stackName;
1170
+ const refStage = expr.stage ?? stage$1;
1171
+ const refState = yield* state.get({
1172
+ stack: refStack,
1173
+ stage: refStage,
1174
+ fqn: expr.resourceId
1175
+ }).pipe(Effect.orDie);
1176
+ if (!refState) return yield* Effect.die(new InvalidReferenceError({
1177
+ message: `Reference to '${expr.resourceId}' in stack '${refStack}' and stage '${refStage}' not found. Have you deployed '${refStage}' of '${refStack}'?`,
1178
+ stack: refStack,
1179
+ stage: refStage,
1180
+ resourceId: expr.resourceId
1181
+ }));
1182
+ return refState.attr ?? refState.output;
1183
+ } else if (isStackRefExpr(expr)) {
1184
+ const refStack = expr.stack;
1185
+ const refStage = expr.stage ?? stage$1;
1186
+ const output = yield* state.getOutput({
1187
+ stack: refStack,
1188
+ stage: refStage
1189
+ }).pipe(Effect.orDie);
1190
+ if (output == null) return yield* Effect.die(new InvalidReferenceError({
1191
+ message: `Reference to stack '${refStack}' at stage '${refStage}' not found. Have you deployed stage '${refStage}' of '${refStack}'?`,
1192
+ stack: refStack,
1193
+ stage: refStage,
1194
+ resourceId: refStack
1195
+ }));
1196
+ return output;
1197
+ } else if (isNamedExpr(expr)) return yield* resolveOutput(expr.expr);
1198
+ return yield* Effect.die(/* @__PURE__ */ new Error("Not implemented yet" + expr.kind));
1078
1199
  });
1079
1200
  const oldDownstreamDependencies = Object.fromEntries(oldResources.filter((resource) => !!resource).map((resource) => [resource.fqn, resource.downstream]));
1080
1201
  const newResourceFqns = new Set(resources.map((r) => r.FQN));
1081
- const newUpstreamDependencies = Object.fromEntries(resources.map((resource) => [resource.FQN, Object.values(upstreamAny(resource.Props)).map((r) => r.FQN)]));
1202
+ const newActionFqns = new Set(actions.map((t) => t.FQN));
1203
+ const newNodeFqns = new Set([...newResourceFqns, ...newActionFqns]);
1204
+ const newUpstreamDependencies = Object.fromEntries([...resources.map((resource) => [resource.FQN, Object.values(upstreamAny(resource.Props)).map((r) => r.FQN)]), ...actions.map((action) => [action.FQN, Object.values(upstreamAny(action.Input)).map((r) => r.FQN)])]);
1082
1205
  const bindingUpstreamDependencies = Object.fromEntries(resources.map((resource) => [resource.FQN, Object.values(upstreamAny(stack.bindings[resource.FQN] ?? [])).map((r) => r.FQN)]));
1083
- const rawUpstreamDependencies = Object.fromEntries(resources.map((resource) => {
1206
+ const rawUpstreamDependencies = Object.fromEntries([...resources.map((resource) => {
1084
1207
  const fqn = resource.FQN;
1085
1208
  const propDeps = newUpstreamDependencies[fqn] ?? [];
1086
1209
  const bindDeps = bindingUpstreamDependencies[fqn] ?? [];
1087
1210
  return [fqn, [...new Set([...propDeps, ...bindDeps])]];
1088
- }));
1089
- const allUpstreamDependencies = Object.fromEntries(resources.map((resource) => {
1211
+ }), ...actions.map((action) => {
1212
+ const fqn = action.FQN;
1213
+ return [fqn, newUpstreamDependencies[fqn] ?? []];
1214
+ })]);
1215
+ const allUpstreamDependencies = Object.fromEntries([...resources.map((resource) => {
1090
1216
  const fqn = resource.FQN;
1091
- return [fqn, (rawUpstreamDependencies[fqn] ?? []).filter((dep) => newResourceFqns.has(dep))];
1092
- }));
1093
- const newDownstreamDependencies = Object.fromEntries(resources.map((resource) => [resource.FQN, Object.entries(newUpstreamDependencies).filter(([_, upstream$1]) => upstream$1.includes(resource.FQN)).map(([depFqn]) => depFqn)]));
1217
+ return [fqn, (rawUpstreamDependencies[fqn] ?? []).filter((dep) => newNodeFqns.has(dep))];
1218
+ }), ...actions.map((action) => {
1219
+ const fqn = action.FQN;
1220
+ return [fqn, (newUpstreamDependencies[fqn] ?? []).filter((dep) => newNodeFqns.has(dep))];
1221
+ })]);
1222
+ const combinedCycleMembers = findCycleMembers(allUpstreamDependencies);
1223
+ const computeDownstream = (upFqn) => {
1224
+ const downstream = [];
1225
+ for (const [downFqn, upstreams] of Object.entries(rawUpstreamDependencies)) {
1226
+ if (downFqn === upFqn) continue;
1227
+ if (!upstreams.includes(upFqn)) continue;
1228
+ if ((newUpstreamDependencies[downFqn] ?? []).includes(upFqn)) {
1229
+ downstream.push(downFqn);
1230
+ continue;
1231
+ }
1232
+ if (combinedCycleMembers.has(upFqn) && combinedCycleMembers.has(downFqn)) continue;
1233
+ downstream.push(downFqn);
1234
+ }
1235
+ return downstream;
1236
+ };
1237
+ const newDownstreamDependencies = Object.fromEntries([...resources.map((resource) => [resource.FQN, computeDownstream(resource.FQN)]), ...actions.map((action) => [action.FQN, computeDownstream(action.FQN)])]);
1094
1238
  const resourceGraph = Object.fromEntries((yield* Effect.all(resources.map(Effect.fn("plan.diff.resource")(function* (resource) {
1095
1239
  const provider = yield* findProviderByType(resource.Type);
1096
1240
  const id = resource.LogicalId;
@@ -1098,11 +1242,12 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1098
1242
  const news = yield* resolveInput(resource.Props);
1099
1243
  const downstream = newDownstreamDependencies[fqn] ?? [];
1100
1244
  const newBindings = yield* resolveInput(stack.bindings[fqn] ?? []);
1101
- let oldState = yield* state.get({
1245
+ const persisted = yield* state.get({
1102
1246
  stack: stackName,
1103
1247
  stage: stage$1,
1104
1248
  fqn
1105
1249
  });
1250
+ let oldState = isActionState(persisted) ? void 0 : persisted;
1106
1251
  let forceUpdateAfterAdoption = false;
1107
1252
  if (oldState === void 0 && provider.read && isResolved(news)) {
1108
1253
  const adoptInstanceId = yield* generateInstanceId();
@@ -1273,7 +1418,43 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1273
1418
  state: oldState
1274
1419
  });
1275
1420
  })), { concurrency: "unbounded" })).map((update) => [update.resource.FQN, update]));
1276
- const cycleMembers = findCycleMembers(allUpstreamDependencies);
1421
+ const actionGraph = Object.fromEntries(yield* Effect.all(actions.map(Effect.fn("plan.diff.action")(function* (action) {
1422
+ const fqn = action.FQN;
1423
+ const downstream = newDownstreamDependencies[fqn] ?? [];
1424
+ const inputHash = yield* hashInput(yield* resolveInput(action.Input));
1425
+ const oldState = yield* state.get({
1426
+ stack: stackName,
1427
+ stage: stage$1,
1428
+ fqn
1429
+ });
1430
+ if (oldState && !isActionState(oldState)) return [fqn, {
1431
+ kind: "action",
1432
+ action: "run",
1433
+ def: action,
1434
+ input: action.Input,
1435
+ state: void 0,
1436
+ downstream,
1437
+ forced: false
1438
+ }];
1439
+ const prior = oldState;
1440
+ if (prior?.status === "ran" && prior.inputHash === inputHash && !options.force) return [fqn, {
1441
+ kind: "action",
1442
+ action: "noop",
1443
+ def: action,
1444
+ state: prior,
1445
+ downstream
1446
+ }];
1447
+ return [fqn, {
1448
+ kind: "action",
1449
+ action: "run",
1450
+ def: action,
1451
+ input: action.Input,
1452
+ state: prior,
1453
+ downstream,
1454
+ forced: !!options.force
1455
+ }];
1456
+ })), { concurrency: "unbounded" }));
1457
+ const cycleMembers = combinedCycleMembers;
1277
1458
  {
1278
1459
  const createReplaceNodes = new Set(Object.entries(resourceGraph).filter(([_, node]) => node.action === "create" || node.action === "replace").map(([fqn]) => fqn));
1279
1460
  if (createReplaceNodes.size > 0) {
@@ -1301,16 +1482,47 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1301
1482
  }
1302
1483
  }
1303
1484
  }
1485
+ const actionDeletions = Object.fromEntries((yield* Effect.all((yield* state.list({
1486
+ stack: stackName,
1487
+ stage: stage$1
1488
+ })).map(Effect.fn("plan.diff.actionDeletion")(function* (fqn) {
1489
+ if (newActionFqns.has(fqn) || newResourceFqns.has(fqn)) return;
1490
+ const persisted = yield* state.get({
1491
+ stack: stackName,
1492
+ stage: stage$1,
1493
+ fqn
1494
+ });
1495
+ if (!isActionState(persisted)) return;
1496
+ const { logicalId } = parseFqn(fqn);
1497
+ return [fqn, {
1498
+ kind: "action",
1499
+ action: "delete",
1500
+ state: persisted,
1501
+ downstream: persisted.downstream ?? [],
1502
+ def: {
1503
+ Kind: "action",
1504
+ Namespace: persisted.namespace,
1505
+ FQN: fqn,
1506
+ LogicalId: logicalId,
1507
+ Type: persisted.actionType,
1508
+ Input: persisted.input,
1509
+ Run: () => void 0,
1510
+ Output: void 0
1511
+ }
1512
+ }];
1513
+ })), { concurrency: "unbounded" })).filter((v) => !!v));
1304
1514
  const deletions = Object.fromEntries((yield* Effect.all((yield* state.list({
1305
1515
  stack: stackName,
1306
1516
  stage: stage$1
1307
1517
  })).map(Effect.fn("plan.diff.deletion")(function* (fqn) {
1308
- if (newResourceFqns.has(fqn)) return;
1309
- const oldState = yield* state.get({
1518
+ if (newResourceFqns.has(fqn) || newActionFqns.has(fqn)) return;
1519
+ const persisted = yield* state.get({
1310
1520
  stack: stackName,
1311
1521
  stage: stage$1,
1312
1522
  fqn
1313
1523
  });
1524
+ if (isActionState(persisted)) return;
1525
+ const oldState = persisted;
1314
1526
  let attr = oldState?.attr;
1315
1527
  if (oldState) {
1316
1528
  const { logicalId } = parseFqn(fqn);
@@ -1363,7 +1575,9 @@ const make = (stack, options = {}) => Effect.gen(function* () {
1363
1575
  }
1364
1576
  return {
1365
1577
  resources: resourceGraph,
1578
+ actions: actionGraph,
1366
1579
  deletions,
1580
+ actionDeletions,
1367
1581
  output: stack.output,
1368
1582
  cycleMembers
1369
1583
  };
@@ -1417,20 +1631,32 @@ const apply = (plan) => Effect.gen(function* () {
1417
1631
  yield* session.done();
1418
1632
  if (!plan.output) return;
1419
1633
  const outputs = Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));
1420
- return yield* evaluate(plan.output, outputs);
1634
+ const resolved = yield* evaluate(plan.output, outputs);
1635
+ yield* state.setOutput({
1636
+ stack: stackName,
1637
+ stage: stage$1,
1638
+ value: resolved
1639
+ });
1640
+ return resolved;
1421
1641
  }).pipe(ensureArtifactStore, Effect.withSpan("apply", { attributes: {
1422
1642
  "alchemy.resources.count": Object.keys(plan.resources).length,
1423
1643
  "alchemy.deletions.count": Object.keys(plan.deletions).length
1424
1644
  } }));
1425
1645
  const executePlan = Effect.fnUntraced(function* (plan, tracker, terminalStatuses, session, state, stackName, stage$1) {
1426
- const ready = Object.fromEntries(yield* Effect.all(Object.keys(plan.resources).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));
1646
+ const allNodes = {
1647
+ ...plan.resources,
1648
+ ...plan.actions
1649
+ };
1650
+ const ready = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));
1651
+ const readyStable = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));
1427
1652
  const getOutputs = () => Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));
1428
1653
  const waitForDeps = (fqns) => Effect.all(fqns.filter((fqn) => fqn in ready).map((fqn) => Deferred.await(ready[fqn])), { concurrency: "unbounded" });
1654
+ const waitForStableDeps = (fqns) => Effect.all(fqns.filter((fqn) => fqn in readyStable).map((fqn) => Deferred.await(readyStable[fqn])), { concurrency: "unbounded" });
1429
1655
  const failures = [];
1430
- yield* Effect.all(Object.entries(plan.resources).map(([fqn, node]) => executeNode(fqn, node, tracker, ready, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForDeps, failures, plan.cycleMembers.has(fqn))), { concurrency: "unbounded" });
1656
+ yield* Effect.all(Object.entries(allNodes).map(([fqn, node]) => node.kind === "action" ? executeActionNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForStableDeps, failures) : executeNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForDeps, failures, plan.cycleMembers.has(fqn))), { concurrency: "unbounded" });
1431
1657
  if (failures.length > 0) yield* Effect.failCause(failures.map((f) => f.cause).reduce(Cause.combine));
1432
1658
  });
1433
- const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForDeps, failures, inCycle) => Effect.gen(function* () {
1659
+ const executeNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForDeps, failures, inCycle) => Effect.gen(function* () {
1434
1660
  const logicalId = node.resource.LogicalId;
1435
1661
  const namespace = node.resource.Namespace;
1436
1662
  const commit = (value) => state.set({
@@ -1464,11 +1690,13 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1464
1690
  });
1465
1691
  });
1466
1692
  const signalReady = Deferred.succeed(ready[fqn], void 0);
1693
+ const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);
1467
1694
  const storeAndSignal = (t) => Effect.gen(function* () {
1468
1695
  tracker[fqn] = t;
1469
1696
  yield* signalReady;
1470
1697
  });
1471
1698
  if (node.action === "noop") {
1699
+ yield* signalReadyStable;
1472
1700
  yield* storeAndSignal({
1473
1701
  output: node.state.attr,
1474
1702
  props: node.state.props,
@@ -1604,6 +1832,7 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1604
1832
  instanceId
1605
1833
  };
1606
1834
  yield* signalReady;
1835
+ yield* signalReadyStable;
1607
1836
  yield* markTerminal("created");
1608
1837
  return;
1609
1838
  }
@@ -1672,6 +1901,7 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1672
1901
  instanceId
1673
1902
  };
1674
1903
  yield* signalReady;
1904
+ yield* signalReadyStable;
1675
1905
  yield* markTerminal("updated");
1676
1906
  return;
1677
1907
  }
@@ -1684,6 +1914,7 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1684
1914
  instanceId
1685
1915
  };
1686
1916
  yield* signalReady;
1917
+ yield* signalReadyStable;
1687
1918
  yield* markTerminal("created");
1688
1919
  return;
1689
1920
  }
@@ -1778,6 +2009,7 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1778
2009
  instanceId
1779
2010
  };
1780
2011
  yield* signalReady;
2012
+ yield* signalReadyStable;
1781
2013
  yield* markTerminal("created");
1782
2014
  return;
1783
2015
  }
@@ -1791,6 +2023,7 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1791
2023
  cause
1792
2024
  });
1793
2025
  yield* Deferred.failCause(ready[fqn], cause);
2026
+ yield* Deferred.failCause(readyStable[fqn], cause);
1794
2027
  yield* session.emit({
1795
2028
  kind: "status-change",
1796
2029
  id: node.resource.LogicalId,
@@ -1803,6 +2036,104 @@ const executeNode = (fqn, node, tracker, ready, terminalStatuses, session, state
1803
2036
  "alchemy.resource.logical_id": node.resource.LogicalId,
1804
2037
  "alchemy.resource.action": node.action
1805
2038
  } }));
2039
+ const executeActionNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage$1, getOutputs, waitForDeps, failures) => Effect.gen(function* () {
2040
+ const task = node.def;
2041
+ const logicalId = task.LogicalId;
2042
+ const namespace = task.Namespace;
2043
+ const commit = (value) => state.set({
2044
+ stack: stackName,
2045
+ stage: stage$1,
2046
+ fqn,
2047
+ value: {
2048
+ ...value,
2049
+ namespace
2050
+ }
2051
+ });
2052
+ const report = (status) => session.emit({
2053
+ kind: "status-change",
2054
+ id: logicalId,
2055
+ type: task.Type,
2056
+ status
2057
+ });
2058
+ const signalReady = Deferred.succeed(ready[fqn], void 0);
2059
+ const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);
2060
+ if (node.action === "noop") {
2061
+ tracker[fqn] = {
2062
+ output: node.state.output,
2063
+ props: { __input: node.state.input },
2064
+ bindings: [],
2065
+ instanceId: fqn
2066
+ };
2067
+ yield* signalReady;
2068
+ yield* signalReadyStable;
2069
+ terminalStatuses.set(fqn, {
2070
+ id: logicalId,
2071
+ type: task.Type,
2072
+ status: "skipped"
2073
+ });
2074
+ return;
2075
+ }
2076
+ yield* waitForDeps(Object.keys(resolveUpstream(node.input)).filter((f) => f in readyStable));
2077
+ const outputs = getOutputs();
2078
+ const resolvedInput = yield* evaluate(node.input, outputs);
2079
+ const inputHashValue = yield* hashInput(resolvedInput);
2080
+ yield* commit({
2081
+ kind: "action",
2082
+ status: "running",
2083
+ fqn,
2084
+ logicalId,
2085
+ actionType: task.Type,
2086
+ inputHash: inputHashValue,
2087
+ input: resolvedInput,
2088
+ downstream: node.downstream
2089
+ });
2090
+ yield* report("running");
2091
+ const result = yield* task.Run(resolvedInput);
2092
+ yield* commit({
2093
+ kind: "action",
2094
+ status: "ran",
2095
+ fqn,
2096
+ logicalId,
2097
+ actionType: task.Type,
2098
+ inputHash: inputHashValue,
2099
+ input: resolvedInput,
2100
+ output: result,
2101
+ downstream: node.downstream
2102
+ });
2103
+ tracker[fqn] = {
2104
+ output: result,
2105
+ props: { __input: resolvedInput },
2106
+ bindings: [],
2107
+ instanceId: fqn
2108
+ };
2109
+ yield* signalReady;
2110
+ yield* signalReadyStable;
2111
+ terminalStatuses.set(fqn, {
2112
+ id: logicalId,
2113
+ type: task.Type,
2114
+ status: "ran"
2115
+ });
2116
+ }).pipe(Effect.catchCause((cause) => Effect.gen(function* () {
2117
+ failures.push({
2118
+ fqn,
2119
+ logicalId: node.def.LogicalId,
2120
+ type: node.def.Type,
2121
+ cause
2122
+ });
2123
+ yield* Deferred.failCause(ready[fqn], cause);
2124
+ yield* Deferred.failCause(readyStable[fqn], cause);
2125
+ yield* session.emit({
2126
+ kind: "status-change",
2127
+ id: node.def.LogicalId,
2128
+ type: node.def.Type,
2129
+ status: "fail"
2130
+ });
2131
+ })), Effect.withSpan("apply.action", { attributes: {
2132
+ "alchemy.action.fqn": fqn,
2133
+ "alchemy.action.type": node.def.Type,
2134
+ "alchemy.action.logical_id": node.def.LogicalId,
2135
+ "alchemy.action.verb": node.action
2136
+ } }));
1806
2137
  const converge = Effect.fnUntraced(function* (plan, tracker, terminalStatuses, session, state, stackName, stage$1) {
1807
2138
  for (;;) {
1808
2139
  let anyUpdated = false;
@@ -1869,6 +2200,61 @@ const converge = Effect.fnUntraced(function* (plan, tracker, terminalStatuses, s
1869
2200
  status: "updated"
1870
2201
  });
1871
2202
  }
2203
+ for (const [fqn, node] of Object.entries(plan.actions)) {
2204
+ if (node.action !== "run") continue;
2205
+ if (!tracker[fqn]) continue;
2206
+ const outputs = Object.fromEntries(Object.entries(tracker).map(([k, t]) => [k, t.output]));
2207
+ const newInput = yield* evaluate(node.input, outputs);
2208
+ const newHash = yield* hashInput(newInput);
2209
+ const oldInput = tracker[fqn].props?.__input;
2210
+ if (newHash === (yield* hashInput(oldInput))) continue;
2211
+ anyUpdated = true;
2212
+ yield* state.set({
2213
+ stack: stackName,
2214
+ stage: stage$1,
2215
+ fqn,
2216
+ value: {
2217
+ kind: "action",
2218
+ status: "running",
2219
+ fqn,
2220
+ logicalId: node.def.LogicalId,
2221
+ namespace: node.def.Namespace,
2222
+ actionType: node.def.Type,
2223
+ inputHash: newHash,
2224
+ input: newInput,
2225
+ downstream: node.downstream
2226
+ }
2227
+ });
2228
+ const result = yield* node.def.Run(newInput);
2229
+ yield* state.set({
2230
+ stack: stackName,
2231
+ stage: stage$1,
2232
+ fqn,
2233
+ value: {
2234
+ kind: "action",
2235
+ status: "ran",
2236
+ fqn,
2237
+ logicalId: node.def.LogicalId,
2238
+ namespace: node.def.Namespace,
2239
+ actionType: node.def.Type,
2240
+ inputHash: newHash,
2241
+ input: newInput,
2242
+ output: result,
2243
+ downstream: node.downstream
2244
+ }
2245
+ });
2246
+ tracker[fqn] = {
2247
+ output: result,
2248
+ props: { __input: newInput },
2249
+ bindings: [],
2250
+ instanceId: fqn
2251
+ };
2252
+ terminalStatuses.set(fqn, {
2253
+ id: node.def.LogicalId,
2254
+ type: node.def.Type,
2255
+ status: "ran"
2256
+ });
2257
+ }
1872
2258
  if (!anyUpdated) break;
1873
2259
  }
1874
2260
  });
@@ -1876,6 +2262,25 @@ const collectGarbage = Effect.fnUntraced(function* (plan, session) {
1876
2262
  const state = yield* State;
1877
2263
  const stackName = (yield* Stack).name;
1878
2264
  const stage$1 = yield* Stage;
2265
+ yield* Effect.all(Object.entries(plan.actionDeletions ?? {}).map(([fqn, node]) => node === void 0 ? Effect.void : Effect.gen(function* () {
2266
+ yield* session.emit({
2267
+ kind: "status-change",
2268
+ id: node.def.LogicalId,
2269
+ type: node.def.Type,
2270
+ status: "deleting"
2271
+ });
2272
+ yield* state.delete({
2273
+ stack: stackName,
2274
+ stage: stage$1,
2275
+ fqn
2276
+ });
2277
+ yield* session.emit({
2278
+ kind: "status-change",
2279
+ id: node.def.LogicalId,
2280
+ type: node.def.Type,
2281
+ status: "deleted"
2282
+ });
2283
+ })), { concurrency: "unbounded" });
1879
2284
  const deleteGraph = Effect.fnUntraced(function* (deletionGraph) {
1880
2285
  const deletions = {};
1881
2286
  const deleteResource = (node, ancestors = /* @__PURE__ */ new Set()) => Effect.gen(function* () {
@@ -2030,10 +2435,10 @@ var __rewriteRelativeImportExtension = void 0 && (void 0).__rewriteRelativeImpor
2030
2435
  return path$1;
2031
2436
  };
2032
2437
  const USER = Config.string("USER").pipe(Config.orElse(() => Config.string("USERNAME")), Config.withDefault("unknown"));
2033
- const STAGE = Config.string("stage").pipe(Config.option, (a) => a.asEffect(), Effect.map(Option.getOrUndefined));
2438
+ const STAGE = Config.string("stage").pipe(Config.option, (a) => a, Effect.map(Option.getOrUndefined));
2034
2439
  const stage = Flag.string("stage").pipe(Flag.withSchema(S.String.check(S.isPattern(/^[a-z0-9]+([-_a-z0-9]+)*$/gi))), Flag.withDescription("Stage to deploy to, defaults to dev_${USER}"), Flag.optional, Flag.map(Option.getOrUndefined), Flag.mapEffect(Effect.fn(function* (stage$1) {
2035
2440
  if (stage$1) return stage$1;
2036
- return yield* STAGE.pipe(Effect.catch(() => Effect.fail(new CliError.MissingOption({ option: "stage" }))), Effect.flatMap((s) => s === void 0 ? USER.asEffect().pipe(Effect.map((user) => `dev_${user}`), Effect.catch(() => Effect.succeed("unknown"))) : Effect.succeed(s)));
2441
+ return yield* STAGE.pipe(Effect.catch(() => Effect.fail(new CliError.MissingOption({ option: "stage" }))), Effect.flatMap((s) => s === void 0 ? USER.pipe(Effect.map((user) => `dev_${user}`), Effect.catch(() => Effect.succeed("unknown"))) : Effect.succeed(s)));
2037
2442
  })));
2038
2443
  const envFile = Flag.file("env-file").pipe(Flag.optional, Flag.withDescription("File to load environment variables from, defaults to .env"));
2039
2444
  const dryRun = Flag.boolean("dry-run").pipe(Flag.withDescription("Dry run the deployment, do not actually deploy"), Flag.withDefault(false));
@@ -2096,7 +2501,7 @@ const stackSpanAttrs = (args) => ({
2096
2501
  const adopt = Flag.boolean("adopt").pipe(Flag.withDescription("Adopt pre-existing cloud resources that conflict with this stack instead of failing. Useful for re-importing infrastructure into a fresh state store."), Flag.withDefault(false));
2097
2502
  const execStack = Effect.fn(function* ({ main, stage: stage$1, envFile: envFile$1, profile: profile$1, dryRun: dryRun$1 = false, force: force$1 = false, yes: yes$1 = false, destroy = false, dev = false, adopt: adopt$1 = false }) {
2098
2503
  const stackEffect = yield* importStack(main);
2099
- const services$1 = Layer.mergeAll(Layer.effect(AlchemyContext, AlchemyContext.asEffect().pipe(Effect.map((ctx) => ({
2504
+ const services$1 = Layer.mergeAll(Layer.effect(AlchemyContext, AlchemyContext.pipe(Effect.map((ctx) => ({
2100
2505
  ...ctx,
2101
2506
  dev,
2102
2507
  adopt: adopt$1
@@ -2250,12 +2655,13 @@ const LoggingCli = Layer.succeed(Cli, Cli.of({
2250
2655
 
2251
2656
  //#endregion
2252
2657
  //#region lib/Cli/NamespaceTree.js
2253
- function buildNamespaceTree(items) {
2658
+ function buildNamespaceTree(items, actions = []) {
2254
2659
  const root = {
2255
2660
  id: "",
2256
2661
  path: [],
2257
2662
  children: /* @__PURE__ */ new Map(),
2258
- resources: []
2663
+ resources: [],
2664
+ actions: []
2259
2665
  };
2260
2666
  const getNode = (path$1) => {
2261
2667
  let current = root;
@@ -2267,7 +2673,8 @@ function buildNamespaceTree(items) {
2267
2673
  id: segment,
2268
2674
  path: path$1.slice(0, i + 1),
2269
2675
  children: /* @__PURE__ */ new Map(),
2270
- resources: []
2676
+ resources: [],
2677
+ actions: []
2271
2678
  };
2272
2679
  current.children.set(segment, child);
2273
2680
  }
@@ -2276,11 +2683,13 @@ function buildNamespaceTree(items) {
2276
2683
  return current;
2277
2684
  };
2278
2685
  for (const item of items) getNode(toPath(item.resource.Namespace)).resources.push(item);
2686
+ for (const action of actions) getNode(toPath(action.def.Namespace)).actions.push(action);
2279
2687
  return root;
2280
2688
  }
2281
2689
  function deriveNamespaceAction(node) {
2282
2690
  const actions = /* @__PURE__ */ new Set();
2283
2691
  for (const resource of node.resources) actions.add(deriveResourceChildrenAction(resource, node));
2692
+ for (const action of node.actions) actions.add(action.action === "run" ? "create" : action.action === "delete" ? "delete" : "noop");
2284
2693
  for (const child of node.children.values()) {
2285
2694
  const childAction = deriveNamespaceAction(child);
2286
2695
  if (childAction === "mixed") return "mixed";
@@ -2333,8 +2742,17 @@ const flattenNamespace = (node, depth, result) => {
2333
2742
  });
2334
2743
  if (childNamespace) flattenNamespace(childNamespace, depth + 1, result);
2335
2744
  }
2745
+ const sortedActions = [...node.actions].sort((a, b) => a.def.LogicalId.localeCompare(b.def.LogicalId));
2746
+ for (const action of sortedActions) result.push({
2747
+ type: "action",
2748
+ depth,
2749
+ id: action.def.LogicalId,
2750
+ path: [...node.path, action.def.LogicalId],
2751
+ action: action.action,
2752
+ actionType: action.def.Type
2753
+ });
2336
2754
  };
2337
- const isEmpty = (node) => node.resources.length === 0 && Array.from(node.children.values()).every(isEmpty);
2755
+ const isEmpty = (node) => node.resources.length === 0 && node.actions.length === 0 && Array.from(node.children.values()).every(isEmpty);
2338
2756
  const deriveResourceChildrenAction = (resource, node) => {
2339
2757
  const actions = new Set([resource.action]);
2340
2758
  for (const binding of resource.bindings) actions.add(binding.action);
@@ -2355,10 +2773,11 @@ const deriveAction = (actions) => {
2355
2773
  //#region lib/Cli/tui/components/Plan.js
2356
2774
  function Plan({ plan }) {
2357
2775
  const items = useMemo(() => [...Object.values(plan.resources), ...Object.values(plan.deletions)], [plan]);
2776
+ const taskItems = useMemo(() => [...Object.values(plan.actions ?? {}), ...Object.values(plan.actionDeletions ?? {})].filter((t) => t !== void 0), [plan]);
2358
2777
  const flatItems = useMemo(() => {
2359
- return flattenTree(buildNamespaceTree(items));
2360
- }, [items]);
2361
- if (items.length === 0) return jsx(Text, {
2778
+ return flattenTree(buildNamespaceTree(items, taskItems));
2779
+ }, [items, taskItems]);
2780
+ if (items.length === 0 && taskItems.length === 0) return jsx(Text, {
2362
2781
  color: "gray",
2363
2782
  children: "No changes planned"
2364
2783
  });
@@ -2369,12 +2788,18 @@ function Plan({ plan }) {
2369
2788
  noop: 0,
2370
2789
  replace: 0
2371
2790
  });
2791
+ const taskCounts = taskItems.reduce((acc, item) => (acc[item.action]++, acc), {
2792
+ run: 0,
2793
+ noop: 0,
2794
+ delete: 0
2795
+ });
2372
2796
  const actions = [
2373
2797
  "create",
2374
2798
  "update",
2375
2799
  "delete",
2376
2800
  "replace"
2377
2801
  ].filter((action) => counts[action] > 0);
2802
+ const taskHeaderEntries = [taskCounts.run > 0 ? `${taskCounts.run} to run` : void 0, taskCounts.delete > 0 ? `${taskCounts.delete} to drop` : void 0].filter((s) => !!s);
2378
2803
  return jsxs(Box, {
2379
2804
  flexDirection: "column",
2380
2805
  children: [jsxs(Box, {
@@ -2385,20 +2810,20 @@ function Plan({ plan }) {
2385
2810
  children: "Plan"
2386
2811
  }),
2387
2812
  jsx(Text, { children: ": " }),
2388
- actions.flatMap((action, i) => {
2813
+ [...actions.map((action) => {
2389
2814
  const count = counts[action];
2390
- const color = actionColor(action);
2391
- if (count === 0) return [];
2392
- const box = jsx(Box, { children: jsxs(Text, {
2393
- color,
2815
+ return jsx(Box, { children: jsxs(Text, {
2816
+ color: actionColor(action),
2394
2817
  children: [
2395
2818
  count,
2396
2819
  " to ",
2397
2820
  action
2398
2821
  ]
2399
2822
  }) }, action);
2400
- return i === actions.length - 1 ? [box] : [box, jsx(Text, { children: " | " }, `${action}-separator`)];
2401
- })
2823
+ }), ...taskHeaderEntries.map((label, i) => jsx(Box, { children: jsx(Text, {
2824
+ color: "cyan",
2825
+ children: label
2826
+ }) }, `task-${i}`))].flatMap((box, i, arr) => i === arr.length - 1 ? [box] : [box, jsx(Text, { children: " | " }, `sep-${i}`)])
2402
2827
  ]
2403
2828
  }), jsx(Box, {
2404
2829
  flexDirection: "column",
@@ -2442,6 +2867,41 @@ function Plan({ plan }) {
2442
2867
  })
2443
2868
  ]
2444
2869
  }, key);
2870
+ if (item.type === "action") return jsxs(Box, {
2871
+ flexDirection: "row",
2872
+ children: [
2873
+ jsx(Text, { children: indent }),
2874
+ jsx(Box, {
2875
+ width: 2,
2876
+ children: jsxs(Text, {
2877
+ color,
2878
+ children: [icon, " "]
2879
+ })
2880
+ }),
2881
+ jsx(Box, { children: jsx(Text, {
2882
+ bold: true,
2883
+ children: item.id
2884
+ }) }),
2885
+ jsx(Box, {
2886
+ marginLeft: 1,
2887
+ children: jsxs(Text, {
2888
+ color: "blackBright",
2889
+ children: [
2890
+ "(",
2891
+ item.actionType,
2892
+ ")"
2893
+ ]
2894
+ })
2895
+ }),
2896
+ jsx(Box, {
2897
+ marginLeft: 1,
2898
+ children: jsx(Text, {
2899
+ color: "cyan",
2900
+ children: "[action]"
2901
+ })
2902
+ })
2903
+ ]
2904
+ }, key);
2445
2905
  return jsxs(Box, {
2446
2906
  flexDirection: "row",
2447
2907
  children: [
@@ -2491,7 +2951,8 @@ const getActionColor = (action) => ({
2491
2951
  update: "yellow",
2492
2952
  delete: "red",
2493
2953
  replace: "magenta",
2494
- mixed: "cyan"
2954
+ mixed: "cyan",
2955
+ run: "cyan"
2495
2956
  })[action] ?? "gray";
2496
2957
  const getActionIcon = (action) => ({
2497
2958
  create: "+",
@@ -2499,7 +2960,8 @@ const getActionIcon = (action) => ({
2499
2960
  delete: "-",
2500
2961
  noop: "•",
2501
2962
  replace: "!",
2502
- mixed: "*"
2963
+ mixed: "*",
2964
+ run: "λ"
2503
2965
  })[action] ?? "?";
2504
2966
  const actionColor = (action) => getActionColor(action);
2505
2967
 
@@ -2542,29 +3004,40 @@ function ApprovePlan(props) {
2542
3004
  //#region lib/Cli/tui/components/PlanProgress.js
2543
3005
  const getTaskKey = (item) => item.path.join("/");
2544
3006
  const buildProgressRows = (plan) => {
2545
- return flattenTree(buildNamespaceTree([...Object.values(plan.resources), ...Object.values(plan.deletions).filter((item) => item !== void 0)])).filter((item) => item.type !== "binding").map((item) => item.type === "namespace" ? {
2546
- key: getTaskKey(item),
2547
- type: "namespace",
2548
- id: item.id,
2549
- depth: item.depth,
2550
- action: item.action
2551
- } : {
2552
- key: getTaskKey(item),
2553
- type: "resource",
2554
- id: item.id,
2555
- depth: item.depth,
2556
- resourceType: item.resourceType ?? "unknown",
2557
- action: item.action,
2558
- persistedApplyStatus: item.action === "noop" ? (() => {
2559
- const crud = findCrudByLogicalId(plan, item.id);
2560
- return crud?.action === "noop" ? crud.state.status : void 0;
2561
- })() : void 0
3007
+ return flattenTree(buildNamespaceTree([...Object.values(plan.resources), ...Object.values(plan.deletions).filter((item) => item !== void 0)], [...Object.values(plan.actions ?? {}), ...Object.values(plan.actionDeletions ?? {})].filter((t) => t !== void 0))).filter((item) => item.type !== "binding").map((item) => {
3008
+ if (item.type === "namespace") return {
3009
+ key: getTaskKey(item),
3010
+ type: "namespace",
3011
+ id: item.id,
3012
+ depth: item.depth,
3013
+ action: item.action
3014
+ };
3015
+ if (item.type === "action") return {
3016
+ key: getTaskKey(item),
3017
+ type: "task",
3018
+ id: item.id,
3019
+ depth: item.depth,
3020
+ actionType: item.actionType ?? "unknown",
3021
+ action: item.action
3022
+ };
3023
+ return {
3024
+ key: getTaskKey(item),
3025
+ type: "resource",
3026
+ id: item.id,
3027
+ depth: item.depth,
3028
+ resourceType: item.resourceType ?? "unknown",
3029
+ action: item.action,
3030
+ persistedApplyStatus: item.action === "noop" ? (() => {
3031
+ const crud = findCrudByLogicalId(plan, item.id);
3032
+ return crud?.action === "noop" ? crud.state.status : void 0;
3033
+ })() : void 0
3034
+ };
2562
3035
  });
2563
3036
  };
2564
3037
  const buildLogicalIdIndex = (rows) => {
2565
3038
  const index = /* @__PURE__ */ new Map();
2566
3039
  for (const row of rows) {
2567
- if (row.type !== "resource") continue;
3040
+ if (row.type !== "resource" && row.type !== "task") continue;
2568
3041
  const keys = index.get(row.id);
2569
3042
  if (keys) keys.push(row.key);
2570
3043
  else index.set(row.id, [row.key]);
@@ -2587,7 +3060,13 @@ function toPlanTask(rowOrId, planItem) {
2587
3060
  updatedAt: Date.now()
2588
3061
  };
2589
3062
  }
2590
- const buildInitialTasks = (rows) => new Map(rows.flatMap((row) => row.type === "resource" ? [[row.key, toPlanTask(row)]] : []));
3063
+ const buildInitialTasks = (rows) => new Map(rows.flatMap((row) => row.type === "resource" ? [[row.key, toPlanTask(row)]] : row.type === "task" ? [[row.key, {
3064
+ key: row.key,
3065
+ id: row.id,
3066
+ type: row.actionType,
3067
+ status: row.action === "noop" ? "skipped" : "pending",
3068
+ updatedAt: Date.now()
3069
+ }]] : []));
2591
3070
  function PlanProgress(props) {
2592
3071
  const { source, plan } = props;
2593
3072
  const spinner = useGlobalSpinner();
@@ -2654,6 +3133,56 @@ function PlanProgress(props) {
2654
3133
  })
2655
3134
  ]
2656
3135
  }, row.key);
3136
+ if (row.type === "task") {
3137
+ const t = tasks.get(row.key);
3138
+ const status = t?.status ?? (row.action === "noop" ? "ran" : "pending");
3139
+ const color$1 = statusColor(status);
3140
+ const icon$1 = taskIcon(row.action, status, spinner);
3141
+ const label = row.action === "delete" ? status === "deleted" ? "deleted" : "drop" : status === "ran" ? row.action === "noop" ? "skip" : "ran" : status === "running" ? "running" : status === "fail" ? "fail" : row.action === "noop" ? "skip" : "run";
3142
+ return jsxs(Box, {
3143
+ flexDirection: "column",
3144
+ children: [jsxs(Box, {
3145
+ flexDirection: "row",
3146
+ children: [
3147
+ jsx(Text, { children: indent }),
3148
+ jsx(Box, {
3149
+ width: 2,
3150
+ children: jsxs(Text, {
3151
+ color: color$1,
3152
+ children: [icon$1, " "]
3153
+ })
3154
+ }),
3155
+ jsx(Text, {
3156
+ bold: true,
3157
+ children: row.id
3158
+ }),
3159
+ jsxs(Text, {
3160
+ dimColor: true,
3161
+ children: [
3162
+ " (",
3163
+ row.actionType,
3164
+ ")"
3165
+ ]
3166
+ }),
3167
+ jsxs(Text, {
3168
+ color: color$1,
3169
+ children: [" ", label]
3170
+ }),
3171
+ jsxs(Text, {
3172
+ color: "cyan",
3173
+ dimColor: true,
3174
+ children: [" ", "[action]"]
3175
+ })
3176
+ ]
3177
+ }), t?.message ? jsx(Box, {
3178
+ paddingLeft: row.depth * 2 + 2,
3179
+ children: jsxs(Text, {
3180
+ dimColor: true,
3181
+ children: ["• ", t.message]
3182
+ })
3183
+ }) : null]
3184
+ }, row.key);
3185
+ }
2657
3186
  const task = tasks.get(row.key) ?? toPlanTask(row);
2658
3187
  const displayStatus = getDisplayStatus(row, task.status);
2659
3188
  const color = statusColor(displayStatus);
@@ -2713,17 +3242,30 @@ function statusColor(status) {
2713
3242
  case "updated": return "yellow";
2714
3243
  case "deleting":
2715
3244
  case "deleted": return "red";
3245
+ case "running":
3246
+ case "ran": return "cyan";
3247
+ case "skipped": return "gray";
2716
3248
  case "fail": return "redBright";
2717
3249
  default: return;
2718
3250
  }
2719
3251
  }
3252
+ function taskIcon(action, status, spinnerChar) {
3253
+ if (status === "running") return spinnerChar;
3254
+ if (status === "fail") return "✗";
3255
+ if (status === "skipped") return "•";
3256
+ if (status === "ran") return action === "noop" ? "•" : "✓";
3257
+ if (status === "deleted") return "✓";
3258
+ if (action === "delete") return "-";
3259
+ if (action === "noop") return "•";
3260
+ return "λ";
3261
+ }
2720
3262
  function statusIcon(status, spinnerChar) {
2721
3263
  if (isInProgress(status)) return spinnerChar;
2722
3264
  if (status === "fail") return "✗";
2723
3265
  return "✓";
2724
3266
  }
2725
3267
  function isInProgress(status) {
2726
- return status === "pending" || status === "creating" || status === "updating" || status === "deleting";
3268
+ return status === "pending" || status === "creating" || status === "updating" || status === "deleting" || status === "running";
2727
3269
  }
2728
3270
  const spinnerFrames = [
2729
3271
  "⠋",