Skip to content

MakeDurableObjectClassOptions

MakeDurableObjectClassOptions = object

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:12

optional enabledTransports: Set<"http" | "ws" | "do-rpc">

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:45

Enabled transports for sync backend

  • http: HTTP JSON-RPC
  • ws: WebSocket
  • do-rpc: Durable Object RPC calls (only works in combination with @livestore/adapter-cf)
Set(['http', 'ws', 'do-rpc'])

optional http: object

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:63

Custom HTTP response headers for HTTP transport These headers will be added to all HTTP RPC responses (Pull, Push, Ping)

optional responseHeaders: Record<string, string>

{
http: {
responseHeaders: {
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'no-cache'
}
}
}

optional onPull: (message, context) => Effect.SyncOrPromiseOrEffect<void>

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:18

SyncMessage.PullRequest

Schema.JsonValue

StoreId

Effect.SyncOrPromiseOrEffect<void>


optional onPullRes: (message) => Effect.SyncOrPromiseOrEffect<void>

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:22

SyncMessage.PullResponse | InvalidPullError

Effect.SyncOrPromiseOrEffect<void>


optional onPush: (message, context) => Effect.SyncOrPromiseOrEffect<void>

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:13

SyncMessage.PushRequest

Schema.JsonValue

StoreId

Effect.SyncOrPromiseOrEffect<void>


optional onPushRes: (message) => Effect.SyncOrPromiseOrEffect<void>

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:17

SyncMessage.PushAck | InvalidPushError

Effect.SyncOrPromiseOrEffect<void>


optional otel: object

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:67

optional baseUrl: string

optional serviceName: string


optional storage: { _tag: "do-sqlite"; } | { _tag: "d1"; binding: string; }

Defined in: packages/@livestore/sync-cf/src/cf-worker/shared.ts:35

Storage engine for event persistence.

  • Default: { _tag: 'do-sqlite' } (Durable Object SQLite)
  • D1: { _tag: 'd1', binding: string } where binding is the D1 binding name in wrangler.toml.

If omitted, the runtime defaults to DO SQLite. For backwards-compatibility, if an env binding named DB exists and looks like a D1Database, D1 will be used.

Trade-offs:

  • DO SQLite: simpler deploy, data co-located with DO, not externally queryable
  • D1: centralized DB, inspectable with DB tools, extra network hop and JSON size limits