Skip to content
20 linesCodeBlameRaw
1/**
2 * Each project's store as a Durable Object: the logic is ./store.ts's
3 * `Store`, whose methods are copied onto the object's (and so are
4 * callable over RPC; ./index.ts types the stub as a `Store`).
5 */
6import { DurableObject } from "cloudflare:workers";
7
8import { Store } from "./store.ts";
9
10export class TelemetryStore extends DurableObject {
11 constructor(ctx: DurableObjectState, env: unknown) {
12 super(ctx, env as never);
13 ctx.blockConcurrencyWhile(async () => Store.prototype.open.call(this, ctx));
14 }
15}
16
17for (const name of Object.getOwnPropertyNames(Store.prototype)) {
18 if (name === "constructor") continue;
19 Object.defineProperty(TelemetryStore.prototype, name, Object.getOwnPropertyDescriptor(Store.prototype, name)!);
20}