Skip to content

MakeWorkerOptions

MakeWorkerOptions<TEnv, TSyncPayload> = object

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

Options accepted by makeWorker. The Durable Object binding has to be supplied explicitly so we never fall back to deprecated defaults when Cloudflare config changes.

TEnv extends Env = Env

TSyncPayload = Schema.JsonValue

optional enableCORS: boolean

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

false

syncBackendBinding: HelperTypes.ExtractDurableObjectKeys<TEnv>

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

Binding name of the sync Durable Object declared in wrangler config.


optional syncPayloadSchema: Schema.Schema<TSyncPayload>

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

Optionally pass a schema to decode the client-provided payload into a typed object before calling validatePayload. If omitted, the raw JSON value is forwarded.


optional validatePayload: (payload, context) => void | Promise<void>

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

Validates the (optionally decoded) payload during WebSocket connection establishment. If syncPayloadSchema is provided, payload will be of the schema’s inferred type.

TSyncPayload

string

void | Promise<void>