alchemy 2.0.0-beta.62 → 2.0.0-beta.63

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 (489) hide show
  1. package/README.md +12 -12
  2. package/bin/exec.js +1959 -70
  3. package/bin/exec.js.map +1 -1
  4. package/lib/AWS/AuthProvider.js +1 -1
  5. package/lib/AWS/AuthProvider.js.map +1 -1
  6. package/lib/AWS/EC2/hosted.d.ts.map +1 -1
  7. package/lib/AWS/EC2/hosted.js +2 -1
  8. package/lib/AWS/EC2/hosted.js.map +1 -1
  9. package/lib/AWS/ECS/Task.d.ts.map +1 -1
  10. package/lib/AWS/ECS/Task.js +2 -1
  11. package/lib/AWS/ECS/Task.js.map +1 -1
  12. package/lib/AWS/Lambda/Function.d.ts.map +1 -1
  13. package/lib/AWS/Lambda/Function.js +13 -40
  14. package/lib/AWS/Lambda/Function.js.map +1 -1
  15. package/lib/AWS/Lambda/MicrovmRuntimeContext.d.ts.map +1 -1
  16. package/lib/AWS/Lambda/MicrovmRuntimeContext.js +9 -21
  17. package/lib/AWS/Lambda/MicrovmRuntimeContext.js.map +1 -1
  18. package/lib/Action.d.ts +8 -0
  19. package/lib/Action.d.ts.map +1 -1
  20. package/lib/Action.js +16 -5
  21. package/lib/Action.js.map +1 -1
  22. package/lib/ActionRuntimeContext.d.ts +14 -0
  23. package/lib/ActionRuntimeContext.d.ts.map +1 -0
  24. package/lib/ActionRuntimeContext.js +56 -0
  25. package/lib/ActionRuntimeContext.js.map +1 -0
  26. package/lib/Apply.d.ts.map +1 -1
  27. package/lib/Apply.js +40 -6
  28. package/lib/Apply.js.map +1 -1
  29. package/lib/Auth/AuthProvider.d.ts +3 -3
  30. package/lib/Auth/AuthProvider.d.ts.map +1 -1
  31. package/lib/Auth/AuthProvider.js +1 -1
  32. package/lib/Auth/AuthProvider.js.map +1 -1
  33. package/lib/Auth/Lock.d.ts.map +1 -1
  34. package/lib/Auth/Lock.js +5 -2
  35. package/lib/Auth/Lock.js.map +1 -1
  36. package/lib/Bundle/PurePlugin.d.ts.map +1 -1
  37. package/lib/Bundle/PurePlugin.js +26 -1
  38. package/lib/Bundle/PurePlugin.js.map +1 -1
  39. package/lib/Bundle/Vite.d.ts +2 -0
  40. package/lib/Bundle/Vite.d.ts.map +1 -1
  41. package/lib/Bundle/Vite.js +24 -1
  42. package/lib/Bundle/Vite.js.map +1 -1
  43. package/lib/Cli/LoggingCli.d.ts.map +1 -1
  44. package/lib/Cli/LoggingCli.js +7 -4
  45. package/lib/Cli/LoggingCli.js.map +1 -1
  46. package/lib/Cli/commands/_shared.d.ts +19 -0
  47. package/lib/Cli/commands/_shared.d.ts.map +1 -1
  48. package/lib/Cli/commands/_shared.js +22 -0
  49. package/lib/Cli/commands/_shared.js.map +1 -1
  50. package/lib/Cli/commands/login.d.ts +7 -3
  51. package/lib/Cli/commands/login.d.ts.map +1 -1
  52. package/lib/Cli/commands/login.js +70 -12
  53. package/lib/Cli/commands/login.js.map +1 -1
  54. package/lib/Cli/commands/profile.d.ts.map +1 -1
  55. package/lib/Cli/commands/profile.js +7 -20
  56. package/lib/Cli/commands/profile.js.map +1 -1
  57. package/lib/Cloudflare/AI/LanguageModel.js +21 -4
  58. package/lib/Cloudflare/AI/LanguageModel.js.map +1 -1
  59. package/lib/Cloudflare/AI/QuerySearchLocal.d.ts +37 -0
  60. package/lib/Cloudflare/AI/QuerySearchLocal.d.ts.map +1 -0
  61. package/lib/Cloudflare/AI/QuerySearchLocal.js +53 -0
  62. package/lib/Cloudflare/AI/QuerySearchLocal.js.map +1 -0
  63. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts +35 -0
  64. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts.map +1 -0
  65. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js +47 -0
  66. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js.map +1 -0
  67. package/lib/Cloudflare/AI/SearchHttpClient.d.ts +34 -0
  68. package/lib/Cloudflare/AI/SearchHttpClient.d.ts.map +1 -0
  69. package/lib/Cloudflare/AI/SearchHttpClient.js +262 -0
  70. package/lib/Cloudflare/AI/SearchHttpClient.js.map +1 -0
  71. package/lib/Cloudflare/AI/index.d.ts +2 -0
  72. package/lib/Cloudflare/AI/index.d.ts.map +1 -1
  73. package/lib/Cloudflare/AI/index.js +2 -0
  74. package/lib/Cloudflare/AI/index.js.map +1 -1
  75. package/lib/Cloudflare/Auth/AuthProvider.js +1 -1
  76. package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
  77. package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
  78. package/lib/Cloudflare/Containers/ContainerBundle.js +11 -1
  79. package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
  80. package/lib/Cloudflare/Containers/ContainerPlatform.d.ts.map +1 -1
  81. package/lib/Cloudflare/Containers/ContainerPlatform.js +12 -33
  82. package/lib/Cloudflare/Containers/ContainerPlatform.js.map +1 -1
  83. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts +24 -0
  84. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts.map +1 -0
  85. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js +106 -0
  86. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js.map +1 -0
  87. package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts +38 -0
  88. package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts.map +1 -0
  89. package/lib/Cloudflare/D1/QueryDatabaseLocal.js +54 -0
  90. package/lib/Cloudflare/D1/QueryDatabaseLocal.js.map +1 -0
  91. package/lib/Cloudflare/D1/index.d.ts +1 -0
  92. package/lib/Cloudflare/D1/index.d.ts.map +1 -1
  93. package/lib/Cloudflare/D1/index.js +1 -0
  94. package/lib/Cloudflare/D1/index.js.map +1 -1
  95. package/lib/Cloudflare/DNS/DnsHttp.d.ts +16 -1
  96. package/lib/Cloudflare/DNS/DnsHttp.d.ts.map +1 -1
  97. package/lib/Cloudflare/DNS/DnsHttp.js +6 -1
  98. package/lib/Cloudflare/DNS/DnsHttp.js.map +1 -1
  99. package/lib/Cloudflare/DNS/DnsLocal.d.ts +22 -0
  100. package/lib/Cloudflare/DNS/DnsLocal.d.ts.map +1 -0
  101. package/lib/Cloudflare/DNS/DnsLocal.js +31 -0
  102. package/lib/Cloudflare/DNS/DnsLocal.js.map +1 -0
  103. package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts +3 -3
  104. package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts.map +1 -1
  105. package/lib/Cloudflare/DNS/ReadDnsHttp.js +3 -4
  106. package/lib/Cloudflare/DNS/ReadDnsHttp.js.map +1 -1
  107. package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts +32 -0
  108. package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts.map +1 -0
  109. package/lib/Cloudflare/DNS/ReadDnsLocal.js +35 -0
  110. package/lib/Cloudflare/DNS/ReadDnsLocal.js.map +1 -0
  111. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts +3 -3
  112. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts.map +1 -1
  113. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js +4 -4
  114. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js.map +1 -1
  115. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts +40 -0
  116. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts.map +1 -0
  117. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js +43 -0
  118. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js.map +1 -0
  119. package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts +3 -3
  120. package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts.map +1 -1
  121. package/lib/Cloudflare/DNS/WriteDnsHttp.js +3 -4
  122. package/lib/Cloudflare/DNS/WriteDnsHttp.js.map +1 -1
  123. package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts +38 -0
  124. package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts.map +1 -0
  125. package/lib/Cloudflare/DNS/WriteDnsLocal.js +41 -0
  126. package/lib/Cloudflare/DNS/WriteDnsLocal.js.map +1 -0
  127. package/lib/Cloudflare/DNS/index.d.ts +3 -0
  128. package/lib/Cloudflare/DNS/index.d.ts.map +1 -1
  129. package/lib/Cloudflare/DNS/index.js +3 -0
  130. package/lib/Cloudflare/DNS/index.js.map +1 -1
  131. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts +27 -0
  132. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts.map +1 -0
  133. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js +86 -0
  134. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js.map +1 -0
  135. package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts +41 -0
  136. package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts.map +1 -0
  137. package/lib/Cloudflare/Flagship/ReadFlagsLocal.js +57 -0
  138. package/lib/Cloudflare/Flagship/ReadFlagsLocal.js.map +1 -0
  139. package/lib/Cloudflare/Flagship/index.d.ts +1 -0
  140. package/lib/Cloudflare/Flagship/index.d.ts.map +1 -1
  141. package/lib/Cloudflare/Flagship/index.js +1 -0
  142. package/lib/Cloudflare/Flagship/index.js.map +1 -1
  143. package/lib/Cloudflare/KV/NamespaceHttp.d.ts +16 -1
  144. package/lib/Cloudflare/KV/NamespaceHttp.d.ts.map +1 -1
  145. package/lib/Cloudflare/KV/NamespaceHttp.js +8 -2
  146. package/lib/Cloudflare/KV/NamespaceHttp.js.map +1 -1
  147. package/lib/Cloudflare/KV/NamespaceLocal.d.ts +22 -0
  148. package/lib/Cloudflare/KV/NamespaceLocal.d.ts.map +1 -0
  149. package/lib/Cloudflare/KV/NamespaceLocal.js +32 -0
  150. package/lib/Cloudflare/KV/NamespaceLocal.js.map +1 -0
  151. package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts +2 -2
  152. package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts.map +1 -1
  153. package/lib/Cloudflare/KV/ReadNamespaceHttp.js +5 -6
  154. package/lib/Cloudflare/KV/ReadNamespaceHttp.js.map +1 -1
  155. package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts +27 -0
  156. package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts.map +1 -0
  157. package/lib/Cloudflare/KV/ReadNamespaceLocal.js +30 -0
  158. package/lib/Cloudflare/KV/ReadNamespaceLocal.js.map +1 -0
  159. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts +3 -3
  160. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts.map +1 -1
  161. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js +6 -6
  162. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js.map +1 -1
  163. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts +34 -0
  164. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts.map +1 -0
  165. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js +37 -0
  166. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js.map +1 -0
  167. package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts +2 -2
  168. package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts.map +1 -1
  169. package/lib/Cloudflare/KV/WriteNamespaceHttp.js +5 -6
  170. package/lib/Cloudflare/KV/WriteNamespaceHttp.js.map +1 -1
  171. package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts +27 -0
  172. package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts.map +1 -0
  173. package/lib/Cloudflare/KV/WriteNamespaceLocal.js +30 -0
  174. package/lib/Cloudflare/KV/WriteNamespaceLocal.js.map +1 -0
  175. package/lib/Cloudflare/KV/index.d.ts +3 -0
  176. package/lib/Cloudflare/KV/index.d.ts.map +1 -1
  177. package/lib/Cloudflare/KV/index.js +3 -0
  178. package/lib/Cloudflare/KV/index.js.map +1 -1
  179. package/lib/Cloudflare/Queues/QueueHttp.d.ts +20 -1
  180. package/lib/Cloudflare/Queues/QueueHttp.d.ts.map +1 -1
  181. package/lib/Cloudflare/Queues/QueueHttp.js +2 -2
  182. package/lib/Cloudflare/Queues/QueueHttp.js.map +1 -1
  183. package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts +9 -3
  184. package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts.map +1 -1
  185. package/lib/Cloudflare/Queues/WriteQueueHttp.js +11 -6
  186. package/lib/Cloudflare/Queues/WriteQueueHttp.js.map +1 -1
  187. package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts +36 -0
  188. package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts.map +1 -0
  189. package/lib/Cloudflare/Queues/WriteQueueLocal.js +51 -0
  190. package/lib/Cloudflare/Queues/WriteQueueLocal.js.map +1 -0
  191. package/lib/Cloudflare/Queues/index.d.ts +1 -0
  192. package/lib/Cloudflare/Queues/index.d.ts.map +1 -1
  193. package/lib/Cloudflare/Queues/index.js +1 -0
  194. package/lib/Cloudflare/Queues/index.js.map +1 -1
  195. package/lib/Cloudflare/R2/BucketHttp.d.ts +15 -1
  196. package/lib/Cloudflare/R2/BucketHttp.d.ts.map +1 -1
  197. package/lib/Cloudflare/R2/BucketHttp.js +3 -3
  198. package/lib/Cloudflare/R2/BucketHttp.js.map +1 -1
  199. package/lib/Cloudflare/R2/BucketLocal.d.ts +21 -0
  200. package/lib/Cloudflare/R2/BucketLocal.d.ts.map +1 -0
  201. package/lib/Cloudflare/R2/BucketLocal.js +32 -0
  202. package/lib/Cloudflare/R2/BucketLocal.js.map +1 -0
  203. package/lib/Cloudflare/R2/ReadBucketHttp.d.ts +2 -2
  204. package/lib/Cloudflare/R2/ReadBucketHttp.d.ts.map +1 -1
  205. package/lib/Cloudflare/R2/ReadBucketHttp.js +4 -4
  206. package/lib/Cloudflare/R2/ReadBucketHttp.js.map +1 -1
  207. package/lib/Cloudflare/R2/ReadBucketLocal.d.ts +27 -0
  208. package/lib/Cloudflare/R2/ReadBucketLocal.d.ts.map +1 -0
  209. package/lib/Cloudflare/R2/ReadBucketLocal.js +30 -0
  210. package/lib/Cloudflare/R2/ReadBucketLocal.js.map +1 -0
  211. package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts +2 -2
  212. package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts.map +1 -1
  213. package/lib/Cloudflare/R2/ReadWriteBucketHttp.js +5 -4
  214. package/lib/Cloudflare/R2/ReadWriteBucketHttp.js.map +1 -1
  215. package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts +30 -0
  216. package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts.map +1 -0
  217. package/lib/Cloudflare/R2/ReadWriteBucketLocal.js +33 -0
  218. package/lib/Cloudflare/R2/ReadWriteBucketLocal.js.map +1 -0
  219. package/lib/Cloudflare/R2/WriteBucketHttp.d.ts +2 -2
  220. package/lib/Cloudflare/R2/WriteBucketHttp.d.ts.map +1 -1
  221. package/lib/Cloudflare/R2/WriteBucketHttp.js +4 -4
  222. package/lib/Cloudflare/R2/WriteBucketHttp.js.map +1 -1
  223. package/lib/Cloudflare/R2/WriteBucketLocal.d.ts +27 -0
  224. package/lib/Cloudflare/R2/WriteBucketLocal.d.ts.map +1 -0
  225. package/lib/Cloudflare/R2/WriteBucketLocal.js +30 -0
  226. package/lib/Cloudflare/R2/WriteBucketLocal.js.map +1 -0
  227. package/lib/Cloudflare/R2/index.d.ts +3 -0
  228. package/lib/Cloudflare/R2/index.d.ts.map +1 -1
  229. package/lib/Cloudflare/R2/index.js +3 -0
  230. package/lib/Cloudflare/R2/index.js.map +1 -1
  231. package/lib/Cloudflare/StateStore/Api.d.ts +2 -0
  232. package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts +3 -3
  233. package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts.map +1 -1
  234. package/lib/Cloudflare/Tunnel/ReadTunnel.js +7 -8
  235. package/lib/Cloudflare/Tunnel/ReadTunnel.js.map +1 -1
  236. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts +29 -0
  237. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts.map +1 -0
  238. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js +30 -0
  239. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js.map +1 -0
  240. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts +3 -3
  241. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts.map +1 -1
  242. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js +4 -4
  243. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js.map +1 -1
  244. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts +35 -0
  245. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts.map +1 -0
  246. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js +36 -0
  247. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js.map +1 -0
  248. package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts +17 -1
  249. package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts.map +1 -1
  250. package/lib/Cloudflare/Tunnel/TunnelBinding.js +7 -1
  251. package/lib/Cloudflare/Tunnel/TunnelBinding.js.map +1 -1
  252. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts +19 -0
  253. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts.map +1 -0
  254. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js +29 -0
  255. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js.map +1 -0
  256. package/lib/Cloudflare/Tunnel/WarpConnector.d.ts +3 -3
  257. package/lib/Cloudflare/Tunnel/WarpConnector.d.ts.map +1 -1
  258. package/lib/Cloudflare/Tunnel/WarpConnector.js +7 -4
  259. package/lib/Cloudflare/Tunnel/WarpConnector.js.map +1 -1
  260. package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts +3 -3
  261. package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts.map +1 -1
  262. package/lib/Cloudflare/Tunnel/WriteTunnel.js +7 -8
  263. package/lib/Cloudflare/Tunnel/WriteTunnel.js.map +1 -1
  264. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts +29 -0
  265. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts.map +1 -0
  266. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js +30 -0
  267. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js.map +1 -0
  268. package/lib/Cloudflare/Tunnel/index.d.ts +3 -0
  269. package/lib/Cloudflare/Tunnel/index.d.ts.map +1 -1
  270. package/lib/Cloudflare/Tunnel/index.js +3 -0
  271. package/lib/Cloudflare/Tunnel/index.js.map +1 -1
  272. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts +30 -0
  273. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts.map +1 -0
  274. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js +100 -0
  275. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js.map +1 -0
  276. package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts +42 -0
  277. package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts.map +1 -0
  278. package/lib/Cloudflare/Vectorize/SearchIndexLocal.js +58 -0
  279. package/lib/Cloudflare/Vectorize/SearchIndexLocal.js.map +1 -0
  280. package/lib/Cloudflare/Vectorize/index.d.ts +1 -0
  281. package/lib/Cloudflare/Vectorize/index.d.ts.map +1 -1
  282. package/lib/Cloudflare/Vectorize/index.js +1 -0
  283. package/lib/Cloudflare/Vectorize/index.js.map +1 -1
  284. package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts +32 -0
  285. package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts.map +1 -0
  286. package/lib/Cloudflare/Workers/BrowserHttpClient.js +100 -0
  287. package/lib/Cloudflare/Workers/BrowserHttpClient.js.map +1 -0
  288. package/lib/Cloudflare/Workers/BrowserLocal.d.ts +37 -0
  289. package/lib/Cloudflare/Workers/BrowserLocal.d.ts.map +1 -0
  290. package/lib/Cloudflare/Workers/BrowserLocal.js +53 -0
  291. package/lib/Cloudflare/Workers/BrowserLocal.js.map +1 -0
  292. package/lib/Cloudflare/Workers/ConfigProvider.d.ts +8 -0
  293. package/lib/Cloudflare/Workers/ConfigProvider.d.ts.map +1 -1
  294. package/lib/Cloudflare/Workers/ConfigProvider.js +10 -1
  295. package/lib/Cloudflare/Workers/ConfigProvider.js.map +1 -1
  296. package/lib/Cloudflare/Workers/DurableObject.d.ts +137 -3
  297. package/lib/Cloudflare/Workers/DurableObject.d.ts.map +1 -1
  298. package/lib/Cloudflare/Workers/DurableObject.js +141 -6
  299. package/lib/Cloudflare/Workers/DurableObject.js.map +1 -1
  300. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +2 -185
  301. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
  302. package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
  303. package/lib/Cloudflare/Workers/Vite.js +81 -2
  304. package/lib/Cloudflare/Workers/Vite.js.map +1 -1
  305. package/lib/Cloudflare/Workers/Worker.d.ts +15 -1
  306. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  307. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  308. package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
  309. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +2 -1
  310. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
  311. package/lib/Cloudflare/Workers/WorkerBinding.d.ts +22 -1
  312. package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
  313. package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
  314. package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
  315. package/lib/Cloudflare/Workers/WorkerBridge.js +7 -2
  316. package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
  317. package/lib/Cloudflare/Workers/WorkerProvider.d.ts +81 -0
  318. package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
  319. package/lib/Cloudflare/Workers/WorkerProvider.js +450 -61
  320. package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
  321. package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
  322. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +11 -37
  323. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
  324. package/lib/Cloudflare/Workers/index.d.ts +1 -0
  325. package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
  326. package/lib/Cloudflare/Workers/index.js +1 -0
  327. package/lib/Cloudflare/Workers/index.js.map +1 -1
  328. package/lib/Diff.d.ts +16 -0
  329. package/lib/Diff.d.ts.map +1 -1
  330. package/lib/Diff.js +33 -0
  331. package/lib/Diff.js.map +1 -1
  332. package/lib/GitHub/Secrets.d.ts +1 -1
  333. package/lib/GitHub/Secrets.js +1 -1
  334. package/lib/GitHub/Variables.d.ts +1 -1
  335. package/lib/GitHub/Variables.js +1 -1
  336. package/lib/Local/RpcSerialization.d.ts.map +1 -1
  337. package/lib/Local/RpcSerialization.js +6 -2
  338. package/lib/Local/RpcSerialization.js.map +1 -1
  339. package/lib/Local/RpcSpawner.d.ts.map +1 -1
  340. package/lib/Local/RpcSpawner.js +14 -8
  341. package/lib/Local/RpcSpawner.js.map +1 -1
  342. package/lib/Neon/AuthProvider.js +1 -1
  343. package/lib/Neon/AuthProvider.js.map +1 -1
  344. package/lib/Plan.d.ts.map +1 -1
  345. package/lib/Plan.js +11 -4
  346. package/lib/Plan.js.map +1 -1
  347. package/lib/Planetscale/Database.d.ts +2 -1
  348. package/lib/Planetscale/Database.d.ts.map +1 -1
  349. package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts +41 -3
  350. package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts.map +1 -1
  351. package/lib/Planetscale/MySQL/MySQLClusterSize.js +88 -11
  352. package/lib/Planetscale/MySQL/MySQLClusterSize.js.map +1 -1
  353. package/lib/Planetscale/MySQL/MySQLDatabase.d.ts +14 -0
  354. package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -1
  355. package/lib/Planetscale/MySQL/MySQLDatabase.js +24 -11
  356. package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -1
  357. package/lib/Platform.d.ts.map +1 -1
  358. package/lib/Platform.js +11 -1
  359. package/lib/Platform.js.map +1 -1
  360. package/lib/Runtime.d.ts +23 -0
  361. package/lib/Runtime.d.ts.map +1 -1
  362. package/lib/Runtime.js +83 -0
  363. package/lib/Runtime.js.map +1 -1
  364. package/lib/RuntimeContext.d.ts +46 -0
  365. package/lib/RuntimeContext.d.ts.map +1 -1
  366. package/lib/RuntimeContext.js +60 -0
  367. package/lib/RuntimeContext.js.map +1 -1
  368. package/lib/Server/Process.d.ts +1 -1
  369. package/lib/Server/Process.d.ts.map +1 -1
  370. package/lib/Server/Process.js +8 -8
  371. package/lib/Server/Process.js.map +1 -1
  372. package/lib/Stack.js +1 -1
  373. package/lib/Stack.js.map +1 -1
  374. package/lib/State/HttpStateApi.d.ts +10 -10
  375. package/lib/Test/Alchemy.d.ts +74 -0
  376. package/lib/Test/Alchemy.d.ts.map +1 -0
  377. package/lib/Test/Alchemy.js +143 -0
  378. package/lib/Test/Alchemy.js.map +1 -0
  379. package/lib/Util/cached-function.d.ts +1 -1
  380. package/lib/Util/cached-function.d.ts.map +1 -1
  381. package/lib/Util/cached-function.js +2 -2
  382. package/lib/Util/cached-function.js.map +1 -1
  383. package/lib/Util/proxy-chain.js +3 -0
  384. package/lib/Util/proxy-chain.js.map +1 -1
  385. package/package.json +10 -10
  386. package/src/AWS/AuthProvider.ts +1 -1
  387. package/src/AWS/EC2/hosted.ts +2 -1
  388. package/src/AWS/ECS/Task.ts +2 -1
  389. package/src/AWS/Lambda/Function.ts +13 -47
  390. package/src/AWS/Lambda/MicrovmRuntimeContext.ts +11 -38
  391. package/src/Action.ts +39 -6
  392. package/src/ActionRuntimeContext.ts +68 -0
  393. package/src/Apply.ts +46 -8
  394. package/src/Auth/AuthProvider.ts +1 -1
  395. package/src/Auth/Lock.ts +5 -2
  396. package/src/Bundle/PurePlugin.ts +34 -1
  397. package/src/Bundle/Vite.ts +51 -1
  398. package/src/Cli/LoggingCli.ts +7 -4
  399. package/src/Cli/commands/_shared.ts +52 -0
  400. package/src/Cli/commands/login.ts +90 -14
  401. package/src/Cli/commands/profile.ts +7 -41
  402. package/src/Cloudflare/AI/LanguageModel.ts +25 -5
  403. package/src/Cloudflare/AI/QuerySearchLocal.ts +66 -0
  404. package/src/Cloudflare/AI/QuerySearchNamespaceLocal.ts +60 -0
  405. package/src/Cloudflare/AI/SearchHttpClient.ts +423 -0
  406. package/src/Cloudflare/AI/index.ts +2 -0
  407. package/src/Cloudflare/Auth/AuthProvider.ts +1 -1
  408. package/src/Cloudflare/Containers/ContainerBundle.ts +11 -1
  409. package/src/Cloudflare/Containers/ContainerPlatform.ts +14 -52
  410. package/src/Cloudflare/D1/QueryDatabaseHttpClient.ts +176 -0
  411. package/src/Cloudflare/D1/QueryDatabaseLocal.ts +66 -0
  412. package/src/Cloudflare/D1/index.ts +1 -0
  413. package/src/Cloudflare/DNS/DnsHttp.ts +24 -2
  414. package/src/Cloudflare/DNS/DnsLocal.ts +41 -0
  415. package/src/Cloudflare/DNS/ReadDnsHttp.ts +4 -5
  416. package/src/Cloudflare/DNS/ReadDnsLocal.ts +38 -0
  417. package/src/Cloudflare/DNS/ReadWriteDnsHttp.ts +5 -5
  418. package/src/Cloudflare/DNS/ReadWriteDnsLocal.ts +46 -0
  419. package/src/Cloudflare/DNS/WriteDnsHttp.ts +4 -5
  420. package/src/Cloudflare/DNS/WriteDnsLocal.ts +44 -0
  421. package/src/Cloudflare/DNS/index.ts +3 -0
  422. package/src/Cloudflare/Flagship/ReadFlagsHttpClient.ts +183 -0
  423. package/src/Cloudflare/Flagship/ReadFlagsLocal.ts +69 -0
  424. package/src/Cloudflare/Flagship/index.ts +1 -0
  425. package/src/Cloudflare/KV/NamespaceHttp.ts +25 -2
  426. package/src/Cloudflare/KV/NamespaceLocal.ts +42 -0
  427. package/src/Cloudflare/KV/ReadNamespaceHttp.ts +7 -6
  428. package/src/Cloudflare/KV/ReadNamespaceLocal.ts +35 -0
  429. package/src/Cloudflare/KV/ReadWriteNamespaceHttp.ts +11 -6
  430. package/src/Cloudflare/KV/ReadWriteNamespaceLocal.ts +42 -0
  431. package/src/Cloudflare/KV/WriteNamespaceHttp.ts +7 -6
  432. package/src/Cloudflare/KV/WriteNamespaceLocal.ts +35 -0
  433. package/src/Cloudflare/KV/index.ts +3 -0
  434. package/src/Cloudflare/Queues/QueueHttp.ts +24 -2
  435. package/src/Cloudflare/Queues/WriteQueueHttp.ts +16 -7
  436. package/src/Cloudflare/Queues/WriteQueueLocal.ts +64 -0
  437. package/src/Cloudflare/Queues/index.ts +1 -0
  438. package/src/Cloudflare/R2/BucketHttp.ts +20 -3
  439. package/src/Cloudflare/R2/BucketLocal.ts +47 -0
  440. package/src/Cloudflare/R2/ReadBucketHttp.ts +10 -5
  441. package/src/Cloudflare/R2/ReadBucketLocal.ts +33 -0
  442. package/src/Cloudflare/R2/ReadWriteBucketHttp.ts +11 -5
  443. package/src/Cloudflare/R2/ReadWriteBucketLocal.ts +36 -0
  444. package/src/Cloudflare/R2/WriteBucketHttp.ts +10 -5
  445. package/src/Cloudflare/R2/WriteBucketLocal.ts +33 -0
  446. package/src/Cloudflare/R2/index.ts +3 -0
  447. package/src/Cloudflare/Tunnel/ReadTunnel.ts +8 -9
  448. package/src/Cloudflare/Tunnel/ReadTunnelLocal.ts +33 -0
  449. package/src/Cloudflare/Tunnel/ReadWriteTunnel.ts +5 -5
  450. package/src/Cloudflare/Tunnel/ReadWriteTunnelLocal.ts +39 -0
  451. package/src/Cloudflare/Tunnel/TunnelBinding.ts +26 -2
  452. package/src/Cloudflare/Tunnel/TunnelLocalBinding.ts +38 -0
  453. package/src/Cloudflare/Tunnel/WarpConnector.ts +8 -5
  454. package/src/Cloudflare/Tunnel/WriteTunnel.ts +8 -9
  455. package/src/Cloudflare/Tunnel/WriteTunnelLocal.ts +33 -0
  456. package/src/Cloudflare/Tunnel/index.ts +3 -0
  457. package/src/Cloudflare/Vectorize/SearchIndexHttpClient.ts +183 -0
  458. package/src/Cloudflare/Vectorize/SearchIndexLocal.ts +70 -0
  459. package/src/Cloudflare/Vectorize/index.ts +1 -0
  460. package/src/Cloudflare/Workers/BrowserHttpClient.ts +201 -0
  461. package/src/Cloudflare/Workers/BrowserLocal.ts +65 -0
  462. package/src/Cloudflare/Workers/ConfigProvider.ts +15 -1
  463. package/src/Cloudflare/Workers/DurableObject.ts +227 -6
  464. package/src/Cloudflare/Workers/Vite.ts +93 -11
  465. package/src/Cloudflare/Workers/Worker.ts +19 -1
  466. package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +6 -5
  467. package/src/Cloudflare/Workers/WorkerBinding.ts +20 -1
  468. package/src/Cloudflare/Workers/WorkerBridge.ts +12 -2
  469. package/src/Cloudflare/Workers/WorkerProvider.ts +664 -117
  470. package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +14 -45
  471. package/src/Cloudflare/Workers/index.ts +1 -0
  472. package/src/Diff.ts +33 -0
  473. package/src/GitHub/Secrets.ts +1 -1
  474. package/src/GitHub/Variables.ts +1 -1
  475. package/src/Local/RpcSerialization.ts +6 -2
  476. package/src/Local/RpcSpawner.ts +21 -8
  477. package/src/Neon/AuthProvider.ts +1 -1
  478. package/src/Plan.ts +17 -4
  479. package/src/Planetscale/Database.ts +2 -1
  480. package/src/Planetscale/MySQL/MySQLClusterSize.ts +120 -21
  481. package/src/Planetscale/MySQL/MySQLDatabase.ts +84 -44
  482. package/src/Platform.ts +12 -3
  483. package/src/Runtime.ts +92 -0
  484. package/src/RuntimeContext.ts +79 -0
  485. package/src/Server/Process.ts +11 -18
  486. package/src/Stack.ts +1 -1
  487. package/src/Test/Alchemy.ts +282 -0
  488. package/src/Util/cached-function.ts +5 -5
  489. package/src/Util/proxy-chain.ts +3 -0
@@ -6,7 +6,7 @@ import {
6
6
  makeHttpQueueBinding,
7
7
  makeQueueHttpScope,
8
8
  toQueueSendError,
9
- type HttpToken,
9
+ type QueueAuth,
10
10
  } from "./QueueHttp.ts";
11
11
  import { SendError, type SendMessage } from "./QueueTypes.ts";
12
12
  import { WriteQueue, type WriteQueueClient } from "./WriteQueue.ts";
@@ -27,7 +27,11 @@ export const WriteQueueHttp = Layer.effect(
27
27
  Effect.suspend(() =>
28
28
  makeHttpQueueBinding({
29
29
  permissionGroups: ["Queues Write"],
30
- makeClient: makeWriteQueueHttpClient,
30
+ makeClient: (token, queueId) =>
31
+ makeWriteQueueHttpClient(
32
+ { authorize: authorizeWith(token), accountId: token.accountId },
33
+ queueId,
34
+ ),
31
35
  }),
32
36
  ),
33
37
  );
@@ -44,18 +48,23 @@ const toMessage = (message: SendMessage) =>
44
48
  }
45
49
  : { body: message.body, contentType: "json" as const };
46
50
 
47
- /** Build the producer client over the Queues bulk-push HTTP API. */
51
+ /**
52
+ * Build the producer client over the Queues bulk-push HTTP API.
53
+ *
54
+ * Shared by {@link WriteQueueHttp} (scoped token auth) and
55
+ * `WriteQueueLocal` (current-credentials auth) — they differ only in the
56
+ * {@link QueueAuth} they inject.
57
+ */
48
58
  export const makeWriteQueueHttpClient = (
49
- token: HttpToken,
59
+ auth: QueueAuth,
50
60
  queueId: Effect.Effect<string>,
51
61
  ): WriteQueueClient => {
52
- const authorize = authorizeWith(token);
53
- const scope = makeQueueHttpScope(token, queueId);
62
+ const scope = makeQueueHttpScope(auth, queueId);
54
63
 
55
64
  const push = (messages: ReadonlyArray<SendMessage>) =>
56
65
  scope.pipe(
57
66
  Effect.flatMap(({ accountId, queueId }) =>
58
- authorize(
67
+ auth.authorize(
59
68
  queues.bulkPushMessages({
60
69
  accountId,
61
70
  queueId,
@@ -0,0 +1,64 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
4
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
5
+ import type { Credentials } from "../Credentials.ts";
6
+ import type { Queue } from "./Queue.ts";
7
+ import { makeWriteQueueHttpClient } from "./WriteQueueHttp.ts";
8
+ import { WriteQueue } from "./WriteQueue.ts";
9
+
10
+ /**
11
+ * Local implementation of the {@link WriteQueue} binding — pushes messages
12
+ * to a Cloudflare Queue over the bulk-push HTTP API using the **current
13
+ * credentials** instead of a native Worker binding
14
+ * ({@link WriteQueueBinding}) or a scoped API token ({@link WriteQueueHttp}).
15
+ *
16
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can send
17
+ * messages to a queue with the same `send`/`sendBatch` client you'd use inside
18
+ * a Worker — no Worker host and no minted token.
19
+ *
20
+ * @example Seeding a queue from an Action
21
+ * ```typescript
22
+ * const Seed = Alchemy.Action(
23
+ * "Seed",
24
+ * Effect.gen(function* () {
25
+ * const q = yield* Cloudflare.Queues.WriteQueue(queue);
26
+ * return Effect.fn(function* () {
27
+ * yield* q.send({ text: "hi", sentAt: Date.now() });
28
+ * yield* q.sendBatch([{ body: { event: "click", id: 1 } }]);
29
+ * });
30
+ * }).pipe(Effect.provide(Cloudflare.Queues.WriteQueueLocal)),
31
+ * );
32
+ * ```
33
+ *
34
+ * The queue id is resolved at apply time through the ambient
35
+ * {@link RuntimeContext} (in an Action, that's the resolve context the engine
36
+ * provides around the body), so `WriteQueue(queue)` works even though the
37
+ * queue is created in the same deploy.
38
+ */
39
+ export const WriteQueueLocal = Layer.effect(
40
+ WriteQueue,
41
+ Effect.gen(function* () {
42
+ // Account + credentials are ambient during stack-eval (the stack's
43
+ // providers layer). Capture the full context so the bulk-push effect can
44
+ // run with the current credentials instead of a scoped token.
45
+ const { accountId } = yield* yield* CloudflareEnvironment;
46
+ const context = yield* Effect.context<
47
+ Credentials | HttpClient.HttpClient
48
+ >();
49
+
50
+ return Effect.fn(function* (queue: Queue) {
51
+ // Deferred accessor — resolves the queueId against the tracker at apply
52
+ // time. No `host.bind`: the local variant registers no binding.
53
+ const queueId = yield* queue.queueId;
54
+
55
+ return makeWriteQueueHttpClient(
56
+ {
57
+ authorize: (eff) => eff.pipe(Effect.provideContext(context)),
58
+ accountId: Effect.succeed(accountId),
59
+ },
60
+ queueId,
61
+ );
62
+ });
63
+ }),
64
+ );
@@ -5,4 +5,5 @@ export * from "./QueueTypes.ts";
5
5
  export * from "./WriteQueue.ts";
6
6
  export * from "./WriteQueueBinding.ts";
7
7
  export * from "./WriteQueueHttp.ts";
8
+ export * from "./WriteQueueLocal.ts";
8
9
  export * from "./Subscription.ts";
@@ -1,13 +1,30 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import type * as Redacted from "effect/Redacted";
3
3
  import * as Stream from "effect/Stream";
4
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
4
5
  import { Self } from "../../Self.ts";
6
+ import type { RuntimeContext } from "../../RuntimeContext.ts";
5
7
  import { AccountApiToken } from "../ApiToken/AccountApiToken.ts";
6
8
  import type { PermissionGroupRef } from "../ApiToken/Common.ts";
7
9
  import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
10
+ import type { Credentials } from "../Credentials.ts";
8
11
  import type { Bucket } from "./Bucket.ts";
9
12
  import { R2Error, type R2Object } from "./BucketTypes.ts";
10
13
 
14
+ /**
15
+ * Injectable auth used by the R2 HTTP client builders. Both the token-scoped
16
+ * `*Http` layers and the current-credentials `*Local` layers build one of
17
+ * these so they can share the exact same client implementation.
18
+ */
19
+ export interface R2Auth {
20
+ /** Provide credentials + HTTP client to a raw distilled R2 op. */
21
+ authorize: <A, E>(
22
+ eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
23
+ ) => Effect.Effect<A, E, RuntimeContext>;
24
+ /** Resolve the Cloudflare account id. */
25
+ accountId: Effect.Effect<string>;
26
+ }
27
+
11
28
  export const makeHttpBucketBinding = <Client>(options: {
12
29
  permissionGroups: PermissionGroup[];
13
30
  makeClient: (
@@ -66,16 +83,16 @@ type PermissionGroup = (typeof R2_HTTP_PERMISSION_GROUPS)[number];
66
83
 
67
84
  /** Resolve the account, bucket, and jurisdiction once per operation. */
68
85
  export const makeR2HttpScope = (
69
- token: HttpToken,
86
+ accountId: Effect.Effect<string>,
70
87
  bucketName: Effect.Effect<string>,
71
88
  jurisdiction: Effect.Effect<string>,
72
89
  ): Effect.Effect<HttpScope> =>
73
90
  Effect.gen(function* () {
74
- const accountId = yield* token.accountId;
91
+ const accountId_ = yield* accountId;
75
92
  const bucket = yield* bucketName;
76
93
  const j = yield* jurisdiction;
77
94
  return {
78
- accountId,
95
+ accountId: accountId_,
79
96
  bucketName: bucket,
80
97
  cfR2Jurisdiction: j === "default" ? undefined : j,
81
98
  };
@@ -0,0 +1,47 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
3
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
4
+ import type { Credentials } from "../Credentials.ts";
5
+ import type { Bucket } from "./Bucket.ts";
6
+ import type { R2Auth } from "./BucketHttp.ts";
7
+
8
+ /**
9
+ * Shared scaffolding for the R2 `*Local` binding layers.
10
+ *
11
+ * Resolves the account + captures the ambient current-credentials context at
12
+ * layer construction, then returns the deferred binding callable. The callable
13
+ * reads the bucket name/jurisdiction as deferred accessors (resolved at apply
14
+ * time) and builds the same HTTP-backed client the `*Http` variant uses, but
15
+ * authorized with the current CLI credentials instead of a minted token.
16
+ *
17
+ * NOT exported from `index.ts`.
18
+ */
19
+ export const makeLocalBucketBinding = <Client>(makeClient: {
20
+ (
21
+ auth: R2Auth,
22
+ bucketName: Effect.Effect<string>,
23
+ jurisdiction: Effect.Effect<string>,
24
+ ): Client;
25
+ }) =>
26
+ Effect.gen(function* () {
27
+ // Account + credentials are ambient during stack-eval (the stack's
28
+ // providers layer). Capture the full context so each op can be run with the
29
+ // current credentials.
30
+ const { accountId } = yield* yield* CloudflareEnvironment;
31
+ const context = yield* Effect.context<
32
+ Credentials | HttpClient.HttpClient
33
+ >();
34
+
35
+ const auth: R2Auth = {
36
+ authorize: (eff) => eff.pipe(Effect.provideContext(context)),
37
+ accountId: Effect.succeed(accountId),
38
+ };
39
+
40
+ return Effect.fn(function* (bucket: Bucket) {
41
+ // Deferred accessors — resolved against the tracker at apply time. No
42
+ // `host.bind`: the local variant registers no binding.
43
+ const bucketName = yield* bucket.bucketName;
44
+ const jurisdiction = yield* bucket.jurisdiction;
45
+ return makeClient(auth, bucketName, jurisdiction);
46
+ });
47
+ });
@@ -9,7 +9,7 @@ import {
9
9
  makeR2HttpScope,
10
10
  toR2Error,
11
11
  type HttpMetadata,
12
- type HttpToken,
12
+ type R2Auth,
13
13
  } from "./BucketHttp.ts";
14
14
  import { ReadBucket, type ReadBucketClient } from "./ReadBucket.ts";
15
15
  import {
@@ -29,18 +29,23 @@ export const ReadBucketHttp = Layer.effect(
29
29
  Effect.suspend(() =>
30
30
  makeHttpBucketBinding({
31
31
  permissionGroups: ["Workers R2 Storage Read"],
32
- makeClient: makeReadR2HttpClient,
32
+ makeClient: (token, bucketName, jurisdiction) =>
33
+ makeReadR2HttpClient(
34
+ { authorize: authorizeWith(token), accountId: token.accountId },
35
+ bucketName,
36
+ jurisdiction,
37
+ ),
33
38
  }),
34
39
  ),
35
40
  );
36
41
 
37
42
  export const makeReadR2HttpClient = (
38
- token: HttpToken,
43
+ auth: R2Auth,
39
44
  bucketName: Effect.Effect<string>,
40
45
  jurisdiction: Effect.Effect<string>,
41
46
  ): ReadBucketClient => {
42
- const authorize = authorizeWith(token);
43
- const scope = makeR2HttpScope(token, bucketName, jurisdiction);
47
+ const authorize = auth.authorize;
48
+ const scope = makeR2HttpScope(auth.accountId, bucketName, jurisdiction);
44
49
 
45
50
  return {
46
51
  raw: Effect.die(
@@ -0,0 +1,33 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalBucketBinding } from "./BucketLocal.ts";
4
+ import { ReadBucket } from "./ReadBucket.ts";
5
+ import { makeReadR2HttpClient } from "./ReadBucketHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link ReadBucket} binding — reads R2 objects
9
+ * over the Cloudflare HTTP API using the **current credentials** instead of a
10
+ * native Worker binding (`ReadBucketBinding`) or a scoped API token
11
+ * (`ReadBucketHttp`).
12
+ *
13
+ * Provide it on an {@link Action} (or any deploy-time Effect) to read a bucket
14
+ * with the same `head`/`get`/`list` client you'd use inside a Worker.
15
+ *
16
+ * @example Reading an object from an Action
17
+ * ```typescript
18
+ * const Read = Alchemy.Action(
19
+ * "Read",
20
+ * Effect.gen(function* () {
21
+ * const r2 = yield* Cloudflare.R2.ReadBucket(bucket);
22
+ * return Effect.fn(function* () {
23
+ * const object = yield* r2.get("hello.txt");
24
+ * return object ? yield* object.text() : null;
25
+ * });
26
+ * }).pipe(Effect.provide(Cloudflare.R2.ReadBucketLocal)),
27
+ * );
28
+ * ```
29
+ */
30
+ export const ReadBucketLocal = Layer.effect(
31
+ ReadBucket,
32
+ Effect.suspend(() => makeLocalBucketBinding(makeReadR2HttpClient)),
33
+ );
@@ -1,6 +1,7 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Layer from "effect/Layer";
3
- import { makeHttpBucketBinding, type HttpToken } from "./BucketHttp.ts";
3
+ import { authorizeWith } from "../HttpClientUtils.ts";
4
+ import { makeHttpBucketBinding, type R2Auth } from "./BucketHttp.ts";
4
5
  import { makeReadR2HttpClient } from "./ReadBucketHttp.ts";
5
6
  import {
6
7
  ReadWriteBucket,
@@ -18,18 +19,23 @@ export const ReadWriteBucketHttp = Layer.effect(
18
19
  Effect.suspend(() =>
19
20
  makeHttpBucketBinding({
20
21
  permissionGroups: ["Workers R2 Storage Read", "Workers R2 Storage Write"],
21
- makeClient: makeReadWriteR2HttpClient,
22
+ makeClient: (token, bucketName, jurisdiction) =>
23
+ makeReadWriteR2HttpClient(
24
+ { authorize: authorizeWith(token), accountId: token.accountId },
25
+ bucketName,
26
+ jurisdiction,
27
+ ),
22
28
  }),
23
29
  ),
24
30
  );
25
31
 
26
32
  /** Build the HTTP-backed {@link ReadWrite} over a bound token + bucket. */
27
33
  export const makeReadWriteR2HttpClient = (
28
- token: HttpToken,
34
+ auth: R2Auth,
29
35
  bucketName: Effect.Effect<string>,
30
36
  jurisdiction: Effect.Effect<string>,
31
37
  ): ReadWriteBucketClient =>
32
38
  ({
33
- ...makeReadR2HttpClient(token, bucketName, jurisdiction),
34
- ...makeWriteR2HttpClient(token, bucketName, jurisdiction),
39
+ ...makeReadR2HttpClient(auth, bucketName, jurisdiction),
40
+ ...makeWriteR2HttpClient(auth, bucketName, jurisdiction),
35
41
  }) satisfies ReadWriteBucketClient;
@@ -0,0 +1,36 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalBucketBinding } from "./BucketLocal.ts";
4
+ import { ReadWriteBucket } from "./ReadWriteBucket.ts";
5
+ import { makeReadWriteR2HttpClient } from "./ReadWriteBucketHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link ReadWriteBucket} binding — reads and
9
+ * writes R2 objects over the Cloudflare HTTP API using the **current
10
+ * credentials** instead of a native Worker binding (`ReadWriteBucketBinding`)
11
+ * or a scoped API token (`ReadWriteBucketHttp`).
12
+ *
13
+ * Provide it on an {@link Action} (or any deploy-time Effect) to use the same
14
+ * `head`/`get`/`list`/`put`/`delete` client you'd use inside a Worker.
15
+ * Multipart uploads are unsupported over the HTTP API (mirrors
16
+ * `ReadWriteBucketHttp`).
17
+ *
18
+ * @example Seeding then reading a bucket from an Action
19
+ * ```typescript
20
+ * const Seed = Alchemy.Action(
21
+ * "Seed",
22
+ * Effect.gen(function* () {
23
+ * const r2 = yield* Cloudflare.R2.ReadWriteBucket(bucket);
24
+ * return Effect.fn(function* () {
25
+ * yield* r2.put("hello.txt", "Hello, World!");
26
+ * const object = yield* r2.get("hello.txt");
27
+ * return object ? yield* object.text() : null;
28
+ * });
29
+ * }).pipe(Effect.provide(Cloudflare.R2.ReadWriteBucketLocal)),
30
+ * );
31
+ * ```
32
+ */
33
+ export const ReadWriteBucketLocal = Layer.effect(
34
+ ReadWriteBucket,
35
+ Effect.suspend(() => makeLocalBucketBinding(makeReadWriteR2HttpClient)),
36
+ );
@@ -10,7 +10,7 @@ import {
10
10
  readHttpMetadata,
11
11
  toBody,
12
12
  toR2Error,
13
- type HttpToken,
13
+ type R2Auth,
14
14
  } from "./BucketHttp.ts";
15
15
  import { R2Error, type PutOptions } from "./BucketTypes.ts";
16
16
  import { WriteBucket, type WriteBucketClient } from "./WriteBucket.ts";
@@ -25,19 +25,24 @@ export const WriteBucketHttp = Layer.effect(
25
25
  Effect.suspend(() =>
26
26
  makeHttpBucketBinding({
27
27
  permissionGroups: ["Workers R2 Storage Write"],
28
- makeClient: makeWriteR2HttpClient,
28
+ makeClient: (token, bucketName, jurisdiction) =>
29
+ makeWriteR2HttpClient(
30
+ { authorize: authorizeWith(token), accountId: token.accountId },
31
+ bucketName,
32
+ jurisdiction,
33
+ ),
29
34
  }),
30
35
  ),
31
36
  );
32
37
 
33
38
  /** Build the write half of the HTTP-backed {@link ReadWrite} client. */
34
39
  export const makeWriteR2HttpClient = (
35
- token: HttpToken,
40
+ auth: R2Auth,
36
41
  bucketName: Effect.Effect<string>,
37
42
  jurisdiction: Effect.Effect<string>,
38
43
  ): WriteBucketClient => {
39
- const authorize = authorizeWith(token);
40
- const scope = makeR2HttpScope(token, bucketName, jurisdiction);
44
+ const authorize = auth.authorize;
45
+ const scope = makeR2HttpScope(auth.accountId, bucketName, jurisdiction);
41
46
 
42
47
  return {
43
48
  put: ((
@@ -0,0 +1,33 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalBucketBinding } from "./BucketLocal.ts";
4
+ import { WriteBucket } from "./WriteBucket.ts";
5
+ import { makeWriteR2HttpClient } from "./WriteBucketHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link WriteBucket} binding — writes R2 objects
9
+ * over the Cloudflare HTTP API using the **current credentials** instead of a
10
+ * native Worker binding (`WriteBucketBinding`) or a scoped API token
11
+ * (`WriteBucketHttp`).
12
+ *
13
+ * Provide it on an {@link Action} (or any deploy-time Effect) to write a bucket
14
+ * with the same `put`/`delete` client you'd use inside a Worker. Multipart
15
+ * uploads are unsupported over the HTTP API (mirrors `WriteBucketHttp`).
16
+ *
17
+ * @example Seeding a bucket from an Action
18
+ * ```typescript
19
+ * const Seed = Alchemy.Action(
20
+ * "Seed",
21
+ * Effect.gen(function* () {
22
+ * const r2 = yield* Cloudflare.R2.WriteBucket(bucket);
23
+ * return Effect.fn(function* () {
24
+ * yield* r2.put("hello.txt", "Hello, World!");
25
+ * });
26
+ * }).pipe(Effect.provide(Cloudflare.R2.WriteBucketLocal)),
27
+ * );
28
+ * ```
29
+ */
30
+ export const WriteBucketLocal = Layer.effect(
31
+ WriteBucket,
32
+ Effect.suspend(() => makeLocalBucketBinding(makeWriteR2HttpClient)),
33
+ );
@@ -5,9 +5,12 @@ export * from "./DataCatalog.ts";
5
5
  export * from "./ReadBucket.ts";
6
6
  export * from "./ReadBucketBinding.ts";
7
7
  export * from "./ReadBucketHttp.ts";
8
+ export * from "./ReadBucketLocal.ts";
8
9
  export * from "./ReadWriteBucket.ts";
9
10
  export * from "./ReadWriteBucketBinding.ts";
10
11
  export * from "./ReadWriteBucketHttp.ts";
12
+ export * from "./ReadWriteBucketLocal.ts";
11
13
  export * from "./WriteBucket.ts";
12
14
  export * from "./WriteBucketBinding.ts";
13
15
  export * from "./WriteBucketHttp.ts";
16
+ export * from "./WriteBucketLocal.ts";
@@ -15,8 +15,7 @@ import * as Binding from "../../Binding.ts";
15
15
  import type { Worker } from "../Workers/Worker.ts";
16
16
  import type { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
17
17
  import type { RuntimeContext } from "../../RuntimeContext.ts";
18
- import { type Token } from "./TunnelBinding.ts";
19
- import { authorizeWith } from "../HttpClientUtils.ts";
18
+ import { type TunnelAuth } from "./TunnelBinding.ts";
20
19
 
21
20
  /**
22
21
  * Binding that lets a Worker read Cloudflare Tunnels at runtime.
@@ -117,31 +116,31 @@ export interface ReadTunnelClient {
117
116
  >;
118
117
  }
119
118
 
120
- /** Build the read-only client over a bound token. */
121
- export const readClient = (token: Token): ReadTunnelClient => {
122
- const authorize = authorizeWith(token);
119
+ /** Build the read-only client over an injectable {@link TunnelAuth}. */
120
+ export const readClient = (auth: TunnelAuth): ReadTunnelClient => {
121
+ const { authorize } = auth;
123
122
  return {
124
123
  get: Effect.fn("Cloudflare.Tunnel.get")(function* (tunnelId) {
125
- const accountId = yield* token.accountId;
124
+ const accountId = yield* auth.accountId;
126
125
  return yield* authorize(
127
126
  zeroTrust.getTunnelCloudflared({ accountId, tunnelId }),
128
127
  );
129
128
  }),
130
129
  list: Effect.fn("Cloudflare.Tunnel.list")(function* (request) {
131
- const accountId = yield* token.accountId;
130
+ const accountId = yield* auth.accountId;
132
131
  return yield* authorize(
133
132
  zeroTrust.listTunnelCloudflareds({ accountId, ...request }),
134
133
  );
135
134
  }),
136
135
  getToken: Effect.fn("Cloudflare.Tunnel.getToken")(function* (tunnelId) {
137
- const accountId = yield* token.accountId;
136
+ const accountId = yield* auth.accountId;
138
137
  return yield* authorize(
139
138
  zeroTrust.getTunnelCloudflaredToken({ accountId, tunnelId }),
140
139
  );
141
140
  }),
142
141
  getConfiguration: Effect.fn("Cloudflare.Tunnel.getConfiguration")(
143
142
  function* (tunnelId) {
144
- const accountId = yield* token.accountId;
143
+ const accountId = yield* auth.accountId;
145
144
  return yield* authorize(
146
145
  zeroTrust.getTunnelCloudflaredConfiguration({ accountId, tunnelId }),
147
146
  );
@@ -0,0 +1,33 @@
1
+ import * as Layer from "effect/Layer";
2
+ import { readClient, ReadTunnel } from "./ReadTunnel.ts";
3
+ import { makeLocalTunnelClient } from "./TunnelLocalBinding.ts";
4
+
5
+ /**
6
+ * Local implementation of the {@link ReadTunnel} binding — reads Cloudflare
7
+ * Tunnels over the cfd_tunnel HTTP API using the **current credentials**
8
+ * instead of a native Worker binding (`ReadTunnelBinding`) or a scoped API
9
+ * token. No `host.bind`, no minted token, no Worker host.
10
+ *
11
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can read
12
+ * tunnels with the same `get`/`list`/`getToken`/`getConfiguration` client you'd
13
+ * use inside a Worker.
14
+ *
15
+ * @example Read a tunnel's connector token from an Action
16
+ * ```typescript
17
+ * const Inspect = Alchemy.Action(
18
+ * "Inspect",
19
+ * Effect.gen(function* () {
20
+ * const tunnels = yield* Cloudflare.Tunnel.ReadTunnel();
21
+ * const tunnelId = yield* tunnel.tunnelId;
22
+ * return Effect.fn(function* () {
23
+ * const t = yield* tunnels.get(yield* tunnelId);
24
+ * return t.result?.name;
25
+ * });
26
+ * }).pipe(Effect.provide(Cloudflare.Tunnel.ReadTunnelLocal)),
27
+ * );
28
+ * ```
29
+ */
30
+ export const ReadTunnelLocal = Layer.effect(
31
+ ReadTunnel,
32
+ makeLocalTunnelClient(readClient),
33
+ );
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
2
2
  import * as Binding from "../../Binding.ts";
3
3
  import type { Worker } from "../Workers/Worker.ts";
4
4
  import type { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
5
- import { type Token } from "./TunnelBinding.ts";
5
+ import { type TunnelAuth } from "./TunnelBinding.ts";
6
6
  import { readClient, type ReadTunnelClient } from "./ReadTunnel.ts";
7
7
  import { writeClient, type WriteTunnelClient } from "./WriteTunnel.ts";
8
8
 
@@ -68,8 +68,8 @@ export const ReadWriteTunnel = Binding.Service<ReadWriteTunnel>(
68
68
  export interface ReadWriteTunnelClient
69
69
  extends ReadTunnelClient, WriteTunnelClient {}
70
70
 
71
- /** Build the combined read + write client over a bound token. */
72
- export const readWriteClient = (token: Token): ReadWriteTunnelClient => ({
73
- ...readClient(token),
74
- ...writeClient(token),
71
+ /** Build the combined read + write client over an injectable {@link TunnelAuth}. */
72
+ export const readWriteClient = (auth: TunnelAuth): ReadWriteTunnelClient => ({
73
+ ...readClient(auth),
74
+ ...writeClient(auth),
75
75
  });
@@ -0,0 +1,39 @@
1
+ import * as Layer from "effect/Layer";
2
+ import { readWriteClient, ReadWriteTunnel } from "./ReadWriteTunnel.ts";
3
+ import { makeLocalTunnelClient } from "./TunnelLocalBinding.ts";
4
+
5
+ /**
6
+ * Local implementation of the {@link ReadWriteTunnel} binding — performs the
7
+ * full cfd_tunnel CRUD surface over the HTTP API using the **current
8
+ * credentials** instead of a native Worker binding (`ReadWriteTunnelBinding`)
9
+ * or a scoped API token. No `host.bind`, no minted token, no Worker host.
10
+ *
11
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can manage
12
+ * tunnels with the same combined read + write client you'd use inside a Worker.
13
+ *
14
+ * @example Configure a deployed tunnel from an Action
15
+ * ```typescript
16
+ * const Configure = Alchemy.Action(
17
+ * "Configure",
18
+ * Effect.gen(function* () {
19
+ * const tunnels = yield* Cloudflare.Tunnel.ReadWriteTunnel();
20
+ * const tunnelId = yield* tunnel.tunnelId;
21
+ * return Effect.fn(function* () {
22
+ * const id = yield* tunnelId;
23
+ * yield* tunnels.putConfiguration(id, {
24
+ * ingress: [
25
+ * { hostname: "app.example.com", service: "http://localhost:3000" },
26
+ * { service: "http_status:404" },
27
+ * ],
28
+ * });
29
+ * const { config } = yield* tunnels.getConfiguration(id);
30
+ * return config;
31
+ * });
32
+ * }).pipe(Effect.provide(Cloudflare.Tunnel.ReadWriteTunnelLocal)),
33
+ * );
34
+ * ```
35
+ */
36
+ export const ReadWriteTunnelLocal = Layer.effect(
37
+ ReadWriteTunnel,
38
+ makeLocalTunnelClient(readWriteClient),
39
+ );
@@ -1,8 +1,12 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import type * as Redacted from "effect/Redacted";
3
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
4
+ import type { RuntimeContext } from "../../RuntimeContext.ts";
3
5
  import { AccountApiToken } from "../ApiToken/AccountApiToken.ts";
4
6
  import type { PermissionGroupRef } from "../ApiToken/Common.ts";
5
7
  import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
8
+ import type { Credentials } from "../Credentials.ts";
9
+ import { authorizeWith } from "../HttpClientUtils.ts";
6
10
  import { Worker } from "../Workers/Worker.ts";
7
11
 
8
12
  /**
@@ -16,7 +20,7 @@ import { Worker } from "../Workers/Worker.ts";
16
20
  export const makeTunnelClient = <C>(
17
21
  sid: string,
18
22
  permissionGroups: PermissionGroupRef[],
19
- makeClient: (token: Token) => C,
23
+ makeClient: (auth: TunnelAuth) => C,
20
24
  ) =>
21
25
  Effect.gen(function* () {
22
26
  const Token = yield* AccountApiToken;
@@ -39,10 +43,30 @@ export const makeTunnelClient = <C>(
39
43
  ],
40
44
  });
41
45
  }
42
- return makeClient(yield* bindTunnelToken(token));
46
+ return makeClient(makeTunnelAuth(yield* bindTunnelToken(token)));
43
47
  });
44
48
  });
45
49
 
50
+ /**
51
+ * Injectable auth for the tunnel client builders. Both the scoped-token
52
+ * (`*Binding`) and current-credentials (`*Local`) variants supply an
53
+ * `authorize` (which provides `Credentials` + `HttpClient` to a raw SDK op)
54
+ * and an `accountId`, so the client builders are agnostic to how creds are
55
+ * obtained.
56
+ */
57
+ export interface TunnelAuth {
58
+ authorize: <A, E>(
59
+ eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
60
+ ) => Effect.Effect<A, E, RuntimeContext>;
61
+ accountId: Effect.Effect<string>;
62
+ }
63
+
64
+ /** Build a scoped-token {@link TunnelAuth} from a bound {@link Token}. */
65
+ export const makeTunnelAuth = (token: Token): TunnelAuth => ({
66
+ authorize: authorizeWith(token),
67
+ accountId: token.accountId,
68
+ });
69
+
46
70
  /**
47
71
  * Runtime accessors for a tunnel binding's token, obtained by binding the
48
72
  * {@link AccountApiToken}'s outputs in the Worker's Init phase. Each accessor