[]
        
(Showing Draft Content)

OT_Type

Interface: OT_Type<S, T>

Defines the interface for customizing operational transformation (OT) behavior in collaboration.

Type parameters

Name Type Description
S unknown The type of snapshot data.
T unknown The type of op data.

Table of contents

Properties

Methods

Properties

uri

uri: string

The URI identifying the document type.

Methods

apply

Optional apply(snapshot, op): S

Applies an operation to snapshot data.

Parameters

Name Type Description
snapshot S The current snapshot data.
op T The operation to apply.

Returns

S

The updated snapshot data.


applyFragments

Optional applyFragments(request, op): Promise<void>

Applies an operation to snapshot fragments asynchronously.

Parameters

Name Type Description
request ISnapshotFragmentsRequest<unknown> The request containing snapshot fragments.
op T The operation to apply.

Returns

Promise<void>

A promise that resolves when the operation is applied.


composeFragments

Optional composeFragments(fragments): S

Composes snapshot data from snapshot fragments.

Parameters

Name Type Description
fragments ISnapshotFragments<unknown> The snapshot fragments.

Returns

S

The composed snapshot data.


create

Optional create(data): S

Creates initial snapshot data from provided data.

Parameters

Name Type Description
data S The initial snapshot data.

Returns

S

The created snapshot data.


createFragments

Optional createFragments(data): ISnapshotFragments<unknown>

Generates snapshot fragments from snapshot data.

Parameters

Name Type Description
data S The snapshot data.

Returns

ISnapshotFragments<unknown>

The generated snapshot fragments.


transform

transform(op1, op2, side): T

Transforms an operation to resolve conflicts with another operation.

Parameters

Name Type Description
op1 T The operation to transform.
op2 T The operation serving as the basis for transformation.
side "left" | "right" Indicates which operation arrived at the server later.

Returns

T

The transformed operation.