alchemy 2.0.0-beta.44 → 2.0.0-beta.45

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 (404) hide show
  1. package/bin/exec.js +67 -8
  2. package/bin/exec.js.map +1 -1
  3. package/lib/AWS/Lambda/Function.d.ts +17 -0
  4. package/lib/AWS/Lambda/Function.d.ts.map +1 -1
  5. package/lib/AWS/Lambda/Function.js +61 -16
  6. package/lib/AWS/Lambda/Function.js.map +1 -1
  7. package/lib/AWS/Providers.d.ts +2 -1
  8. package/lib/AWS/Providers.d.ts.map +1 -1
  9. package/lib/AWS/Providers.js +3 -1
  10. package/lib/AWS/Providers.js.map +1 -1
  11. package/lib/Apply.js +17 -1
  12. package/lib/Apply.js.map +1 -1
  13. package/lib/Auth/AuthProvider.d.ts.map +1 -1
  14. package/lib/Auth/AuthProvider.js +24 -6
  15. package/lib/Auth/AuthProvider.js.map +1 -1
  16. package/lib/Auth/Credentials.d.ts.map +1 -1
  17. package/lib/Auth/Credentials.js +3 -3
  18. package/lib/Auth/Credentials.js.map +1 -1
  19. package/lib/Cli/commands/_shared.d.ts +13 -1
  20. package/lib/Cli/commands/_shared.d.ts.map +1 -1
  21. package/lib/Cli/commands/_shared.js +33 -2
  22. package/lib/Cli/commands/_shared.js.map +1 -1
  23. package/lib/Cli/commands/dev.d.ts.map +1 -1
  24. package/lib/Cli/commands/dev.js +10 -1
  25. package/lib/Cli/commands/dev.js.map +1 -1
  26. package/lib/Cli/commands/login.d.ts.map +1 -1
  27. package/lib/Cli/commands/login.js +19 -5
  28. package/lib/Cli/commands/login.js.map +1 -1
  29. package/lib/Cli/commands/profile.d.ts.map +1 -1
  30. package/lib/Cli/commands/profile.js +7 -27
  31. package/lib/Cli/commands/profile.js.map +1 -1
  32. package/lib/Cli/main.d.ts.map +1 -1
  33. package/lib/Cli/main.js +0 -2
  34. package/lib/Cli/main.js.map +1 -1
  35. package/lib/Cloudflare/AiGateway/AiGateway.d.ts +0 -2
  36. package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -1
  37. package/lib/Cloudflare/AiGateway/AiGateway.js +2 -4
  38. package/lib/Cloudflare/AiGateway/AiGateway.js.map +1 -1
  39. package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts +116 -0
  40. package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts.map +1 -0
  41. package/lib/Cloudflare/BrowserRendering/BrowserRendering.js +92 -0
  42. package/lib/Cloudflare/BrowserRendering/BrowserRendering.js.map +1 -0
  43. package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts +55 -0
  44. package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts.map +1 -0
  45. package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js +55 -0
  46. package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js.map +1 -0
  47. package/lib/Cloudflare/BrowserRendering/index.d.ts +3 -0
  48. package/lib/Cloudflare/BrowserRendering/index.d.ts.map +1 -0
  49. package/lib/Cloudflare/BrowserRendering/index.js +3 -0
  50. package/lib/Cloudflare/BrowserRendering/index.js.map +1 -0
  51. package/lib/Cloudflare/Container/Container.d.ts +3 -3
  52. package/lib/Cloudflare/Container/Container.js +3 -3
  53. package/lib/Cloudflare/Container/StartContainer.d.ts.map +1 -1
  54. package/lib/Cloudflare/Container/StartContainer.js.map +1 -1
  55. package/lib/Cloudflare/D1/D1Database.d.ts +1 -0
  56. package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
  57. package/lib/Cloudflare/D1/D1Database.js +2 -1
  58. package/lib/Cloudflare/D1/D1Database.js.map +1 -1
  59. package/lib/Cloudflare/D1/D1DatabaseBinding.js +1 -1
  60. package/lib/Cloudflare/D1/D1DatabaseBinding.js.map +1 -1
  61. package/lib/Cloudflare/Fetcher.d.ts.map +1 -1
  62. package/lib/Cloudflare/Fetcher.js +0 -2
  63. package/lib/Cloudflare/Fetcher.js.map +1 -1
  64. package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts +1 -0
  65. package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts.map +1 -1
  66. package/lib/Cloudflare/Hyperdrive/Hyperdrive.js +3 -0
  67. package/lib/Cloudflare/Hyperdrive/Hyperdrive.js.map +1 -1
  68. package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts +3 -2
  69. package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts.map +1 -1
  70. package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js +32 -33
  71. package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js.map +1 -1
  72. package/lib/Cloudflare/KV/KVNamespace.d.ts +1 -0
  73. package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
  74. package/lib/Cloudflare/KV/KVNamespace.js +2 -0
  75. package/lib/Cloudflare/KV/KVNamespace.js.map +1 -1
  76. package/lib/Cloudflare/Local.js +1 -1
  77. package/lib/Cloudflare/Local.js.map +1 -1
  78. package/lib/Cloudflare/Providers.d.ts +2 -1
  79. package/lib/Cloudflare/Providers.d.ts.map +1 -1
  80. package/lib/Cloudflare/Providers.js +21 -17
  81. package/lib/Cloudflare/Providers.js.map +1 -1
  82. package/lib/Cloudflare/Queue/Queue.d.ts +1 -0
  83. package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -1
  84. package/lib/Cloudflare/Queue/Queue.js +1 -0
  85. package/lib/Cloudflare/Queue/Queue.js.map +1 -1
  86. package/lib/Cloudflare/Queue/QueueConsumer.d.ts +2 -1
  87. package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
  88. package/lib/Cloudflare/Queue/QueueConsumer.js +11 -3
  89. package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -1
  90. package/lib/Cloudflare/Queue/QueueEventSource.d.ts +30 -4
  91. package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -1
  92. package/lib/Cloudflare/Queue/QueueEventSource.js +22 -1
  93. package/lib/Cloudflare/Queue/QueueEventSource.js.map +1 -1
  94. package/lib/Cloudflare/R2/R2Bucket.d.ts +1 -0
  95. package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
  96. package/lib/Cloudflare/R2/R2Bucket.js +18 -0
  97. package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
  98. package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
  99. package/lib/Cloudflare/SecretsStore/Secret.js +13 -34
  100. package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -1
  101. package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +3 -2
  102. package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -1
  103. package/lib/Cloudflare/SecretsStore/SecretBinding.js +3 -2
  104. package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
  105. package/lib/Cloudflare/StateStore/Api.d.ts +5 -13
  106. package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
  107. package/lib/Cloudflare/StateStore/Api.js +14 -8
  108. package/lib/Cloudflare/StateStore/Api.js.map +1 -1
  109. package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
  110. package/lib/Cloudflare/StateStore/State.js +45 -9
  111. package/lib/Cloudflare/StateStore/State.js.map +1 -1
  112. package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
  113. package/lib/Cloudflare/StateStore/Store.js +5 -2
  114. package/lib/Cloudflare/StateStore/Store.js.map +1 -1
  115. package/lib/Cloudflare/VpcService/VpcService.d.ts +2 -2
  116. package/lib/Cloudflare/VpcService/VpcService.d.ts.map +1 -1
  117. package/lib/Cloudflare/Website/StaticSite.d.ts +5 -5
  118. package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
  119. package/lib/Cloudflare/Website/StaticSite.js +3 -0
  120. package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
  121. package/lib/Cloudflare/Website/Vite.d.ts +5 -5
  122. package/lib/Cloudflare/Website/Vite.d.ts.map +1 -1
  123. package/lib/Cloudflare/Website/Vite.js.map +1 -1
  124. package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
  125. package/lib/Cloudflare/Workers/Assets.js +1 -1
  126. package/lib/Cloudflare/Workers/Assets.js.map +1 -1
  127. package/lib/Cloudflare/Workers/DurableObjectBridge.d.ts.map +1 -1
  128. package/lib/Cloudflare/Workers/DurableObjectBridge.js +4 -2
  129. package/lib/Cloudflare/Workers/DurableObjectBridge.js.map +1 -1
  130. package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts +183 -6
  131. package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts.map +1 -1
  132. package/lib/Cloudflare/Workers/DurableObjectNamespace.js +279 -76
  133. package/lib/Cloudflare/Workers/DurableObjectNamespace.js.map +1 -1
  134. package/lib/Cloudflare/Workers/HttpServer.d.ts +6 -4
  135. package/lib/Cloudflare/Workers/HttpServer.d.ts.map +1 -1
  136. package/lib/Cloudflare/Workers/HttpServer.js +20 -15
  137. package/lib/Cloudflare/Workers/HttpServer.js.map +1 -1
  138. package/lib/Cloudflare/Workers/InferEnv.d.ts +3 -2
  139. package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
  140. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +4 -7
  141. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
  142. package/lib/Cloudflare/Workers/LocalWorkerProvider.js +111 -66
  143. package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
  144. package/lib/Cloudflare/Workers/Rpc.d.ts +16 -0
  145. package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
  146. package/lib/Cloudflare/Workers/Rpc.js +22 -0
  147. package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
  148. package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts +285 -0
  149. package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts.map +1 -0
  150. package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js +288 -0
  151. package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js.map +1 -0
  152. package/lib/Cloudflare/Workers/RpcWorker.d.ts +305 -0
  153. package/lib/Cloudflare/Workers/RpcWorker.d.ts.map +1 -0
  154. package/lib/Cloudflare/Workers/RpcWorker.js +350 -0
  155. package/lib/Cloudflare/Workers/RpcWorker.js.map +1 -0
  156. package/lib/Cloudflare/Workers/Vite.d.ts +1 -1
  157. package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
  158. package/lib/Cloudflare/Workers/Vite.js +2 -1
  159. package/lib/Cloudflare/Workers/Vite.js.map +1 -1
  160. package/lib/Cloudflare/Workers/Worker.d.ts +69 -24
  161. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  162. package/lib/Cloudflare/Workers/Worker.js +168 -47
  163. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  164. package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts +1 -1
  165. package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
  166. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +158 -97
  167. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
  168. package/lib/Cloudflare/Workers/WorkerBinding.d.ts +11 -23
  169. package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
  170. package/lib/Cloudflare/Workers/WorkerBinding.js +3 -0
  171. package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
  172. package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
  173. package/lib/Cloudflare/Workers/WorkerBridge.js +5 -2
  174. package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
  175. package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
  176. package/lib/Cloudflare/Workers/WorkerBundle.js +4 -1
  177. package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
  178. package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
  179. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +9 -10
  180. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
  181. package/lib/Cloudflare/Workers/Workflow.d.ts +5 -3
  182. package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
  183. package/lib/Cloudflare/Workers/Workflow.js +19 -1
  184. package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
  185. package/lib/Cloudflare/Workers/index.d.ts +2 -0
  186. package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
  187. package/lib/Cloudflare/Workers/index.js +2 -0
  188. package/lib/Cloudflare/Workers/index.js.map +1 -1
  189. package/lib/Cloudflare/index.d.ts +1 -0
  190. package/lib/Cloudflare/index.d.ts.map +1 -1
  191. package/lib/Cloudflare/index.js +1 -0
  192. package/lib/Cloudflare/index.js.map +1 -1
  193. package/lib/Dependencies.d.ts +10 -0
  194. package/lib/Dependencies.d.ts.map +1 -0
  195. package/lib/Dependencies.js +1 -0
  196. package/lib/Dependencies.js.map +1 -0
  197. package/lib/Deploy.d.ts +2 -1
  198. package/lib/Deploy.d.ts.map +1 -1
  199. package/lib/Deploy.js +2 -2
  200. package/lib/Deploy.js.map +1 -1
  201. package/lib/Diff.d.ts +11 -0
  202. package/lib/Diff.d.ts.map +1 -1
  203. package/lib/Diff.js +11 -0
  204. package/lib/Diff.js.map +1 -1
  205. package/lib/Input.d.ts +2 -1
  206. package/lib/Input.d.ts.map +1 -1
  207. package/lib/KeyPair.d.ts +77 -0
  208. package/lib/KeyPair.d.ts.map +1 -0
  209. package/lib/KeyPair.js +102 -0
  210. package/lib/KeyPair.js.map +1 -0
  211. package/lib/Local/RpcProvider.d.ts +3 -1
  212. package/lib/Local/RpcProvider.d.ts.map +1 -1
  213. package/lib/Local/RpcProvider.js +28 -2
  214. package/lib/Local/RpcProvider.js.map +1 -1
  215. package/lib/Local/RpcServerEnvironment.js +1 -1
  216. package/lib/Local/RpcServerEnvironment.js.map +1 -1
  217. package/lib/Neon/Project.d.ts.map +1 -1
  218. package/lib/Neon/Project.js +14 -3
  219. package/lib/Neon/Project.js.map +1 -1
  220. package/lib/Output.d.ts.map +1 -1
  221. package/lib/Output.js +9 -2
  222. package/lib/Output.js.map +1 -1
  223. package/lib/Phase.d.ts +2 -1
  224. package/lib/Phase.d.ts.map +1 -1
  225. package/lib/Phase.js +6 -1
  226. package/lib/Phase.js.map +1 -1
  227. package/lib/Plan.d.ts.map +1 -1
  228. package/lib/Plan.js +14 -3
  229. package/lib/Plan.js.map +1 -1
  230. package/lib/Platform.d.ts +8 -6
  231. package/lib/Platform.d.ts.map +1 -1
  232. package/lib/Platform.js +33 -3
  233. package/lib/Platform.js.map +1 -1
  234. package/lib/Random.d.ts.map +1 -1
  235. package/lib/Random.js +9 -14
  236. package/lib/Random.js.map +1 -1
  237. package/lib/RuntimeContext.d.ts +21 -1
  238. package/lib/RuntimeContext.d.ts.map +1 -1
  239. package/lib/RuntimeContext.js +12 -0
  240. package/lib/RuntimeContext.js.map +1 -1
  241. package/lib/Stack.d.ts +3 -3
  242. package/lib/Stack.d.ts.map +1 -1
  243. package/lib/Stack.js.map +1 -1
  244. package/lib/State/HttpStateApi.d.ts +2 -2
  245. package/lib/State/StateEncoding.d.ts +8 -0
  246. package/lib/State/StateEncoding.d.ts.map +1 -1
  247. package/lib/State/StateEncoding.js +55 -5
  248. package/lib/State/StateEncoding.js.map +1 -1
  249. package/lib/Test/Bun.d.ts.map +1 -1
  250. package/lib/Test/Bun.js +0 -2
  251. package/lib/Test/Bun.js.map +1 -1
  252. package/lib/Test/Vitest.d.ts.map +1 -1
  253. package/lib/Test/Vitest.js +0 -2
  254. package/lib/Test/Vitest.js.map +1 -1
  255. package/lib/Util/Duration.d.ts +14 -0
  256. package/lib/Util/Duration.d.ts.map +1 -0
  257. package/lib/Util/Duration.js +18 -0
  258. package/lib/Util/Duration.js.map +1 -0
  259. package/lib/Util/index.d.ts +0 -6
  260. package/lib/Util/index.d.ts.map +1 -1
  261. package/lib/Util/index.js +0 -6
  262. package/lib/Util/index.js.map +1 -1
  263. package/lib/Util/types.d.ts +3 -1
  264. package/lib/Util/types.d.ts.map +1 -1
  265. package/lib/Util/types.js +5 -1
  266. package/lib/Util/types.js.map +1 -1
  267. package/lib/index.d.ts +2 -3
  268. package/lib/index.d.ts.map +1 -1
  269. package/lib/index.js +1 -3
  270. package/lib/index.js.map +1 -1
  271. package/lib/tsconfig.test.tsbuildinfo +1 -1
  272. package/package.json +20 -19
  273. package/src/AWS/Lambda/Function.ts +87 -34
  274. package/src/AWS/Providers.ts +3 -0
  275. package/src/Apply.ts +18 -1
  276. package/src/Auth/AuthProvider.ts +25 -5
  277. package/src/Auth/Credentials.ts +8 -7
  278. package/src/Cli/commands/_shared.ts +47 -4
  279. package/src/Cli/commands/dev.ts +13 -1
  280. package/src/Cli/commands/login.ts +20 -4
  281. package/src/Cli/commands/profile.ts +24 -34
  282. package/src/Cli/main.ts +0 -3
  283. package/src/Cloudflare/AiGateway/AiGateway.ts +2 -6
  284. package/src/Cloudflare/BrowserRendering/BrowserRendering.ts +132 -0
  285. package/src/Cloudflare/BrowserRendering/BrowserRenderingBinding.ts +137 -0
  286. package/src/Cloudflare/BrowserRendering/index.ts +11 -0
  287. package/src/Cloudflare/Container/Container.ts +3 -3
  288. package/src/Cloudflare/Container/StartContainer.ts +1 -2
  289. package/src/Cloudflare/D1/D1Database.ts +4 -1
  290. package/src/Cloudflare/D1/D1DatabaseBinding.ts +1 -1
  291. package/src/Cloudflare/Fetcher.ts +0 -2
  292. package/src/Cloudflare/Hyperdrive/Hyperdrive.ts +5 -0
  293. package/src/Cloudflare/Hyperdrive/HyperdriveBinding.ts +41 -43
  294. package/src/Cloudflare/KV/KVNamespace.ts +4 -0
  295. package/src/Cloudflare/Local.ts +1 -1
  296. package/src/Cloudflare/Providers.ts +25 -16
  297. package/src/Cloudflare/Queue/Queue.ts +3 -0
  298. package/src/Cloudflare/Queue/QueueConsumer.ts +23 -8
  299. package/src/Cloudflare/Queue/QueueEventSource.ts +33 -5
  300. package/src/Cloudflare/R2/R2Bucket.ts +26 -0
  301. package/src/Cloudflare/SecretsStore/Secret.ts +14 -41
  302. package/src/Cloudflare/SecretsStore/SecretBinding.ts +11 -11
  303. package/src/Cloudflare/StateStore/Api.ts +15 -15
  304. package/src/Cloudflare/StateStore/State.ts +68 -6
  305. package/src/Cloudflare/StateStore/Store.ts +5 -2
  306. package/src/Cloudflare/VpcService/VpcService.ts +2 -2
  307. package/src/Cloudflare/Website/StaticSite.ts +8 -10
  308. package/src/Cloudflare/Website/Vite.ts +4 -7
  309. package/src/Cloudflare/Workers/Assets.ts +1 -1
  310. package/src/Cloudflare/Workers/DurableObjectBridge.ts +7 -4
  311. package/src/Cloudflare/Workers/DurableObjectNamespace.ts +380 -121
  312. package/src/Cloudflare/Workers/HttpServer.ts +31 -25
  313. package/src/Cloudflare/Workers/InferEnv.ts +15 -8
  314. package/src/Cloudflare/Workers/LocalWorkerProvider.ts +139 -78
  315. package/src/Cloudflare/Workers/Rpc.ts +50 -0
  316. package/src/Cloudflare/Workers/RpcDurableObjectNamespace.ts +502 -0
  317. package/src/Cloudflare/Workers/RpcWorker.ts +562 -0
  318. package/src/Cloudflare/Workers/Vite.ts +2 -0
  319. package/src/Cloudflare/Workers/Worker.ts +274 -93
  320. package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +158 -103
  321. package/src/Cloudflare/Workers/WorkerBinding.ts +10 -0
  322. package/src/Cloudflare/Workers/WorkerBridge.ts +7 -4
  323. package/src/Cloudflare/Workers/WorkerBundle.ts +4 -1
  324. package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +8 -15
  325. package/src/Cloudflare/Workers/Workflow.ts +22 -3
  326. package/src/Cloudflare/Workers/index.ts +2 -0
  327. package/src/Cloudflare/index.ts +1 -0
  328. package/src/Dependencies.ts +10 -0
  329. package/src/Deploy.ts +3 -1
  330. package/src/Diff.ts +13 -0
  331. package/src/Input.ts +2 -0
  332. package/src/KeyPair.ts +146 -0
  333. package/src/Local/RpcProvider.ts +45 -1
  334. package/src/Local/RpcServerEnvironment.ts +1 -1
  335. package/src/Neon/Project.ts +16 -3
  336. package/src/Output.ts +8 -2
  337. package/src/Phase.ts +8 -0
  338. package/src/Plan.ts +16 -3
  339. package/src/Platform.ts +74 -27
  340. package/src/Random.ts +22 -27
  341. package/src/RuntimeContext.ts +23 -1
  342. package/src/Stack.ts +3 -3
  343. package/src/State/StateEncoding.ts +58 -7
  344. package/src/Test/Bun.ts +0 -3
  345. package/src/Test/Vitest.ts +0 -3
  346. package/src/Util/Duration.ts +21 -0
  347. package/src/Util/index.ts +0 -6
  348. package/src/Util/types.ts +9 -2
  349. package/src/index.ts +2 -3
  350. package/lib/Secret.d.ts +0 -50
  351. package/lib/Secret.d.ts.map +0 -1
  352. package/lib/Secret.js +0 -23
  353. package/lib/Secret.js.map +0 -1
  354. package/lib/Trait.d.ts +0 -43
  355. package/lib/Trait.d.ts.map +0 -1
  356. package/lib/Trait.js +0 -17
  357. package/lib/Trait.js.map +0 -1
  358. package/lib/Util/LocalhostDns.d.ts +0 -23
  359. package/lib/Util/LocalhostDns.d.ts.map +0 -1
  360. package/lib/Util/LocalhostDns.js +0 -46
  361. package/lib/Util/LocalhostDns.js.map +0 -1
  362. package/lib/Util/assert-never.d.ts +0 -12
  363. package/lib/Util/assert-never.d.ts.map +0 -1
  364. package/lib/Util/assert-never.js +0 -11
  365. package/lib/Util/assert-never.js.map +0 -1
  366. package/lib/Util/class.d.ts +0 -3
  367. package/lib/Util/class.d.ts.map +0 -1
  368. package/lib/Util/class.js +0 -1
  369. package/lib/Util/class.js.map +0 -1
  370. package/lib/Util/ignore.d.ts +0 -40
  371. package/lib/Util/ignore.d.ts.map +0 -1
  372. package/lib/Util/ignore.js +0 -591
  373. package/lib/Util/ignore.js.map +0 -1
  374. package/lib/Util/instance.d.ts +0 -4
  375. package/lib/Util/instance.d.ts.map +0 -1
  376. package/lib/Util/instance.js +0 -1
  377. package/lib/Util/instance.js.map +0 -1
  378. package/lib/Util/pointer.d.ts +0 -5
  379. package/lib/Util/pointer.d.ts.map +0 -1
  380. package/lib/Util/pointer.js +0 -1
  381. package/lib/Util/pointer.js.map +0 -1
  382. package/lib/Util/schema-to-type.d.ts +0 -42
  383. package/lib/Util/schema-to-type.d.ts.map +0 -1
  384. package/lib/Util/schema-to-type.js +0 -364
  385. package/lib/Util/schema-to-type.js.map +0 -1
  386. package/lib/Util/todo.d.ts +0 -3
  387. package/lib/Util/todo.d.ts.map +0 -1
  388. package/lib/Util/todo.js +0 -3
  389. package/lib/Util/todo.js.map +0 -1
  390. package/lib/Variable.d.ts +0 -29
  391. package/lib/Variable.d.ts.map +0 -1
  392. package/lib/Variable.js +0 -9
  393. package/lib/Variable.js.map +0 -1
  394. package/src/Secret.ts +0 -87
  395. package/src/Trait.ts +0 -105
  396. package/src/Util/LocalhostDns.ts +0 -52
  397. package/src/Util/assert-never.ts +0 -18
  398. package/src/Util/class.ts +0 -7
  399. package/src/Util/ignore.ts +0 -815
  400. package/src/Util/instance.ts +0 -9
  401. package/src/Util/pointer.ts +0 -5
  402. package/src/Util/schema-to-type.ts +0 -456
  403. package/src/Util/todo.ts +0 -4
  404. package/src/Variable.ts +0 -44
@@ -0,0 +1,285 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import type * as Layer from "effect/Layer";
4
+ import type { Rpc, RpcGroup } from "effect/unstable/rpc";
5
+ import * as RpcClient from "effect/unstable/rpc/RpcClient";
6
+ import * as RpcClientError from "effect/unstable/rpc/RpcClientError";
7
+ import type { Dependencies } from "../../Dependencies.ts";
8
+ import type { HttpEffect } from "../../Http.ts";
9
+ import type { Input } from "../../Input.ts";
10
+ import { type DurableObjectNamespaceLike, type DurableObjectNamespaceProps, type DurableObjectNamespace as DurableObjectNamespaceType, type DurableObjectServices } from "./DurableObjectNamespace.ts";
11
+ import type { DurableObjectState } from "./DurableObjectState.ts";
12
+ import type { Worker as WorkerService } from "./Worker.ts";
13
+ /**
14
+ * The runtime value bound to a typed rpc Durable Object namespace.
15
+ * Same shape as the underlying {@link DurableObjectNamespaceType} for
16
+ * binding metadata (name, namespaceId, kind), but `getByName(id)`
17
+ * returns a typed Effect `RpcClient` over the rpc server living on
18
+ * the DO's `fetch` handler.
19
+ */
20
+ export interface RpcDurableObjectNamespace<Self, Rpcs extends Rpc.Any = Rpc.Any> extends Omit<DurableObjectNamespaceType<{
21
+ fetch: HttpEffect<DurableObjectState>;
22
+ }>, "getByName" | "get" | "Shape"> {
23
+ /** @internal phantom — keeps `Self` reachable through the inferred type */
24
+ Self?: Self;
25
+ readonly getByName: (id: string) => Effect.Effect<RpcClient.RpcClient<Rpcs, RpcClientError.RpcClientError>, never, Rpc.MiddlewareClient<Rpcs>>;
26
+ }
27
+ declare const RpcDurableObjectNamespaceScope_base: Context.ServiceClass<RpcDurableObjectNamespaceScope, "Cloudflare.RpcDurableObjectNamespace", RpcDurableObjectNamespace<unknown, Rpc.Any>>;
28
+ export declare class RpcDurableObjectNamespaceScope extends RpcDurableObjectNamespaceScope_base {
29
+ }
30
+ export interface RpcDurableObjectNamespaceClass extends Effect.Effect<RpcDurableObjectNamespace<unknown>, never, RpcDurableObjectNamespaceScope> {
31
+ /**
32
+ * Class-based forms: `class Counter extends RpcDurableObjectNamespace<Counter>()(...)`.
33
+ *
34
+ * Modular (no impl):
35
+ * ```ts
36
+ * class Counter extends RpcDurableObjectNamespace<Counter>()(
37
+ * "Counter",
38
+ * { schema: CounterRpcs },
39
+ * ) {}
40
+ * export const CounterLive = Counter.make(/* impl *\/);
41
+ * ```
42
+ * Inline impl:
43
+ * ```ts
44
+ * class Counter extends RpcDurableObjectNamespace<Counter>()(
45
+ * "Counter",
46
+ * { schema: CounterRpcs },
47
+ * Effect.gen(function* () { ... }),
48
+ * ) {}
49
+ * ```
50
+ */
51
+ <Self>(): {
52
+ /** Modular form: separate `static make(impl)` + `static from(scriptName | Worker)`. */
53
+ <Rpcs extends Rpc.Any>(name: string, props: {
54
+ readonly schema: RpcGroup.RpcGroup<Rpcs>;
55
+ }): Effect.Effect<RpcDurableObjectNamespace<Self, Rpcs>, never, WorkerService | Self> & {
56
+ new (_: never): {};
57
+ from(scriptName: Input<string>): Effect.Effect<RpcDurableObjectNamespace<Self, Rpcs>, never, WorkerService>;
58
+ from<Req = never>(worker: Dependencies<Self> | Effect.Effect<Dependencies<Self>, never, Req>): Effect.Effect<RpcDurableObjectNamespace<Self, Rpcs>, never, WorkerService | Req>;
59
+ make<InnerR = never, InitReq = never>(impl: Effect.Effect<Effect.Effect<Effect.Effect<HttpEffect<InnerR>, never, InnerR>, never, DurableObjectServices>, never, InitReq>): Layer.Layer<Self, never, WorkerService | Exclude<InitReq | InnerR, DurableObjectServices>>;
60
+ };
61
+ /** Inline-impl form. */
62
+ <Rpcs extends Rpc.Any, InnerR = never, InitReq = never>(name: string, props: {
63
+ readonly schema: RpcGroup.RpcGroup<Rpcs>;
64
+ }, impl: Effect.Effect<Effect.Effect<Effect.Effect<HttpEffect<InnerR>, never, InnerR>, never, DurableObjectServices>, never, InitReq>): Effect.Effect<RpcDurableObjectNamespace<Self, Rpcs>, never, WorkerService | Exclude<InitReq | InnerR, DurableObjectServices>> & {
65
+ new (_: never): {};
66
+ };
67
+ };
68
+ /** Descriptor-only form, for `worker.bind` declarations */
69
+ <Rpcs extends Rpc.Any>(name: string, props: {
70
+ readonly schema: RpcGroup.RpcGroup<Rpcs>;
71
+ } & Partial<DurableObjectNamespaceProps>): DurableObjectNamespaceLike<{
72
+ fetch: HttpEffect<DurableObjectState>;
73
+ }>;
74
+ /** Bare form: `(name, { schema }, impl)` */
75
+ <Rpcs extends Rpc.Any, InnerR = never, InitReq = never>(name: string, props: {
76
+ readonly schema: RpcGroup.RpcGroup<Rpcs>;
77
+ }, impl: Effect.Effect<Effect.Effect<Effect.Effect<HttpEffect<InnerR>, never, InnerR>, never, DurableObjectServices>, never, InitReq>): Effect.Effect<RpcDurableObjectNamespace<unknown, Rpcs>, never, WorkerService | Exclude<InitReq | InnerR, DurableObjectServices>>;
78
+ }
79
+ /**
80
+ * `RpcDurableObjectNamespace` is sugar over {@link DurableObjectNamespace}
81
+ * for Durable Objects whose surface is a typed Effect `RpcGroup`. The
82
+ * DO serves an `RpcServer.toHttpEffect(group)` on its own `fetch`, and
83
+ * consumers see `namespace.getByName(id)` as a typed `RpcClient`
84
+ * directly — no manual client wiring.
85
+ *
86
+ * Use this over alchemy's built-in DO method bridge whenever values
87
+ * crossing the DO boundary contain `Schema.Class` instances. The
88
+ * built-in bridge `JSON.stringify`s every method return value, which
89
+ * strips class identity (e.g. an `effect/ai` `Response.Usage` instance
90
+ * becomes a plain struct on the consumer side). With
91
+ * `RpcDurableObjectNamespace`, both ends go through the same
92
+ * `RpcSerialization` codec, so `Schema.decode` reconstructs class
93
+ * instances correctly.
94
+ *
95
+ * @resource
96
+ *
97
+ * @section Defining the rpc group
98
+ * @example DO-scoped rpc schemas
99
+ * The DO instance *is* the session, so the group payloads typically
100
+ * don't include any per-session identifier — only the per-call inputs.
101
+ * ```typescript
102
+ * import * as Schema from "effect/Schema";
103
+ * import { Rpc, RpcGroup } from "effect/unstable/rpc";
104
+ *
105
+ * const setTitle = Rpc.make("setTitle", {
106
+ * success: Schema.Void,
107
+ * payload: { title: Schema.String },
108
+ * });
109
+ *
110
+ * const getTitle = Rpc.make("getTitle", {
111
+ * success: Schema.String,
112
+ * payload: {},
113
+ * });
114
+ *
115
+ * export class CounterRpcs extends RpcGroup.make(setTitle, getTitle) {}
116
+ * ```
117
+ *
118
+ * @section Implementing the Durable Object
119
+ * @example Class form (recommended)
120
+ * Mirrors `Cloudflare.DurableObjectNamespace<Self>()(...)` — same
121
+ * outer/inner Effect pattern. The outer Effect resolves shared deps;
122
+ * the per-instance inner Effect returns the
123
+ * `RpcServer.toHttpEffect(schema)`-piped Effect directly.
124
+ * ```typescript
125
+ * import * as Cloudflare from "alchemy/Cloudflare";
126
+ * import * as Effect from "effect/Effect";
127
+ * import * as Layer from "effect/Layer";
128
+ * import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
129
+ * import { CounterRpcs } from "./rpcs.ts";
130
+ *
131
+ * export default class Counter extends Cloudflare.RpcDurableObjectNamespace<Counter>()(
132
+ * "Counter",
133
+ * { schema: CounterRpcs },
134
+ * Effect.gen(function* () {
135
+ * // outer init: shared deps for all instances
136
+ * return Effect.gen(function* () {
137
+ * // per-instance init: state + handlers
138
+ * const state = yield* Cloudflare.DurableObjectState;
139
+ * const handlers = CounterRpcs.toLayer({
140
+ * setTitle: ({ title }) => state.storage.put("title", title),
141
+ * getTitle: () =>
142
+ * Effect.map(state.storage.get<string>("title"), (t) => t ?? ""),
143
+ * });
144
+ * return RpcServer.toHttpEffect(CounterRpcs).pipe(
145
+ * Effect.provide(Layer.mergeAll(handlers, RpcSerialization.layerNdjson)),
146
+ * );
147
+ * });
148
+ * }),
149
+ * ) {}
150
+ * ```
151
+ *
152
+ * @section Calling the DO from a Worker
153
+ * @example Typed rpc client at the call site
154
+ * `yield* Counter` resolves to a value whose `getByName(id)` returns
155
+ * an `Effect<RpcClient<CounterRpcs>>`. Each rpc method is a typed
156
+ * Effect/Stream factory — no `RpcClient.make` setup needed. Yield
157
+ * the client inside a per-request `Effect.scoped` handler so it's
158
+ * freed with the request.
159
+ * ```typescript
160
+ * import Counter from "./counter.ts";
161
+ *
162
+ * Effect.gen(function* () {
163
+ * const counters = yield* Counter;
164
+ * const client = yield* counters.getByName("global");
165
+ * yield* client.setTitle({ title: "Hello" });
166
+ * const title = yield* client.getTitle({});
167
+ * return title;
168
+ * }).pipe(Effect.scoped);
169
+ * ```
170
+ *
171
+ * @section Modular form: separate the class from its runtime
172
+ * @example Class declaration with no impl + `static make(impl)`
173
+ * The inline class form above bundles the runtime into the class
174
+ * declaration. The two-arg form `(name, { schema })` declares the
175
+ * class as a pure tagged identifier; provide the runtime separately
176
+ * via `Class.make(impl)`. Consumer Workers can import the class for
177
+ * binding (`Counter.from(HostWorker)`) without pulling the runtime
178
+ * into their bundle.
179
+ * ```typescript
180
+ * import * as Cloudflare from "alchemy/Cloudflare";
181
+ * import * as Effect from "effect/Effect";
182
+ * import * as Layer from "effect/Layer";
183
+ * import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
184
+ * import { CounterRpcs } from "./rpcs.ts";
185
+ *
186
+ * export class Counter extends Cloudflare.RpcDurableObjectNamespace<Counter>()(
187
+ * "Counter",
188
+ * { schema: CounterRpcs },
189
+ * ) {}
190
+ *
191
+ * // Only the host script imports this default export.
192
+ * export default Counter.make(
193
+ * Effect.gen(function* () {
194
+ * return Effect.gen(function* () {
195
+ * const state = yield* Cloudflare.DurableObjectState;
196
+ * const handlers = CounterRpcs.toLayer({
197
+ * setTitle: ({ title }) => state.storage.put("title", title),
198
+ * getTitle: () =>
199
+ * Effect.map(state.storage.get<string>("title"), (t) => t ?? ""),
200
+ * });
201
+ * return RpcServer.toHttpEffect(CounterRpcs).pipe(
202
+ * Effect.provide(Layer.mergeAll(handlers, RpcSerialization.layerNdjson)),
203
+ * );
204
+ * });
205
+ * }),
206
+ * );
207
+ * ```
208
+ *
209
+ * @section Cross-script binding via `Counter.from(Worker)`
210
+ * @example Hosting on WorkerA, binding from WorkerB
211
+ * The host Worker declares `Counter` in its `Deps` (third type
212
+ * arg of `Worker<Self, Bindings, Deps>` or second of
213
+ * `RpcWorker<Self, Deps>`) and provides `CounterLive`. Any other
214
+ * Worker uses `Counter.from(HostWorker)` to bind to the same DO
215
+ * instances — writes through `HostWorker.getByName(name)` are
216
+ * visible from `Counter.from(HostWorker).getByName(name)`.
217
+ * ```typescript
218
+ * // host worker (declares + provides Counter)
219
+ * import CounterLive, { Counter } from "./counter.ts";
220
+ *
221
+ * export class WorkerA extends Cloudflare.Worker<WorkerA, {}, Counter>()(
222
+ * "WorkerA",
223
+ * { main: import.meta.filename },
224
+ * ) {}
225
+ *
226
+ * export default WorkerA.make(
227
+ * Effect.gen(function* () {
228
+ * const counters = yield* Counter; // local host binding
229
+ * // ... fetch handler ...
230
+ * }).pipe(Effect.provide(CounterLive)),
231
+ * );
232
+ *
233
+ * // consumer worker (binds via .from)
234
+ * export default class WorkerB extends Cloudflare.Worker<WorkerB>()(
235
+ * "WorkerB",
236
+ * { main: import.meta.filename },
237
+ * Effect.gen(function* () {
238
+ * const counters = yield* Counter.from(WorkerA);
239
+ * return {
240
+ * fetch: Effect.gen(function* () {
241
+ * const client = yield* counters.getByName("shared");
242
+ * yield* client.setTitle({ title: "via WorkerB" });
243
+ * return HttpServerResponse.text("ok");
244
+ * }).pipe(Effect.scoped),
245
+ * };
246
+ * }),
247
+ * ) {}
248
+ * ```
249
+ *
250
+ * @example Self-hosted isolated namespace
251
+ * A Worker that declares `Counter` in its own `Deps` and provides
252
+ * `CounterLive` hosts its own isolated namespace — instances under
253
+ * it are separate from any other host's. Use `Counter.from(Self)`
254
+ * inside the host to be explicit about which script's namespace
255
+ * you're binding to.
256
+ * ```typescript
257
+ * export class WorkerC extends Cloudflare.Worker<WorkerC, {}, Counter>()(
258
+ * "WorkerC",
259
+ * { main: import.meta.filename },
260
+ * ) {}
261
+ *
262
+ * export default WorkerC.make(
263
+ * Effect.gen(function* () {
264
+ * const counters = yield* Counter.from(WorkerC); // explicit self
265
+ * // ... fetch handler ...
266
+ * }).pipe(Effect.provide(CounterLive)),
267
+ * );
268
+ * ```
269
+ *
270
+ * @section Yielding the surrounding namespace from inside a DO
271
+ * @example `yield* RpcDurableObjectNamespace` inside the DO impl
272
+ * Lets a DO instance refer to its own namespace — e.g. to fan a call
273
+ * out to sibling instances. Mirrors `yield* DurableObjectNamespace`
274
+ * on the regular `DurableObjectNamespace`.
275
+ * ```typescript
276
+ * Effect.gen(function* () {
277
+ * const self = yield* Cloudflare.RpcDurableObjectNamespace;
278
+ * const peer = yield* self.getByName("peer-1");
279
+ * yield* peer.setTitle({ title: "Sibling call" });
280
+ * }).pipe(Effect.scoped);
281
+ * ```
282
+ */
283
+ export declare const RpcDurableObjectNamespace: RpcDurableObjectNamespaceClass;
284
+ export {};
285
+ //# sourceMappingURL=RpcDurableObjectNamespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RpcDurableObjectNamespace.d.ts","sourceRoot":"","sources":["../../../src/Cloudflare/Workers/RpcDurableObjectNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,IAAI,0BAA0B,EACzD,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB,CACxC,IAAI,EACJ,IAAI,SAAS,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAC9B,SAAQ,IAAI,CACZ,0BAA0B,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAA;CAAE,CAAC,EACrE,WAAW,GAAG,KAAK,GAAG,OAAO,CAC9B;IACC,2EAA2E;IAC3E,IAAI,CAAC,EA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CAAC,2BAA2B,CAAC,GACvC,0BAA0B,CAAC;QAAE,KAAK,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAA;KAAE,CAAC,CAAC;IACzE,4CAA4C;IAC5C,CAAC,IAAI,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EACpD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;KAAE,EACnD,IAAI,EAAE,MAAM,CAAC,MAAM,CACjB,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,EAChD,KAAK,EACL,qBAAqB,CACtB,EACD,KAAK,EACL,OAAO,CACR,GACA,MAAM,CAAC,MAAM,CACd,yBAAyB,CAAC,OAAO,EAAE,IAAI,CAAC,EACxC,KAAK,EACL,aAAa,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM,EAAE,qBAAqB,CAAC,CACjE,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2MG;AACH,eAAO,MAAM,yBAAyB,EAAE,8BA4C7B,CAAC"}
@@ -0,0 +1,288 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as RpcClient from "effect/unstable/rpc/RpcClient";
4
+ import * as RpcClientError from "effect/unstable/rpc/RpcClientError";
5
+ import { effectClass, taggedFunction } from "../../Util/effect.js";
6
+ import { DurableObjectNamespace, } from "./DurableObjectNamespace.js";
7
+ import { bindEffectRpc } from "./Rpc.js";
8
+ // Context tag carrying the surrounding `RpcDurableObjectNamespace`
9
+ // inside an rpc DO impl. Yield it from within a DO handler to refer
10
+ // back to the surrounding namespace (e.g. to fan a call out to
11
+ // sibling instances). Documented as part of the main
12
+ // `RpcDurableObjectNamespace` JSDoc below.
13
+ export class RpcDurableObjectNamespaceScope extends Context.Service()("Cloudflare.RpcDurableObjectNamespace") {
14
+ }
15
+ /**
16
+ * `RpcDurableObjectNamespace` is sugar over {@link DurableObjectNamespace}
17
+ * for Durable Objects whose surface is a typed Effect `RpcGroup`. The
18
+ * DO serves an `RpcServer.toHttpEffect(group)` on its own `fetch`, and
19
+ * consumers see `namespace.getByName(id)` as a typed `RpcClient`
20
+ * directly — no manual client wiring.
21
+ *
22
+ * Use this over alchemy's built-in DO method bridge whenever values
23
+ * crossing the DO boundary contain `Schema.Class` instances. The
24
+ * built-in bridge `JSON.stringify`s every method return value, which
25
+ * strips class identity (e.g. an `effect/ai` `Response.Usage` instance
26
+ * becomes a plain struct on the consumer side). With
27
+ * `RpcDurableObjectNamespace`, both ends go through the same
28
+ * `RpcSerialization` codec, so `Schema.decode` reconstructs class
29
+ * instances correctly.
30
+ *
31
+ * @resource
32
+ *
33
+ * @section Defining the rpc group
34
+ * @example DO-scoped rpc schemas
35
+ * The DO instance *is* the session, so the group payloads typically
36
+ * don't include any per-session identifier — only the per-call inputs.
37
+ * ```typescript
38
+ * import * as Schema from "effect/Schema";
39
+ * import { Rpc, RpcGroup } from "effect/unstable/rpc";
40
+ *
41
+ * const setTitle = Rpc.make("setTitle", {
42
+ * success: Schema.Void,
43
+ * payload: { title: Schema.String },
44
+ * });
45
+ *
46
+ * const getTitle = Rpc.make("getTitle", {
47
+ * success: Schema.String,
48
+ * payload: {},
49
+ * });
50
+ *
51
+ * export class CounterRpcs extends RpcGroup.make(setTitle, getTitle) {}
52
+ * ```
53
+ *
54
+ * @section Implementing the Durable Object
55
+ * @example Class form (recommended)
56
+ * Mirrors `Cloudflare.DurableObjectNamespace<Self>()(...)` — same
57
+ * outer/inner Effect pattern. The outer Effect resolves shared deps;
58
+ * the per-instance inner Effect returns the
59
+ * `RpcServer.toHttpEffect(schema)`-piped Effect directly.
60
+ * ```typescript
61
+ * import * as Cloudflare from "alchemy/Cloudflare";
62
+ * import * as Effect from "effect/Effect";
63
+ * import * as Layer from "effect/Layer";
64
+ * import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
65
+ * import { CounterRpcs } from "./rpcs.ts";
66
+ *
67
+ * export default class Counter extends Cloudflare.RpcDurableObjectNamespace<Counter>()(
68
+ * "Counter",
69
+ * { schema: CounterRpcs },
70
+ * Effect.gen(function* () {
71
+ * // outer init: shared deps for all instances
72
+ * return Effect.gen(function* () {
73
+ * // per-instance init: state + handlers
74
+ * const state = yield* Cloudflare.DurableObjectState;
75
+ * const handlers = CounterRpcs.toLayer({
76
+ * setTitle: ({ title }) => state.storage.put("title", title),
77
+ * getTitle: () =>
78
+ * Effect.map(state.storage.get<string>("title"), (t) => t ?? ""),
79
+ * });
80
+ * return RpcServer.toHttpEffect(CounterRpcs).pipe(
81
+ * Effect.provide(Layer.mergeAll(handlers, RpcSerialization.layerNdjson)),
82
+ * );
83
+ * });
84
+ * }),
85
+ * ) {}
86
+ * ```
87
+ *
88
+ * @section Calling the DO from a Worker
89
+ * @example Typed rpc client at the call site
90
+ * `yield* Counter` resolves to a value whose `getByName(id)` returns
91
+ * an `Effect<RpcClient<CounterRpcs>>`. Each rpc method is a typed
92
+ * Effect/Stream factory — no `RpcClient.make` setup needed. Yield
93
+ * the client inside a per-request `Effect.scoped` handler so it's
94
+ * freed with the request.
95
+ * ```typescript
96
+ * import Counter from "./counter.ts";
97
+ *
98
+ * Effect.gen(function* () {
99
+ * const counters = yield* Counter;
100
+ * const client = yield* counters.getByName("global");
101
+ * yield* client.setTitle({ title: "Hello" });
102
+ * const title = yield* client.getTitle({});
103
+ * return title;
104
+ * }).pipe(Effect.scoped);
105
+ * ```
106
+ *
107
+ * @section Modular form: separate the class from its runtime
108
+ * @example Class declaration with no impl + `static make(impl)`
109
+ * The inline class form above bundles the runtime into the class
110
+ * declaration. The two-arg form `(name, { schema })` declares the
111
+ * class as a pure tagged identifier; provide the runtime separately
112
+ * via `Class.make(impl)`. Consumer Workers can import the class for
113
+ * binding (`Counter.from(HostWorker)`) without pulling the runtime
114
+ * into their bundle.
115
+ * ```typescript
116
+ * import * as Cloudflare from "alchemy/Cloudflare";
117
+ * import * as Effect from "effect/Effect";
118
+ * import * as Layer from "effect/Layer";
119
+ * import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
120
+ * import { CounterRpcs } from "./rpcs.ts";
121
+ *
122
+ * export class Counter extends Cloudflare.RpcDurableObjectNamespace<Counter>()(
123
+ * "Counter",
124
+ * { schema: CounterRpcs },
125
+ * ) {}
126
+ *
127
+ * // Only the host script imports this default export.
128
+ * export default Counter.make(
129
+ * Effect.gen(function* () {
130
+ * return Effect.gen(function* () {
131
+ * const state = yield* Cloudflare.DurableObjectState;
132
+ * const handlers = CounterRpcs.toLayer({
133
+ * setTitle: ({ title }) => state.storage.put("title", title),
134
+ * getTitle: () =>
135
+ * Effect.map(state.storage.get<string>("title"), (t) => t ?? ""),
136
+ * });
137
+ * return RpcServer.toHttpEffect(CounterRpcs).pipe(
138
+ * Effect.provide(Layer.mergeAll(handlers, RpcSerialization.layerNdjson)),
139
+ * );
140
+ * });
141
+ * }),
142
+ * );
143
+ * ```
144
+ *
145
+ * @section Cross-script binding via `Counter.from(Worker)`
146
+ * @example Hosting on WorkerA, binding from WorkerB
147
+ * The host Worker declares `Counter` in its `Deps` (third type
148
+ * arg of `Worker<Self, Bindings, Deps>` or second of
149
+ * `RpcWorker<Self, Deps>`) and provides `CounterLive`. Any other
150
+ * Worker uses `Counter.from(HostWorker)` to bind to the same DO
151
+ * instances — writes through `HostWorker.getByName(name)` are
152
+ * visible from `Counter.from(HostWorker).getByName(name)`.
153
+ * ```typescript
154
+ * // host worker (declares + provides Counter)
155
+ * import CounterLive, { Counter } from "./counter.ts";
156
+ *
157
+ * export class WorkerA extends Cloudflare.Worker<WorkerA, {}, Counter>()(
158
+ * "WorkerA",
159
+ * { main: import.meta.filename },
160
+ * ) {}
161
+ *
162
+ * export default WorkerA.make(
163
+ * Effect.gen(function* () {
164
+ * const counters = yield* Counter; // local host binding
165
+ * // ... fetch handler ...
166
+ * }).pipe(Effect.provide(CounterLive)),
167
+ * );
168
+ *
169
+ * // consumer worker (binds via .from)
170
+ * export default class WorkerB extends Cloudflare.Worker<WorkerB>()(
171
+ * "WorkerB",
172
+ * { main: import.meta.filename },
173
+ * Effect.gen(function* () {
174
+ * const counters = yield* Counter.from(WorkerA);
175
+ * return {
176
+ * fetch: Effect.gen(function* () {
177
+ * const client = yield* counters.getByName("shared");
178
+ * yield* client.setTitle({ title: "via WorkerB" });
179
+ * return HttpServerResponse.text("ok");
180
+ * }).pipe(Effect.scoped),
181
+ * };
182
+ * }),
183
+ * ) {}
184
+ * ```
185
+ *
186
+ * @example Self-hosted isolated namespace
187
+ * A Worker that declares `Counter` in its own `Deps` and provides
188
+ * `CounterLive` hosts its own isolated namespace — instances under
189
+ * it are separate from any other host's. Use `Counter.from(Self)`
190
+ * inside the host to be explicit about which script's namespace
191
+ * you're binding to.
192
+ * ```typescript
193
+ * export class WorkerC extends Cloudflare.Worker<WorkerC, {}, Counter>()(
194
+ * "WorkerC",
195
+ * { main: import.meta.filename },
196
+ * ) {}
197
+ *
198
+ * export default WorkerC.make(
199
+ * Effect.gen(function* () {
200
+ * const counters = yield* Counter.from(WorkerC); // explicit self
201
+ * // ... fetch handler ...
202
+ * }).pipe(Effect.provide(CounterLive)),
203
+ * );
204
+ * ```
205
+ *
206
+ * @section Yielding the surrounding namespace from inside a DO
207
+ * @example `yield* RpcDurableObjectNamespace` inside the DO impl
208
+ * Lets a DO instance refer to its own namespace — e.g. to fan a call
209
+ * out to sibling instances. Mirrors `yield* DurableObjectNamespace`
210
+ * on the regular `DurableObjectNamespace`.
211
+ * ```typescript
212
+ * Effect.gen(function* () {
213
+ * const self = yield* Cloudflare.RpcDurableObjectNamespace;
214
+ * const peer = yield* self.getByName("peer-1");
215
+ * yield* peer.setTitle({ title: "Sibling call" });
216
+ * }).pipe(Effect.scoped);
217
+ * ```
218
+ */
219
+ export const RpcDurableObjectNamespace = taggedFunction(RpcDurableObjectNamespaceScope, (...args) => {
220
+ // Class-form: zero args returns the inner builder. Inner-arg arity
221
+ // distinguishes modular (`(name, { schema })`, no impl — `static
222
+ // from`/`static make` provide the runtime) from inline-impl
223
+ // (`(name, { schema }, impl)`).
224
+ if (args.length === 0) {
225
+ return (...inner) => {
226
+ if (inner.length === 2) {
227
+ const [name, props] = inner;
228
+ return buildModular(name, props.schema);
229
+ }
230
+ const [name, props, impl] = inner;
231
+ return build(name, props, impl);
232
+ };
233
+ }
234
+ // Descriptor-only form: `(name, { schema })` — no impl.
235
+ if (args.length === 2) {
236
+ const [name, props] = args;
237
+ return {
238
+ kind: "Cloudflare.DurableObjectNamespace",
239
+ name,
240
+ className: props?.className,
241
+ };
242
+ }
243
+ // Bare form: `(name, { schema }, impl)`.
244
+ const [name, props, impl] = args;
245
+ return build(name, props, impl);
246
+ });
247
+ // Wrap a raw `DurableObjectNamespace` so its `getByName` returns a typed
248
+ // Effect `RpcClient` (via `bindEffectRpc`) instead of the built-in
249
+ // method-bridge stub. Used in every branch that produces a yieldable
250
+ // `RpcDurableObjectNamespace` value.
251
+ const rpcWrap = (rawNs, schema) => {
252
+ const rpcView = bindEffectRpc(rawNs, schema);
253
+ return Object.assign({}, rawNs, {
254
+ getByName: rpcView.getByName,
255
+ });
256
+ };
257
+ // The user's inner Effect resolves to `Effect<HttpEffect>`; the
258
+ // underlying `DurableObjectNamespace` expects `Effect<{ fetch:
259
+ // HttpEffect }>` (a `DurableObjectShape`). Map through both layers to
260
+ // box the http effect in the `{ fetch }` shape.
261
+ const wrapImpl = (impl) => impl.pipe(Effect.map((inner) => inner.pipe(Effect.map((fetch) => ({ fetch })))));
262
+ const build = (name, props, impl) => {
263
+ // Inline-impl class form: delegate to `DurableObjectNamespace`'s
264
+ // inline class form, then expose the rpc-wrapped view at yield
265
+ // time. No `static from`/`static make` because the impl is provided
266
+ // eagerly here (consumers wanting cross-script binding use the
267
+ // modular form below).
268
+ const underlying = DurableObjectNamespace()(name, wrapImpl(impl));
269
+ const underlyingEff = underlying.asEffect();
270
+ const rpcBound = underlyingEff.pipe(Effect.map((rawNs) => rpcWrap(rawNs, props.schema)));
271
+ return effectClass(rpcBound);
272
+ };
273
+ const buildModular = (name, schema) => {
274
+ // Delegate to `DurableObjectNamespace<Self>()(name)` (no-impl class
275
+ // form) so we inherit its Self-tag plumbing for free:
276
+ // - yielding the class resolves to the live namespace via the tag
277
+ // (populated by `static make(impl)`'s Layer)
278
+ // - `static from(scriptName | Worker)` registers a foreign-script
279
+ // binding on the surrounding worker and yields a fresh handle
280
+ // We just rpc-wrap each output so consumers see a typed `getByName`.
281
+ const Underlying = DurableObjectNamespace()(name);
282
+ const underlyingEff = Underlying.asEffect();
283
+ return class extends effectClass(underlyingEff.pipe(Effect.map((rawNs) => rpcWrap(rawNs, schema)))) {
284
+ static make = (impl) => Underlying.make(wrapImpl(impl));
285
+ static from = (worker) => Underlying.from(worker).pipe(Effect.map((rawNs) => rpcWrap(rawNs, schema)));
286
+ };
287
+ };
288
+ //# sourceMappingURL=RpcDurableObjectNamespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RpcDurableObjectNamespace.js","sourceRoot":"","sources":["../../../src/Cloudflare/Workers/RpcDurableObjectNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AAIrE,OAAO,EAAE,WAAW,EAAE,cAAc,E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