← All packages

@searsuite/sear-domain-collaboration

Host-neutral revision, pending-operation, acknowledgement, catch-up, and rebase algorithms.

Authority and contributions

classCollaborationAuthority

In-memory authority that validates, rebases, orders, and deduplicates collaboration batches.

classCollaborationEngine

Single client-side collaboration algorithm shared by all editor bridges.

constructorCollaborationEngine(contributors: CollaborationContributorRegistry): CollaborationEngine
methodconnect(resourceId: string, clientId: string, revision?: number): void

Starts one resource session from a host-supplied document revision.

methoddisconnect(): void

Ends the current session and releases transient pending state.

methodgetPendingCount(): number
methodgetRevision(): number
methodreceive(message: CollaborationServerMessage): readonly CollaborationEngineEffect[]

Applies one authority message and returns host/transport effects in deterministic order.

methodsubmitLocal<OperationType>(ownerId: string, operations: readonly OperationType[]): readonly CollaborationEngineEffect[]

Queues one already-committed local transaction and emits at most one in-flight submission.

classCollaborationError
class CollaborationError extends SearError

Public collaboration failure with stable diagnostics.

Inherited members 9

Inherited from SearError.

interfaceCollaborationContribution
interface CollaborationContribution<OperationType>

Open collaboration contribution shared by editor clients and authorities.

interfaceCollaborationOperationType

Versioned OT family identity carried on the wire.

typeCollaborationEngineEffect
type CollaborationEngineEffect = { kind: "send"; submission: CollaborationSubmission } | { kind: "applyRemote"; operations: readonly OTOperation[]; ownerId: string; serverRevision: number }

Effects emitted by the pure collaboration client state machine.

typeCollaborationErrorCode
type CollaborationErrorCode = typeof CollaborationErrorCode[keyof typeof CollaborationErrorCode] CollaborationErrorCode: { AcknowledgementMismatch: "SEAR_COLLABORATION_ACKNOWLEDGEMENT_MISMATCH"; EngineDisconnected: "SEAR_COLLABORATION_ENGINE_DISCONNECTED"; InvalidIdentity: "SEAR_COLLABORATION_INVALID_IDENTITY"; InvalidProtocol: "SEAR_COLLABORATION_INVALID_PROTOCOL"; InvalidRevision: "SEAR_COLLABORATION_INVALID_REVISION"; OperationRejected: "SEAR_COLLABORATION_OPERATION_REJECTED"; OwnerConflict: "SEAR_COLLABORATION_OWNER_CONFLICT"; OwnerNotRegistered: "SEAR_COLLABORATION_OWNER_NOT_REGISTERED"; … }

Stable collaboration protocol and state-machine errors.

variableCollaborationErrorCodeType
CollaborationErrorCodeType: { AcknowledgementMismatch: "SEAR_COLLABORATION_ACKNOWLEDGEMENT_MISMATCH"; EngineDisconnected: "SEAR_COLLABORATION_ENGINE_DISCONNECTED"; InvalidIdentity: "SEAR_COLLABORATION_INVALID_IDENTITY"; InvalidProtocol: "SEAR_COLLABORATION_INVALID_PROTOCOL"; InvalidRevision: "SEAR_COLLABORATION_INVALID_REVISION"; OperationRejected: "SEAR_COLLABORATION_OPERATION_REJECTED"; OwnerConflict: "SEAR_COLLABORATION_OWNER_CONFLICT"; OwnerNotRegistered: "SEAR_COLLABORATION_OWNER_NOT_REGISTERED"; … }

Stable collaboration protocol and state-machine errors.

Protocol messages

interfaceCollaborationRejectedMessage

Explicit authority rejection; clients must not infer recovery from dropped frames.

typeCollaborationClientMessage
type CollaborationClientMessage = CollaborationSubmission
typeCollaborationServerMessage
type CollaborationServerMessage = CollaborationAcceptedBatch | CollaborationSyncMessage | CollaborationRejectedMessage
variableCollaborationProtocolVersion
CollaborationProtocolVersion: 1

Current collaboration wire protocol version.