import { type CfTypes } from '@livestore/common-cf'; import { type Env, type MakeDurableObjectClassOptions, type SyncBackendRpcInterface } from '../shared.ts'; export type DoState = CfTypes.DurableObjectState; export type DoObject = CfTypes.DurableObject & T; export type MakeDurableObjectClass = (options?: MakeDurableObjectClassOptions) => { new (ctx: DoState, env: Env): DoObject; }; /** * Creates a Durable Object class for handling WebSocket-based sync. * A sync Durable Object is uniquely scoped to a specific `storeId`. * * The sync DO supports 3 transport modes: * - HTTP JSON-RPC * - WebSocket * - Durable Object RPC calls (only works in combination with `@livestore/adapter-cf`) * * Example: * * ```ts * // In your Cloudflare Worker file * import { makeDurableObject } from '@livestore/sync-cf/cf-worker' * * export class SyncBackendDO extends makeDurableObject({ * onPush: async (message) => { * console.log('onPush', message.batch) * }, * onPull: async (message) => { * console.log('onPull', message) * }, * }) {} * ``` * * `wrangler.toml` * ```toml * [[durable_objects.bindings]] * name = "SYNC_BACKEND_DO" * class_name = "SyncBackendDO" * [[migrations]] * tag = "v1" * new_sqlite_classes = ["SyncBackendDO"] * ``` */ export declare const makeDurableObject: MakeDurableObjectClass; //# sourceMappingURL=durable-object.d.ts.map