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
@@ -0,0 +1,183 @@
1
+ import type * as cf from "@cloudflare/workers-types";
2
+ import * as flagship from "@distilled.cloud/cloudflare/flagship";
3
+ import * as Effect from "effect/Effect";
4
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
5
+ import type { RuntimeContext } from "../../RuntimeContext.ts";
6
+ import type { Credentials } from "../Credentials.ts";
7
+ import {
8
+ type EvaluationContext,
9
+ type EvaluationDetails,
10
+ FlagshipError,
11
+ type ReadFlagsClient,
12
+ } from "./ReadFlags.ts";
13
+
14
+ // Shared HTTP scaffolding for the Flagship `ReadFlags` binding. NOT
15
+ // re-exported from `index.ts` — only the contract and the impl layers are
16
+ // public. A future token-scoped `ReadFlagsHttp` layer reuses this builder with
17
+ // an auth minted from an `AccountApiToken`; `ReadFlagsLocal` builds the auth
18
+ // from the ambient current-credentials context.
19
+
20
+ /**
21
+ * Injectable auth shared by the Local (current-credentials) impl and a future
22
+ * Http (scoped-token) impl. `authorize` discharges the
23
+ * `Credentials | HttpClient` requirement of a distilled op; `accountId` is the
24
+ * Cloudflare account the ops run against.
25
+ */
26
+ export interface FlagshipAuth {
27
+ authorize: <A, E>(
28
+ eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
29
+ ) => Effect.Effect<A, E>;
30
+ accountId: string;
31
+ }
32
+
33
+ /**
34
+ * The HTTP evaluate endpoint only supports a single `targetingKey` query
35
+ * param, not the full flat evaluation context the Worker binding accepts.
36
+ */
37
+ const targetingKeyOf = (
38
+ context: EvaluationContext | undefined,
39
+ ): string | undefined => {
40
+ const value = context?.["targetingKey"];
41
+ return value === undefined ? undefined : String(value);
42
+ };
43
+
44
+ /**
45
+ * Build a {@link ReadFlagsClient} over the Flagship HTTP evaluate endpoint
46
+ * (`GET .../flagship/apps/{appId}/evaluate`).
47
+ *
48
+ * `appId` is an Effect so the resolution stays deferred to each call — inside
49
+ * an Action it resolves through the apply-time RuntimeContext. Mirrors the
50
+ * Worker binding's fall-back-to-default semantics: evaluation never fails the
51
+ * effect — an HTTP error or a value whose type does not match the requested
52
+ * method resolves to `defaultValue` instead. The `raw` runtime binding has no
53
+ * HTTP equivalent and dies if used.
54
+ */
55
+ export const makeHttpFlagshipClient = (
56
+ auth: FlagshipAuth,
57
+ appId: Effect.Effect<string>,
58
+ ): ReadFlagsClient => {
59
+ const evaluate = (flagKey: string, context?: EvaluationContext) =>
60
+ appId.pipe(
61
+ Effect.flatMap((id) =>
62
+ auth.authorize(
63
+ flagship.getAppEvaluate({
64
+ accountId: auth.accountId,
65
+ appId: id,
66
+ flagKey,
67
+ targetingKey: targetingKeyOf(context),
68
+ }),
69
+ ),
70
+ ),
71
+ );
72
+
73
+ const details = <T>(
74
+ flagKey: string,
75
+ defaultValue: T,
76
+ match: (value: unknown) => value is T,
77
+ context?: EvaluationContext,
78
+ ): Effect.Effect<EvaluationDetails<T>, FlagshipError, RuntimeContext> =>
79
+ evaluate(flagKey, context).pipe(
80
+ Effect.map(
81
+ (r): EvaluationDetails<T> =>
82
+ match(r.value)
83
+ ? { flagKey, value: r.value, variant: r.variant, reason: r.reason }
84
+ : {
85
+ flagKey,
86
+ value: defaultValue,
87
+ variant: r.variant,
88
+ reason: r.reason,
89
+ errorCode: "TYPE_MISMATCH",
90
+ },
91
+ ),
92
+ Effect.catch((error) =>
93
+ Effect.succeed<EvaluationDetails<T>>({
94
+ flagKey,
95
+ value: defaultValue,
96
+ reason: "ERROR",
97
+ errorCode: error._tag,
98
+ }),
99
+ ),
100
+ );
101
+
102
+ const value = <T>(
103
+ flagKey: string,
104
+ defaultValue: T,
105
+ match: (value: unknown) => value is T,
106
+ context?: EvaluationContext,
107
+ ): Effect.Effect<T, FlagshipError, RuntimeContext> =>
108
+ evaluate(flagKey, context).pipe(
109
+ Effect.map((r) => (match(r.value) ? r.value : defaultValue)),
110
+ Effect.catch(() => Effect.succeed(defaultValue)),
111
+ );
112
+
113
+ const isBoolean = (v: unknown): v is boolean => typeof v === "boolean";
114
+ const isString = (v: unknown): v is string => typeof v === "string";
115
+ const isNumber = (v: unknown): v is number => typeof v === "number";
116
+ const isObjectLike = (v: unknown): boolean =>
117
+ v !== null && typeof v === "object";
118
+
119
+ return {
120
+ // The raw runtime binding is a workerd object with no HTTP surface.
121
+ raw: Effect.die(
122
+ new FlagshipError({
123
+ message:
124
+ "the raw Flagship runtime binding is unavailable over HTTP; use ReadFlagsBinding inside a Worker",
125
+ cause: undefined,
126
+ }),
127
+ ) as Effect.Effect<cf.Flagship, never, RuntimeContext>,
128
+ get: (flagKey, defaultValue, context) =>
129
+ evaluate(flagKey, context).pipe(
130
+ Effect.map((r) => r.value ?? defaultValue),
131
+ Effect.catch(() => Effect.succeed(defaultValue)),
132
+ ),
133
+ getBooleanValue: (flagKey, defaultValue, context) =>
134
+ value(flagKey, defaultValue, isBoolean, context),
135
+ getStringValue: (flagKey, defaultValue, context) =>
136
+ value(flagKey, defaultValue, isString, context),
137
+ getNumberValue: (flagKey, defaultValue, context) =>
138
+ value(flagKey, defaultValue, isNumber, context),
139
+ getObjectValue: (flagKey, defaultValue, context) =>
140
+ evaluate(flagKey, context).pipe(
141
+ Effect.map((r) =>
142
+ isObjectLike(r.value)
143
+ ? (r.value as typeof defaultValue)
144
+ : defaultValue,
145
+ ),
146
+ Effect.catch(() => Effect.succeed(defaultValue)),
147
+ ),
148
+ getBooleanDetails: (flagKey, defaultValue, context) =>
149
+ details(flagKey, defaultValue, isBoolean, context),
150
+ getStringDetails: (flagKey, defaultValue, context) =>
151
+ details(flagKey, defaultValue, isString, context),
152
+ getNumberDetails: (flagKey, defaultValue, context) =>
153
+ details(flagKey, defaultValue, isNumber, context),
154
+ getObjectDetails: (flagKey, defaultValue, context) =>
155
+ evaluate(flagKey, context).pipe(
156
+ Effect.map(
157
+ (r): EvaluationDetails<typeof defaultValue> =>
158
+ isObjectLike(r.value)
159
+ ? {
160
+ flagKey,
161
+ value: r.value as typeof defaultValue,
162
+ variant: r.variant,
163
+ reason: r.reason,
164
+ }
165
+ : {
166
+ flagKey,
167
+ value: defaultValue,
168
+ variant: r.variant,
169
+ reason: r.reason,
170
+ errorCode: "TYPE_MISMATCH",
171
+ },
172
+ ),
173
+ Effect.catch((error) =>
174
+ Effect.succeed<EvaluationDetails<typeof defaultValue>>({
175
+ flagKey,
176
+ value: defaultValue,
177
+ reason: "ERROR",
178
+ errorCode: error._tag,
179
+ }),
180
+ ),
181
+ ),
182
+ } satisfies ReadFlagsClient;
183
+ };
@@ -0,0 +1,69 @@
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 { App } from "./App.ts";
7
+ import { ReadFlags } from "./ReadFlags.ts";
8
+ import {
9
+ type FlagshipAuth,
10
+ makeHttpFlagshipClient,
11
+ } from "./ReadFlagsHttpClient.ts";
12
+
13
+ /**
14
+ * Local implementation of the {@link ReadFlags} binding — evaluates Flagship
15
+ * feature flags over the Cloudflare HTTP API (`GET .../flagship/apps/{appId}/evaluate`)
16
+ * using the **current credentials** instead of a native Worker binding
17
+ * ({@link ReadFlagsBinding}).
18
+ *
19
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can read
20
+ * flag values with the same `getBooleanValue`/`getStringValue`/… client you'd
21
+ * use inside a Worker:
22
+ *
23
+ * @example Reading a flag from an Action
24
+ * ```typescript
25
+ * const CheckFlag = Alchemy.Action(
26
+ * "CheckFlag",
27
+ * Effect.gen(function* () {
28
+ * const flags = yield* Cloudflare.Flagship.ReadFlags(app);
29
+ * return Effect.fn(function* () {
30
+ * return yield* flags.getBooleanValue("new-checkout", false);
31
+ * });
32
+ * }).pipe(Effect.provide(Cloudflare.Flagship.ReadFlagsLocal)),
33
+ * );
34
+ * ```
35
+ *
36
+ * The app id is resolved at apply time through the ambient {@link RuntimeContext}
37
+ * (in an Action, that's the resolve context the engine provides around the
38
+ * body), so `ReadFlags(app)` works even though the app is created in the same
39
+ * deploy.
40
+ *
41
+ * Limitations vs. the Worker binding: the HTTP evaluate endpoint only accepts a
42
+ * single `targetingKey` (read from `context.targetingKey`), so attribute-based
43
+ * targeting rules that key off other context fields cannot be exercised locally.
44
+ * The `raw` runtime binding has no HTTP equivalent and dies if used — see
45
+ * {@link makeHttpFlagshipClient}.
46
+ */
47
+ export const ReadFlagsLocal = Layer.effect(
48
+ ReadFlags,
49
+ Effect.gen(function* () {
50
+ // Account + credentials are ambient during stack-eval (the stack's
51
+ // providers layer). Capture the full context so the evaluate op can run
52
+ // with the current credentials — no `host.bind`, no minted token.
53
+ const { accountId } = yield* yield* CloudflareEnvironment;
54
+ const context = yield* Effect.context<
55
+ Credentials | HttpClient.HttpClient
56
+ >();
57
+ const auth: FlagshipAuth = {
58
+ authorize: (eff) => eff.pipe(Effect.provideContext(context)),
59
+ accountId,
60
+ };
61
+
62
+ return Effect.fn(function* (app: App) {
63
+ // Deferred accessor — resolves the appId against the tracker at apply
64
+ // time (in an Action, that's the engine's resolve context).
65
+ const appId = yield* app.appId;
66
+ return makeHttpFlagshipClient(auth, appId);
67
+ });
68
+ }),
69
+ );
@@ -8,3 +8,4 @@ export {
8
8
  type EvaluationDetails,
9
9
  } from "./ReadFlags.ts";
10
10
  export { ReadFlagsBinding } from "./ReadFlagsBinding.ts";
11
+ export { ReadFlagsLocal } from "./ReadFlagsLocal.ts";
@@ -1,9 +1,13 @@
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 { Self } from "../../Self.ts";
4
6
  import { AccountApiToken } from "../ApiToken/AccountApiToken.ts";
5
7
  import type { PermissionGroupRef } from "../ApiToken/Common.ts";
6
8
  import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
9
+ import type { Credentials } from "../Credentials.ts";
10
+ import { authorizeWith } from "../HttpClientUtils.ts";
7
11
  import type { Namespace } from "./Namespace.ts";
8
12
  import { NamespaceError } from "./NamespaceTypes.ts";
9
13
 
@@ -58,6 +62,25 @@ export interface HttpScope {
58
62
  namespaceId: string;
59
63
  }
60
64
 
65
+ /**
66
+ * Injectable auth for the KV HTTP client builders. Both the scoped-token
67
+ * (`*Http`) and current-credentials (`*Local`) variants supply an `authorize`
68
+ * (which provides `Credentials` + `HttpClient` to a raw SDK op) and an
69
+ * `accountId`, so the client builders are agnostic to how creds are obtained.
70
+ */
71
+ export interface KVAuth {
72
+ authorize: <A, E>(
73
+ eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
74
+ ) => Effect.Effect<A, E, RuntimeContext>;
75
+ accountId: Effect.Effect<string>;
76
+ }
77
+
78
+ /** Build a scoped-token {@link KVAuth} from a bound {@link HttpToken}. */
79
+ export const makeKVAuth = (token: HttpToken): KVAuth => ({
80
+ authorize: authorizeWith(token),
81
+ accountId: token.accountId,
82
+ });
83
+
61
84
  const KV_HTTP_PERMISSION_GROUPS: PermissionGroupRef[] = [
62
85
  "Workers KV Storage Read",
63
86
  "Workers KV Storage Write",
@@ -67,11 +90,11 @@ type PermissionGroup = (typeof KV_HTTP_PERMISSION_GROUPS)[number];
67
90
 
68
91
  /** Resolve the account and namespace id once per operation. */
69
92
  export const makeKVHttpScope = (
70
- token: HttpToken,
93
+ auth: KVAuth,
71
94
  namespaceId: Effect.Effect<string>,
72
95
  ): Effect.Effect<HttpScope> =>
73
96
  Effect.gen(function* () {
74
- const accountId = yield* token.accountId;
97
+ const accountId = yield* auth.accountId;
75
98
  const id = yield* namespaceId;
76
99
  return { accountId, namespaceId: id };
77
100
  });
@@ -0,0 +1,42 @@
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 { Namespace } from "./Namespace.ts";
6
+ import type { KVAuth } from "./NamespaceHttp.ts";
7
+
8
+ /**
9
+ * Shared scaffolding for the `*Local` KV services.
10
+ *
11
+ * Instead of minting a scoped {@link AccountApiToken} (the `*Http` path) or
12
+ * resolving a native Worker binding (the `*Binding` path), it captures the
13
+ * ambient current-credentials context available during stack-eval and builds
14
+ * a {@link KVAuth} that provides those credentials directly to the KV HTTP
15
+ * ops. It then delegates to the same client builders the `*Http` variant uses.
16
+ *
17
+ * NOT exported from `index.ts` — this is internal scaffolding shared by the
18
+ * three access-level Local layers.
19
+ */
20
+ export const makeLocalKVNamespaceBinding = <Client>(options: {
21
+ makeClient: (auth: KVAuth, namespaceId: Effect.Effect<string>) => Client;
22
+ }) =>
23
+ Effect.gen(function* () {
24
+ // Account + credentials are ambient during stack-eval (the stack's
25
+ // providers layer). Capture the full context so KV HTTP ops can run with
26
+ // the current credentials — no `host.bind`, no minted token.
27
+ const { accountId } = yield* yield* CloudflareEnvironment;
28
+ const context = yield* Effect.context<
29
+ Credentials | HttpClient.HttpClient
30
+ >();
31
+
32
+ return Effect.fn(function* (namespace: Namespace) {
33
+ // Deferred accessor — resolves the namespaceId against the tracker at
34
+ // apply time (in an Action, that's the engine's resolve context).
35
+ const namespaceId = yield* namespace.namespaceId;
36
+ const auth: KVAuth = {
37
+ authorize: (eff) => eff.pipe(Effect.provideContext(context)),
38
+ accountId: Effect.succeed(accountId),
39
+ };
40
+ return options.makeClient(auth, namespaceId);
41
+ });
42
+ });
@@ -1,12 +1,12 @@
1
1
  import * as kv from "@distilled.cloud/cloudflare/kv";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Layer from "effect/Layer";
4
- import { authorizeWith } from "../HttpClientUtils.ts";
5
4
  import {
6
5
  makeHttpKVNamespaceBinding,
6
+ makeKVAuth,
7
7
  makeKVHttpScope,
8
8
  toKVNamespaceError,
9
- type HttpToken,
9
+ type KVAuth,
10
10
  } from "./NamespaceHttp.ts";
11
11
  import { ReadNamespace, type ReadNamespaceClient } from "./ReadNamespace.ts";
12
12
 
@@ -21,17 +21,18 @@ export const ReadNamespaceHttp = Layer.effect(
21
21
  Effect.suspend(() =>
22
22
  makeHttpKVNamespaceBinding({
23
23
  permissionGroups: ["Workers KV Storage Read"],
24
- makeClient: makeReadKVHttpClient,
24
+ makeClient: (token, namespaceId) =>
25
+ makeReadKVHttpClient(makeKVAuth(token), namespaceId),
25
26
  }),
26
27
  ),
27
28
  );
28
29
 
29
30
  export const makeReadKVHttpClient = (
30
- token: HttpToken,
31
+ auth: KVAuth,
31
32
  namespaceId: Effect.Effect<string>,
32
33
  ): ReadNamespaceClient => {
33
- const authorize = authorizeWith(token);
34
- const scope = makeKVHttpScope(token, namespaceId);
34
+ const { authorize } = auth;
35
+ const scope = makeKVHttpScope(auth, namespaceId);
35
36
 
36
37
  const getOne = (key: string, type: string) =>
37
38
  scope.pipe(
@@ -0,0 +1,35 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalKVNamespaceBinding } from "./NamespaceLocal.ts";
4
+ import { ReadNamespace } from "./ReadNamespace.ts";
5
+ import { makeReadKVHttpClient } from "./ReadNamespaceHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link ReadNamespace} binding — reads KV values
9
+ * over the Cloudflare HTTP API using the **current credentials** instead of a
10
+ * native Worker binding (`ReadNamespaceBinding`) or a scoped API token
11
+ * (`ReadNamespaceHttp`).
12
+ *
13
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can read
14
+ * from a namespace with the same `get`/`getWithMetadata`/`list` client you'd
15
+ * use inside a Worker:
16
+ *
17
+ * @example Reading a value from an Action
18
+ * ```typescript
19
+ * const Check = Alchemy.Action(
20
+ * "Check",
21
+ * Effect.gen(function* () {
22
+ * const kv = yield* Cloudflare.KV.ReadNamespace(namespace);
23
+ * return Effect.fn(function* () {
24
+ * return yield* kv.get("my-key");
25
+ * });
26
+ * }).pipe(Effect.provide(Cloudflare.KV.ReadNamespaceLocal)),
27
+ * );
28
+ * ```
29
+ */
30
+ export const ReadNamespaceLocal = Layer.effect(
31
+ ReadNamespace,
32
+ Effect.suspend(() =>
33
+ makeLocalKVNamespaceBinding({ makeClient: makeReadKVHttpClient }),
34
+ ),
35
+ );
@@ -1,6 +1,10 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Layer from "effect/Layer";
3
- import { makeHttpKVNamespaceBinding, type HttpToken } from "./NamespaceHttp.ts";
3
+ import {
4
+ makeHttpKVNamespaceBinding,
5
+ makeKVAuth,
6
+ type KVAuth,
7
+ } from "./NamespaceHttp.ts";
4
8
  import { makeReadKVHttpClient } from "./ReadNamespaceHttp.ts";
5
9
  import {
6
10
  ReadWriteNamespace,
@@ -19,17 +23,18 @@ export const ReadWriteNamespaceHttp = Layer.effect(
19
23
  Effect.suspend(() =>
20
24
  makeHttpKVNamespaceBinding({
21
25
  permissionGroups: ["Workers KV Storage Read", "Workers KV Storage Write"],
22
- makeClient: makeReadWriteKVHttpClient,
26
+ makeClient: (token, namespaceId) =>
27
+ makeReadWriteKVHttpClient(makeKVAuth(token), namespaceId),
23
28
  }),
24
29
  ),
25
30
  );
26
31
 
27
- /** Build the HTTP-backed read-write client over a bound token + namespace. */
32
+ /** Build the HTTP-backed read-write client over an auth + namespace. */
28
33
  export const makeReadWriteKVHttpClient = (
29
- token: HttpToken,
34
+ auth: KVAuth,
30
35
  namespaceId: Effect.Effect<string>,
31
36
  ): ReadWriteNamespaceClient =>
32
37
  ({
33
- ...makeReadKVHttpClient(token, namespaceId),
34
- ...makeWriteKVHttpClient(token, namespaceId),
38
+ ...makeReadKVHttpClient(auth, namespaceId),
39
+ ...makeWriteKVHttpClient(auth, namespaceId),
35
40
  }) as ReadWriteNamespaceClient;
@@ -0,0 +1,42 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalKVNamespaceBinding } from "./NamespaceLocal.ts";
4
+ import { ReadWriteNamespace } from "./ReadWriteNamespace.ts";
5
+ import { makeReadWriteKVHttpClient } from "./ReadWriteNamespaceHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link ReadWriteNamespace} binding — reads and
9
+ * writes KV values over the Cloudflare HTTP API using the **current
10
+ * credentials** instead of a native Worker binding
11
+ * (`ReadWriteNamespaceBinding`) or a scoped API token
12
+ * (`ReadWriteNamespaceHttp`).
13
+ *
14
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can talk
15
+ * to a namespace with the same `get`/`put`/`list`/`delete` client you'd use
16
+ * inside a Worker:
17
+ *
18
+ * @example Seeding a namespace from an Action
19
+ * ```typescript
20
+ * const Seed = Alchemy.Action(
21
+ * "Seed",
22
+ * Effect.gen(function* () {
23
+ * const kv = yield* Cloudflare.KV.ReadWriteNamespace(namespace);
24
+ * return Effect.fn(function* () {
25
+ * yield* kv.put("greeting", "hello world");
26
+ * return yield* kv.get("greeting");
27
+ * });
28
+ * }).pipe(Effect.provide(Cloudflare.KV.ReadWriteNamespaceLocal)),
29
+ * );
30
+ * ```
31
+ *
32
+ * The namespace id is resolved at apply time through the ambient
33
+ * {@link RuntimeContext} (in an Action, that's the resolve context the engine
34
+ * provides around the body), so `ReadWriteNamespace(namespace)` works even
35
+ * though the namespace is created in the same deploy.
36
+ */
37
+ export const ReadWriteNamespaceLocal = Layer.effect(
38
+ ReadWriteNamespace,
39
+ Effect.suspend(() =>
40
+ makeLocalKVNamespaceBinding({ makeClient: makeReadWriteKVHttpClient }),
41
+ ),
42
+ );
@@ -1,12 +1,12 @@
1
1
  import * as kv from "@distilled.cloud/cloudflare/kv";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Layer from "effect/Layer";
4
- import { authorizeWith } from "../HttpClientUtils.ts";
5
4
  import {
6
5
  makeHttpKVNamespaceBinding,
6
+ makeKVAuth,
7
7
  makeKVHttpScope,
8
8
  toKVNamespaceError,
9
- type HttpToken,
9
+ type KVAuth,
10
10
  } from "./NamespaceHttp.ts";
11
11
  import { NamespaceError } from "./NamespaceTypes.ts";
12
12
  import { WriteNamespace, type WriteNamespaceClient } from "./WriteNamespace.ts";
@@ -22,17 +22,18 @@ export const WriteNamespaceHttp = Layer.effect(
22
22
  Effect.suspend(() =>
23
23
  makeHttpKVNamespaceBinding({
24
24
  permissionGroups: ["Workers KV Storage Write"],
25
- makeClient: makeWriteKVHttpClient,
25
+ makeClient: (token, namespaceId) =>
26
+ makeWriteKVHttpClient(makeKVAuth(token), namespaceId),
26
27
  }),
27
28
  ),
28
29
  );
29
30
 
30
31
  export const makeWriteKVHttpClient = (
31
- token: HttpToken,
32
+ auth: KVAuth,
32
33
  namespaceId: Effect.Effect<string>,
33
34
  ): WriteNamespaceClient => {
34
- const authorize = authorizeWith(token);
35
- const scope = makeKVHttpScope(token, namespaceId);
35
+ const { authorize } = auth;
36
+ const scope = makeKVHttpScope(auth, namespaceId);
36
37
 
37
38
  return {
38
39
  put: ((
@@ -0,0 +1,35 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { makeLocalKVNamespaceBinding } from "./NamespaceLocal.ts";
4
+ import { WriteNamespace } from "./WriteNamespace.ts";
5
+ import { makeWriteKVHttpClient } from "./WriteNamespaceHttp.ts";
6
+
7
+ /**
8
+ * Local implementation of the {@link WriteNamespace} binding — writes KV
9
+ * values over the Cloudflare HTTP API using the **current credentials**
10
+ * instead of a native Worker binding (`WriteNamespaceBinding`) or a scoped API
11
+ * token (`WriteNamespaceHttp`).
12
+ *
13
+ * Provide it on an {@link Action} (or any deploy-time Effect) so you can write
14
+ * to a namespace with the same `put`/`delete` client you'd use inside a
15
+ * Worker:
16
+ *
17
+ * @example Writing a value from an Action
18
+ * ```typescript
19
+ * const Seed = Alchemy.Action(
20
+ * "Seed",
21
+ * Effect.gen(function* () {
22
+ * const kv = yield* Cloudflare.KV.WriteNamespace(namespace);
23
+ * return Effect.fn(function* () {
24
+ * yield* kv.put("my-key", "hello world");
25
+ * });
26
+ * }).pipe(Effect.provide(Cloudflare.KV.WriteNamespaceLocal)),
27
+ * );
28
+ * ```
29
+ */
30
+ export const WriteNamespaceLocal = Layer.effect(
31
+ WriteNamespace,
32
+ Effect.suspend(() =>
33
+ makeLocalKVNamespaceBinding({ makeClient: makeWriteKVHttpClient }),
34
+ ),
35
+ );
@@ -3,9 +3,12 @@ export * from "./NamespaceTypes.ts";
3
3
  export * from "./ReadNamespace.ts";
4
4
  export * from "./ReadNamespaceBinding.ts";
5
5
  export * from "./ReadNamespaceHttp.ts";
6
+ export * from "./ReadNamespaceLocal.ts";
6
7
  export * from "./ReadWriteNamespace.ts";
7
8
  export * from "./ReadWriteNamespaceBinding.ts";
8
9
  export * from "./ReadWriteNamespaceHttp.ts";
10
+ export * from "./ReadWriteNamespaceLocal.ts";
9
11
  export * from "./WriteNamespace.ts";
10
12
  export * from "./WriteNamespaceBinding.ts";
11
13
  export * from "./WriteNamespaceHttp.ts";
14
+ export * from "./WriteNamespaceLocal.ts";
@@ -1,12 +1,34 @@
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 { Self } from "../../Self.ts";
4
6
  import { AccountApiToken } from "../ApiToken/AccountApiToken.ts";
5
7
  import type { PermissionGroupRef } from "../ApiToken/Common.ts";
6
8
  import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
9
+ import type { Credentials } from "../Credentials.ts";
7
10
  import type { Queue } from "./Queue.ts";
8
11
  import { SendError } from "./QueueTypes.ts";
9
12
 
13
+ /**
14
+ * Injectable auth used by the Queue HTTP client builder. Both the
15
+ * scoped-token HTTP variant ({@link makeWriteQueueHttpClient}) and the
16
+ * current-credentials Local variant build this so they share the exact
17
+ * same request path — only the way credentials reach the SDK op differs.
18
+ *
19
+ * - `authorize` runs a raw distilled op (which needs
20
+ * `Credentials | HttpClient`) and discharges those requirements down to
21
+ * {@link RuntimeContext}. The HTTP variant provides a minted token; the
22
+ * Local variant provides the ambient current-credentials context.
23
+ * - `accountId` resolves the Cloudflare account the queue lives in.
24
+ */
25
+ export interface QueueAuth {
26
+ authorize: <A, E>(
27
+ eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
28
+ ) => Effect.Effect<A, E, RuntimeContext>;
29
+ accountId: Effect.Effect<string>;
30
+ }
31
+
10
32
  /**
11
33
  * Shared scaffolding for the HTTP-backed Queue services.
12
34
  *
@@ -50,11 +72,11 @@ export const makeHttpQueueBinding = <Client>(options: {
50
72
 
51
73
  /** Resolve the account and queue id once per operation. */
52
74
  export const makeQueueHttpScope = (
53
- token: HttpToken,
75
+ auth: QueueAuth,
54
76
  queueId: Effect.Effect<string>,
55
77
  ): Effect.Effect<HttpScope> =>
56
78
  Effect.gen(function* () {
57
- const accountId = yield* token.accountId;
79
+ const accountId = yield* auth.accountId;
58
80
  const id = yield* queueId;
59
81
  return { accountId, queueId: id };
60
82
  });