Skip to content
Sheetwrite

Sheetwrite / Documentation

Store@sheetwrite/core

Columnar workbook storage, query, transaction, and subscription contract.

Columnar workbook storage, query, transaction, and subscription contract.

Members 17

getWorkbook
getWorkbook(): Workbook;
getCell Single-cell read for interactions, API reads, and tests.
getCell(addr: CellAddress): ResolvedCell;

Single-cell read for interactions, API reads, and tests. NOT for the render hot path — renderers use `getVisibleWindow`.

getFormula Formula source at addr, or null when the cell is not a formula.
getFormula(addr: CellAddress): string | null;
getRefTarget Plain-reference target at addr, or null when the cell is not a ref.
getRefTarget(addr: CellAddress): CellAddress | null;
recalculateVolatile Recompute volatile formulas (TODAY/NOW) from one captured instant.
recalculateVolatile(now?: Date): void;

Recompute volatile formulas (`TODAY`/`NOW`) from one captured instant. The supplied Date is interpreted as an absolute UTC instant.

getVisibleWindow Bulk read of a visible window; the only read a renderer should use per frame.
getVisibleWindow( sheet: SheetId, rows: { start: number; end: number }, cols: readonly number[], ): VisibleWindowView;
getDataWindow Optional packed canonical data-row window used by file export.
getDataWindow?( sheet: SheetId, rows: { start: number; end: number }, cols: readonly number[], ): VisibleWindowView;

Optional packed canonical data-row window used by file export. Unlike `getVisibleWindow`, sort/filter state never remaps `rows`.

getClipboardWindow Optional packed clipboard read.
getClipboardWindow?( sheet: SheetId, viewRows: { start: number; end: number }, cols: readonly number[], ): ClipboardWindowView;

Optional packed clipboard read. Custom stores may omit it; the controller preserves the per-cell Store fallback contract.

ensureColumns Ensure a sheet can address at least columns.length columns without producing user changes or dirty patches.
ensureColumns(sheet: SheetId, columns: readonly Column[]): void;

Ensure a sheet can address at least `columns.length` columns without producing user changes or dirty patches. Used for presentation padding.

applyTransaction Apply a low-level storage transaction.
applyTransaction( tx: Transaction, options?: TransactionApplicationOptions, ): ApplyTransactionResult;

Apply a low-level storage transaction.

This bypasses Grid read-only checks and Grid undo/redo history. Use Grid.applyTransaction for normal host-driven edits. Queued and flushed at a barrier — never reentrant.

setProtectionResolver Configure host-owned protected-range permissions.
setProtectionResolver?(resolver: ProtectionResolver | undefined, mode?: MutationPolicyMode): void;

Configure host-owned protected-range permissions. The resolver is synchronous so every local mutation ingress shares one atomic commit barrier.

on
on(evt: "change", fn: (event: ChangeEvent) => void): () => void;
queryCapability Explicit partial-data state for paged datasource stores.
queryCapability?(sheet: SheetId): QueryCapability;
getCellLoadState Loaded/empty/local state; dense stores always return a loaded state.
getCellLoadState?(addr: CellAddress): CellLoadState;
acknowledgeOperations Release paged dirty pins after server acknowledgement.
acknowledgeOperations?(operations: readonly DocumentOp[]): void;
exportSnapshot Deterministic, JSON-safe authoritative runtime document.
exportSnapshot?(): WorkbookSnapshot;
viewRowCount Displayed row count after any active sort/filter view.
viewRowCount(sheet: SheetId): number;

Declaration

View full TypeScript declaration
export interface Store {
getWorkbook(): Workbook;
getCell(addr: CellAddress): ResolvedCell;
getFormula(addr: CellAddress): string | null;
getRefTarget(addr: CellAddress): CellAddress | null;
recalculateVolatile(now?: Date): void;
getVisibleWindow(
sheet: SheetId,
rows: {
start: number;
end: number;
},
cols: readonly number[],
): VisibleWindowView;
getDataWindow?(
sheet: SheetId,
rows: {
start: number;
end: number;
},
cols: readonly number[],
): VisibleWindowView;
getClipboardWindow?(
sheet: SheetId,
viewRows: {
start: number;
end: number;
},
cols: readonly number[],
): ClipboardWindowView;
ensureColumns(sheet: SheetId, columns: readonly Column[]): void;
applyTransaction(
tx: Transaction,
options?: TransactionApplicationOptions,
): ApplyTransactionResult;
setProtectionResolver?(
resolver: ProtectionResolver | undefined,
mode?: MutationPolicyMode,
): void;
on(evt: "change", fn: (event: ChangeEvent) => void): () => void;
queryCapability?(sheet: SheetId): QueryCapability;
getCellLoadState?(addr: CellAddress): CellLoadState;
acknowledgeOperations?(operations: readonly DocumentOp[]): void;
exportSnapshot?(): WorkbookSnapshot;
viewRowCount(sheet: SheetId): number;
}