Sync / foldkit-sync/do

defineDocumentHost

function · packages/sync/src/do.ts:172

function defineDocumentHost<Message, Shared, Principal, Env, RP = never>(
  Base: new (ctx: DocumentHostContext, env: Env) => object,
  config: DocumentHostConfig<Message, Shared, Principal, Env, RP> &
    DocumentHostLayer<Env, RP>,
): new (
  ctx: DocumentHostContext,
  env: Env,
) => {
  fetch(request: Request): Promise<Response>
}

Defines the Durable Object class serving one document's Sync exchange. Non-upgrades are 404s that open nothing; a refused principal is a 401; a resolver that breaks, or a journal that never opened, a 500 that says nothing of it.