API reference
@searsuite/sear-domain-collaboration
Host-neutral revision, pending-operation, acknowledgement, catch-up, and rebase algorithms.
17 exportsderived from source
- classCollaborationAuthoritysource ↗
-
class CollaborationAuthorityIn-memory authority that validates, rebases, orders, and deduplicates collaboration batches.
constructorconstructor CollaborationAuthority(contributors: CollaborationContributorRegistry): CollaborationAuthoritycontributors: CollaborationContributorRegistry
methodaccept accept(submission: CollaborationSubmission): CollaborationAcceptedBatchAccepts one client submission into the canonical resource order.
submission: CollaborationSubmission
methodsync sync(resourceId: string, fromRevision: number): CollaborationSyncMessageReturns ordered canonical batches after a known revision.
resourceId: stringfromRevision: number
- classCollaborationContributorRegistrysource ↗
-
class CollaborationContributorRegistryOwner-to-OT mapping used by clients, authorities, and editor bridges.
constructorconstructor CollaborationContributorRegistry(operations: TransactionOTRegistry): CollaborationContributorRegistryoperations: TransactionOTRegistry
propertyoperations readonly operations: TransactionOTRegistrymethoddestroy destroy(): voidmethodgetRegisteredOwnerIds getRegisteredOwnerIds(): readonly string[]methodhas has(ownerId: string): booleanownerId: string
methodregister register<OperationType>(ownerId: string, definition: TransactionOTDefinition<OperationType>, relations?: readonly OTTransformRelation<OTOperation, OTOperation>[]): (): voidRegisters one collaborative state owner and returns an idempotent disposer.
ownerId: stringdefinition: TransactionOTDefinition<OperationType>relations: readonly OTTransformRelation<OTOperation, OTOperation>[]
methodrequire require(ownerId: string, operationType?: CollaborationOperationType): TransactionOTDefinitionResolves one registered owner and optionally validates its wire operation type.
ownerId: stringoperationType: CollaborationOperationType
- classCollaborationEnginesource ↗
-
class CollaborationEngineSingle client-side collaboration algorithm shared by all editor bridges.
constructorconstructor CollaborationEngine(contributors: CollaborationContributorRegistry): CollaborationEnginecontributors: CollaborationContributorRegistry
methodconnect connect(resourceId: string, clientId: string, revision?: number): voidStarts one resource session from a host-supplied document revision.
resourceId: stringclientId: stringrevision: number
methoddisconnect disconnect(): voidEnds the current session and releases transient pending state.
methodgetPendingCount getPendingCount(): numbermethodgetRevision getRevision(): numbermethodreceive receive(message: CollaborationServerMessage): readonly CollaborationEngineEffect[]Applies one authority message and returns host/transport effects in deterministic order.
message: CollaborationServerMessage
methodsubmitLocal submitLocal<OperationType>(ownerId: string, operations: readonly OperationType[]): readonly CollaborationEngineEffect[]Queues one already-committed local transaction and emits at most one in-flight submission.
ownerId: stringoperations: readonly OperationType[]
- classCollaborationErrorsource ↗
-
class CollaborationError extends SearErrorPublic collaboration failure with stable diagnostics.
constructorconstructor CollaborationError(code: CollaborationErrorCode, message: string, details?: SearErrorDetails): CollaborationErrorcode: CollaborationErrorCodemessage: stringdetails: SearErrorDetails
propertycode readonly code: CollaborationErrorCodeStable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- 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 - interfaceCollaborationContributionsource ↗
-
interface CollaborationContribution<OperationType>Open collaboration contribution shared by editor clients and authorities.
propertydefinition readonly definition: TransactionOTDefinition<OperationType>propertyownerId readonly ownerId: stringpropertyrelations readonly relations?: readonly OTTransformRelation<OTOperation, OTOperation>[] - interfaceCollaborationOperationTypesource ↗
-
interface CollaborationOperationTypeVersioned OT family identity carried on the wire.
- 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 - 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 - typeCollaborationClientMessagesource ↗
-
type CollaborationClientMessage = CollaborationSubmission - typeCollaborationEngineEffectsource ↗
-
type CollaborationEngineEffect = { kind: "send"; submission: CollaborationSubmission } | { kind: "applyRemote"; operations: readonly OTOperation[]; ownerId: string; serverRevision: number }Effects emitted by the pure collaboration client state machine.
- typeCollaborationErrorCodesource ↗
-
type CollaborationErrorCode = typeof CollaborationErrorCode[keyof typeof CollaborationErrorCode]Stable collaboration protocol and state-machine errors.
- typeCollaborationServerMessagesource ↗
-
type CollaborationServerMessage = CollaborationAcceptedBatch | CollaborationSyncMessage | CollaborationRejectedMessage - variableCollaborationErrorCodesource ↗
-
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.
- variableCollaborationProtocolVersionsource ↗
-
CollaborationProtocolVersion: 1Current collaboration wire protocol version.
- variableCollaborationErrorCodeTypesource ↗
-
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.
No public exports match that search.