@searsuite/sear-plugin-export
Versioned export envelopes, document-state codec registries, and durable persistence boundaries.
Document codecs
- classDocumentStateCodecRegistry
-
class DocumentStateCodecRegistry<TState>Registry that composes document-state modules without central field enumeration.
constructor DocumentStateCodecRegistry<TState>(): DocumentStateCodecRegistry<TState>method deserialize(modules: readonly SearDocumentStateModuleFile[], path: string): Partial<TState>Deserializes registered modules into one partial document state.
method register(codec: DocumentStateCodec<TState>): thisRegisters a module codec. Duplicate keys are rejected.
method registerContribution(contribution: DocumentStateModuleContribution<unknown, object>): thisRegisters the codec from a plugin-owned document-state contribution.
method serialize(state: TState): SearDocumentStateModuleFile[]Serializes every registered module whose codec returns a payload.
- interfaceDocumentStateCodec
-
interface DocumentStateCodec<TState>Codec contributed by the owner of one document-state module.
property readonly key: stringStable module key written to persisted files.
method deserialize(payload: JsonValue, path: string): Partial<TState>Restores the module-owned part of a document state.
method serialize(state: TState): unknownSerializes the module-owned part of a document state.
- interfaceDocumentStateModuleContribution
-
interface DocumentStateModuleContribution<TOwnerState, TDocumentState>Export contribution owned by one document-state owner.
property readonly codec: DocumentStateCodec<TDocumentState>JSON codec used for this module in stable export files.
property readonly key: stringStable module key written to persisted files.
method capture(ownerState: TOwnerState): Partial<TDocumentState> | undefinedCaptures this owner state into the aggregate document-state snapshot.
Export files
- classExportError
-
class ExportError extends SearErrorError thrown when a persisted workbook payload cannot be encoded or decoded.
constructor ExportError(code: ExportErrorCode, message: string, details?: SearErrorDetails): ExportErrorproperty readonly code: ExportErrorCodeStable machine-readable error code.
Inherited members 9
Inherited from SearError.
- interfaceSearDocumentStateModuleFile
-
One registered document-state module in a stable export file.
property readonly key: stringStable module key owned by the state owner, such as
sheet.data.property readonly payload: JsonValueModule-owned JSON payload.
- interfaceSearFormulaBindingFile
-
One formula cell's workbook-qualified reference targets.
property readonly col: numberproperty readonly formula: stringproperty readonly references: readonly { sheetId: string; sheetName: string }[]property readonly row: numberproperty readonly sheetId: string - interfaceSearSheetDocumentFile
-
Stable persisted representation of one Sheet document state.
property readonly kind: "sheet"Sheet payload kind.
property readonly modules: readonly SearDocumentStateModuleFile[]Registered document-state modules.
- interfaceSearWorkbookFile
-
interface SearWorkbookFile<TSheetDescriptor>Stable persisted representation of a Workbook document state.
property readonly format: "searsuite.workbook"Stable file-format identifier.
property readonly workbook: { formulaBindings?: readonly SearFormulaBindingFile[]; id: string; metadata?: Readonly<Record<string, JsonValue>>; sheets: readonly TSheetDescriptor[]; sheetStates: Readonly<Record<string, SearSheetDocumentFile>> }Persisted workbook document state.
- typeExportErrorCode
-
type ExportErrorCode = typeof ExportErrorCode[keyof typeof ExportErrorCode]ExportErrorCode: { codecNotFound: "SEAR_EXPORT_CODEC_NOT_FOUND"; duplicateCodec: "SEAR_EXPORT_DUPLICATE_CODEC"; invalidFormat: "SEAR_EXPORT_INVALID_FORMAT" }Machine-readable export error code type.
- variableSearWorkbookFileFormat
-
SearWorkbookFileFormat: "searsuite.workbook"Current stable workbook JSON format identifier.
- variableExportErrorCodeValue
-
ExportErrorCodeValue: { codecNotFound: "SEAR_EXPORT_CODEC_NOT_FOUND"; duplicateCodec: "SEAR_EXPORT_DUPLICATE_CODEC"; invalidFormat: "SEAR_EXPORT_INVALID_FORMAT" }Stable machine-readable error codes owned by the export plugin.
JSON values
- typeJsonValue
-
type JsonValue = null | boolean | number | string | readonly JsonValue[] | { }JSON-compatible scalar or object value.
- functioncloneJsonRecord
-
cloneJsonRecord(value: Readonly<Record<string, unknown>> | undefined, path: string): Readonly<Record<string, JsonValue>> | undefinedNarrows a runtime value to a JSON-compatible metadata record.
- functioncloneJsonValue
-
cloneJsonValue<TValue>(value: TValue, path?: string): TValueClones a JSON-compatible value and rejects values that cannot be persisted as JSON.
- functionreadRecord
-
readRecord(value: unknown, path: string): Record<string, unknown>Narrows a runtime value to a plain object.
No matching API entries.