# @salmonui/data API reference

> 180 exported symbols of @salmonui/data: 39 functions, 6 classes, 96 interfaces, 37 types and 2 constants.

Canonical: https://salmonui.dev/docs/reference/data

```ts
import { … } from '@salmonui/data';
```

## Functions

### createAbortController

Kind: function

Page: https://salmonui.dev/docs/reference/data/createAbortController

```ts
function createAbortController(): AbortControllerLike;
```

Platform `AbortController` when present (read lazily), otherwise a structural fallback.

### createConflictReview

Kind: function

Page: https://salmonui.dev/docs/reference/data/createConflictReview

```ts
function createConflictReview<Row>(conflicts: readonly ConflictSnapshot<Row>[]): ConflictReview<Row>;
```

### createControlledDataSource

Kind: function

Page: https://salmonui.dev/docs/reference/data/createControlledDataSource

```ts
function createControlledDataSource<Row>(options: ControlledDataSourceOptions<Row>): DataSource<Row>;
```

### createManualScheduler

Kind: function

Page: https://salmonui.dev/docs/reference/data/createManualScheduler

```ts
function createManualScheduler(start?: number): ManualScheduler;
```

Deterministic scheduler for tests: time only moves through `advance`.

### createRangeSource

Kind: function

Page: https://salmonui.dev/docs/reference/data/createRangeSource

```ts
function createRangeSource<T>(options: RangeSourceOptions<T>): RangeSource<T>;
```

### isAbortError

Kind: function

Page: https://salmonui.dev/docs/reference/data/isAbortError

```ts
function isAbortError(error: unknown): boolean;
```

### resolveConflicts

Kind: function

Page: https://salmonui.dev/docs/reference/data/resolveConflicts

```ts
function resolveConflicts<Row>(review: ConflictReview<Row>, options: ResolveConflictsOptions<Row>): WriteRequest<Row>;
```

Builds the follow-up write: rows where at least one cell is `keepLocal`
are re-sent on top of the server row (other cells take the server value),
with the server row as `previous` so its version is the expected version.
Rows that are all `useServer` or `defer` are not sent.

### setConflictChoice

Kind: function

Page: https://salmonui.dev/docs/reference/data/setConflictChoice

```ts
function setConflictChoice<Row>(review: ConflictReview<Row>, rowId: RowId, choice: ConflictChoice, columnId?: ColumnId): ConflictReview<Row>;
```

Returns a new review with one cell's choice changed (`columnId` omitted: every cell of the row).

### systemScheduler

Kind: function

Page: https://salmonui.dev/docs/reference/data/systemScheduler

```ts
function systemScheduler(): Scheduler;
```

Platform timers and `Date.now`, read lazily at call time (never at import).

## Classes

### AbortedError

Kind: class

Page: https://salmonui.dev/docs/reference/data/AbortedError

```ts
class AbortedError extends Error {
    readonly name = "AbortError";
    constructor(message?: string);
}
```

Error used for aborted requests. `name === 'AbortError'`.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `name` | `readonly name = "AbortError";` |  |  |

## Interfaces

### AbortControllerLike

Kind: interface

Page: https://salmonui.dev/docs/reference/data/AbortControllerLike

```ts
interface AbortControllerLike {
    readonly signal: AbortSignalLike;
    abort(reason?: unknown): void;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `signal` | `readonly signal: AbortSignalLike;` |  |  |
| `abort` | `abort(reason?: unknown): void;` |  |  |

### AbortSignalLike

Kind: interface

Page: https://salmonui.dev/docs/reference/data/AbortSignalLike

```ts
interface AbortSignalLike {
    readonly aborted: boolean;
    readonly reason?: unknown;
    addEventListener(type: 'abort', listener: () => void): void;
    removeEventListener(type: 'abort', listener: () => void): void;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `aborted` | `readonly aborted: boolean;` |  |  |
| `reason` | `readonly reason?: unknown;` | optional |  |
| `addEventListener` | `addEventListener(type: 'abort', listener: () => void): void;` |  |  |
| `removeEventListener` | `removeEventListener(type: 'abort', listener: () => void): void;` |  |  |

### AggregateDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/AggregateDescriptor

```ts
interface AggregateDescriptor {
    readonly columnId: ColumnId;
    readonly type: AggregateType;
    readonly custom?: {
        custom(rows: readonly unknown[], column: unknown): unknown;
    }['custom'];
    readonly placement: readonly ('footer' | 'groupFooter' | 'groupCaption')[];
    readonly format?: string;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `type` | `readonly type: AggregateType;` |  |  |
| `custom` | `readonly custom?: {     custom(rows: readonly unknown[], column: unknown): unknown; }['custom'];` | optional | Local only; never serialized. The grid calls it with its compiled column (Data Grid engine `CompiledColumn`); declared as a method so that signature stays assignable both ways. |
| `placement` | `readonly placement: readonly ('footer' \| 'groupFooter' \| 'groupCaption')[];` |  |  |
| `format` | `readonly format?: string;` | optional |  |

### ConflictReview

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ConflictReview

```ts
interface ConflictReview<Row> {
    readonly conflicts: readonly ConflictSnapshot<Row>[];
    readonly choices: Readonly<Record<string, ConflictChoice>>;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `conflicts` | `readonly conflicts: readonly ConflictSnapshot<Row>[];` |  |  |
| `choices` | `readonly choices: Readonly<Record<string, ConflictChoice>>;` |  | `${rowId}:${columnId}` -> choice. Default `defer`. |

### ConflictSnapshot

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ConflictSnapshot

```ts
interface ConflictSnapshot<Row> {
    readonly rowId: RowId;
    readonly local: Row;
    readonly server: Row;
    readonly base: Row | null;
    readonly cells: readonly {
        readonly columnId: ColumnId;
        readonly local: unknown;
        readonly server: unknown;
    }[];
    readonly version?: string;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rowId` | `readonly rowId: RowId;` |  |  |
| `local` | `readonly local: Row;` |  |  |
| `server` | `readonly server: Row;` |  |  |
| `base` | `readonly base: Row \| null;` |  |  |
| `cells` | `readonly cells: readonly {     readonly columnId: ColumnId;     readonly local: unknown;     readonly server: unknown; }[];` |  |  |
| `version` | `readonly version?: string;` | optional |  |

### ControlledDataSourceOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ControlledDataSourceOptions

```ts
interface ControlledDataSourceOptions<Row> {
    readonly onQueryChange: (request: DataSourceRequest) => DataSourceResult<Row> | Promise<DataSourceResult<Row>>;
    readonly onDataChange?: (request: WriteRequest<Row>) => Promise<WriteResult<Row>>;
    readonly capabilities?: Partial<DataSourceCapabilities>;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `onQueryChange` | `readonly onQueryChange: (request: DataSourceRequest) => DataSourceResult<Row> \| Promise<DataSourceResult<Row>>;` |  |  |
| `onDataChange` | `readonly onDataChange?: (request: WriteRequest<Row>) => Promise<WriteResult<Row>>;` | optional |  |
| `capabilities` | `readonly capabilities?: Partial<DataSourceCapabilities>;` | optional |  |

### DataGridState

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataGridState

```ts
interface DataGridState {
    readonly version: number;
    readonly [key: string]: unknown;
}
```

Structural subset of the Data Grid engine's `DataGridState` used by the storage adapters.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  | Schema version of the state (Data Grid engine `DATA_GRID_STATE_VERSION`). |

### DataQuery

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataQuery

```ts
interface DataQuery {
    readonly search: SearchDescriptor | null;
    readonly filters: readonly FilterEntry[];
    readonly sorting: readonly SortDescriptor[];
    readonly grouping: readonly GroupDescriptor[];
    readonly aggregates: readonly AggregateDescriptor[];
    readonly paging: PagingDescriptor | null;
    readonly expansion: ExpansionDescriptor;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `search` | `readonly search: SearchDescriptor \| null;` |  |  |
| `filters` | `readonly filters: readonly FilterEntry[];` |  |  |
| `sorting` | `readonly sorting: readonly SortDescriptor[];` |  |  |
| `grouping` | `readonly grouping: readonly GroupDescriptor[];` |  |  |
| `aggregates` | `readonly aggregates: readonly AggregateDescriptor[];` |  |  |
| `paging` | `readonly paging: PagingDescriptor \| null;` |  |  |
| `expansion` | `readonly expansion: ExpansionDescriptor;` |  |  |

### DataSource

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataSource

```ts
interface DataSource<Row> {
    readonly mode: DataSourceMode;
    read(request: DataSourceRequest): DataSourceResult<Row> | Promise<DataSourceResult<Row>>;
    write?(request: WriteRequest<Row>): Promise<WriteResult<Row>>;
    subscribe?(listener: (event: DataSourceEvent<Row>) => void): () => void;
    readonly capabilities?: Partial<DataSourceCapabilities>;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `mode` | `readonly mode: DataSourceMode;` |  |  |
| `read` | `read(request: DataSourceRequest): DataSourceResult<Row> \| Promise<DataSourceResult<Row>>;` |  |  |
| `write` | `write?(request: WriteRequest<Row>): Promise<WriteResult<Row>>;` | optional |  |
| `subscribe` | `subscribe?(listener: (event: DataSourceEvent<Row>) => void): () => void;` | optional |  |
| `capabilities` | `readonly capabilities?: Partial<DataSourceCapabilities>;` | optional |  |

### DataSourceCapabilities

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataSourceCapabilities

```ts
interface DataSourceCapabilities {
    readonly facets: boolean;
    readonly lazyGroups: boolean;
    readonly treeChildren: boolean;
    readonly cursor: boolean;
    readonly infinite: boolean;
    readonly lookups: boolean;
    readonly write: boolean;
    readonly exportJobs: boolean;
    readonly reload: boolean;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `facets` | `readonly facets: boolean;` |  |  |
| `lazyGroups` | `readonly lazyGroups: boolean;` |  |  |
| `treeChildren` | `readonly treeChildren: boolean;` |  |  |
| `cursor` | `readonly cursor: boolean;` |  |  |
| `infinite` | `readonly infinite: boolean;` |  |  |
| `lookups` | `readonly lookups: boolean;` |  |  |
| `write` | `readonly write: boolean;` |  |  |
| `exportJobs` | `readonly exportJobs: boolean;` |  |  |
| `reload` | `readonly reload: boolean;` |  |  |

### DataSourceRequest

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataSourceRequest

```ts
interface DataSourceRequest {
    readonly version: number;
    readonly query: DataQuery;
    readonly range?: {
        readonly start: number;
        readonly end: number;
    };
    readonly cursor?: string | null;
    readonly groupPath?: readonly GroupPathSegment[];
    readonly parentRowId?: RowId | null;
    readonly facet?: {
        readonly columnId: ColumnId;
        readonly search?: string;
        readonly limit?: number;
    };
    readonly signal: AbortSignalLike;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `query` | `readonly query: DataQuery;` |  |  |
| `range` | `readonly range?: {     readonly start: number;     readonly end: number; };` | optional |  |
| `cursor` | `readonly cursor?: string \| null;` | optional |  |
| `groupPath` | `readonly groupPath?: readonly GroupPathSegment[];` | optional | Lazy group load. `[]` loads the root group level; a non-empty path loads that group's children. |
| `parentRowId` | `readonly parentRowId?: RowId \| null;` | optional | Tree read: `null` reads the root level, a row id reads that row's children (wire `parent`). |
| `facet` | `readonly facet?: {     readonly columnId: ColumnId;     readonly search?: string;     readonly limit?: number; };` | optional | Distinct values of a column: `search` narrows by label, `limit` caps the entries (`complete: false` when more exist). |
| `signal` | `readonly signal: AbortSignalLike;` |  |  |

### DataSourceResult

Kind: interface

Page: https://salmonui.dev/docs/reference/data/DataSourceResult

```ts
interface DataSourceResult<Row, Item = Row> {
    readonly version: number;
    readonly rows: readonly Item[];
    readonly totalRowCount?: number;
    readonly performed?: readonly PerformedStage[];
    readonly aggregates?: AggregateValues;
    readonly pageInfo?: PageInfo;
    readonly facet?: FacetPayload;
    readonly rowOffset?: number;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `rows` | `readonly rows: readonly Item[];` |  |  |
| `totalRowCount` | `readonly totalRowCount?: number;` | optional |  |
| `performed` | `readonly performed?: readonly PerformedStage[];` | optional |  |
| `aggregates` | `readonly aggregates?: AggregateValues;` | optional |  |
| `pageInfo` | `readonly pageInfo?: PageInfo;` | optional |  |
| `facet` | `readonly facet?: FacetPayload;` | optional |  |
| `rowOffset` | `readonly rowOffset?: number;` | optional | Infinite mode: index of `rows[0]` within the full result when leading blocks were evicted (`maxBlocks`). |

### ExpansionDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ExpansionDescriptor

```ts
interface ExpansionDescriptor {
    readonly groups: Readonly<Record<string, boolean>>;
    readonly tree: Readonly<Record<RowId, boolean>>;
    readonly detail: Readonly<Record<RowId, boolean>>;
    readonly defaultGroupExpanded: boolean;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `groups` | `readonly groups: Readonly<Record<string, boolean>>;` |  |  |
| `tree` | `readonly tree: Readonly<Record<RowId, boolean>>;` |  |  |
| `detail` | `readonly detail: Readonly<Record<RowId, boolean>>;` |  |  |
| `defaultGroupExpanded` | `readonly defaultGroupExpanded: boolean;` |  |  |

### FacetPayload

Kind: interface

Page: https://salmonui.dev/docs/reference/data/FacetPayload

```ts
interface FacetPayload {
    readonly columnId: ColumnId;
    readonly entries: readonly {
        readonly key: string;
        readonly label: string;
        readonly count: number;
    }[];
    readonly complete: boolean;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `entries` | `readonly entries: readonly {     readonly key: string;     readonly label: string;     readonly count: number; }[];` |  |  |
| `complete` | `readonly complete: boolean;` |  | False when the server truncated the list. |

### FetchRequestInit

Kind: interface

Page: https://salmonui.dev/docs/reference/data/FetchRequestInit

```ts
interface FetchRequestInit {
    readonly method?: string;
    readonly headers?: Readonly<Record<string, string>>;
    readonly body?: string;
    readonly signal?: typeof globalThis extends {
        readonly AbortSignal: {
            readonly prototype: infer S;
        };
    } ? S : AbortSignalLike;
    readonly credentials?: 'omit' | 'same-origin' | 'include';
    readonly [key: string]: unknown;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `method` | `readonly method?: string;` | optional |  |
| `headers` | `readonly headers?: Readonly<Record<string, string>>;` | optional |  |
| `body` | `readonly body?: string;` | optional |  |
| `signal` | `readonly signal?: typeof globalThis extends {     readonly AbortSignal: {         readonly prototype: infer S;     }; } ? S : AbortSignalLike;` | optional | The request's abort signal: the platform `AbortSignal` wherever the consumer's lib declares one (the Data Grid engine uses the platform `AbortController` whenever the runtime has it), else `AbortSignalLike`. |
| `credentials` | `readonly credentials?: 'omit' \| 'same-origin' \| 'include';` | optional |  |

### FetchResponseLike

Kind: interface

Page: https://salmonui.dev/docs/reference/data/FetchResponseLike

```ts
interface FetchResponseLike {
    readonly ok: boolean;
    readonly status: number;
    readonly statusText?: string;
    readonly headers?: {
        get(name: string): string | null;
    };
    json(): Promise<unknown>;
    text(): Promise<string>;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ok` | `readonly ok: boolean;` |  |  |
| `status` | `readonly status: number;` |  |  |
| `statusText` | `readonly statusText?: string;` | optional |  |
| `headers` | `readonly headers?: {     get(name: string): string \| null; };` | optional |  |
| `json` | `json(): Promise<unknown>;` |  |  |
| `text` | `text(): Promise<string>;` |  |  |

### FilterDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/FilterDescriptor

```ts
interface FilterDescriptor {
    readonly kind?: 'condition';
    readonly columnId: ColumnId;
    readonly operator: FilterOperator | (string & {});
    readonly value: Json;
    readonly predicate: 'and' | 'or';
    readonly matchCase?: boolean;
    readonly ignoreAccent?: boolean;
    readonly source: FilterSource;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind?: 'condition';` | optional |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `operator` | `readonly operator: FilterOperator \| (string & {});` |  |  |
| `value` | `readonly value: Json;` |  |  |
| `predicate` | `readonly predicate: 'and' \| 'or';` |  |  |
| `matchCase` | `readonly matchCase?: boolean;` | optional |  |
| `ignoreAccent` | `readonly ignoreAccent?: boolean;` | optional |  |
| `source` | `readonly source: FilterSource;` |  |  |

### FilterGroupDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/FilterGroupDescriptor

```ts
interface FilterGroupDescriptor {
    readonly kind: 'group';
    readonly predicate: 'and' | 'or';
    readonly not?: boolean;
    readonly filters: readonly FilterEntry[];
    readonly source?: FilterSource;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'group';` |  |  |
| `predicate` | `readonly predicate: 'and' \| 'or';` |  |  |
| `not` | `readonly not?: boolean;` | optional | Negates the combined group: NOT (A AND B). |
| `filters` | `readonly filters: readonly FilterEntry[];` |  |  |
| `source` | `readonly source?: FilterSource;` | optional |  |

### GroupDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/GroupDescriptor

```ts
interface GroupDescriptor {
    readonly columnId: ColumnId;
    readonly format?: string;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `format` | `readonly format?: string;` | optional |  |

### GroupPathSegment

Kind: interface

Page: https://salmonui.dev/docs/reference/data/GroupPathSegment

```ts
interface GroupPathSegment {
    readonly columnId: ColumnId;
    readonly key: Json;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `key` | `readonly key: Json;` |  |  |

### GroupedRowEnvelope

Kind: interface

Page: https://salmonui.dev/docs/reference/data/GroupedRowEnvelope

```ts
interface GroupedRowEnvelope<Row> {
    readonly kind: 'group';
    readonly key: Json;
    readonly columnId: ColumnId;
    readonly groupPath: readonly GroupPathSegment[];
    readonly count: number;
    readonly aggregates?: AggregateValues;
    readonly items?: readonly (Row | GroupedRowEnvelope<Row>)[];
    readonly pageInfo?: PageInfo;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'group';` |  |  |
| `key` | `readonly key: Json;` |  |  |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `groupPath` | `readonly groupPath: readonly GroupPathSegment[];` |  |  |
| `count` | `readonly count: number;` |  | Total descendants, not loaded descendants. |
| `aggregates` | `readonly aggregates?: AggregateValues;` | optional |  |
| `items` | `readonly items?: readonly (Row \| GroupedRowEnvelope<Row>)[];` | optional | Omitted for lazy groups. |
| `pageInfo` | `readonly pageInfo?: PageInfo;` | optional |  |

### ManualScheduler

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ManualScheduler

```ts
interface ManualScheduler extends Scheduler {
    advance(ms: number): void;
    runAll(): void;
    readonly pending: number;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `advance` | `advance(ms: number): void;` |  | Moves the clock forward, running due timers in order. |
| `runAll` | `runAll(): void;` |  | Runs every pending timer (advancing the clock to each). |
| `pending` | `readonly pending: number;` |  |  |
| `now` | `now: () => number;` | inherited |  |
| `setTimeout` | `setTimeout: (callback: () => void, ms: number) => unknown;` | inherited |  |
| `clearTimeout` | `clearTimeout: (handle: unknown) => void;` | inherited |  |

### PageInfo

Kind: interface

Page: https://salmonui.dev/docs/reference/data/PageInfo

```ts
interface PageInfo {
    readonly hasNextPage?: boolean;
    readonly hasPreviousPage?: boolean;
    readonly startCursor?: string | null;
    readonly endCursor?: string | null;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `hasNextPage` | `readonly hasNextPage?: boolean;` | optional |  |
| `hasPreviousPage` | `readonly hasPreviousPage?: boolean;` | optional |  |
| `startCursor` | `readonly startCursor?: string \| null;` | optional |  |
| `endCursor` | `readonly endCursor?: string \| null;` | optional |  |

### PagingDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/PagingDescriptor

```ts
interface PagingDescriptor {
    readonly page: number;
    readonly pageSize: number;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `page` | `readonly page: number;` |  | 1-based. |
| `pageSize` | `readonly pageSize: number;` |  |  |

### RangeSource

Kind: interface

Page: https://salmonui.dev/docs/reference/data/RangeSource

```ts
interface RangeSource<T> {
    getSnapshot(): RangeSourceSnapshot<T>;
    subscribe(listener: () => void): () => void;
    request(range: Range): void;
    invalidate(): void;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getSnapshot` | `getSnapshot(): RangeSourceSnapshot<T>;` |  |  |
| `subscribe` | `subscribe(listener: () => void): () => void;` |  |  |
| `request` | `request(range: Range): void;` |  | Shows `range`: served from a cached range that covers it, else loaded (the previous load is aborted). |
| `invalidate` | `invalidate(): void;` |  | Drops the cache (for example after the data changed on the server). |

### RangeSourceOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data/RangeSourceOptions

```ts
interface RangeSourceOptions<T> {
    readonly load: (range: Range, options: {
        readonly signal: AbortSignalLike;
    }) => Promise<readonly T[]>;
    readonly overscan?: number | undefined;
    readonly cacheSize?: number | undefined;
    readonly initialRows?: readonly T[] | undefined;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `load` | `readonly load: (range: Range, options: {     readonly signal: AbortSignalLike; }) => Promise<readonly T[]>;` |  | Loads the rows of a range; honor `signal` to stop superseded requests. |
| `overscan` | `readonly overscan?: number \| undefined;` | optional | Widens each request by this fraction of its span on both sides (default 0.5), so small pans hit the cache. |
| `cacheSize` | `readonly cacheSize?: number \| undefined;` | optional | Cached ranges (default 8). |
| `initialRows` | `readonly initialRows?: readonly T[] \| undefined;` | optional | Rows before the first load. |

### RangeSourceSnapshot

Kind: interface

Page: https://salmonui.dev/docs/reference/data/RangeSourceSnapshot

```ts
interface RangeSourceSnapshot<T> {
    readonly rows: readonly T[];
    readonly range: Range | null;
    readonly loading: boolean;
    readonly error: unknown;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rows` | `readonly rows: readonly T[];` |  | Rows of the last completed range (kept while the next one loads). |
| `range` | `readonly range: Range \| null;` |  | The range the rows belong to, or null before the first load. |
| `loading` | `readonly loading: boolean;` |  |  |
| `error` | `readonly error: unknown;` |  |  |

### RequestPolicy

Kind: interface

Page: https://salmonui.dev/docs/reference/data/RequestPolicy

```ts
interface RequestPolicy {
    readonly cache?: {
        readonly ttlMs: number;
        readonly maxEntries?: number;
    };
    readonly dedupe?: boolean;
    readonly retry?: {
        readonly attempts: number;
        readonly delayMs: number | ((attempt: number) => number);
        readonly retryOn?: (error: unknown) => boolean;
    };
    readonly prefetch?: {
        readonly adjacentPages: number;
    };
    readonly invalidate?: 'onWrite' | 'manual';
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `cache` | `readonly cache?: {     readonly ttlMs: number;     readonly maxEntries?: number; };` | optional | Keyed by canonical serialized query + range + cursor + groupPath + facet. |
| `dedupe` | `readonly dedupe?: boolean;` | optional | Default true: identical in-flight requests share one transport call. |
| `retry` | `readonly retry?: {     readonly attempts: number;     readonly delayMs: number \| ((attempt: number) => number);     readonly retryOn?: (error: unknown) => boolean; };` | optional |  |
| `prefetch` | `readonly prefetch?: {     readonly adjacentPages: number; };` | optional | After a successful foreground page load, fetch this many pages on each side (off the status path). |
| `invalidate` | `readonly invalidate?: 'onWrite' \| 'manual';` | optional | Default `onWrite`: a successful write clears the read cache. |

### ResolveConflictsOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/data/ResolveConflictsOptions

```ts
interface ResolveConflictsOptions<Row> {
    readonly version: number;
    readonly signal: AbortSignalLike;
    readonly mode?: WriteRequest<Row>['mode'];
    readonly setValue?: (row: Row, columnId: ColumnId, value: unknown) => Row;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `signal` | `readonly signal: AbortSignalLike;` |  |  |
| `mode` | `readonly mode?: WriteRequest<Row>['mode'];` | optional |  |
| `setValue` | `readonly setValue?: (row: Row, columnId: ColumnId, value: unknown) => Row;` | optional | Writes one cell value into a row (immutably). Tuple rows: from `tupleColumns`; object rows default to `{ ...row, [columnId]: value }`. |

### RowPlacement

Kind: interface

Page: https://salmonui.dev/docs/reference/data/RowPlacement

```ts
interface RowPlacement {
    readonly rowIds: readonly RowId[];
    readonly targetRowId: RowId | null;
    readonly position: 'before' | 'after';
    readonly parentId?: RowId | null;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rowIds` | `readonly rowIds: readonly RowId[];` |  |  |
| `targetRowId` | `readonly targetRowId: RowId \| null;` |  |  |
| `position` | `readonly position: 'before' \| 'after';` |  |  |
| `parentId` | `readonly parentId?: RowId \| null;` | optional | Tree mode: the new parent of the moved rows (null: roots). |

### Scheduler

Kind: interface

Page: https://salmonui.dev/docs/reference/data/Scheduler

```ts
interface Scheduler {
    now(): number;
    setTimeout(callback: () => void, ms: number): unknown;
    clearTimeout(handle: unknown): void;
}
```

Injected timer and clock. `systemScheduler()` reads the globals lazily; tests use `createManualScheduler()`.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `now` | `now(): number;` |  |  |
| `setTimeout` | `setTimeout(callback: () => void, ms: number): unknown;` |  |  |
| `clearTimeout` | `clearTimeout(handle: unknown): void;` |  |  |

### SearchDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/SearchDescriptor

```ts
interface SearchDescriptor {
    readonly text: string;
    readonly columnIds: readonly ColumnId[] | 'all';
    readonly operator: SearchOperator;
    readonly ignoreCase: boolean;
    readonly ignoreAccent: boolean;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `text` | `readonly text: string;` |  |  |
| `columnIds` | `readonly columnIds: readonly ColumnId[] \| 'all';` |  |  |
| `operator` | `readonly operator: SearchOperator;` |  |  |
| `ignoreCase` | `readonly ignoreCase: boolean;` |  |  |
| `ignoreAccent` | `readonly ignoreAccent: boolean;` |  |  |

### SortDescriptor

Kind: interface

Page: https://salmonui.dev/docs/reference/data/SortDescriptor

```ts
interface SortDescriptor {
    readonly columnId: ColumnId;
    readonly direction: 'asc' | 'desc';
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnId` | `readonly columnId: ColumnId;` |  |  |
| `direction` | `readonly direction: 'asc' \| 'desc';` |  |  |

### TreeRowEnvelope

Kind: interface

Page: https://salmonui.dev/docs/reference/data/TreeRowEnvelope

```ts
interface TreeRowEnvelope<Row> {
    readonly kind: 'tree';
    readonly row: Row;
    readonly depth: number;
    readonly parentId: RowId | null;
    readonly hasChildren: boolean;
    readonly childCount?: number;
    readonly children?: readonly TreeRowEnvelope<Row>[];
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: 'tree';` |  |  |
| `row` | `readonly row: Row;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `parentId` | `readonly parentId: RowId \| null;` |  |  |
| `hasChildren` | `readonly hasChildren: boolean;` |  |  |
| `childCount` | `readonly childCount?: number;` | optional |  |
| `children` | `readonly children?: readonly TreeRowEnvelope<Row>[];` | optional |  |

### WriteRequest

Kind: interface

Page: https://salmonui.dev/docs/reference/data/WriteRequest

```ts
interface WriteRequest<Row> {
    readonly version: number;
    readonly added: readonly {
        readonly tempId: RowId;
        readonly row: Row;
        readonly parentId?: RowId | null;
    }[];
    readonly changed: readonly {
        readonly rowId: RowId;
        readonly row: Row;
        readonly previous: Row;
        readonly changedColumnIds: readonly ColumnId[];
    }[];
    readonly deleted: readonly {
        readonly rowId: RowId;
        readonly row: Row;
    }[];
    readonly mode: 'row' | 'dialog' | 'batch' | 'cell';
    readonly signal: AbortSignalLike;
    readonly moved?: RowPlacement;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `added` | `readonly added: readonly {     readonly tempId: RowId;     readonly row: Row;     readonly parentId?: RowId \| null; }[];` |  | `parentId` (tree mode): the parent the added row joins (null: a root). |
| `changed` | `readonly changed: readonly {     readonly rowId: RowId;     readonly row: Row;     readonly previous: Row;     readonly changedColumnIds: readonly ColumnId[]; }[];` |  |  |
| `deleted` | `readonly deleted: readonly {     readonly rowId: RowId;     readonly row: Row; }[];` |  |  |
| `mode` | `readonly mode: 'row' \| 'dialog' \| 'batch' \| 'cell';` |  |  |
| `signal` | `readonly signal: AbortSignalLike;` |  |  |
| `moved` | `readonly moved?: RowPlacement;` | optional | Row reorder placement hint (row drag and drop). Remote sources persist order through `changed` rows (`orderField`). |

### WriteResult

Kind: interface

Page: https://salmonui.dev/docs/reference/data/WriteResult

```ts
interface WriteResult<Row> {
    readonly version: number;
    readonly status: 'applied' | 'partial' | 'rejected';
    readonly added?: readonly {
        readonly tempId: RowId;
        readonly row: Row;
    }[];
    readonly changed?: readonly {
        readonly rowId: RowId;
        readonly row: Row;
    }[];
    readonly deleted?: readonly RowId[];
    readonly rowErrors?: Readonly<Record<RowId, readonly string[]>>;
    readonly cellErrors?: Readonly<Record<CellKey, readonly string[]>>;
    readonly conflicts?: readonly ConflictSnapshot<Row>[];
    readonly totalRowCount?: number;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `status` | `readonly status: 'applied' \| 'partial' \| 'rejected';` |  |  |
| `added` | `readonly added?: readonly {     readonly tempId: RowId;     readonly row: Row; }[];` | optional |  |
| `changed` | `readonly changed?: readonly {     readonly rowId: RowId;     readonly row: Row; }[];` | optional |  |
| `deleted` | `readonly deleted?: readonly RowId[];` | optional |  |
| `rowErrors` | `readonly rowErrors?: Readonly<Record<RowId, readonly string[]>>;` | optional |  |
| `cellErrors` | `readonly cellErrors?: Readonly<Record<CellKey, readonly string[]>>;` | optional |  |
| `conflicts` | `readonly conflicts?: readonly ConflictSnapshot<Row>[];` | optional |  |
| `totalRowCount` | `readonly totalRowCount?: number;` | optional |  |

## Types

### AggregateType

Kind: type

Page: https://salmonui.dev/docs/reference/data/AggregateType

```ts
type AggregateType = 'sum' | 'average' | 'min' | 'max' | 'count' | 'trueCount' | 'falseCount' | 'custom';
```

### AggregateValues

Kind: type

Page: https://salmonui.dev/docs/reference/data/AggregateValues

```ts
type AggregateValues = Readonly<Record<ColumnId, Readonly<Record<string, unknown>>>>;
```

### CellKey

Kind: type

Page: https://salmonui.dev/docs/reference/data/CellKey

```ts
type CellKey = `${RowId}:${ColumnId}`;
```

### ColumnId

Kind: type

Page: https://salmonui.dev/docs/reference/data/ColumnId

```ts
type ColumnId = string;
```

### ConflictChoice

Kind: type

Page: https://salmonui.dev/docs/reference/data/ConflictChoice

```ts
type ConflictChoice = 'useServer' | 'keepLocal' | 'defer';
```

### DataSourceEvent

Kind: type

Page: https://salmonui.dev/docs/reference/data/DataSourceEvent

```ts
type DataSourceEvent<Row> = {
    readonly type: 'reset';
    readonly rows: readonly Row[];
    readonly totalRowCount?: number;
} | {
    readonly type: 'patch';
    readonly rows: readonly Row[];
    readonly updated: readonly RowId[];
    readonly added: readonly RowId[];
    readonly removed: readonly RowId[];
    readonly totalRowCount?: number;
};
```

### DataSourceMode

Kind: type

Page: https://salmonui.dev/docs/reference/data/DataSourceMode

```ts
type DataSourceMode = 'local' | 'remote' | 'live';
```

### FetchLike

Kind: type

Page: https://salmonui.dev/docs/reference/data/FetchLike

```ts
type FetchLike = (input: string, init?: FetchRequestInit) => Promise<FetchResponseLike>;
```

Structural `fetch`; the platform `fetch` is assignable.

### FilterEntry

Kind: type

Page: https://salmonui.dev/docs/reference/data/FilterEntry

```ts
type FilterEntry = FilterDescriptor | FilterGroupDescriptor;
```

### FilterOperator

Kind: type

Page: https://salmonui.dev/docs/reference/data/FilterOperator

```ts
type FilterOperator = 'equal' | 'notEqual' | 'contains' | 'doesNotContain' | 'startsWith' | 'doesNotStartWith' | 'endsWith' | 'doesNotEndWith' | 'isEmpty' | 'isNotEmpty' | 'isNull' | 'isNotNull' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between' | 'in' | 'notIn' | 'like' | 'wildcard';
```

Built-in filter operators (Data Grid engine names). Custom operator names pass through as strings.

### FilterSource

Kind: type

Page: https://salmonui.dev/docs/reference/data/FilterSource

```ts
type FilterSource = 'bar' | 'menu' | 'checkbox' | 'excel' | 'api';
```

### GroupLoadResult

Kind: type

Page: https://salmonui.dev/docs/reference/data/GroupLoadResult

```ts
type GroupLoadResult<Row> = DataSourceResult<Row, Row | GroupedRowEnvelope<Row>>;
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `version: number;` | inherited |  |
| `rows` | `rows: readonly (Row \| GroupedRowEnvelope<Row>)[];` | inherited |  |
| `totalRowCount` | `totalRowCount?: number;` | optional, inherited |  |
| `performed` | `performed?: readonly PerformedStage[];` | optional, inherited |  |
| `aggregates` | `aggregates?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;` | optional, inherited |  |
| `pageInfo` | `pageInfo?: PageInfo;` | optional, inherited |  |
| `facet` | `facet?: FacetPayload;` | optional, inherited |  |
| `rowOffset` | `rowOffset?: number;` | optional, inherited | Infinite mode: index of `rows[0]` within the full result when leading blocks were evicted (`maxBlocks`). |

### InvalidateScope

Kind: type

Page: https://salmonui.dev/docs/reference/data/InvalidateScope

```ts
type InvalidateScope = 'rows' | 'counts' | 'facets' | 'all';
```

### Json

Kind: type

Page: https://salmonui.dev/docs/reference/data/Json-type

```ts
type Json = null | boolean | number | string | readonly Json[] | {
    readonly [key: string]: Json;
};
```

### PagingStrategy

Kind: type

Page: https://salmonui.dev/docs/reference/data/PagingStrategy

```ts
type PagingStrategy = {
    readonly kind: 'offset';
} | {
    readonly kind: 'cursor';
} | {
    readonly kind: 'infinite';
    readonly blockSize: number;
    readonly strategy?: 'offset' | 'cursor';
    readonly maxBlocks?: number;
};
```

### PerformedStage

Kind: type

Page: https://salmonui.dev/docs/reference/data/PerformedStage

```ts
type PerformedStage = 'search' | 'filter' | 'sort' | 'group' | 'aggregate' | 'page';
```

### Range

Kind: type

Page: https://salmonui.dev/docs/reference/data/Range

```ts
type Range = readonly [
    number,
    number
];
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `0` | `0: number;` | inherited |  |
| `1` | `1: number;` | inherited |  |
| `length` | `length: 2;` | inherited |  |

### RowId

Kind: type

Page: https://salmonui.dev/docs/reference/data/RowId

```ts
type RowId = string;
```

### SearchOperator

Kind: type

Page: https://salmonui.dev/docs/reference/data/SearchOperator

```ts
type SearchOperator = 'contains' | 'startsWith' | 'endsWith' | 'equal' | 'notEqual' | 'wildcard' | 'like';
```

### TreeLoadResult

Kind: type

Page: https://salmonui.dev/docs/reference/data/TreeLoadResult

```ts
type TreeLoadResult<Row> = DataSourceResult<Row, TreeRowEnvelope<Row>>;
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `version: number;` | inherited |  |
| `rows` | `rows: readonly TreeRowEnvelope<Row>[];` | inherited |  |
| `totalRowCount` | `totalRowCount?: number;` | optional, inherited |  |
| `performed` | `performed?: readonly PerformedStage[];` | optional, inherited |  |
| `aggregates` | `aggregates?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;` | optional, inherited |  |
| `pageInfo` | `pageInfo?: PageInfo;` | optional, inherited |  |
| `facet` | `facet?: FacetPayload;` | optional, inherited |  |
| `rowOffset` | `rowOffset?: number;` | optional, inherited | Infinite mode: index of `rows[0]` within the full result when leading blocks were evicted (`maxBlocks`). |

## Re-exported entry points

- [@salmonui/data/json](https://salmonui.dev/docs/reference/data/json.md): 88 symbols: 22 functions, 5 classes, 44 interfaces, 16 types and 1 constant
  `CursorUnknownError`, `EncodeRowsOptions`, `FetchTransportOptions`, `HttpError`, `JsonDataSource`, `JsonDataSourceOptions`, `JsonPivotSource`, `JsonPivotSourceOptions`, `JsonTransport`, `PROTOCOL_VERSION`, `PivotDrillThroughPage`, `PivotDrillThroughQuery`, `PivotJsonTransport`, `PivotRequestErrorEvent`, `PivotRequestEvent`, `PivotRequestKind`, `PivotResponseEvent`, `PivotWindowQuery`, `ProtocolError`, `RemotePivotCell`, `RemotePivotEngine`, `RemotePivotEngineOptions`, `RemotePivotHeader`, `RemotePivotMember`, `RemotePivotResult`, `RemotePivotStatus`, `RequestCanceledError`, `RequestErrorEvent`, `RequestEvent`, `RequestKind`, `ResponseEvent`, `StaleResponseError`, `TransportContext`, `TupleColumnDefLike`, `TupleColumnHooks`, `TupleRow`, `UniversalJsonTransport`, `WireAnyRequest`, `WireAnyResponse`, `WireBatchRequest`, `WireBatchResponse`, `WireCondition`, `WireError`, `WireGroup`, `WireLiveMessage`, `WirePage`, `WirePivotAxisField`, `WirePivotHeader`, `WirePivotModel`, `WirePivotRequest`, `WirePivotResponse`, `WirePivotValueField`, `WirePivotWindow`, `WirePredicate`, `WireQuery`, `WireQueryOptions`, `WireReadRequest`, `WireReadResponse`, `WireRequest`, `WireResponse`, `WireTuple`, `WireType`, `WireWriteRequest`, `WireWriteResponse`, `WriteStateEvent`, `WriteStateSnapshot`, `createBatchingFetchTransport`, `createBatchingTransport`, `createFetchTransport`, `createJsonDataSource`, `createJsonPivotSource`, `decodeTuples`, `encodeRows`, `fieldIndex`, `isRetryableError`, `isWirePivotRequest`, `isWireWriteRequest`, `normalizeFilterOperator`, `objectToTuple`, `serializeDataGridQuery`, `structuralQueryKey`, `toWherePredicate`, `toWirePivotModel`, `toWireQuery`, `tupleColumns`, `tupleRowId`, `tuplesToObjects`, `wirePivotModelKey`
- [@salmonui/data/local](https://salmonui.dev/docs/reference/data/local.md): 3 symbols: 1 function and 2 interfaces
  `OfflineDataSource`, `OfflineDataSourceOptions`, `createOfflineDataSource`
- [@salmonui/data/stream](https://salmonui.dev/docs/reference/data/stream.md): 5 symbols: 1 function and 4 interfaces
  `LiveDataSource`, `LiveDataSourceOptions`, `LiveEmitter`, `LivePatch`, `createLiveDataSource`
- [@salmonui/data/storage](https://salmonui.dev/docs/reference/data/storage.md): 6 symbols: 3 functions, 2 interfaces and 1 type
  `DataGridStateStorage`, `KeyValueStore`, `SaveResult`, `createJsonStateStorage`, `createKeyValueStateStorage`, `createMemoryStore`
- [@salmonui/data/views](https://salmonui.dev/docs/reference/data/views.md): 6 symbols: 1 function, 4 interfaces and 1 constant
  `SAVED_VIEW_SCHEMA_VERSION`, `SavedView`, `SavedViewInput`, `SavedViews`, `SavedViewsOptions`, `createSavedViews`
- [@salmonui/data/lookup](https://salmonui.dev/docs/reference/data/lookup.md): 6 symbols: 2 functions and 4 interfaces
  `CachedLookup`, `JsonLookupOptions`, `LookupOptions`, `LookupRequest`, `createJsonLookup`, `createLookup`
