Skip to content
@drupflare/spool v1.0.0 GitHub
    Preparing search index...

    Type Alias SwConfig

    what the server compiles into the worker script: routes, templates and the tag to inject

    type SwConfig = {
        assets?: AssetMode;
        beacons: string[];
        clientTag: string;
        collectors?: CollectorConfig[];
        datasetShare?: number;
        lease?: number;
        live?: { mode: "adaptive" | "always"; public: boolean; socket?: true };
        logout?: string[];
        manifest?: string;
        mode?: Mode;
        pack?: StubPack;
        policy?: [string, string][];
        principalDatasets?: { maxStaleMs: number; name: string }[];
        protocol: typeof PROTOCOL_VERSION;
        provision?: ProvisionConfig;
        resourceWrites?: readonly ResourceWrite[];
        routes: SerializedRoute[];
        runtime?: string;
        shadowSample?: number;
        stamp?: number;
        templates: Record<string, CompiledTemplate>;
        thirdParty?: ThirdPartyConfig;
        version: string;
        views?: boolean;
        writes?: WriteConfig[];
    }
    Index
    assets?: AssetMode

    how same-origin subresources are handled; cache when absent

    beacons: string[]

    same-origin POST paths the worker queues and flushes in one request

    clientTag: string

    the exact script tag the server injects, so a local render matches a network one

    collectors?: CollectorConfig[]

    cross-origin analytics collectors the worker holds and delivers later

    datasetShare?: number

    The share, above 0 and at most 1, of the storage headroom one dataset may use. The worker refuses a seed whose rows would use more; 1 when absent.

    lease?: number

    seconds the browser may hold the worker script: the lease after which the page checks it again

    live?: { mode: "adaptive" | "always"; public: boolean; socket?: true }

    Present while the server answers /.spool/live. public is true when the stream also carries public freshness, so the worker treats its public replica as current while a lease is open. mode is always when the page opens the stream whenever it is visible, and adaptive when the worker asks for it at the second lease renewal of a page's visible session. socket is true when the hub also accepts a WebSocket upgrade at the same path; a page then opens a socket and falls back to server-sent events if the upgrade fails.

    logout?: string[]

    same-origin paths whose request ends the session: the worker wipes the principal store first

    manifest?: string

    The URL of a spool.json. Present, the worker has no spool server: it takes its routes from that file, checks it for changes in place of /.spool/sync, and sends no request to /.spool/*.

    mode?: Mode

    the mode for routes that do not name one; serve when absent

    pack?: StubPack

    the pack the script carries, when the server holds one for its current version

    policy?: [string, string][]

    the site's security headers, as name and value pairs, for a worker that holds no site policy yet

    principalDatasets?: { maxStaleMs: number; name: string }[]

    the principal datasets and how long each may answer after its last confirmed sync; absent while the flag is off

    protocol: typeof PROTOCOL_VERSION
    provision?: ProvisionConfig

    what the worker assumes before telemetry says otherwise, and which pages to warm

    resourceWrites?: readonly ResourceWrite[]

    the resource writes a request is sent to the server for, each applied from its Spool-Delta

    routes: SerializedRoute[]
    runtime?: string

    the hash of the worker's own code; a different one empties the replica, a content version does not

    shadowSample?: number

    the share of views, 0 to 1, that run in shadow while the mode is serve; 0 when absent

    stamp?: number

    The operator's counter for the stub. Its bytes change when the stamp does, so a static host that republishes each lease period makes a forced check install a new script, and the install is a contact.

    templates: Record<string, CompiledTemplate>

    compiled templates keyed by route pattern

    thirdParty?: ThirdPartyConfig

    the opt-in cache for versioned cross-origin files

    version: string
    views?: boolean

    whether the worker queues a spool.view per page view; true when absent

    writes?: WriteConfig[]

    the declared write classes; absent while declared writes are off, which is the default