API reference
@searsuite/sear-plugin-collab
Editor bridges that connect committed collaborative transactions to host transports.
35 exportsderived from source
- classCollaborationChannelsource ↗
-
class CollaborationChannel extends CollaborationSessionLong-lived collaboration resource channel shared by standalone and embedded editors. It is the sole owner of transport, revision, pending submissions, ACK handling and rebase state.
constructorconstructor CollaborationChannel(transport: CollabTransport | (): CollabTransport, platform: Pick<Platform, "warn" | "createId">): CollaborationChanneltransport: CollabTransport | (): CollabTransportplatform: Pick<Platform, "warn" | "createId">
methodapplyExternalEvent applyExternalEvent(event: CollaborationExternalEvent): voidApplies one transport event while the owning editor dispatches its command.
event: CollaborationExternalEvent
methodattachRemoteApplier attachRemoteApplier(applier: CollaborationRemoteOperationApplier): (): voidAttaches the one currently mounted editor and replays queued remote effects in revision order.
applier: CollaborationRemoteOperationApplier
methodconnect connect(options: CollaborationConnectOptions): Promise<void>options: CollaborationConnectOptions
methoddestroy destroy(): voidmethoddisconnect disconnect(): voidmethodenforceCommandBoundary enforceCommandBoundary(assertWrite: (): void, runWithoutMutationAuthority?: <Value>(callback: (): Value): Value, dispatchExternalEvent: (event: CollaborationExternalEvent): void): voidRestricts public channel mutations after its owning editor finishes assembly.
assertWrite: (): voidrunWithoutMutationAuthority: <Value>(callback: (): Value): ValuedispatchExternalEvent: (event: CollaborationExternalEvent): void
methodgetStatus getStatus(): CollaborationStatusmethodregisterContributor registerContributor(contribution: CollaborationContribution): voidInstalls one open OT owner contract for the lifetime of this channel.
contribution: CollaborationContribution
methodsubmitLocal submitLocal(ownerId: string, operations: readonly OTOperation[]): voidQueues a committed local operation batch through the shared collaboration engine.
ownerId: stringoperations: readonly OTOperation[]
methodsubscribeStatus subscribeStatus(listener: (status: CollaborationStatus): void): (): voidlistener: (status: CollaborationStatus): void
- classCollaborationChannelErrorsource ↗
-
class CollaborationChannelError extends SearErrorStable public failures raised by a collaboration channel host.
constructorconstructor CollaborationChannelError(code: CollaborationChannelErrorCode, message: string, details?: Record<string, unknown>): CollaborationChannelErrorcode: CollaborationChannelErrorCodemessage: stringdetails: Record<string, unknown>
propertycode readonly code: CollaborationChannelErrorCodeStable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classCollabTransportsource ↗
-
class CollabTransportAbstract transport layer. Swap implementations (WebSocket, BroadcastChannel, polling, etc.) without touching the plugin logic.
constructorconstructor CollabTransport(): CollabTransportpropertysymbolstatic readonly symbol: symbolDI token for resolving CollabTransport.
methodconnect connect(options: CollaborationTransportConnectOptions): Promise<void>Opens the collaboration transport and begins receiving messages.
options: CollaborationTransportConnectOptions
methoddisconnect disconnect(): voidCloses the collaboration transport and releases its listeners.
methodsend send(message: CollaborationSubmission): voidSends one encoded collaboration message through the transport.
message: CollaborationSubmission
methodsubscribe subscribe(handler: (message: CollaborationServerMessage): void): (): voidSubscribes to server messages and returns an idempotent disposer.
handler: (message: CollaborationServerMessage): void
- classHeadlessCollabTransportsource ↗
-
class HeadlessCollabTransport extends CollabTransportCollaboration transport that keeps the plugin local to the current host.
constructorconstructor HeadlessCollabTransport(): HeadlessCollabTransportpropertysymbolstatic readonly symbol: symbolDI token for resolving HeadlessCollabTransport.
methodconnect connect(_options: CollaborationTransportConnectOptions): Promise<void>Opens the collaboration transport and begins receiving messages.
_options: CollaborationTransportConnectOptions
methoddisconnect disconnect(): voidCloses the collaboration transport and releases its listeners.
methodsend send(_message: CollaborationSubmission): voidSends one encoded collaboration message through the transport.
_message: CollaborationSubmission
methodsubscribe subscribe(_handler: (message: CollaborationServerMessage): void): (): voidSubscribes without producing network messages.
_handler: (message: CollaborationServerMessage): void
- classSheetCollaborationPluginsource ↗
-
class SheetCollaborationPlugin extends Plugin<SearCoreSheet, CellProperties, null>, SheetLifecycleController, CollaborationSessionThin Sheet bridge around the editor-independent collaboration engine.
constructorconstructor SheetCollaborationPlugin(channelBinding: CollaborationChannelBinding, plugins: PluginManager<SearCoreSheet, CellProperties>, commands: SheetCommandBus): SheetCollaborationPluginchannelBinding: CollaborationChannelBindingplugins: PluginManager<SearCoreSheet, CellProperties>commands: SheetCommandBus
propertyinterestedIn readonly interestedIn: string[]Declares which Sheet OT action names this plugin is interested in. The engine will only call
applywhen a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.['uc', 'rr', 'rc']— only called for UpdateCell, ResizeRow, ResizeCol['*']— called for any transaction (wildcard)[]— only called for this plugin's own transactions
propertywarnOnDuplicateDepth readonly warnOnDuplicateDepth: falseWhether PluginManager should warn when another ordered plugin shares this depth.
propertysymbolstatic readonly symbol: typeof symbolmethodapply apply(_state: null, _transaction: Transaction): nullApplies a transaction to plugin-owned state and returns the next state.
_state: null_transaction: Transaction
methodconnect connect(options: CollaborationConnectOptions): Promise<void>options: CollaborationConnectOptions
methoddestroy destroy(): voidmethoddisconnect disconnect(): voidmethodgetPluginConfig getPluginConfig(): nullReturns this plugin's runtime configuration view for the current core.
methodgetStatus getStatus(): CollaborationStatusmethodonTransactionCommitted onTransactionCommitted(transaction: Transaction): voidRuns only after every step in the enclosing pipeline has succeeded and all staged plugin state has been committed. Use it for derived caches, notifications, persistence, and transport; never perform those effects in apply, because a later pipeline step may still fail.
transaction: TransactionA committed transaction from the completed pipeline.
methodregisterCommands registerCommands(commands: SheetCommandBus): voidcommands: SheetCommandBus
methodregisterObservations registerObservations(observations: ObservationRegistry): voidobservations: ObservationRegistry
methodregisterState registerState(): { dataEngine: { enabled: boolean }; key: PluginKey; state: null }Registers one or more plugin-owned state records with the host manager.
methodrender render(): nullProduces scene nodes owned by this plugin for the current core state.
methodstart start(_context: SheetLifecycleContext): void_context: SheetLifecycleContext
Inherited members 27
Inherited from Plugin.
- depth
- documentState
- pluginKey
- transactionHistory
- transactionOT
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- classWebSocketTransportsource ↗
-
class WebSocketTransport extends CollabTransportBrowser WebSocket implementation of CollabTransport.
The authority validates and orders submitted operation batches while this adapter owns only WebSocket lifecycle and JSON framing.
constructorconstructor WebSocketTransport(): WebSocketTransportmethodconnect connect(options: CollaborationTransportConnectOptions): Promise<void>Opens the collaboration transport and begins receiving messages.
options: CollaborationTransportConnectOptions
methoddisconnect disconnect(): voidCloses the collaboration transport and releases its listeners.
methodsend send(message: CollaborationSubmission): voidSends one encoded collaboration message through the transport.
message: CollaborationSubmission
methodsubscribe subscribe(handler: (message: CollaborationServerMessage): void): (): voidSubscribes to parsed server messages.
handler: (message: CollaborationServerMessage): void
- interfaceCollaborationChannelBindingsource ↗
-
interface CollaborationChannelBindingDI value used to distinguish editor-owned channels from host-retained channels.
- interfaceCollaborationConnectOptionssource ↗
-
interface CollaborationConnectOptionspropertyresourceId readonly resourceId: stringpropertyrevision readonly revision?: numberpropertyurl readonly url: string - interfaceCollaborationRemoteOperationssource ↗
-
interface CollaborationRemoteOperationsRemote operation batch delivered to the currently mounted editor bridge.
propertyoperations readonly operations: readonly OTOperation[]propertyownerId readonly ownerId: stringpropertyserverRevision readonly serverRevision: number - interfaceCollaborationSessionsource ↗
-
interface CollaborationSessionHost-facing lifecycle API independent from a concrete editor bridge.
methodconnect connect(options: CollaborationConnectOptions): Promise<void>options: CollaborationConnectOptions
methoddisconnect disconnect(): voidmethodgetStatus getStatus(): CollaborationStatus - interfaceCollaborationStatussource ↗
-
interface CollaborationStatuspropertyerror readonly error: unknownpropertypendingCount readonly pendingCount: numberpropertyresourceId readonly resourceId: string | nullpropertyrevision readonly revision: numberpropertystate readonly state: CollaborationConnectionState - interfaceCollaborationTransportConnectOptionssource ↗
-
interface CollaborationTransportConnectOptionsConnection parameters for one collaboration resource.
propertyresourceId readonly resourceId: stringpropertyrevision readonly revision: numberpropertyurl readonly url: string - interfaceConnectSheetCollaborationResultsource ↗
-
interface ConnectSheetCollaborationResult extends SheetCommandResultCommand result that resolves when the collaboration transport is connected.
propertycompletion readonly completion: Promise<void>Optional asynchronous completion of a command-owned external effect.
- interfaceSheetApplyRemoteOperationsInputsource ↗
-
interface SheetApplyRemoteOperationsInputInput for applying operations received from a collaboration transport.
propertyoperations readonly operations: readonly Operation[]Remote operations after local OT transformation.
propertyownerId readonly ownerId: stringStable collaboration owner id resolved through the local plugin registry.
- typeCollaborationChannelErrorCodesource ↗
-
type CollaborationChannelErrorCode = typeof CollaborationChannelErrorCode[keyof typeof CollaborationChannelErrorCode] - typeCollaborationConnectionStatesource ↗
-
type CollaborationConnectionState = typeof CollaborationConnectionState[keyof typeof CollaborationConnectionState]Public lifecycle state of one collaboration session.
- typeCollaborationExternalEventsource ↗
-
type CollaborationExternalEvent = { epoch: number; kind: "connected"; resourceId: string } | { epoch: number; error: unknown; kind: "failed"; resourceId: string } | { epoch: number; kind: "message"; message: CollaborationServerMessage }Transport event returned to the owning editor's command bus.
- typeCollaborationRemoteOperationAppliersource ↗
-
type CollaborationRemoteOperationApplier = (effect: CollaborationRemoteOperations): void - variableApplyRemoteOperationsCommandsource ↗
-
ApplyRemoteOperationsCommand: SheetCommandDefinition<SheetApplyRemoteOperationsInput, SheetCommandResult>Command that applies remote collaboration operations through the normal pipeline.
- variableApplySheetCollaborationEventCommandsource ↗
-
ApplySheetCollaborationEventCommand: SheetCommandDefinition<CollaborationExternalEvent, SheetCommandResult>Routes an external transport event into the owning Sheet command bus.
- variableCollaborationChannelBindingsource ↗
-
CollaborationChannelBinding: { symbol: symbol } - variableCollaborationChannelErrorCodesource ↗
-
CollaborationChannelErrorCode: { AttachmentConflict: "SEAR_COLLABORATION_ATTACHMENT_CONFLICT"; BoundaryInstalled: "SEAR_COLLABORATION_BOUNDARY_INSTALLED"; ContributorConflict: "SEAR_COLLABORATION_CONTRIBUTOR_CONFLICT"; Destroyed: "SEAR_COLLABORATION_CHANNEL_DESTROYED" } - variableCollaborationConnectionStatesource ↗
-
CollaborationConnectionState: { Connecting: "connecting"; Disconnected: "disconnected"; Error: "error"; Online: "online" }Public lifecycle state of one collaboration session.
- variableCollaborationStatusObservationsource ↗
-
CollaborationStatusObservation: StateObservationDefinition<CollaborationStatus>Editor-local collaboration connection and synchronization status.
- variableConnectSheetCollaborationCommandsource ↗
-
ConnectSheetCollaborationCommand: SheetCommandDefinition<CollaborationConnectOptions, ConnectSheetCollaborationResult>Starts a Sheet collaboration session through the editor command bus.
- variableDisconnectSheetCollaborationCommandsource ↗
-
DisconnectSheetCollaborationCommand: SheetCommandDefinition<void, SheetCommandResult>Disconnects a Sheet collaboration session through the editor command bus.
- interfaceCollaborationAcceptedBatchsource ↗
-
interface CollaborationAcceptedBatchCanonical operation batch accepted and ordered by the authority.
propertybaseRevision readonly baseRevision: numberpropertyclientId readonly clientId: stringpropertykind readonly kind: "accepted"propertyoperationId readonly operationId: stringpropertyoperationType readonly operationType: CollaborationOperationTypepropertyownerId readonly ownerId: stringpropertypayload readonly payload: OTEncodedValuepropertyprotocolVersion readonly protocolVersion: 1propertyresourceId readonly resourceId: stringpropertyserverRevision readonly serverRevision: number - variableCollaborationChannelErrorCodeTypesource ↗
-
CollaborationChannelErrorCodeType: { AttachmentConflict: "SEAR_COLLABORATION_ATTACHMENT_CONFLICT"; BoundaryInstalled: "SEAR_COLLABORATION_BOUNDARY_INSTALLED"; ContributorConflict: "SEAR_COLLABORATION_CONTRIBUTOR_CONFLICT"; Destroyed: "SEAR_COLLABORATION_CHANNEL_DESTROYED" } - typeCollaborationClientMessagesource ↗
-
type CollaborationClientMessage = CollaborationSubmission - variableCollaborationConnectionStateTypesource ↗
-
CollaborationConnectionStateType: { Connecting: "connecting"; Disconnected: "disconnected"; Error: "error"; Online: "online" }Public lifecycle state of one collaboration session.
- variableCollaborationProtocolVersionsource ↗
-
CollaborationProtocolVersion: 1Current collaboration wire protocol version.
- interfaceCollaborationRejectedMessagesource ↗
-
interface CollaborationRejectedMessageExplicit authority rejection; clients must not infer recovery from dropped frames.
propertycode readonly code: stringpropertykind readonly kind: "rejected"propertymessage readonly message: stringpropertyoperationId readonly operationId?: stringpropertyprotocolVersion readonly protocolVersion: 1propertyresourceId readonly resourceId: string - typeCollaborationServerMessagesource ↗
-
type CollaborationServerMessage = CollaborationAcceptedBatch | CollaborationSyncMessage | CollaborationRejectedMessage - interfaceCollaborationSubmissionsource ↗
-
interface CollaborationSubmissionClient submission before the authority assigns a canonical revision.
propertybaseRevision readonly baseRevision: numberpropertyclientId readonly clientId: stringpropertykind readonly kind: "submit"propertyoperationId readonly operationId: stringpropertyoperationType readonly operationType: CollaborationOperationTypepropertyownerId readonly ownerId: stringpropertypayload readonly payload: OTEncodedValuepropertyprotocolVersion readonly protocolVersion: 1propertyresourceId readonly resourceId: string - interfaceCollaborationSyncMessagesource ↗
-
interface CollaborationSyncMessageOrdered catch-up response sent when a transport joins a resource.
propertybatches readonly batches: readonly CollaborationAcceptedBatch[]propertyfromRevision readonly fromRevision: numberpropertykind readonly kind: "sync"propertyprotocolVersion readonly protocolVersion: 1propertyresourceId readonly resourceId: stringpropertyserverRevision readonly serverRevision: number
No public exports match that search.