| 1 | import * as Cloudflare from "@/Cloudflare"; |
| 2 | import * as Alchemy from "@/index"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import RpcCounterWorker from "./worker.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Stack with one Worker driving an |
| 8 | * {@link Cloudflare.RpcDurableObject} counter via the typed |
| 9 | * `getByName(id)` client. |
| 10 | */ |
| 11 | export default Alchemy.Stack( |
| 12 | "RpcDurableObjectStack", |
| 13 | { |
| 14 | providers: Cloudflare.providers(), |
| 15 | state: Alchemy.localState(), |
| 16 | }, |
| 17 | Effect.gen(function* () { |
| 18 | const worker = yield* RpcCounterWorker; |
| 19 | return { url: worker.url.as<string>() }; |
| 20 | }), |
| 21 | ); |