@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.
constructor CollaborationAuthority(contributors: CollaborationContributorRegistry): CollaborationAuthoritymethod accept(submission: CollaborationSubmission): CollaborationAcceptedBatchAccepts one client submission into the canonical resource order.
method sync(resourceId: string, fromRevision: number): CollaborationSyncMessageReturns ordered canonical batches after a known revision.
- classCollaborationContributorRegistry
-
Owner-to-OT mapping used by clients, authorities, and editor bridges.
constructor CollaborationContributorRegistry(operations: TransactionOTRegistry): CollaborationContributorRegistryproperty readonly operations: TransactionOTRegistrymethod destroy(): voidmethod getRegisteredOwnerIds(): readonly string[]method has(ownerId: string): booleanmethod register<OperationType>(ownerId: string, definition: TransactionOTDefinition<OperationType>, relations?: readonly OTTransformRelation<OTOperation, OTOperation>[]): (): voidRegisters one collaborative state owner and returns an idempotent disposer.
method require(ownerId: string, operationType?: CollaborationOperationType): TransactionOTDefinitionResolves one registered owner and optionally validates its wire operation type.
- classCollaborationEngine
-
Single client-side collaboration algorithm shared by all editor bridges.
constructor CollaborationEngine(contributors: CollaborationContributorRegistry): CollaborationEnginemethod connect(resourceId: string, clientId: string, revision?: number): voidStarts one resource session from a host-supplied document revision.
method disconnect(): voidEnds the current session and releases transient pending state.
method getPendingCount(): numbermethod getRevision(): numbermethod receive(message: CollaborationServerMessage): readonly CollaborationEngineEffect[]Applies one authority message and returns host/transport effects in deterministic order.
method submitLocal<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 SearErrorPublic collaboration failure with stable diagnostics.
constructor CollaborationError(code: CollaborationErrorCode, message: string, details?: SearErrorDetails): CollaborationErrorproperty readonly code: CollaborationErrorCodeStable machine-readable identifier for this error category.
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.
property readonly id: stringproperty readonly version: number - 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
- interfaceCollaborationAcceptedBatch
-
Canonical operation batch accepted and ordered by the authority.
property readonly baseRevision: numberproperty readonly clientId: stringproperty readonly kind: "accepted"property readonly operationId: stringproperty readonly operationType: CollaborationOperationTypeproperty readonly ownerId: stringproperty readonly payload: OTEncodedValueproperty readonly protocolVersion: 1property readonly resourceId: stringproperty readonly serverRevision: number - interfaceCollaborationRejectedMessage
-
Explicit authority rejection; clients must not infer recovery from dropped frames.
property readonly code: stringproperty readonly kind: "rejected"property readonly message: stringproperty readonly operationId?: stringproperty readonly protocolVersion: 1property readonly resourceId: string - interfaceCollaborationSubmission
-
Client submission before the authority assigns a canonical revision.
property readonly baseRevision: numberproperty readonly clientId: stringproperty readonly kind: "submit"property readonly operationId: stringproperty readonly operationType: CollaborationOperationTypeproperty readonly ownerId: stringproperty readonly payload: OTEncodedValueproperty readonly protocolVersion: 1property readonly resourceId: string - interfaceCollaborationSyncMessage
-
Ordered catch-up response sent when a transport joins a resource.
property readonly batches: readonly CollaborationAcceptedBatch[]property readonly fromRevision: numberproperty readonly kind: "sync"property readonly protocolVersion: 1property readonly resourceId: stringproperty readonly serverRevision: number - typeCollaborationClientMessage
-
type CollaborationClientMessage = CollaborationSubmission - typeCollaborationServerMessage
-
type CollaborationServerMessage = CollaborationAcceptedBatch | CollaborationSyncMessage | CollaborationRejectedMessage - variableCollaborationProtocolVersion
-
CollaborationProtocolVersion: 1Current collaboration wire protocol version.
No matching API entries.