Remote / API

foldkit-remote-server/fetch

foldkit-remote-server/fetch: RemoteServer over the Fetch API, for Cloudflare Workers and any other runtime that speaks Request/Response.

Reads, queries, and mutations ride one POST each, as Remote.http sends them and RemoteServer.answer answers them. Live requirements ride one POST that answers with a text/event-stream of LiveChange frames, one data: frame per change and a terminal event: error frame when the stream fails; Remote.httpWithLive is the other end. The principal is resolved per request, from whatever the runtime hands over (a header, a binding, a session), and the Sources' requirements are provided per request from the environment (a D1 binding, a connection string).

Functions

serveFetchAnswers Remote POSTs with Responses: what a Worker's fetch hands to the route. Each request is one Effect, with layer built once for it: resolvePrincipal…

Interfaces

FetchConfigWhat serveFetch needs of the host runtime, per request.