API reference
@searsuite/sear-domain-workbook
Stable workbook and Sheet identities, structure, and document-state contracts.
56 exportsderived from source
Concept 1
Separate Workbook structure from the active Sheet session
WorkbookDocumentState holds stable Sheet identities, order, names, visibility, and each Sheet's document state.
WorkbookSessionState holds local values needed to remount the active Sheet. Internal references use stable
sheetId values so renaming a Sheet changes its label without changing its identity.
The Workbook assembly mounts one active Sheet editor. Before switching, it captures that Sheet's document and local session, tears down the editor, and mounts the next Sheet. Switching back restores the captured session; viewport state does not become durable Workbook content.
Concept 2
Change Workbook structure through staged operations
addWorkbookSheet(), moveWorkbookSheet(), and related operations describe structural changes. The Workbook
assembly stages add, remove, move, rename, hide, and unhide commands as Workbook transactions, with history
separate from edits inside a mounted Sheet.
Use when: managing several Sheets or resolving references across them. Keep structural reads and identity in the Workbook domain; use the active Sheet editor and its feature commands for cell content or appearance. Formula references and collaboration channels use stable Sheet identities rather than mutable display names.
- classWorkbookErrorsource ↗
-
class WorkbookError extends SearErrorError thrown when workbook state or workbook references violate their domain contract.
constructorconstructor WorkbookError(code: WorkbookErrorCode, message: string, details?: SearErrorDetails): WorkbookErrorCreates a WorkbookError instance.
code: WorkbookErrorCodemessage: stringdetails: SearErrorDetails
propertycode readonly code: WorkbookErrorCodeStable machine-readable error code.
Inherited members 9
Inherited from SearError.
- interfaceAddWorkbookSheetInputsource ↗
-
interface AddWorkbookSheetInput<SheetState>Input accepted by
addWorkbookSheet.propertyindex readonly index?: numberOptional insertion index; defaults to appending after the current last sheet.
propertysheet readonly sheet: WorkbookSheetDescriptorDescriptor for the sheet being inserted.
propertysheetState readonly sheetState: SheetStateInitial state payload for the inserted sheet.
- interfaceCreateWorkbookDocumentStateInputsource ↗
-
interface CreateWorkbookDocumentStateInput<SheetState>Input accepted by
createWorkbookDocumentState.propertyid readonly id: stringStable workbook id used by persistence and collaboration rooms.
propertymetadata readonly metadata?: Readonly<Record<string, unknown>>Extension-owned serializable metadata copied onto the workbook state.
propertysheets readonly sheets: readonly WorkbookSheetDescriptor[]Ordered sheet descriptors.
propertysheetStates readonly sheetStates: WorkbookSheetStateMap<SheetState>Per-sheet state payloads keyed by sheet id.
- interfaceMoveWorkbookSheetInputsource ↗
-
interface MoveWorkbookSheetInputInput accepted by
moveWorkbookSheet. - interfaceParsedWorkbookFormulaReferencesource ↗
-
interface ParsedWorkbookFormulaReferenceParsed workbook formula reference bound to a stable sheet id.
- interfaceRemoveWorkbookSheetInputsource ↗
-
interface RemoveWorkbookSheetInputInput accepted by
removeWorkbookSheet.propertysheetId readonly sheetId: stringSheet id to remove.
- interfaceRenameWorkbookSheetInputsource ↗
-
interface RenameWorkbookSheetInputInput accepted by
renameWorkbookSheet. - interfaceUpdateWorkbookSheetStateInputsource ↗
-
interface UpdateWorkbookSheetStateInput<SheetState>Input accepted by
updateWorkbookSheetState.propertysheetId readonly sheetId: stringSheet id whose state payload should be replaced.
propertysheetState readonly sheetState: SheetStateReplacement sheet state payload.
- interfaceWorkbookCellReferencesource ↗
-
interface WorkbookCellReferenceQualified cell reference used by workbook-level formulas and dependency graphs.
- interfaceWorkbookColumnRangeReferencesource ↗
-
interface WorkbookColumnRangeReferenceQualified whole-column range reference used by workbook-level formulas.
- interfaceWorkbookDocumentStatesource ↗
-
interface WorkbookDocumentState<SheetState>Workbook state containing sheet metadata plus per-sheet state payloads.
SheetStateis generic so this package stays independent from sheet, render, formula, and assembly packages.propertyid readonly id: stringStable workbook id used by persistence and collaboration rooms.
propertymetadata readonly metadata?: Readonly<Record<string, unknown>>Extension-owned serializable metadata that does not affect core workbook semantics.
propertysheets readonly sheets: readonly WorkbookSheetDescriptor[]Ordered sheet descriptors; array order is the persisted tab order.
propertysheetStates readonly sheetStates: WorkbookSheetStateMap<SheetState>Per-sheet state payloads keyed by stable sheet id.
- interfaceWorkbookRangeReferencesource ↗
-
interface WorkbookRangeReferenceQualified rectangular range reference used by workbook-level formulas.
- interfaceWorkbookRowRangeReferencesource ↗
-
interface WorkbookRowRangeReferenceQualified whole-row range reference used by workbook-level formulas.
- interfaceWorkbookSheetDescriptorsource ↗
-
interface WorkbookSheetDescriptorWorkbook-level sheet metadata.
The containing
WorkbookDocumentState.sheetsarray is the only source of sheet order; descriptors intentionally do not carry a separate order field.propertycolor readonly color?: stringOptional UI tab color owned by the workbook host.
propertyid readonly id: stringStable sheet id used by workbook state, collaboration envelopes, and formula dependencies.
propertymetadata readonly metadata?: Readonly<Record<string, unknown>>Extension-owned serializable metadata that does not affect core workbook semantics.
propertyname readonly name: stringUnique user-facing sheet name used when displaying formula references.
- typeWorkbookCellKeysource ↗
-
type WorkbookCellKey = stringSerialized key for a workbook-qualified formula cell.
- typeWorkbookCoordinateAxissource ↗
-
type WorkbookCoordinateAxis = typeof WorkbookCoordinateAxis[keyof typeof WorkbookCoordinateAxis]Stable workbook coordinate axis-name type.
- typeWorkbookErrorCodesource ↗
-
type WorkbookErrorCode = typeof WorkbookErrorCode[keyof typeof WorkbookErrorCode]Machine-readable workbook error code type.
- typeWorkbookFormulaReferencesource ↗
-
type WorkbookFormulaReference = WorkbookCellReference | WorkbookRangeReference | WorkbookColumnRangeReference | WorkbookRowRangeReferenceAny workbook-qualified formula reference supported by the workbook protocol.
- typeWorkbookIdsource ↗
-
type WorkbookId = stringStable workbook identifier used by host-level workbook registries.
- typeWorkbookReferenceDiagnosticFieldsource ↗
-
type WorkbookReferenceDiagnosticField = WorkbookReferenceField | templateLiteral | templateLiteralDiagnostic field path emitted by workbook reference validation errors.
- typeWorkbookReferenceFieldsource ↗
-
type WorkbookReferenceField = typeof WorkbookReferenceField[keyof typeof WorkbookReferenceField]Stable workbook reference property-name type.
- typeWorkbookSheetIdsource ↗
-
type WorkbookSheetId = stringStable sheet identifier used inside workbook metadata and cross-sheet references.
- typeWorkbookSheetStateMapsource ↗
-
type WorkbookSheetStateMap = Readonly<Record<WorkbookSheetId, SheetState>>Map from workbook sheet id to the host-selected sheet state payload.
- variableWorkbookCoordinateAxissource ↗
-
WorkbookCoordinateAxis: { col: "col"; row: "row" }Stable coordinate axis names used by tuple-backed workbook range references.
- variableWorkbookCoordinateIndexsource ↗
-
WorkbookCoordinateIndex: { col: 1; row: 0 }Tuple positions for workbook range coordinates.
- variableWorkbookErrorCodesource ↗
-
WorkbookErrorCode: { cannotHideAllSheets: "SEAR_WORKBOOK_CANNOT_HIDE_ALL_SHEETS"; cannotRemoveLastSheet: "SEAR_WORKBOOK_CANNOT_REMOVE_LAST_SHEET"; duplicateSheetId: "SEAR_WORKBOOK_DUPLICATE_SHEET_ID"; duplicateSheetName: "SEAR_WORKBOOK_DUPLICATE_SHEET_NAME"; invalidCellKey: "SEAR_WORKBOOK_INVALID_CELL_KEY"; invalidReference: "SEAR_WORKBOOK_INVALID_REFERENCE"; invalidSheetIndex: "SEAR_WORKBOOK_INVALID_SHEET_INDEX"; invalidSheetName: "SEAR_WORKBOOK_INVALID_SHEET_NAME"; … }Stable machine-readable error codes owned by the workbook domain package.
- variableWorkbookReferenceFieldsource ↗
-
WorkbookReferenceField: { col: "col"; end: "end"; endCol: "endCol"; endRow: "endRow"; row: "row"; sheetId: "sheetId"; start: "start"; startCol: "startCol"; … }Stable property names used by workbook-qualified formula references.
- functionaddWorkbookSheetsource ↗
-
addWorkbookSheet<SheetState>(state: WorkbookDocumentState<SheetState>, input: AddWorkbookSheetInput<SheetState>): WorkbookDocumentState<SheetState>Adds a sheet descriptor and its initial state payload without mutating the source workbook.
state: WorkbookDocumentState<SheetState>input: AddWorkbookSheetInput<SheetState>
- functioncreateWorkbookCellKeysource ↗
-
createWorkbookCellKey(reference: WorkbookCellReference): stringCreates a stable string key for a workbook-qualified cell reference.
reference: WorkbookCellReference
- functioncreateWorkbookDocumentStatesource ↗
-
createWorkbookDocumentState<SheetState>(input: CreateWorkbookDocumentStateInput<SheetState>): WorkbookDocumentState<SheetState>Creates a validated workbook state using array order as the sheet tab order.
input: CreateWorkbookDocumentStateInput<SheetState>
- functionformatParsedWorkbookFormulaReferencesource ↗
-
formatParsedWorkbookFormulaReference(reference: ParsedWorkbookFormulaReference, sheets: readonly WorkbookSheetDescriptor[]): stringFormats a parsed workbook formula reference with the current user-facing sheet name.
reference: ParsedWorkbookFormulaReferencesheets: readonly WorkbookSheetDescriptor[]
- functionformatWorkbookCellReferencesource ↗
-
formatWorkbookCellReference(reference: WorkbookCellReference, sheetName: string): stringFormats a workbook-qualified cell reference using a caller-provided sheet name.
reference: WorkbookCellReferencesheetName: string
- functionformatWorkbookRangeReferencesource ↗
-
formatWorkbookRangeReference(reference: WorkbookRangeReference, sheetName: string): stringFormats a workbook-qualified rectangular range reference using a caller-provided sheet name.
reference: WorkbookRangeReferencesheetName: string
- functiongetWorkbookSheetDescriptorsource ↗
-
getWorkbookSheetDescriptor<SheetState>(state: WorkbookDocumentState<SheetState>, sheetId: string): WorkbookSheetDescriptor | nullReturns the descriptor for a sheet id, or null when the sheet is absent.
state: WorkbookDocumentState<SheetState>sheetId: string
- functiongetWorkbookSheetStatesource ↗
-
getWorkbookSheetState<SheetState>(state: WorkbookDocumentState<SheetState>, sheetId: string): SheetState | nullReturns one sheet state payload, or null when the sheet is absent.
state: WorkbookDocumentState<SheetState>sheetId: string
- functionisValidWorkbookReferencesource ↗
-
isValidWorkbookReference(reference: unknown): referenceReports whether an unknown value is any valid workbook-qualified formula reference.
reference: unknown
- functionisWorkbookCellReferencesource ↗
-
isWorkbookCellReference(reference: unknown): referenceReports whether an unknown value is a valid workbook-qualified cell reference.
reference: unknown
- functionisWorkbookColumnRangeReferencesource ↗
-
isWorkbookColumnRangeReference(reference: unknown): referenceReports whether an unknown value is a valid workbook-qualified whole-column range reference.
reference: unknown
- functionisWorkbookRangeReferencesource ↗
-
isWorkbookRangeReference(reference: unknown): referenceReports whether an unknown value is a valid workbook-qualified rectangular range reference.
reference: unknown
- functionisWorkbookRowRangeReferencesource ↗
-
isWorkbookRowRangeReference(reference: unknown): referenceReports whether an unknown value is a valid workbook-qualified whole-row range reference.
reference: unknown
- functionmoveWorkbookSheetsource ↗
-
moveWorkbookSheet<SheetState>(state: WorkbookDocumentState<SheetState>, input: MoveWorkbookSheetInput): WorkbookDocumentState<SheetState>Moves a sheet descriptor to a new tab index without mutating the source workbook.
state: WorkbookDocumentState<SheetState>input: MoveWorkbookSheetInput
- functionnormalizeWorkbookColumnRangeReferencesource ↗
-
normalizeWorkbookColumnRangeReference(reference: WorkbookColumnRangeReference): WorkbookColumnRangeReferenceNormalizes a whole-column reference so the start column is before the end column.
reference: WorkbookColumnRangeReference
- functionnormalizeWorkbookRangeReferencesource ↗
-
normalizeWorkbookRangeReference(reference: WorkbookRangeReference): WorkbookRangeReferenceNormalizes a range reference so start is top-left and end is bottom-right.
reference: WorkbookRangeReference
- functionnormalizeWorkbookRowRangeReferencesource ↗
-
normalizeWorkbookRowRangeReference(reference: WorkbookRowRangeReference): WorkbookRowRangeReferenceNormalizes a whole-row reference so the start row is before the end row.
reference: WorkbookRowRangeReference
- functionparseWorkbookCellKeysource ↗
-
parseWorkbookCellKey(key: string): WorkbookCellReferenceParses a string produced by
createWorkbookCellKeyback into a cell reference.key: string
- functionparseWorkbookFormulaReferencesource ↗
-
parseWorkbookFormulaReference(reference: string, sheets: readonly WorkbookSheetDescriptor[]): ParsedWorkbookFormulaReferenceParses a displayed workbook reference such as Sheet2!A1 or Sheet2!A1:B5 into a stable sheet-id range.
reference: stringsheets: readonly WorkbookSheetDescriptor[]
- functionquoteWorkbookSheetNamesource ↗
-
quoteWorkbookSheetName(name: string): stringReturns a formula-safe display name for a workbook sheet.
name: string
- functionremoveWorkbookSheetsource ↗
-
removeWorkbookSheet<SheetState>(state: WorkbookDocumentState<SheetState>, input: RemoveWorkbookSheetInput): WorkbookDocumentState<SheetState>Removes a sheet descriptor and its state payload without mutating the source workbook.
state: WorkbookDocumentState<SheetState>input: RemoveWorkbookSheetInput
- functionrenameWorkbookSheetsource ↗
-
renameWorkbookSheet<SheetState>(state: WorkbookDocumentState<SheetState>, input: RenameWorkbookSheetInput): WorkbookDocumentState<SheetState>Renames a workbook sheet without mutating the source workbook.
state: WorkbookDocumentState<SheetState>input: RenameWorkbookSheetInput
- functionupdateWorkbookSheetStatesource ↗
-
updateWorkbookSheetState<SheetState>(state: WorkbookDocumentState<SheetState>, input: UpdateWorkbookSheetStateInput<SheetState>): WorkbookDocumentState<SheetState>Replaces one sheet state payload without mutating the source workbook.
state: WorkbookDocumentState<SheetState>input: UpdateWorkbookSheetStateInput<SheetState>
- functionvalidateWorkbookDocumentStatesource ↗
-
validateWorkbookDocumentState<SheetState>(state: WorkbookDocumentState<SheetState>): voidValidates the workbook structural invariants shared by commands and persistence.
state: WorkbookDocumentState<SheetState>
- variableWorkbookCoordinateAxisValuesource ↗
-
WorkbookCoordinateAxisValue: { col: "col"; row: "row" }Stable coordinate axis names used by tuple-backed workbook range references.
- variableWorkbookErrorCodeValuesource ↗
-
WorkbookErrorCodeValue: { cannotHideAllSheets: "SEAR_WORKBOOK_CANNOT_HIDE_ALL_SHEETS"; cannotRemoveLastSheet: "SEAR_WORKBOOK_CANNOT_REMOVE_LAST_SHEET"; duplicateSheetId: "SEAR_WORKBOOK_DUPLICATE_SHEET_ID"; duplicateSheetName: "SEAR_WORKBOOK_DUPLICATE_SHEET_NAME"; invalidCellKey: "SEAR_WORKBOOK_INVALID_CELL_KEY"; invalidReference: "SEAR_WORKBOOK_INVALID_REFERENCE"; invalidSheetIndex: "SEAR_WORKBOOK_INVALID_SHEET_INDEX"; invalidSheetName: "SEAR_WORKBOOK_INVALID_SHEET_NAME"; … }Stable machine-readable error codes owned by the workbook domain package.
- variableWorkbookReferenceFieldValuesource ↗
-
WorkbookReferenceFieldValue: { col: "col"; end: "end"; endCol: "endCol"; endRow: "endRow"; row: "row"; sheetId: "sheetId"; start: "start"; startCol: "startCol"; … }Stable property names used by workbook-qualified formula references.
No public exports match that search.