API reference: @salmonui/data/json
JsonDataSourceOptionsinterface
import type { JsonDataSourceOptions } from '@salmonui/data/json';Also exported from @salmonui/data.
interface JsonDataSourceOptions {
readonly url?: string;
readonly fetch?: FetchLike;
readonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>);
readonly batch?: boolean;
readonly transport?: JsonTransport;
readonly key: string;
readonly fields?: readonly string[];
readonly rowShape?: 'tuple' | 'object';
readonly fieldOf?: (columnId: ColumnId) => string;
readonly columnIdOf?: (field: string) => ColumnId;
readonly paging?: PagingStrategy;
readonly policy?: RequestPolicy;
readonly scheduler?: Scheduler;
readonly optimistic?: boolean;
readonly versionField?: string;
readonly capabilities?: Partial<DataSourceCapabilities>;
readonly onRequest?: (event: RequestEvent) => boolean | void;
readonly onResponse?: (event: ResponseEvent) => WireResponse | void;
readonly onError?: (event: RequestErrorEvent) => void;
}
| Name | Signature | Description |
|---|---|---|
urloptional | readonly url?: string; | Endpoint for the default fetch transport. Ignored when |
fetchoptional | readonly fetch?: FetchLike; | |
headersoptional | readonly headers?: Readonly<Record<string, string>> | (() => Readonly<Record<string, string>>); | |
batchoptional | readonly batch?: boolean; | Multiplex same-tick requests into one |
transportoptional | readonly transport?: JsonTransport; | Custom transport (GraphQL bridge, WebSocket, in-process handler, ...). |
key | readonly key: string; | Primary key field. |
fieldsoptional | readonly fields?: readonly string[]; | Requested field list ( |
rowShapeoptional | readonly rowShape?: 'tuple' | 'object'; | Default |
fieldOfoptional | readonly fieldOf?: (columnId: ColumnId) => string; | columnId to server field. Default identity. |
columnIdOfoptional | readonly columnIdOf?: (field: string) => ColumnId; | server field to columnId, for errors and aggregates. Default: inverse of |
pagingoptional | readonly paging?: PagingStrategy; | |
policyoptional | readonly policy?: RequestPolicy; | |
scheduleroptional | readonly scheduler?: Scheduler; | |
optimisticoptional | readonly optimistic?: boolean; | Default: true for |
versionFieldoptional | readonly versionField?: string; | Row field holding the row version (ETag); forwarded as expected version on change/remove. |
capabilitiesoptional | readonly capabilities?: Partial<DataSourceCapabilities>; | |
onRequestoptional | readonly onRequest?: (event: RequestEvent) => boolean | void; | Cancelable ( |
onResponseoptional | readonly onResponse?: (event: ResponseEvent) => WireResponse | void; | Called with every successful protocol response before the source decodes
it. Returning a response object replaces
the response for this request (e.g. to rewrite rows or |
onErroroptional | readonly onError?: (event: RequestErrorEvent) => void; |