@sheetwrite/corefunction
Incrementally validate the operation count and exact encoded payload size without constructing a JSON string. Compact operation ranges are measured by their serialized fields; their logical cell area is deliberately irrelevant.
- Package
@sheetwrite/core- Source
packages/core/src/document-protocol.ts#L88
Declaration
function validateTransactionResources( operations: readonly DocumentOptype DocumentOp =
| {
op: "set";
addr: CellAddress;
value: CellValue;
style?: CellStyle;
}
| { op: "setRange"; range: Range; cells: SnapshotCell[] }
| { op: "setBlock"; range: Range; block: PackedCellBlock }
| {
op: "setRangeStyle";
range: Range;
style: Partial<CellStyle> | null;
}
| {
// … 93 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: "setRangeStyle";
range: Range;
style: Partial<CellStyle> | null;
}
| {
// … 93 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: "setRangeStyle";
// … 168 more lines — see the API reference
}Exhaustive serializable operation union for workbook mutations.API reference →[], limits?: Readonly<TransactionResourceLimitsinterface TransactionResourceLimits {
maxOperations: number;
maxEncodedBytes: number;
}interface TransactionResourceLimits {
maxOperations: number;
maxEncodedBytes: number;
}interface TransactionResourceLimits {
maxOperations: number;
maxEncodedBytes: number;
}Public ceilings shared by transaction producers, persistence, transport, and replay. Limits measure the submitted operation array itself, not the logical cell area covered by compact operations.API reference →>,): TransactionResourceValidationResulttype TransactionResourceValidationResult =
| { ok: true; operationCount: number; encodedBytes: number }
| {
ok: false;
issue: Extract<
MutationIssue,
{ kind: "resource-limit" } | { kind: "invalid-operation" }
>;
};type TransactionResourceValidationResult =
| { ok: true; operationCount: number; encodedBytes: number }
| {
ok: false;
issue: Extract<
MutationIssue,
{ kind: "resource-limit" } | { kind: "invalid-operation" }
>;
};type TransactionResourceValidationResult =
| {
ok: true;
operationCount: number;
encodedBytes: number;
}
| {
ok: false;
issue: Extract<
MutationIssue,
| {
kind: "resource-limit";
}
| {
kind: "invalid-operation";
}
>;
};Successful byte/count inspection or one structured transaction rejection.API reference →