On this page
Low-level Store transaction. epoch provides optional optimistic
concurrency at the storage boundary.
Calling Store.applyTransaction bypasses Grid read-only checks and Grid
undo/redo history. Host-driven edits should use Grid.applyTransaction.
Examples
See also
Members 2
patches Ordered document operations submitted as one store commit.
epoch Expected current store epoch; a mismatch returns a conflict without applying patches.
Declaration
View full TypeScript declaration
export interface Transaction {
Referenced by
Workspace packages depending on @sheetwrite/core
@sheetwrite/benchdependency
@sheetwrite/docs-startdependency
@sheetwrite/reactdependency
@sheetwrite/sveltedependency
@sheetwrite/vuedependency
@sheetwrite/xlsxdependency
Public exports naming Transaction
interface Storeinterface Storeinterface StoreColumnar workbook storage, query, transaction, and subscription contract.API reference →type SheetId = stringtype SheetId = string;type SheetId = string;Stable identifier used to address a workbook sheet.API reference →interface Transactioninterface Transactioninterface TransactionLow-level Store transaction. epoch provides optional optimistic concurrency at the storage boundary. Calling Store.applyTransaction bypasses Grid read-only checks and Grid undo/redo history. Host-driven edits should use Grid.applyTransaction.@example import type { Store, SheetId, Transaction } from "@sheetwrite/core"; function setAmount(store: Store, sheet: SheetId) { const transaction: Transaction = { patches: [{ op: "set", addr: { sheet, row: 0, col: 0 }, value: { kind: "literal", value: 25 } }], }; return store.applyTransaction(transaction); }@see Grid.applyTransactionAPI reference →function setAmount(store: Store, sheet: SheetId): ApplyTransactionResultfunction setAmount(
store: Store,
sheet: SheetId,
): ApplyTransactionResultfunction setAmount(
store: Store,
sheet: SheetId,
): ApplyTransactionResultsheet: stringlet sheet: stringlet sheet: stringSheet identity used by the simple data-first adapter. Defaults to sheet1.API reference →const transaction: Transactionconst transaction: Transactionconst transaction: TransactionOperations that actually committed after policy and bounds filtering.API reference →Transaction.patches: DocumentOp[]interface Transaction {
patches: DocumentOp[];
}interface Transaction {
patches: DocumentOp[];
}Ordered document operations submitted as one store commit.API reference →addr: CellAddresslet addr: CellAddresslet addr: CellAddressAPI reference →CellAddress.sheet: stringinterface CellAddress {
sheet: string;
}interface CellAddress {
sheet: string;
}Sheet identity used by the simple data-first adapter. Defaults to sheet1.API reference →CellAddress.row: numberinterface CellAddress {
row: number;
}interface CellAddress {
row: number;
}API reference →CellAddress.col: numberinterface CellAddress {
col: number;
}interface CellAddress {
col: number;
}API reference →value: CellValuelet value: CellValuelet value: CellValueAPI reference →value: CellScalarlet value: CellScalarlet value: CellScalarAPI reference →store: Storelet store: Storelet store: StoreAPI reference →Store.applyTransaction(tx: Transaction, options?: TransactionApplicationOptions): ApplyTransactionResultStore.applyTransaction(tx: Transaction, options?: TransactionApplicationOptions): ApplyTransactionResultStore.applyTransaction(tx: Transaction, options?: TransactionApplicationOptions): ApplyTransactionResultApply 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.API reference →type DocumentOp =
| {
op: "set";
addr: CellAddress;
value: CellValue;
style?: CellStyle;
}
| { op: "setRange"; range: Range; cells: SnapshotCell[] }
| { op: "setBlock"; range: Range; block: PackedCellBlock }
| {
op: "restoreBlock";
range: Range;
encoding: "deflate-json-v1";
decodedBytes: number;
data: string;
// … 100 more lines — see the API reference
}type DocumentOp =
| {
op: "set";
addr: CellAddress;
value: CellValue;
style?: CellStyle;
}
| { op: "setRange"; range: Range; cells: SnapshotCell[] }
| { op: "setBlock"; range: Range; block: PackedCellBlock }
| {
op: "restoreBlock";
range: Range;
encoding: "deflate-json-v1";
decodedBytes: number;
data: string;
// … 100 more lines — see the API reference
}type DocumentOp =
| {
op: "set";
addr: CellAddress;
value: CellValue;
style?: CellStyle;
}
| {
op: "setRange";
range: Range;
cells: SnapshotCell[];
}
| {
op: "setBlock";
range: Range;
block: PackedCellBlock;
}
| {
op: "restoreBlock";
// … 175 more lines — see the API reference
}Exhaustive serializable operation union for workbook mutations.API reference →