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; httpWithLive (foldkit-remote/live) 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

checkCacheThe cache's checker, for a test: serves each request twice through serveFetch with cache.check and a store in memory, so every public read is answered both…
pageReaderThe reader a page render reads through, in the same process: the request's RemoteClient, answered by the server's own handlers with no HTTP between them.…
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…

Values

fetchLimitsConfigEffect Config for serveFetch path and body/query limits. Load via any ConfigProvider (REMOTE_PATH, REMOTE_MAX_BODY_BYTES, REMOTE_MAX_IDS_PER_ENTITY,…

Interfaces

FetchConfigWhat serveFetch needs of the host runtime, per request.

Types

PageReaderConfigWhat pageReader reads of a serveFetch config: the server, its Sources' layer, its limits, and the cache's visitor.