alchemy 2.0.0-beta.10 → 2.0.0-beta.13

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 (420) hide show
  1. package/bin/alchemy.js +1122 -450
  2. package/bin/alchemy.js.map +1 -1
  3. package/bin/alchemy.sh +15 -0
  4. package/bin/alchemy.ts +22 -727
  5. package/bin/commands/_shared.ts +237 -0
  6. package/bin/commands/bootstrap.ts +117 -0
  7. package/bin/commands/deploy.ts +144 -0
  8. package/bin/commands/login.ts +93 -0
  9. package/bin/commands/logs.ts +157 -0
  10. package/bin/commands/tail.ts +138 -0
  11. package/lib/AWS/AuthProvider.d.ts +7 -71
  12. package/lib/AWS/AuthProvider.d.ts.map +1 -1
  13. package/lib/AWS/AuthProvider.js +27 -22
  14. package/lib/AWS/AuthProvider.js.map +1 -1
  15. package/lib/AWS/AutoScaling/LaunchTemplate.d.ts +3 -3
  16. package/lib/AWS/AutoScaling/LaunchTemplate.d.ts.map +1 -1
  17. package/lib/AWS/AutoScaling/LaunchTemplate.js +2 -2
  18. package/lib/AWS/AutoScaling/LaunchTemplate.js.map +1 -1
  19. package/lib/AWS/Bootstrap.d.ts +2 -1
  20. package/lib/AWS/Bootstrap.d.ts.map +1 -1
  21. package/lib/AWS/Bootstrap.js +27 -29
  22. package/lib/AWS/Bootstrap.js.map +1 -1
  23. package/lib/AWS/CloudWatch/Alarm.d.ts +2 -2
  24. package/lib/AWS/CloudWatch/Alarm.d.ts.map +1 -1
  25. package/lib/AWS/CloudWatch/Alarm.js +2 -2
  26. package/lib/AWS/CloudWatch/Alarm.js.map +1 -1
  27. package/lib/AWS/CloudWatch/AlarmMuteRule.d.ts +2 -2
  28. package/lib/AWS/CloudWatch/AlarmMuteRule.d.ts.map +1 -1
  29. package/lib/AWS/CloudWatch/AlarmMuteRule.js +2 -2
  30. package/lib/AWS/CloudWatch/AlarmMuteRule.js.map +1 -1
  31. package/lib/AWS/CloudWatch/CompositeAlarm.d.ts +2 -2
  32. package/lib/AWS/CloudWatch/CompositeAlarm.d.ts.map +1 -1
  33. package/lib/AWS/CloudWatch/CompositeAlarm.js +2 -2
  34. package/lib/AWS/CloudWatch/CompositeAlarm.js.map +1 -1
  35. package/lib/AWS/CloudWatch/Dashboard.d.ts +2 -2
  36. package/lib/AWS/CloudWatch/Dashboard.d.ts.map +1 -1
  37. package/lib/AWS/CloudWatch/Dashboard.js +2 -2
  38. package/lib/AWS/CloudWatch/Dashboard.js.map +1 -1
  39. package/lib/AWS/CloudWatch/InsightRule.d.ts +2 -2
  40. package/lib/AWS/CloudWatch/InsightRule.d.ts.map +1 -1
  41. package/lib/AWS/CloudWatch/InsightRule.js +2 -2
  42. package/lib/AWS/CloudWatch/InsightRule.js.map +1 -1
  43. package/lib/AWS/CloudWatch/MetricStream.d.ts +2 -2
  44. package/lib/AWS/CloudWatch/MetricStream.d.ts.map +1 -1
  45. package/lib/AWS/CloudWatch/MetricStream.js +2 -2
  46. package/lib/AWS/CloudWatch/MetricStream.js.map +1 -1
  47. package/lib/AWS/Credentials.d.ts +5 -10
  48. package/lib/AWS/Credentials.d.ts.map +1 -1
  49. package/lib/AWS/Credentials.js +6 -30
  50. package/lib/AWS/Credentials.js.map +1 -1
  51. package/lib/AWS/DynamoDB/Table.d.ts +1 -1
  52. package/lib/AWS/DynamoDB/Table.d.ts.map +1 -1
  53. package/lib/AWS/EC2/EIP.d.ts +3 -3
  54. package/lib/AWS/EC2/EIP.d.ts.map +1 -1
  55. package/lib/AWS/EC2/EIP.js +2 -2
  56. package/lib/AWS/EC2/EIP.js.map +1 -1
  57. package/lib/AWS/EC2/EgressOnlyInternetGateway.d.ts +3 -3
  58. package/lib/AWS/EC2/EgressOnlyInternetGateway.d.ts.map +1 -1
  59. package/lib/AWS/EC2/EgressOnlyInternetGateway.js +2 -2
  60. package/lib/AWS/EC2/EgressOnlyInternetGateway.js.map +1 -1
  61. package/lib/AWS/EC2/Instance.d.ts +3 -3
  62. package/lib/AWS/EC2/Instance.d.ts.map +1 -1
  63. package/lib/AWS/EC2/Instance.js +2 -2
  64. package/lib/AWS/EC2/Instance.js.map +1 -1
  65. package/lib/AWS/EC2/InternetGateway.d.ts +3 -3
  66. package/lib/AWS/EC2/InternetGateway.d.ts.map +1 -1
  67. package/lib/AWS/EC2/InternetGateway.js +2 -2
  68. package/lib/AWS/EC2/InternetGateway.js.map +1 -1
  69. package/lib/AWS/EC2/NatGateway.d.ts +3 -3
  70. package/lib/AWS/EC2/NatGateway.d.ts.map +1 -1
  71. package/lib/AWS/EC2/NatGateway.js +2 -2
  72. package/lib/AWS/EC2/NatGateway.js.map +1 -1
  73. package/lib/AWS/EC2/Network.d.ts +1 -1
  74. package/lib/AWS/EC2/NetworkAcl.d.ts +3 -3
  75. package/lib/AWS/EC2/NetworkAcl.d.ts.map +1 -1
  76. package/lib/AWS/EC2/NetworkAcl.js +2 -2
  77. package/lib/AWS/EC2/NetworkAcl.js.map +1 -1
  78. package/lib/AWS/EC2/RouteTable.d.ts +3 -3
  79. package/lib/AWS/EC2/RouteTable.d.ts.map +1 -1
  80. package/lib/AWS/EC2/RouteTable.js +2 -2
  81. package/lib/AWS/EC2/RouteTable.js.map +1 -1
  82. package/lib/AWS/EC2/SecurityGroup.d.ts +3 -3
  83. package/lib/AWS/EC2/SecurityGroup.d.ts.map +1 -1
  84. package/lib/AWS/EC2/SecurityGroup.js +2 -2
  85. package/lib/AWS/EC2/SecurityGroup.js.map +1 -1
  86. package/lib/AWS/EC2/Subnet.d.ts +1 -1
  87. package/lib/AWS/EC2/Subnet.d.ts.map +1 -1
  88. package/lib/AWS/EC2/Vpc.d.ts +3 -3
  89. package/lib/AWS/EC2/Vpc.d.ts.map +1 -1
  90. package/lib/AWS/EC2/Vpc.js +2 -2
  91. package/lib/AWS/EC2/Vpc.js.map +1 -1
  92. package/lib/AWS/EC2/VpcEndpoint.d.ts +3 -3
  93. package/lib/AWS/EC2/VpcEndpoint.d.ts.map +1 -1
  94. package/lib/AWS/EC2/VpcEndpoint.js +2 -2
  95. package/lib/AWS/EC2/VpcEndpoint.js.map +1 -1
  96. package/lib/AWS/ECR/Repository.d.ts +1 -1
  97. package/lib/AWS/ECR/Repository.d.ts.map +1 -1
  98. package/lib/AWS/ECR/Repository.js +0 -1
  99. package/lib/AWS/ECR/Repository.js.map +1 -1
  100. package/lib/AWS/ECS/Cluster.d.ts +2 -2
  101. package/lib/AWS/ECS/Cluster.d.ts.map +1 -1
  102. package/lib/AWS/ECS/Cluster.js +2 -2
  103. package/lib/AWS/ECS/Cluster.js.map +1 -1
  104. package/lib/AWS/ECS/Service.d.ts +1 -1
  105. package/lib/AWS/ECS/Service.d.ts.map +1 -1
  106. package/lib/AWS/ECS/Task.d.ts +2 -2
  107. package/lib/AWS/ECS/Task.d.ts.map +1 -1
  108. package/lib/AWS/ECS/Task.js +2 -2
  109. package/lib/AWS/ECS/Task.js.map +1 -1
  110. package/lib/AWS/EKS/Cluster.d.ts +1 -1
  111. package/lib/AWS/EKS/Cluster.d.ts.map +1 -1
  112. package/lib/AWS/ELBv2/Listener.d.ts +1 -1
  113. package/lib/AWS/ELBv2/Listener.d.ts.map +1 -1
  114. package/lib/AWS/ELBv2/LoadBalancer.d.ts +1 -1
  115. package/lib/AWS/ELBv2/LoadBalancer.d.ts.map +1 -1
  116. package/lib/AWS/ELBv2/TargetGroup.d.ts +1 -1
  117. package/lib/AWS/ELBv2/TargetGroup.d.ts.map +1 -1
  118. package/lib/AWS/Endpoint.d.ts +7 -2
  119. package/lib/AWS/Endpoint.d.ts.map +1 -1
  120. package/lib/AWS/Endpoint.js +7 -2
  121. package/lib/AWS/Endpoint.js.map +1 -1
  122. package/lib/AWS/Environment.d.ts +68 -0
  123. package/lib/AWS/Environment.d.ts.map +1 -0
  124. package/lib/AWS/Environment.js +53 -0
  125. package/lib/AWS/Environment.js.map +1 -0
  126. package/lib/AWS/EventBridge/EventBus.d.ts +2 -2
  127. package/lib/AWS/EventBridge/EventBus.d.ts.map +1 -1
  128. package/lib/AWS/EventBridge/EventBus.js +2 -2
  129. package/lib/AWS/EventBridge/EventBus.js.map +1 -1
  130. package/lib/AWS/EventBridge/ListRules.d.ts +2 -2
  131. package/lib/AWS/EventBridge/ListRules.d.ts.map +1 -1
  132. package/lib/AWS/EventBridge/ListRules.js +2 -2
  133. package/lib/AWS/EventBridge/ListRules.js.map +1 -1
  134. package/lib/AWS/EventBridge/PutEvents.d.ts +2 -2
  135. package/lib/AWS/EventBridge/PutEvents.d.ts.map +1 -1
  136. package/lib/AWS/EventBridge/PutEvents.js +2 -2
  137. package/lib/AWS/EventBridge/PutEvents.js.map +1 -1
  138. package/lib/AWS/EventBridge/Rule.d.ts +2 -2
  139. package/lib/AWS/EventBridge/Rule.d.ts.map +1 -1
  140. package/lib/AWS/EventBridge/Rule.js +2 -2
  141. package/lib/AWS/EventBridge/Rule.js.map +1 -1
  142. package/lib/AWS/IAM/OpenIDConnectProvider.d.ts +2 -2
  143. package/lib/AWS/IAM/OpenIDConnectProvider.d.ts.map +1 -1
  144. package/lib/AWS/IAM/OpenIDConnectProvider.js +2 -2
  145. package/lib/AWS/IAM/OpenIDConnectProvider.js.map +1 -1
  146. package/lib/AWS/IAM/Policy.d.ts +3 -3
  147. package/lib/AWS/IAM/Policy.d.ts.map +1 -1
  148. package/lib/AWS/IAM/Policy.js +2 -2
  149. package/lib/AWS/IAM/Policy.js.map +1 -1
  150. package/lib/AWS/IAM/Role.d.ts +3 -3
  151. package/lib/AWS/IAM/Role.d.ts.map +1 -1
  152. package/lib/AWS/IAM/Role.js +3 -3
  153. package/lib/AWS/IAM/Role.js.map +1 -1
  154. package/lib/AWS/Kinesis/Stream.d.ts +2 -2
  155. package/lib/AWS/Kinesis/Stream.d.ts.map +1 -1
  156. package/lib/AWS/Kinesis/Stream.js +2 -2
  157. package/lib/AWS/Kinesis/Stream.js.map +1 -1
  158. package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
  159. package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
  160. package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
  161. package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
  162. package/lib/AWS/Lambda/EventSourceMapping.d.ts +2 -2
  163. package/lib/AWS/Lambda/EventSourceMapping.d.ts.map +1 -1
  164. package/lib/AWS/Lambda/EventSourceMapping.js +2 -2
  165. package/lib/AWS/Lambda/EventSourceMapping.js.map +1 -1
  166. package/lib/AWS/Lambda/Function.d.ts +2 -2
  167. package/lib/AWS/Lambda/Function.d.ts.map +1 -1
  168. package/lib/AWS/Lambda/Function.js +2 -2
  169. package/lib/AWS/Lambda/Function.js.map +1 -1
  170. package/lib/AWS/Lambda/Permission.d.ts +1 -1
  171. package/lib/AWS/Lambda/Permission.js +1 -1
  172. package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
  173. package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
  174. package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
  175. package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
  176. package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
  177. package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
  178. package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
  179. package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
  180. package/lib/AWS/Logs/LogGroup.d.ts +3 -3
  181. package/lib/AWS/Logs/LogGroup.d.ts.map +1 -1
  182. package/lib/AWS/Logs/LogGroup.js +2 -2
  183. package/lib/AWS/Logs/LogGroup.js.map +1 -1
  184. package/lib/AWS/Providers.d.ts +1 -2
  185. package/lib/AWS/Providers.d.ts.map +1 -1
  186. package/lib/AWS/Providers.js +3 -3
  187. package/lib/AWS/Providers.js.map +1 -1
  188. package/lib/AWS/Region.d.ts +6 -22
  189. package/lib/AWS/Region.d.ts.map +1 -1
  190. package/lib/AWS/Region.js +6 -39
  191. package/lib/AWS/Region.js.map +1 -1
  192. package/lib/AWS/S3/Bucket.d.ts +2 -2
  193. package/lib/AWS/S3/Bucket.d.ts.map +1 -1
  194. package/lib/AWS/S3/Bucket.js +2 -2
  195. package/lib/AWS/S3/Bucket.js.map +1 -1
  196. package/lib/AWS/SNS/Topic.d.ts +1 -1
  197. package/lib/AWS/SNS/Topic.d.ts.map +1 -1
  198. package/lib/AWS/SQS/Queue.d.ts +3 -3
  199. package/lib/AWS/SQS/Queue.d.ts.map +1 -1
  200. package/lib/AWS/SQS/Queue.js +2 -2
  201. package/lib/AWS/SQS/Queue.js.map +1 -1
  202. package/lib/AWS/index.d.ts +1 -3
  203. package/lib/AWS/index.d.ts.map +1 -1
  204. package/lib/AWS/index.js +1 -3
  205. package/lib/AWS/index.js.map +1 -1
  206. package/lib/Apply.d.ts.map +1 -1
  207. package/lib/Apply.js +2 -2
  208. package/lib/Apply.js.map +1 -1
  209. package/lib/Auth/AuthProvider.d.ts +51 -7
  210. package/lib/Auth/AuthProvider.d.ts.map +1 -1
  211. package/lib/Auth/AuthProvider.js +37 -0
  212. package/lib/Auth/AuthProvider.js.map +1 -1
  213. package/lib/Auth/Profile.d.ts +71 -10
  214. package/lib/Auth/Profile.d.ts.map +1 -1
  215. package/lib/Auth/Profile.js +47 -30
  216. package/lib/Auth/Profile.js.map +1 -1
  217. package/lib/Auth/index.d.ts +1 -1
  218. package/lib/Auth/index.d.ts.map +1 -1
  219. package/lib/Cloudflare/Auth/AuthProvider.d.ts +14 -31
  220. package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
  221. package/lib/Cloudflare/Auth/AuthProvider.js +59 -38
  222. package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
  223. package/lib/Cloudflare/CloudflareEnvironment.d.ts +11 -0
  224. package/lib/Cloudflare/CloudflareEnvironment.d.ts.map +1 -0
  225. package/lib/Cloudflare/CloudflareEnvironment.js +26 -0
  226. package/lib/Cloudflare/CloudflareEnvironment.js.map +1 -0
  227. package/lib/Cloudflare/Container/ContainerApplication.d.ts +70 -42
  228. package/lib/Cloudflare/Container/ContainerApplication.d.ts.map +1 -1
  229. package/lib/Cloudflare/Container/ContainerApplication.js +49 -24
  230. package/lib/Cloudflare/Container/ContainerApplication.js.map +1 -1
  231. package/lib/Cloudflare/Credentials.d.ts +11 -0
  232. package/lib/Cloudflare/Credentials.d.ts.map +1 -0
  233. package/lib/Cloudflare/Credentials.js +34 -0
  234. package/lib/Cloudflare/Credentials.js.map +1 -0
  235. package/lib/Cloudflare/D1/D1Database.d.ts +2 -2
  236. package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
  237. package/lib/Cloudflare/D1/D1Database.js +2 -2
  238. package/lib/Cloudflare/D1/D1Database.js.map +1 -1
  239. package/lib/Cloudflare/KV/KVNamespace.d.ts +2 -2
  240. package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
  241. package/lib/Cloudflare/KV/KVNamespace.js +2 -2
  242. package/lib/Cloudflare/KV/KVNamespace.js.map +1 -1
  243. package/lib/Cloudflare/Providers.d.ts +2 -3
  244. package/lib/Cloudflare/Providers.d.ts.map +1 -1
  245. package/lib/Cloudflare/Providers.js +12 -4
  246. package/lib/Cloudflare/Providers.js.map +1 -1
  247. package/lib/Cloudflare/Queue/Queue.d.ts +52 -0
  248. package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -0
  249. package/lib/Cloudflare/Queue/Queue.js +136 -0
  250. package/lib/Cloudflare/Queue/Queue.js.map +1 -0
  251. package/lib/Cloudflare/Queue/QueueBinding.d.ts +35 -0
  252. package/lib/Cloudflare/Queue/QueueBinding.d.ts.map +1 -0
  253. package/lib/Cloudflare/Queue/QueueBinding.js +51 -0
  254. package/lib/Cloudflare/Queue/QueueBinding.js.map +1 -0
  255. package/lib/Cloudflare/Queue/QueueConsumer.d.ts +86 -0
  256. package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -0
  257. package/lib/Cloudflare/Queue/QueueConsumer.js +138 -0
  258. package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -0
  259. package/lib/Cloudflare/Queue/index.d.ts +4 -0
  260. package/lib/Cloudflare/Queue/index.d.ts.map +1 -0
  261. package/lib/Cloudflare/Queue/index.js +4 -0
  262. package/lib/Cloudflare/Queue/index.js.map +1 -0
  263. package/lib/Cloudflare/R2/R2Bucket.d.ts +2 -2
  264. package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
  265. package/lib/Cloudflare/R2/R2Bucket.js +2 -2
  266. package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
  267. package/lib/Cloudflare/SecretsStore/Secret.d.ts +74 -0
  268. package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -0
  269. package/lib/Cloudflare/SecretsStore/Secret.js +161 -0
  270. package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -0
  271. package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +42 -0
  272. package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -0
  273. package/lib/Cloudflare/SecretsStore/SecretBinding.js +49 -0
  274. package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -0
  275. package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts +37 -0
  276. package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts.map +1 -0
  277. package/lib/Cloudflare/SecretsStore/SecretsStore.js +88 -0
  278. package/lib/Cloudflare/SecretsStore/SecretsStore.js.map +1 -0
  279. package/lib/Cloudflare/SecretsStore/index.d.ts +4 -0
  280. package/lib/Cloudflare/SecretsStore/index.d.ts.map +1 -0
  281. package/lib/Cloudflare/SecretsStore/index.js +4 -0
  282. package/lib/Cloudflare/SecretsStore/index.js.map +1 -0
  283. package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
  284. package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
  285. package/lib/Cloudflare/Workers/Worker.d.ts +5 -3
  286. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  287. package/lib/Cloudflare/Workers/Worker.js +61 -7
  288. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  289. package/lib/Cloudflare/Workers/Workflow.d.ts +10 -4
  290. package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
  291. package/lib/Cloudflare/Workers/Workflow.js +3 -3
  292. package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
  293. package/lib/Cloudflare/index.d.ts +3 -1
  294. package/lib/Cloudflare/index.d.ts.map +1 -1
  295. package/lib/Cloudflare/index.js +3 -1
  296. package/lib/Cloudflare/index.js.map +1 -1
  297. package/lib/Stack.d.ts +3 -2
  298. package/lib/Stack.d.ts.map +1 -1
  299. package/lib/Stack.js +10 -7
  300. package/lib/Stack.js.map +1 -1
  301. package/lib/State/LocalState.d.ts.map +1 -1
  302. package/lib/State/LocalState.js +40 -12
  303. package/lib/State/LocalState.js.map +1 -1
  304. package/lib/Test/Bun.d.ts.map +1 -1
  305. package/lib/Test/Bun.js +3 -2
  306. package/lib/Test/Bun.js.map +1 -1
  307. package/lib/Test/Vitest.d.ts +3 -1
  308. package/lib/Test/Vitest.d.ts.map +1 -1
  309. package/lib/Test/Vitest.js +19 -16
  310. package/lib/Test/Vitest.js.map +1 -1
  311. package/lib/Util/PlatformServices.d.ts +14 -3
  312. package/lib/Util/PlatformServices.d.ts.map +1 -1
  313. package/lib/Util/PlatformServices.js +21 -3
  314. package/lib/Util/PlatformServices.js.map +1 -1
  315. package/package.json +5 -5
  316. package/src/AWS/AuthProvider.ts +67 -67
  317. package/src/AWS/AutoScaling/LaunchTemplate.ts +3 -3
  318. package/src/AWS/Bootstrap.ts +32 -37
  319. package/src/AWS/CloudWatch/Alarm.ts +2 -2
  320. package/src/AWS/CloudWatch/AlarmMuteRule.ts +2 -2
  321. package/src/AWS/CloudWatch/CompositeAlarm.ts +2 -2
  322. package/src/AWS/CloudWatch/Dashboard.ts +2 -2
  323. package/src/AWS/CloudWatch/InsightRule.ts +2 -2
  324. package/src/AWS/CloudWatch/MetricStream.ts +2 -2
  325. package/src/AWS/Credentials.ts +9 -44
  326. package/src/AWS/DynamoDB/Table.ts +1 -1
  327. package/src/AWS/EC2/EIP.ts +3 -3
  328. package/src/AWS/EC2/EgressOnlyInternetGateway.ts +3 -3
  329. package/src/AWS/EC2/Instance.ts +3 -3
  330. package/src/AWS/EC2/InternetGateway.ts +3 -3
  331. package/src/AWS/EC2/NatGateway.ts +3 -3
  332. package/src/AWS/EC2/NetworkAcl.ts +3 -3
  333. package/src/AWS/EC2/RouteTable.ts +3 -3
  334. package/src/AWS/EC2/SecurityGroup.ts +3 -3
  335. package/src/AWS/EC2/Subnet.ts +1 -1
  336. package/src/AWS/EC2/Vpc.ts +3 -3
  337. package/src/AWS/EC2/VpcEndpoint.ts +3 -3
  338. package/src/AWS/ECR/Repository.ts +1 -1
  339. package/src/AWS/ECS/Cluster.ts +2 -2
  340. package/src/AWS/ECS/Service.ts +1 -1
  341. package/src/AWS/ECS/Task.ts +2 -2
  342. package/src/AWS/EKS/Cluster.ts +1 -1
  343. package/src/AWS/ELBv2/Listener.ts +1 -1
  344. package/src/AWS/ELBv2/LoadBalancer.ts +1 -1
  345. package/src/AWS/ELBv2/TargetGroup.ts +1 -1
  346. package/src/AWS/Endpoint.ts +12 -8
  347. package/src/AWS/Environment.ts +123 -0
  348. package/src/AWS/EventBridge/EventBus.ts +2 -2
  349. package/src/AWS/EventBridge/ListRules.ts +2 -2
  350. package/src/AWS/EventBridge/PutEvents.ts +2 -2
  351. package/src/AWS/EventBridge/Rule.ts +2 -2
  352. package/src/AWS/IAM/OpenIDConnectProvider.ts +2 -2
  353. package/src/AWS/IAM/Policy.ts +3 -3
  354. package/src/AWS/IAM/Role.ts +4 -4
  355. package/src/AWS/Kinesis/Stream.ts +2 -2
  356. package/src/AWS/Lambda/EventSourceMapping.ts +2 -2
  357. package/src/AWS/Lambda/Function.ts +2 -2
  358. package/src/AWS/Lambda/Permission.ts +1 -1
  359. package/src/AWS/Logs/LogGroup.ts +3 -3
  360. package/src/AWS/Providers.ts +7 -7
  361. package/src/AWS/Region.ts +9 -66
  362. package/src/AWS/S3/Bucket.ts +2 -2
  363. package/src/AWS/SNS/Topic.ts +1 -1
  364. package/src/AWS/SQS/Queue.ts +3 -3
  365. package/src/AWS/index.ts +1 -3
  366. package/src/Apply.ts +55 -57
  367. package/src/Auth/AuthProvider.ts +188 -8
  368. package/src/Auth/Profile.ts +117 -54
  369. package/src/Auth/index.ts +1 -1
  370. package/src/Cloudflare/Auth/AuthProvider.ts +127 -98
  371. package/src/Cloudflare/CloudflareEnvironment.ts +49 -0
  372. package/src/Cloudflare/Container/ContainerApplication.ts +172 -94
  373. package/src/Cloudflare/Credentials.ts +75 -0
  374. package/src/Cloudflare/D1/D1Database.ts +2 -2
  375. package/src/Cloudflare/KV/KVNamespace.ts +2 -2
  376. package/src/Cloudflare/Providers.ts +20 -10
  377. package/src/Cloudflare/Queue/Queue.ts +174 -0
  378. package/src/Cloudflare/Queue/QueueBinding.ts +110 -0
  379. package/src/Cloudflare/Queue/QueueConsumer.ts +219 -0
  380. package/src/Cloudflare/Queue/index.ts +3 -0
  381. package/src/Cloudflare/R2/R2Bucket.ts +2 -2
  382. package/src/Cloudflare/SecretsStore/Secret.ts +229 -0
  383. package/src/Cloudflare/SecretsStore/SecretBinding.ts +107 -0
  384. package/src/Cloudflare/SecretsStore/SecretsStore.ts +106 -0
  385. package/src/Cloudflare/SecretsStore/index.ts +3 -0
  386. package/src/Cloudflare/Workers/InferEnv.ts +5 -3
  387. package/src/Cloudflare/Workers/Worker.ts +63 -7
  388. package/src/Cloudflare/Workers/Workflow.ts +19 -9
  389. package/src/Cloudflare/index.ts +3 -1
  390. package/src/Stack.ts +40 -29
  391. package/src/State/LocalState.ts +43 -16
  392. package/src/Test/Bun.ts +3 -0
  393. package/src/Test/Vitest.ts +31 -23
  394. package/src/Util/PlatformServices.ts +54 -13
  395. package/bin/process-manager.ts +0 -10
  396. package/lib/AWS/Account.d.ts +0 -26
  397. package/lib/AWS/Account.d.ts.map +0 -1
  398. package/lib/AWS/Account.js +0 -32
  399. package/lib/AWS/Account.js.map +0 -1
  400. package/lib/AWS/Profile.d.ts +0 -6
  401. package/lib/AWS/Profile.d.ts.map +0 -1
  402. package/lib/AWS/Profile.js +0 -4
  403. package/lib/AWS/Profile.js.map +0 -1
  404. package/lib/AWS/StageConfig.d.ts +0 -25
  405. package/lib/AWS/StageConfig.d.ts.map +0 -1
  406. package/lib/AWS/StageConfig.js +0 -23
  407. package/lib/AWS/StageConfig.js.map +0 -1
  408. package/lib/Cloudflare/Account.d.ts +0 -10
  409. package/lib/Cloudflare/Account.d.ts.map +0 -1
  410. package/lib/Cloudflare/Account.js +0 -24
  411. package/lib/Cloudflare/Account.js.map +0 -1
  412. package/lib/Cloudflare/StageConfig.d.ts +0 -8
  413. package/lib/Cloudflare/StageConfig.d.ts.map +0 -1
  414. package/lib/Cloudflare/StageConfig.js +0 -4
  415. package/lib/Cloudflare/StageConfig.js.map +0 -1
  416. package/src/AWS/Account.ts +0 -56
  417. package/src/AWS/Profile.ts +0 -5
  418. package/src/AWS/StageConfig.ts +0 -44
  419. package/src/Cloudflare/Account.ts +0 -38
  420. package/src/Cloudflare/StageConfig.ts +0 -8
@@ -31,58 +31,60 @@ import * as Server from "../../Server/index.ts";
31
31
  import { Stack } from "../../Stack.ts";
32
32
  import { sha256Object } from "../../Util/sha256.ts";
33
33
  import { normalizeNulls } from "../../Util/stable.ts";
34
- import { Account } from "../Account.ts";
34
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
35
35
  import { CloudflareLogs, type TelemetryFilter } from "../Logs.ts";
36
36
  import type { Providers } from "../Providers.ts";
37
37
  import { Container, ContainerTypeId } from "./Container.ts";
38
38
 
39
39
  export { Credentials } from "@distilled.cloud/cloudflare/Credentials";
40
40
 
41
- export type InstanceType = NonNullable<
42
- Containers.CreateContainerApplicationRequest["configuration"]["instanceType"]
43
- >;
44
- export type SchedulingPolicy = NonNullable<
45
- Containers.CreateContainerApplicationRequest["schedulingPolicy"]
46
- >;
47
- export type Observability = NonNullable<
48
- Containers.CreateContainerApplicationRequest["configuration"]["observability"]
49
- >;
50
- export type Secret = NonNullable<
51
- Containers.CreateContainerApplicationRequest["configuration"]["secrets"]
52
- >[number];
53
- export type Disk = NonNullable<
54
- Containers.CreateContainerApplicationRequest["configuration"]["disk"]
55
- >;
56
- export type EnvironmentVariable = NonNullable<
57
- Containers.CreateContainerApplicationRequest["configuration"]["environmentVariables"]
58
- >[number];
59
- export type Label = NonNullable<
60
- Containers.CreateContainerApplicationRequest["configuration"]["labels"]
61
- >[number];
62
- export type Network = NonNullable<
63
- Containers.CreateContainerApplicationRequest["configuration"]["network"]
64
- >;
65
- export type Dns = NonNullable<
66
- Containers.CreateContainerApplicationRequest["configuration"]["dns"]
67
- >;
68
- export type Port = NonNullable<
69
- Containers.CreateContainerApplicationRequest["configuration"]["ports"]
70
- >[number];
71
- export type Check = NonNullable<
72
- Containers.CreateContainerApplicationRequest["configuration"]["checks"]
73
- >[number];
74
- export type Constraints = {
75
- tier?: number;
76
- };
77
- export type Affinities = {
78
- colocation?: "datacenter";
79
- };
80
- export type Configuration =
81
- Containers.CreateContainerApplicationRequest["configuration"];
82
- export interface Rollout {
83
- strategy?: "rolling" | "immediate";
84
- kind?: "full_auto";
85
- stepPercentage?: number;
41
+ export namespace ContainerApplication {
42
+ export type InstanceType = NonNullable<
43
+ Containers.CreateContainerApplicationRequest["configuration"]["instanceType"]
44
+ >;
45
+ export type SchedulingPolicy = NonNullable<
46
+ Containers.CreateContainerApplicationRequest["schedulingPolicy"]
47
+ >;
48
+ export type Observability = NonNullable<
49
+ Containers.CreateContainerApplicationRequest["configuration"]["observability"]
50
+ >;
51
+ export type Secret = NonNullable<
52
+ Containers.CreateContainerApplicationRequest["configuration"]["secrets"]
53
+ >[number];
54
+ export type Disk = NonNullable<
55
+ Containers.CreateContainerApplicationRequest["configuration"]["disk"]
56
+ >;
57
+ export type EnvironmentVariable = NonNullable<
58
+ Containers.CreateContainerApplicationRequest["configuration"]["environmentVariables"]
59
+ >[number];
60
+ export type Label = NonNullable<
61
+ Containers.CreateContainerApplicationRequest["configuration"]["labels"]
62
+ >[number];
63
+ export type Network = NonNullable<
64
+ Containers.CreateContainerApplicationRequest["configuration"]["network"]
65
+ >;
66
+ export type Dns = NonNullable<
67
+ Containers.CreateContainerApplicationRequest["configuration"]["dns"]
68
+ >;
69
+ export type Port = NonNullable<
70
+ Containers.CreateContainerApplicationRequest["configuration"]["ports"]
71
+ >[number];
72
+ export type Check = NonNullable<
73
+ Containers.CreateContainerApplicationRequest["configuration"]["checks"]
74
+ >[number];
75
+ export type Constraints = {
76
+ tier?: number;
77
+ };
78
+ export type Affinities = {
79
+ colocation?: "datacenter";
80
+ };
81
+ export type Configuration =
82
+ Containers.CreateContainerApplicationRequest["configuration"];
83
+ export interface Rollout {
84
+ strategy?: "rolling" | "immediate";
85
+ kind?: "full_auto";
86
+ stepPercentage?: number;
87
+ }
86
88
  }
87
89
 
88
90
  export interface ContainerApplicationProps extends PlatformProps {
@@ -102,6 +104,32 @@ export interface ContainerApplicationProps extends PlatformProps {
102
104
  * @default "bun"
103
105
  */
104
106
  runtime?: "bun" | "node";
107
+ /**
108
+ * Module specifiers that Rolldown should mark as external when bundling
109
+ * the container entrypoint. The matching packages are installed inside the
110
+ * image via the runtime's package manager (`bun add` for `runtime: "bun"`,
111
+ * `npm install` for `runtime: "node"`) before the entrypoint runs.
112
+ *
113
+ * Use this for native dependencies that must not be bundled (e.g. `sharp`,
114
+ * `impit`) or for packages that intentionally ship in the base image.
115
+ *
116
+ * Install inside the image is controlled by {@link autoInstallExternals}
117
+ * (default `true`); set it to `false` if your custom `dockerfile` already
118
+ * installs these packages and you want to avoid the redundant step.
119
+ */
120
+ external?: string[];
121
+ /**
122
+ * Whether to auto-install the packages listed in {@link external} inside
123
+ * the container image (via `bun add` or `npm install`) before running the
124
+ * entrypoint.
125
+ *
126
+ * @default true
127
+ *
128
+ * Set to `false` when your custom `dockerfile` already installs these
129
+ * packages (for example, via a base image that pre-installs `sharp`), to
130
+ * avoid the redundant install step.
131
+ */
132
+ autoInstallExternals?: boolean;
105
133
  /**
106
134
  * Human-readable application name. If omitted, Alchemy derives a deterministic
107
135
  * physical name from the stack, stage, and logical ID.
@@ -127,16 +155,16 @@ export interface ContainerApplicationProps extends PlatformProps {
127
155
  * Scheduling policy used by Cloudflare's containers control plane.
128
156
  * @default "default"
129
157
  */
130
- schedulingPolicy?: SchedulingPolicy;
158
+ schedulingPolicy?: ContainerApplication.SchedulingPolicy;
131
159
  /**
132
160
  * Instance type for each deployment.
133
161
  * @default "dev"
134
162
  */
135
- instanceType?: InstanceType;
163
+ instanceType?: ContainerApplication.InstanceType;
136
164
  /**
137
165
  * Observability settings for the deployment.
138
166
  */
139
- observability?: Observability;
167
+ observability?: ContainerApplication.Observability;
140
168
  /**
141
169
  * SSH public keys to install into the deployment.
142
170
  */
@@ -144,7 +172,7 @@ export interface ContainerApplicationProps extends PlatformProps {
144
172
  /**
145
173
  * Secrets exposed to the container runtime as environment variables.
146
174
  */
147
- secrets?: Secret[];
175
+ secrets?: ContainerApplication.Secret[];
148
176
  /**
149
177
  * CPU allocation override for each deployment.
150
178
  */
@@ -156,19 +184,19 @@ export interface ContainerApplicationProps extends PlatformProps {
156
184
  /**
157
185
  * Disk allocation override for each deployment.
158
186
  */
159
- disk?: Disk;
187
+ disk?: ContainerApplication.Disk;
160
188
  /**
161
189
  * Plain environment variables passed to the container runtime.
162
190
  */
163
- environmentVariables?: EnvironmentVariable[];
191
+ environmentVariables?: ContainerApplication.EnvironmentVariable[];
164
192
  /**
165
193
  * Labels attached to the deployment.
166
194
  */
167
- labels?: Label[];
195
+ labels?: ContainerApplication.Label[];
168
196
  /**
169
197
  * Network configuration for the deployment.
170
198
  */
171
- network?: Network;
199
+ network?: ContainerApplication.Network;
172
200
  /**
173
201
  * Command override for the container image.
174
202
  */
@@ -180,27 +208,27 @@ export interface ContainerApplicationProps extends PlatformProps {
180
208
  /**
181
209
  * DNS configuration for the deployment.
182
210
  */
183
- dns?: Dns;
211
+ dns?: ContainerApplication.Dns;
184
212
  /**
185
213
  * Exposed ports for the deployment.
186
214
  */
187
- ports?: Port[];
215
+ ports?: ContainerApplication.Port[];
188
216
  /**
189
217
  * Health and readiness checks for the deployment.
190
218
  */
191
- checks?: Check[];
219
+ checks?: ContainerApplication.Check[];
192
220
  /**
193
221
  * Resource constraints for the application.
194
222
  */
195
- constraints?: Constraints;
223
+ constraints?: ContainerApplication.Constraints;
196
224
  /**
197
225
  * Affinity hints for scheduling.
198
226
  */
199
- affinities?: Affinities;
227
+ affinities?: ContainerApplication.Affinities;
200
228
  /**
201
229
  * Progressive rollout settings applied after updates.
202
230
  */
203
- rollout?: Rollout;
231
+ rollout?: ContainerApplication.Rollout;
204
232
  /**
205
233
  * Container registry host to use for generated Dockerfile builds.
206
234
  * @default "registry.cloudflare.com"
@@ -233,12 +261,12 @@ export interface ContainerApplication<Shape = unknown> extends Resource<
233
261
  applicationId: string;
234
262
  applicationName: string;
235
263
  accountId: string;
236
- schedulingPolicy: SchedulingPolicy;
264
+ schedulingPolicy: ContainerApplication.SchedulingPolicy;
237
265
  instances: number;
238
266
  maxInstances: number;
239
- constraints: Constraints | undefined;
240
- affinities: Affinities | undefined;
241
- configuration: Configuration;
267
+ constraints: ContainerApplication.Constraints | undefined;
268
+ affinities: ContainerApplication.Affinities | undefined;
269
+ configuration: ContainerApplication.Configuration;
242
270
  durableObjects:
243
271
  | {
244
272
  namespaceId: string;
@@ -327,7 +355,7 @@ export const ContainerProvider = () =>
327
355
  Container,
328
356
  Effect.gen(function* () {
329
357
  const stack = yield* Stack;
330
- const accountId = yield* Account;
358
+ const { accountId } = yield* CloudflareEnvironment;
331
359
  const adoptPolicy = yield* Effect.serviceOption(AdoptPolicy).pipe(
332
360
  Effect.map(Option.getOrElse(() => false)),
333
361
  );
@@ -397,7 +425,7 @@ export const ContainerProvider = () =>
397
425
  dns: props.dns,
398
426
  ports: props.ports,
399
427
  checks: props.checks,
400
- }) as Configuration;
428
+ }) as ContainerApplication.Configuration;
401
429
 
402
430
  const computeImageHash = Effect.fnUntraced(function* (
403
431
  id: string,
@@ -410,15 +438,21 @@ export const ContainerProvider = () =>
410
438
  );
411
439
  }
412
440
  const runtime = props.runtime ?? "bun";
413
- const { code, hash: bundleHash } = yield* bundleProgram({
441
+ const { files, hash: bundleHash } = yield* bundleProgram({
414
442
  id,
415
443
  main,
416
444
  runtime,
417
445
  handler: props.handler,
418
446
  isExternal: props.isExternal,
447
+ external: props.external,
419
448
  });
420
449
 
421
- const finalDockerfile = buildFinalDockerfile(props.dockerfile, runtime);
450
+ const finalDockerfile = buildFinalDockerfile(
451
+ props.dockerfile,
452
+ runtime,
453
+ props.external,
454
+ props.autoInstallExternals,
455
+ );
422
456
  const imageHash = (yield* sha256Object({
423
457
  bundleHash,
424
458
  dockerfile: finalDockerfile,
@@ -429,7 +463,7 @@ export const ContainerProvider = () =>
429
463
  const repositoryName = name.toLowerCase();
430
464
  const imageRef = `${registryId}/${accountId}/${repositoryName}:${imageHash}`;
431
465
 
432
- return { code, imageRef, imageHash };
466
+ return { files, imageRef, imageHash };
433
467
  });
434
468
 
435
469
  const bundleProgram = Effect.fnUntraced(function* ({
@@ -437,12 +471,14 @@ export const ContainerProvider = () =>
437
471
  runtime,
438
472
  handler = "default",
439
473
  isExternal = false,
474
+ external = [],
440
475
  }: {
441
476
  id: string;
442
477
  main: string;
443
478
  runtime: "bun" | "node";
444
479
  handler: string | undefined;
445
480
  isExternal?: boolean;
481
+ external?: string[];
446
482
  }) {
447
483
  const realMain = yield* fs.realPath(main);
448
484
  const cwd = yield* findCwdForBundle(realMain);
@@ -459,6 +495,7 @@ export const ContainerProvider = () =>
459
495
  "cloudflare:workers",
460
496
  "cloudflare:workflows",
461
497
  ...(runtime === "bun" ? ["bun", "bun:*"] : []),
498
+ ...external,
462
499
  ],
463
500
  platform: "node",
464
501
  plugins,
@@ -549,28 +586,49 @@ await Effect.runPromise(serverEffect).catch((err) => {
549
586
  ),
550
587
  );
551
588
 
552
- const mainFile = bundleOutput.files[0];
553
- const code =
554
- typeof mainFile.content === "string"
555
- ? new TextEncoder().encode(mainFile.content)
556
- : mainFile.content;
557
-
558
- return { code, hash: bundleOutput.hash };
589
+ // Rolldown can emit multiple chunk files (entry + shared chunks).
590
+ // Return every file so downstream code can materialize all of them
591
+ // into the Docker build context — dropping any of them produces a
592
+ // `Cannot find module './chunk-XXX.js'` runtime crash inside the
593
+ // container (with zero stdout, because it crashes before any user
594
+ // code runs).
595
+ const files = bundleOutput.files.map((f) => ({
596
+ path: f.path,
597
+ content:
598
+ typeof f.content === "string"
599
+ ? new TextEncoder().encode(f.content)
600
+ : f.content,
601
+ }));
602
+
603
+ return { files, hash: bundleOutput.hash };
559
604
  });
560
605
 
561
606
  const buildFinalDockerfile = (
562
607
  userDockerfile: string | undefined,
563
608
  runtime: "bun" | "node",
609
+ external: string[] = [],
610
+ autoInstallExternals = true,
564
611
  ): string => {
565
612
  const base =
566
613
  userDockerfile?.trim() ??
567
614
  (runtime === "bun" ? "FROM oven/bun:1" : "FROM node:22-slim");
568
615
  const runtimeBin = runtime === "bun" ? "bun" : "node";
616
+ const installCmd = runtime === "bun" ? "bun add" : "npm install";
617
+ const installStep =
618
+ autoInstallExternals && external.length > 0
619
+ ? `RUN ${installCmd} ${external.join(" ")}`
620
+ : "";
569
621
  return [
570
622
  base,
571
623
  "",
572
624
  "WORKDIR /app",
625
+ ...(installStep ? [installStep, ""] : []),
573
626
  "COPY index.mjs /app/index.mjs",
627
+ // Copy any additional rolldown chunks (`chunk-XXX.js`,
628
+ // `BunServices-YYY.js`, …). The glob matches zero or more files;
629
+ // non-trivial bundles always emit at least one chunk, minimal
630
+ // bundles emit none and the COPY no-ops.
631
+ "COPY *.js /app/",
574
632
  `ENTRYPOINT ["${runtimeBin}", "/app/index.mjs"]`,
575
633
  "",
576
634
  ].join("\n");
@@ -579,7 +637,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
579
637
  const buildAndPushImage = Effect.fnUntraced(function* (
580
638
  id: string,
581
639
  props: ContainerApplicationProps,
582
- code: Uint8Array,
640
+ files: ReadonlyArray<{ path: string; content: Uint8Array }>,
583
641
  imageRef: string,
584
642
  session?: { note: (message: string) => Effect.Effect<void> },
585
643
  ) {
@@ -597,11 +655,24 @@ await Effect.runPromise(serverEffect).catch((err) => {
597
655
  dotAlchemy,
598
656
  `${id}-container`,
599
657
  );
600
- const finalDockerfile = buildFinalDockerfile(props.dockerfile, runtime);
658
+ const finalDockerfile = buildFinalDockerfile(
659
+ props.dockerfile,
660
+ runtime,
661
+ props.external,
662
+ props.autoInstallExternals,
663
+ );
601
664
  yield* materializeDockerfile(finalDockerfile, contextDir);
602
- yield* writeContextFiles(contextDir, [
603
- { path: "index.mjs", content: code },
604
- ]);
665
+ yield* writeContextFiles(
666
+ contextDir,
667
+ files.map((f, i) => ({
668
+ // Keep the entry rename to `index.mjs` so the Dockerfile
669
+ // ENTRYPOINT (`ENTRYPOINT ["bun", "/app/index.mjs"]`) stays
670
+ // valid; preserve rolldown-assigned fileNames for every other
671
+ // chunk so intra-bundle relative imports resolve at runtime.
672
+ path: i === 0 ? "index.mjs" : f.path,
673
+ content: f.content,
674
+ })),
675
+ );
605
676
  yield* dockerBuild({
606
677
  tag: imageRef,
607
678
  context: contextDir,
@@ -644,8 +715,8 @@ await Effect.runPromise(serverEffect).catch((err) => {
644
715
  rollout,
645
716
  }: {
646
717
  applicationId: string;
647
- configuration: Configuration;
648
- rollout: Rollout | undefined;
718
+ configuration: ContainerApplication.Configuration;
719
+ rollout: ContainerApplication.Rollout | undefined;
649
720
  }) {
650
721
  const strategy = rollout?.strategy ?? "immediate";
651
722
  const stepPercentage =
@@ -680,7 +751,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
680
751
  id: string;
681
752
  news: ContainerApplicationProps;
682
753
  name: string;
683
- configuration: Configuration;
754
+ configuration: ContainerApplication.Configuration;
684
755
  durableObjects:
685
756
  | {
686
757
  namespaceId: string;
@@ -821,11 +892,14 @@ await Effect.runPromise(serverEffect).catch((err) => {
821
892
  yield* Effect.logInfo(
822
893
  `Cloudflare Container update: preparing ${existing.applicationName}`,
823
894
  );
824
- const { code, imageRef, imageHash } = yield* computeImageHash(id, news);
895
+ const { files, imageRef, imageHash } = yield* computeImageHash(
896
+ id,
897
+ news,
898
+ );
825
899
  const configuration = desiredConfiguration(news, imageRef);
826
900
 
827
901
  if (imageHash !== existing.hash?.image) {
828
- yield* buildAndPushImage(id, news, code, imageRef, session);
902
+ yield* buildAndPushImage(id, news, files, imageRef, session);
829
903
  }
830
904
 
831
905
  yield* session.note(
@@ -927,12 +1001,12 @@ await Effect.runPromise(serverEffect).catch((err) => {
927
1001
  `Cloudflare Container precreate: starting ${name}`,
928
1002
  );
929
1003
 
930
- const { code, imageRef, imageHash } = yield* computeImageHash(
1004
+ const { files, imageRef, imageHash } = yield* computeImageHash(
931
1005
  id,
932
1006
  news,
933
1007
  );
934
1008
  const configuration = desiredConfiguration(news, imageRef);
935
- yield* buildAndPushImage(id, news, code, imageRef, session);
1009
+ yield* buildAndPushImage(id, news, files, imageRef, session);
936
1010
 
937
1011
  // Precreate intentionally omits the Durable Object attachment so the
938
1012
  // worker can bind to this application id and break the circular
@@ -967,7 +1041,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
967
1041
  `Cloudflare Container create: starting ${name}${adoptPolicy ? " with adopt" : ""}`,
968
1042
  );
969
1043
  const durableObjects = yield* getDurableObjects(bindings);
970
- const { code, imageRef, imageHash } = yield* computeImageHash(
1044
+ const { files, imageRef, imageHash } = yield* computeImageHash(
971
1045
  id,
972
1046
  news,
973
1047
  );
@@ -1019,7 +1093,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
1019
1093
  ),
1020
1094
  );
1021
1095
  if (imageHash !== output.hash?.image) {
1022
- yield* buildAndPushImage(id, news, code, imageRef, session);
1096
+ yield* buildAndPushImage(id, news, files, imageRef, session);
1023
1097
  }
1024
1098
  const result = yield* createApplication({
1025
1099
  id,
@@ -1044,7 +1118,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
1044
1118
  });
1045
1119
  }
1046
1120
 
1047
- yield* buildAndPushImage(id, news, code, imageRef, session);
1121
+ yield* buildAndPushImage(id, news, files, imageRef, session);
1048
1122
 
1049
1123
  const result = yield* createApplication({
1050
1124
  id,
@@ -1169,10 +1243,14 @@ const toAttributes = (
1169
1243
  instances: application.instances,
1170
1244
  maxInstances: application.maxInstances,
1171
1245
  constraints: normalizeNulls(
1172
- application.constraints as Constraints | undefined,
1246
+ application.constraints as ContainerApplication.Constraints | undefined,
1247
+ ),
1248
+ affinities: normalizeNulls(
1249
+ application.affinities as ContainerApplication.Affinities | undefined,
1250
+ ),
1251
+ configuration: normalizeNulls(
1252
+ application.configuration as ContainerApplication.Configuration,
1173
1253
  ),
1174
- affinities: normalizeNulls(application.affinities as Affinities | undefined),
1175
- configuration: normalizeNulls(application.configuration as Configuration),
1176
1254
  durableObjects: normalizeNulls(application.durableObjects) as
1177
1255
  | { namespaceId: string }
1178
1256
  | undefined,
@@ -0,0 +1,75 @@
1
+ import {
2
+ apiKeyCredentials,
3
+ apiTokenCredentials,
4
+ Credentials,
5
+ oauthCredentials,
6
+ } from "@distilled.cloud/cloudflare/Credentials";
7
+ import { ConfigError } from "@distilled.cloud/core/errors";
8
+ import * as Config from "effect/Config";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Layer from "effect/Layer";
11
+ import * as Match from "effect/Match";
12
+ import * as Redacted from "effect/Redacted";
13
+ import { getAuthProvider } from "../Auth/AuthProvider.ts";
14
+ import { ALCHEMY_PROFILE, loadOrConfigure } from "../Auth/Profile.ts";
15
+ import {
16
+ CLOUDFLARE_AUTH_PROVIDER_NAME,
17
+ type CloudflareAuthConfig,
18
+ type CloudflareResolvedCredentials,
19
+ } from "./Auth/AuthProvider.ts";
20
+
21
+ export { Credentials, fromEnv } from "@distilled.cloud/cloudflare/Credentials";
22
+
23
+ /**
24
+ * Build a `Credentials` layer that resolves Cloudflare credentials via the
25
+ * Alchemy AuthProvider using the configured profile (defaults to "default",
26
+ * overridable with the `ALCHEMY_PROFILE` env/config value).
27
+ */
28
+ export const fromAuthProvider = () =>
29
+ Layer.effect(
30
+ Credentials,
31
+ Effect.gen(function* () {
32
+ const auth = yield* getAuthProvider<
33
+ CloudflareAuthConfig,
34
+ CloudflareResolvedCredentials
35
+ >(CLOUDFLARE_AUTH_PROVIDER_NAME);
36
+ const profileName = yield* ALCHEMY_PROFILE;
37
+ const ci = yield* Config.boolean("CI").pipe(Config.withDefault(false));
38
+ const ctx = yield* Effect.context<never>();
39
+
40
+ return loadOrConfigure(auth, profileName, { ci }).pipe(
41
+ Effect.flatMap((config) =>
42
+ auth.read(profileName, config as CloudflareAuthConfig),
43
+ ),
44
+ Effect.map((creds) =>
45
+ Match.value(creds).pipe(
46
+ Match.when({ type: "apiToken" }, (c) =>
47
+ apiTokenCredentials({
48
+ apiToken: Redacted.value(c.apiToken),
49
+ }),
50
+ ),
51
+ Match.when({ type: "apiKey" }, (c) =>
52
+ apiKeyCredentials({
53
+ apiKey: Redacted.value(c.apiKey),
54
+ email: Redacted.value(c.email),
55
+ }),
56
+ ),
57
+ Match.when({ type: "oauth" }, (c) =>
58
+ oauthCredentials({
59
+ accessToken: Redacted.value(c.accessToken),
60
+ expiresAt: c.expires,
61
+ }),
62
+ ),
63
+ Match.exhaustive,
64
+ ),
65
+ ),
66
+ Effect.mapError(
67
+ (e) =>
68
+ new ConfigError({
69
+ message: `Failed to resolve Cloudflare credentials for profile '${profileName}': ${(e as { message?: string }).message ?? String(e)}`,
70
+ }),
71
+ ),
72
+ Effect.provide(ctx),
73
+ );
74
+ }),
75
+ );
@@ -5,7 +5,7 @@ import { isResolved } from "../../Diff.ts";
5
5
  import { createPhysicalName } from "../../PhysicalName.ts";
6
6
  import * as Provider from "../../Provider.ts";
7
7
  import { Resource } from "../../Resource.ts";
8
- import { Account } from "../Account.ts";
8
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
9
9
  import type { Providers } from "../Providers.ts";
10
10
 
11
11
  export type Jurisdiction = "default" | "eu" | "fedramp";
@@ -95,7 +95,7 @@ export const DatabaseProvider = () =>
95
95
  Provider.effect(
96
96
  D1Database,
97
97
  Effect.gen(function* () {
98
- const accountId = yield* Account;
98
+ const { accountId } = yield* CloudflareEnvironment;
99
99
  const createDb = yield* d1.createDatabase;
100
100
  const getDb = yield* d1.getDatabase;
101
101
  const patchDb = yield* d1.patchDatabase;
@@ -4,7 +4,7 @@ import { isResolved } from "../../Diff.ts";
4
4
  import { createPhysicalName } from "../../PhysicalName.ts";
5
5
  import * as Provider from "../../Provider.ts";
6
6
  import { Resource } from "../../Resource.ts";
7
- import { Account } from "../Account.ts";
7
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
8
8
  import type { Providers } from "../Providers.ts";
9
9
  import { KVNamespaceBinding } from "./KVNamespaceBinding.ts";
10
10
 
@@ -63,7 +63,7 @@ export const KVNamespaceProvider = () =>
63
63
  Provider.effect(
64
64
  KVNamespace,
65
65
  Effect.gen(function* () {
66
- const accountId = yield* Account;
66
+ const { accountId } = yield* CloudflareEnvironment;
67
67
  const createNamespace = yield* kv.createNamespace;
68
68
  const updateNamespace = yield* kv.updateNamespace;
69
69
  const deleteNamespace = yield* kv.deleteNamespace;