The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 07:15 UTC
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as Domain from "@alchemy.run/domain"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as Layer from "effect/Layer"; |
| 5 | import { Account, Deposits } from "./ledger.ts"; |
| 6 | import { hosted, ledgerWorker } from "./worker.ts"; |
| 7 | |
| 8 | /** The view added lazily: each account's key reads its history when first read. */ |
| 9 | class LazyLedger extends Domain.Model("Ledger", { aggregates: [Account], views: [Deposits] }) {} |
| 10 | |
| 11 | export default class DomainCatchUpWorker extends Cloudflare.Worker<DomainCatchUpWorker>()( |
| 12 | "DomainCatchUpWorker", |
| 13 | { main: import.meta.url }, |
| 14 | ledgerWorker("v2-lazy", Deposits).pipe( |
| 15 | Effect.provide(hosted(LazyLedger.layer(Layer.empty, { lazy: ["Deposits"] }))), |
| 16 | ), |
| 17 | ) {} |