Packages > @fluidframework/merge-tree

@fluidframework/merge-tree Package

Interfaces

Interface Alerts Modifiers Description
AttributionPolicy Legacy, Alpha sealed Implements policy dictating which kinds of operations should be attributed and how.
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/iattributioncollection-interface'>IAttributionCollection</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/iattributioncollectionserializer-interface'>IAttributionCollectionSerializer</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
    <code>sealed</code>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/iattributioncollectionspec-interface'>IAttributionCollectionSpec</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/iclientevents-interface'>IClientEvents</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    Emitted before this client's merge-tree normalizes its segments on reconnect, potentially ordering them. Useful for DDS-like consumers built atop the merge-tree to compute any information they need for rebasing their ops on reconnection.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/ijsonmarkersegment-interface'>IJSONMarkerSegment</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/ijsonsegment-interface'>IJSONSegment</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/ijsontextsegment-interface'>IJSONTextSegment</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imarkerdef-interface'>IMarkerDef</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergenodecommon-interface'>IMergeNodeCommon</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    Common properties for a node in a merge tree.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeannotatemsg-interface'>IMergeTreeAnnotateMsg</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeattributionoptions-interface'>IMergeTreeAttributionOptions</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreedelta-interface'>IMergeTreeDelta</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreedeltacallbackargs-interface'>IMergeTreeDeltaCallbackArgs</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreedeltaopargs-interface'>IMergeTreeDeltaOpArgs</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreegroupmsg-interface'>IMergeTreeGroupMsg</a>
  </td>
  <td>
    <code>Deprecated</code>, <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeinsertmsg-interface'>IMergeTreeInsertMsg</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreemaintenancecallbackargs-interface'>IMergeTreeMaintenanceCallbackArgs</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeobliteratemsg-interface'>IMergeTreeObliterateMsg</a>
  </td>
  <td>
    <code>Deprecated</code>, <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeoptions-interface'>IMergeTreeOptions</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreeremovemsg-interface'>IMergeTreeRemoveMsg</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreesegmentdelta-interface'>IMergeTreeSegmentDelta</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imergetreetexthelper-interface'>IMergeTreeTextHelper</a>
  </td>
  <td>
    <code>Deprecated</code>, <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/imoveinfo-interface'>IMoveInfo</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    <p>
      Tracks information about when and where this segment was moved to.
    </p>
    <p>
      Note that merge-tree does not currently support moving and only supports obliterate. The fields below include &quot;move&quot; in their names to avoid renaming in the future, when moves _are_ supported.
      <br>
    </p>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/irelativeposition-interface'>IRelativePosition</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    A position specified relative to a segment.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/iremovalinfo-interface'>IRemovalInfo</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    Contains removal information associated to an <a href='/docs/api/v2/merge-tree/isegment-interface'>ISegment</a>.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/isegment-interface'>ISegment</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    A segment representing a portion of the merge tree. Segments are leaf nodes of the merge tree and contain data.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/isegmentaction-interface'>ISegmentAction</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/itrackinggroup-interface'>ITrackingGroup</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/localreferenceposition-interface'>LocalReferencePosition</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
    <code>sealed</code>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/maplike-interface'>MapLike</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    Any mapping from a string to values of type <code>T</code>
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/mergetreerevertibledriver-interface'>MergeTreeRevertibleDriver</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/referenceposition-interface'>ReferencePosition</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    Represents a reference to a place within a merge tree. This place conceptually remains stable over time by referring to a particular segment and offset within that segment. Thus, this reference's character position changes as the tree is edited.
    <br>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/segmentgroup-interface'>SegmentGroup</a>
  </td>
  <td>
    <code>Deprecated</code>, <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/sequenceoffsets-interface'>SequenceOffsets</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/serializedattributioncollection-interface'>SerializedAttributionCollection</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>

Classes

Class Alerts Modifiers Description
BaseSegment Legacy, Alpha
Client Deprecated, Legacy, Alpha
CollaborationWindow Deprecated, Legacy, Alpha
LocalReferenceCollection Legacy, Alpha sealed Represents a collection of LocalReferencePositions associated with one segment in a merge-tree. Represents a collection of LocalReferencePositions associated with one segment in a merge-tree.
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/marker-class'>Marker</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    <p>
      Markers are a special kind of segment that do not hold any content.
    </p>
    <p>
      Markers with a reference type of <a href='/docs/api/v2/merge-tree/referencetype-enum#tile-enummember'>Tile</a> support spatially accelerated queries for finding the next marker to the left or right of it in sub-linear time. This is useful, for example, in the case of jumping from the start of a paragraph to the end, assuming a paragraph is bound by markers at the start and end.
      <br>
    </p>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/mergenode-class'>MergeNode</a>
  </td>
  <td>
    <code>Deprecated</code>, <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/propertiesmanager-class'>PropertiesManager</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/segmentgroupcollection-class'>SegmentGroupCollection</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/textsegment-class'>TextSegment</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/trackinggroup-class'>TrackingGroup</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
  </td>
</tr>
<tr>
  <td>
    <a href='/docs/api/v2/merge-tree/trackinggroupcollection-class'>TrackingGroupCollection</a>
  </td>
  <td>
    <code>Legacy</code>, <code>Alpha</code>
  </td>
  <td>
  </td>
  <td>
    A collection of <a href='/docs/api/v2/merge-tree/itrackinggroup-interface'>ITrackingGroup</a>.
    <br>
  </td>
</tr>

Enumerations

Enum Alerts Description
PropertiesRollback Legacy, Alpha
ReferenceType Legacy, Alpha Flags enum that dictates behavior of a ReferencePosition

Types

TypeAlias Alerts Description
IMergeTreeDeltaOp Legacy, Alpha
IMergeTreeOp Legacy, Alpha
MergeTreeDeltaOperationType Legacy, Alpha
MergeTreeDeltaOperationTypes Legacy, Alpha
MergeTreeDeltaRevertible Legacy, Alpha
MergeTreeDeltaType Legacy, Alpha
MergeTreeMaintenanceType Legacy, Alpha
PropertySet Legacy, Alpha A loosely-typed mapping from strings to any value.
SlidingPreference Legacy, Alpha Dictates the preferential direction for a ReferencePosition to slide in a merge-tree
Trackable Legacy, Alpha

Functions

Function Alerts Return Type Description
appendToMergeTreeDeltaRevertibles(deltaArgs, revertibles) Legacy, Alpha void Appends a merge tree delta to the list of revertibles.
discardMergeTreeDeltaRevertible(revertibles) Legacy, Alpha void Removes all revertibles from the list of revertibles.
refGetTileLabels(refPos) Legacy, Alpha string[] | undefined Gets the tile labels stored in the given reference position.
refHasTileLabel(refPos, label) Legacy, Alpha boolean Determines if a reference position has the given tile label.
revertMergeTreeDeltaRevertibles(driver, revertibles) Legacy, Alpha void Reverts all operations in the list of revertibles.

Variables

Variable Alerts Modifiers Type Description
MergeTreeDeltaType Legacy, Alpha readonly { readonly INSERT: 0; readonly REMOVE: 1; readonly ANNOTATE: 2; readonly GROUP: 3; readonly OBLITERATE: 4; }
MergeTreeMaintenanceType Legacy, Alpha readonly { readonly APPEND: -1; readonly SPLIT: -2; readonly UNLINK: -3; readonly ACKNOWLEDGED: -4; }

Enum-like constant defining the types of "maintenance" events on a merge tree. Maintenance events correspond to structural segment changes or acks of pending segments.

Note: these values are assigned negative integers to avoid clashing with MergeTreeDeltaType.

reservedMarkerIdKey Legacy, Alpha readonly The special-cased property key that tracks the id of a Marker.
SlidingPreference Legacy, Alpha readonly { readonly BACKWARD: 0; readonly FORWARD: 1; } Dictates the preferential direction for a ReferencePosition to slide in a merge-tree

Function Details

appendToMergeTreeDeltaRevertibles

Appends a merge tree delta to the list of revertibles.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

export declare function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;

Parameters

Parameter Type Description
deltaArgs IMergeTreeDeltaCallbackArgs
revertibles MergeTreeDeltaRevertible[]

discardMergeTreeDeltaRevertible

Removes all revertibles from the list of revertibles.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

export declare function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;

Parameters

Parameter Type Description
revertibles MergeTreeDeltaRevertible[]

refGetTileLabels

Gets the tile labels stored in the given reference position.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined

Parameters

Parameter Type Description
refPos ReferencePosition

Returns

Return type: string[] | undefined

refHasTileLabel

Determines if a reference position has the given tile label.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

export declare function refHasTileLabel(refPos: ReferencePosition, label: string): boolean;

Parameters

Parameter Type Description
refPos ReferencePosition
label string

Returns

Return type: boolean

revertMergeTreeDeltaRevertibles

Reverts all operations in the list of revertibles.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

export declare function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;

Parameters

Parameter Type Description
driver MergeTreeRevertibleDriver
revertibles MergeTreeDeltaRevertible[]

Variable Details

MergeTreeDeltaType

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

MergeTreeDeltaType: {
    readonly INSERT: 0;
    readonly REMOVE: 1;
    readonly ANNOTATE: 2;
    readonly GROUP: 3;
    readonly OBLITERATE: 4;
}

Type: { readonly INSERT: 0; readonly REMOVE: 1; readonly ANNOTATE: 2; readonly GROUP: 3; readonly OBLITERATE: 4; }

MergeTreeMaintenanceType

Enum-like constant defining the types of “maintenance” events on a merge tree. Maintenance events correspond to structural segment changes or acks of pending segments.

Note: these values are assigned negative integers to avoid clashing with MergeTreeDeltaType.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

MergeTreeMaintenanceType: {
    readonly APPEND: -1;
    readonly SPLIT: -2;
    readonly UNLINK: -3;
    readonly ACKNOWLEDGED: -4;
}

Type: { readonly APPEND: -1; readonly SPLIT: -2; readonly UNLINK: -3; readonly ACKNOWLEDGED: -4; }

reservedMarkerIdKey

The special-cased property key that tracks the id of a Marker .

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

reservedMarkerIdKey = "markerId"

Remarks

In general, marker ids should be accessed using the inherent method Marker.getId. Marker ids should not be updated after creation.

SlidingPreference

Dictates the preferential direction for a ReferencePosition to slide in a merge-tree

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here .

Signature

SlidingPreference: {
    readonly BACKWARD: 0;
    readonly FORWARD: 1;
}

Type: { readonly BACKWARD: 0; readonly FORWARD: 1; }