View as Markdown

API reference: @salmonui/data/json

JsonPivotSourceOptionsinterface

import type { JsonPivotSourceOptions } from '@salmonui/data/json';

Also exported from @salmonui/data.

interface JsonPivotSourceOptions {
    readonly url?: string;
    readonly fetch?: FetchLike;
    readonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
    readonly batch?: boolean;
    readonly transport?: PivotJsonTransport;
    readonly policy?: RequestPolicy;
    readonly scheduler?: Scheduler;
    readonly onRequest?: (event: PivotRequestEvent) => boolean | void;
    readonly onResponse?: (event: PivotResponseEvent) => WireAnyResponse | void;
    readonly onError?: (event: PivotRequestErrorEvent) => void;
}
JsonPivotSourceOptions members (10)
NameSignatureDescription
urloptionalreadonly url?: string;

Endpoint for the default fetch transport. Ignored when transport is set.

fetchoptionalreadonly fetch?: FetchLike;
headersoptionalreadonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);

Request headers (auth), or a function read per request.

batchoptionalreadonly batch?: boolean;

Multiplex same-tick requests into one { v: 1, batch } POST. Default true.

transportoptionalreadonly transport?: PivotJsonTransport;

Custom transport (auth refresh, signing, WebSocket, in-process handler).

policyoptionalreadonly policy?: RequestPolicy;

Cache, dedupe and retry, as createJsonDataSource.

scheduleroptionalreadonly scheduler?: Scheduler;
onRequestoptionalreadonly onRequest?: (event: PivotRequestEvent) => boolean | void;

Called before every request; return false cancels it (RequestCanceledError). Mutate nothing: replace through transport.

onResponseoptionalreadonly onResponse?: (event: PivotResponseEvent) => WireAnyResponse | void;

Called with every successful response; returning an object replaces it.

onErroroptionalreadonly onError?: (event: PivotRequestErrorEvent) => void;