## Beta API Report File for "@fluidframework/merge-tree"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @beta @legacy
export interface AdjustParams {
    delta: number;
    max?: number | undefined;
    min?: number | undefined;
}

// @beta @legacy
export function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;

// @beta @legacy (undocumented)
export abstract class BaseSegment implements ISegment {
    constructor(properties?: PropertySet);
    // (undocumented)
    protected addSerializedProps(jseg: IJSONSegment): void;
    // (undocumented)
    append(other: ISegment): void;
    // (undocumented)
    attribution?: IAttributionCollection<AttributionKey>;
    // (undocumented)
    cachedLength: number;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    abstract clone(): ISegment;
    // (undocumented)
    protected cloneInto(b: ISegment): void;
    // (undocumented)
    protected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;
    // (undocumented)
    hasProperty(key: string): boolean;
    // (undocumented)
    isLeaf(): this is ISegment;
    // (undocumented)
    properties?: PropertySet;
    // (undocumented)
    splitAt(pos: number): ISegment | undefined;
    // (undocumented)
    abstract toJSONObject(): any;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
    // (undocumented)
    abstract readonly type: string;
}

// @beta @legacy
export function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;

// @beta @legacy
export function endpointPosAndSide(start: SequencePlace | undefined, end: SequencePlace | undefined): {
    startSide: Side | undefined;
    endSide: Side | undefined;
    startPos: number | "start" | "end" | undefined;
    endPos: number | "start" | "end" | undefined;
};

// @beta @legacy (undocumented)
export interface IAttributionCollection<T> {
    // (undocumented)
    append(other: IAttributionCollection<T>): void;
    // (undocumented)
    readonly channelNames: Iterable<string>;
    // (undocumented)
    clone(): IAttributionCollection<T>;
    getAll(): IAttributionCollectionSpec<T>;
    getAtOffset(offset: number, channel?: string): AttributionKey | undefined;
    getKeysInOffsetRange(startOffset: number, endOffset?: number, channel?: string): {
        offset: number;
        key: AttributionKey;
    }[] | undefined;
    readonly length: number;
    // (undocumented)
    splitAt(pos: number): IAttributionCollection<T>;
    update(name: string | undefined, channel: IAttributionCollection<T>): void;
}

// @beta @sealed @legacy (undocumented)
export interface IAttributionCollectionSerializer {
    populateAttributionCollections(segments: Iterable<ISegment>, summary: SerializedAttributionCollection): void;
    // (undocumented)
    serializeAttributionCollections(segments: Iterable<{
        attribution?: IAttributionCollection<AttributionKey>;
        cachedLength: number;
    }>): SerializedAttributionCollection;
}

// @beta @legacy (undocumented)
export interface IAttributionCollectionSpec<T> {
    // (undocumented)
    channels?: {
        [name: string]: Iterable<{
            offset: number;
            key: T | null;
        }>;
    };
    // (undocumented)
    length: number;
    // (undocumented)
    root: Iterable<{
        offset: number;
        key: T | null;
    }>;
}

// @beta @legacy (undocumented)
export interface IJSONMarkerSegment extends IJSONSegment {
    // (undocumented)
    marker: IMarkerDef;
}

// @beta @legacy (undocumented)
export interface IJSONSegment {
    // (undocumented)
    props?: Record<string, any>;
}

// @beta @legacy (undocumented)
export interface IJSONTextSegment extends IJSONSegment {
    // (undocumented)
    text: string;
}

// @beta @legacy (undocumented)
export interface IMarkerDef {
    // (undocumented)
    refType?: ReferenceType;
}

// @beta @legacy (undocumented)
export interface IMergeTreeAnnotateAdjustMsg extends IMergeTreeDelta {
    // (undocumented)
    adjust: Record<string, AdjustParams>;
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    props?: never;
    // (undocumented)
    relativePos1?: undefined;
    // (undocumented)
    relativePos2?: undefined;
    // (undocumented)
    type: typeof MergeTreeDeltaType.ANNOTATE;
}

// @beta @legacy (undocumented)
export interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {
    // (undocumented)
    adjust?: never;
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    props: Record<string, any>;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    type: typeof MergeTreeDeltaType.ANNOTATE;
}

// @beta @legacy (undocumented)
export interface IMergeTreeDelta {
    type: MergeTreeDeltaType;
}

// @beta @legacy (undocumented)
export interface IMergeTreeDeltaCallbackArgs<TOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType> {
    readonly deltaSegments: IMergeTreeSegmentDelta[];
    readonly operation: TOperationType;
}

// @beta @legacy (undocumented)
export type IMergeTreeDeltaOp = IMergeTreeInsertMsg | IMergeTreeRemoveMsg | IMergeTreeAnnotateMsg | IMergeTreeAnnotateAdjustMsg | IMergeTreeObliterateMsg | IMergeTreeObliterateSidedMsg;

// @beta @legacy (undocumented)
export interface IMergeTreeDeltaOpArgs {
    readonly groupOp?: IMergeTreeGroupMsg;
    readonly op: IMergeTreeOp;
    readonly rollback?: true;
    readonly sequencedMessage?: ISequencedDocumentMessage;
}

// @beta @deprecated @legacy (undocumented)
export interface IMergeTreeGroupMsg extends IMergeTreeDelta {
    // (undocumented)
    ops: IMergeTreeDeltaOp[];
    // (undocumented)
    type: typeof MergeTreeDeltaType.GROUP;
}

// @beta @legacy (undocumented)
export interface IMergeTreeInsertMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    seg?: any;
    // (undocumented)
    type: typeof MergeTreeDeltaType.INSERT;
}

// @beta @legacy (undocumented)
export interface IMergeTreeMaintenanceCallbackArgs extends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> {
}

// @beta @deprecated @legacy (undocumented)
export interface IMergeTreeObliterateMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    relativePos1?: never;
    relativePos2?: never;
    // (undocumented)
    type: typeof MergeTreeDeltaType.OBLITERATE;
}

// @beta @legacy (undocumented)
export interface IMergeTreeObliterateSidedMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1: {
        pos: number;
        before: boolean;
    };
    // (undocumented)
    pos2: {
        pos: number;
        before: boolean;
    };
    relativePos1?: never;
    relativePos2?: never;
    // (undocumented)
    type: typeof MergeTreeDeltaType.OBLITERATE_SIDED;
}

// @beta @legacy (undocumented)
export type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;

// @beta @legacy (undocumented)
export interface IMergeTreeOptions {
    // (undocumented)
    catchUpBlobName?: string;
    mergeTreeEnableAnnotateAdjust?: boolean;
    mergeTreeEnableObliterate?: boolean;
    mergeTreeEnableObliterateReconnect?: boolean;
    mergeTreeEnableSidedObliterate?: boolean;
    mergeTreeReferencesCanSlideToEndpoint?: boolean;
    // (undocumented)
    mergeTreeSnapshotChunkSize?: number;
    newMergeTreeSnapshotFormat?: boolean;
}

// @beta @legacy (undocumented)
export interface IMergeTreeRemoveMsg extends IMergeTreeDelta {
    // (undocumented)
    pos1?: number;
    // (undocumented)
    pos2?: number;
    // (undocumented)
    relativePos1?: IRelativePosition;
    // (undocumented)
    relativePos2?: IRelativePosition;
    // (undocumented)
    type: typeof MergeTreeDeltaType.REMOVE;
}

// @beta @legacy (undocumented)
export interface IMergeTreeSegmentDelta {
    propertyDeltas?: PropertySet;
    segment: ISegment;
}

// @beta @legacy
export interface InteriorSequencePlace {
    // (undocumented)
    pos: number;
    // (undocumented)
    side: Side;
}

// @beta @legacy
export interface IRelativePosition {
    before?: boolean;
    id?: string;
    offset?: number;
}

// @beta @legacy
export interface ISegment {
    // (undocumented)
    append(segment: ISegment): void;
    attribution?: IAttributionCollection<AttributionKey>;
    cachedLength: number;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(): ISegment;
    // (undocumented)
    isLeaf(): this is ISegment;
    properties?: PropertySet;
    // (undocumented)
    splitAt(pos: number): ISegment | undefined;
    // (undocumented)
    toJSONObject(): any;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
    // (undocumented)
    readonly type: string;
}

// @beta @legacy (undocumented)
export interface ISegmentAction<TClientData> {
    // (undocumented)
    (segment: ISegment, pos: number, refSeq: number, clientId: number, start: number, end: number, accum: TClientData): boolean;
}

// @beta @legacy (undocumented)
export interface ITrackingGroup {
    // (undocumented)
    has(trackable: Trackable): boolean;
    // (undocumented)
    link(trackable: Trackable): void;
    // (undocumented)
    size: number;
    // (undocumented)
    tracked: readonly Trackable[];
    // (undocumented)
    unlink(trackable: Trackable): boolean;
}

// @beta @sealed @legacy (undocumented)
export interface LocalReferencePosition extends ReferencePosition {
    // (undocumented)
    addProperties(newProps: PropertySet): void;
    // (undocumented)
    callbacks?: Partial<Record<"beforeSlide" | "afterSlide", (ref: LocalReferencePosition) => void>>;
    readonly canSlideToEndpoint?: boolean;
    // (undocumented)
    readonly trackingCollection: TrackingGroupCollection;
}

// @beta @legacy
export interface MapLike<T> {
    // (undocumented)
    [index: string]: T;
}

// @beta @legacy
export class Marker extends BaseSegment implements ReferencePosition, ISegment {
    constructor(refType: ReferenceType, props?: PropertySet);
    // (undocumented)
    append(): void;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(): Marker;
    // (undocumented)
    protected createSplitSegmentAt(pos: number): undefined;
    // (undocumented)
    static fromJSONObject(spec: IJSONSegment): Marker | undefined;
    // (undocumented)
    getId(): string | undefined;
    // (undocumented)
    getOffset(): number;
    // (undocumented)
    getProperties(): PropertySet | undefined;
    // (undocumented)
    getSegment(): Marker;
    // (undocumented)
    static is(segment: ISegment): segment is Marker;
    // (undocumented)
    static make(refType: ReferenceType, props?: PropertySet): Marker;
    // (undocumented)
    refType: ReferenceType;
    // (undocumented)
    toJSONObject(): IJSONMarkerSegment;
    // (undocumented)
    toString(): string;
    // (undocumented)
    static readonly type = "Marker";
    // (undocumented)
    readonly type = "Marker";
}

// @beta @legacy (undocumented)
export type MergeTreeDeltaOperationType = typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE | typeof MergeTreeDeltaType.OBLITERATE;

// @beta @legacy (undocumented)
export type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;

// @beta @legacy (undocumented)
export type MergeTreeDeltaRevertible = {
    operation: typeof MergeTreeDeltaType.INSERT;
    trackingGroup: ITrackingGroup;
} | {
    operation: typeof MergeTreeDeltaType.REMOVE;
    trackingGroup: ITrackingGroup;
} | {
    operation: typeof MergeTreeDeltaType.ANNOTATE;
    trackingGroup: ITrackingGroup;
    propertyDeltas: PropertySet;
};

// @beta @legacy (undocumented)
export const MergeTreeDeltaType: {
    readonly INSERT: 0;
    readonly REMOVE: 1;
    readonly ANNOTATE: 2;
    readonly GROUP: 3;
    readonly OBLITERATE: 4;
    readonly OBLITERATE_SIDED: 5;
};

// @beta @legacy (undocumented)
export type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];

// @beta @legacy
export const MergeTreeMaintenanceType: {
    readonly APPEND: -1;
    readonly SPLIT: -2;
    readonly UNLINK: -3;
    readonly ACKNOWLEDGED: -4;
};

// @beta @legacy (undocumented)
export type MergeTreeMaintenanceType = (typeof MergeTreeMaintenanceType)[keyof typeof MergeTreeMaintenanceType];

// @beta @legacy (undocumented)
export interface MergeTreeRevertibleDriver {
    // (undocumented)
    annotateRange(start: number, end: number, props: PropertySet): void;
    // (undocumented)
    insertFromSpec(pos: number, spec: IJSONSegment): void;
    // (undocumented)
    removeRange(start: number, end: number): void;
}

// @beta @legacy
export type PropertySet = MapLike<any>;

// @beta @legacy
export interface ReferencePosition {
    getOffset(): number;
    getSegment(): ISegment | undefined;
    // (undocumented)
    isLeaf(): this is ISegment;
    properties?: PropertySet;
    // (undocumented)
    refType: ReferenceType;
    slidingPreference?: SlidingPreference;
}

// @beta @legacy
export enum ReferenceType {
    RangeBegin = 16,
    RangeEnd = 32,
    // (undocumented)
    Simple = 0,
    SlideOnRemove = 64,
    StayOnRemove = 128,
    Tile = 1,
    Transient = 256
}

// @beta @legacy
export const refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined;

// @beta @legacy
export function refHasTileLabel(refPos: ReferencePosition, label: string): boolean;

// @beta @legacy
export const reservedMarkerIdKey = "markerId";

// @beta @legacy
export function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;

// @beta @legacy
export function segmentIsRemoved(segment: ISegment): boolean;

// @beta @legacy (undocumented)
export interface SequenceOffsets {
    // (undocumented)
    posBreakpoints: number[];
    seqs: (number | AttributionKey | null)[];
}

// @beta @legacy
export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;

// @beta @legacy (undocumented)
export interface SerializedAttributionCollection extends SequenceOffsets {
    // (undocumented)
    channels?: {
        [name: string]: SequenceOffsets;
    };
    // (undocumented)
    length: number;
}

// @beta @legacy
export enum Side {
    // (undocumented)
    After = 1,
    // (undocumented)
    Before = 0
}

// @beta @legacy
export const SlidingPreference: {
    readonly BACKWARD: 0;
    readonly FORWARD: 1;
};

// @beta @legacy
export type SlidingPreference = (typeof SlidingPreference)[keyof typeof SlidingPreference];

// @beta @legacy (undocumented)
export class TextSegment extends BaseSegment {
    constructor(text: string, props?: PropertySet);
    // (undocumented)
    append(segment: ISegment): void;
    // (undocumented)
    canAppend(segment: ISegment): boolean;
    // (undocumented)
    clone(start?: number, end?: number): TextSegment;
    // (undocumented)
    protected createSplitSegmentAt(pos: number): TextSegment | undefined;
    // (undocumented)
    static fromJSONObject(spec: string | IJSONSegment): TextSegment | undefined;
    // (undocumented)
    static is(segment: ISegment): segment is TextSegment;
    // (undocumented)
    static make(text: string, props?: PropertySet): TextSegment;
    // (undocumented)
    text: string;
    // (undocumented)
    toJSONObject(): IJSONTextSegment | string;
    // (undocumented)
    toString(): string;
    // (undocumented)
    static readonly type = "TextSegment";
    // (undocumented)
    readonly type = "TextSegment";
}

// @beta @legacy (undocumented)
export type Trackable = ISegment | LocalReferencePosition;

// @beta @legacy (undocumented)
export class TrackingGroup implements ITrackingGroup {
    constructor();
    // (undocumented)
    has(trackable: Trackable): boolean;
    // (undocumented)
    link(trackable: Trackable): void;
    // (undocumented)
    get size(): number;
    // (undocumented)
    get tracked(): readonly Trackable[];
    // (undocumented)
    unlink(trackable: Trackable): boolean;
}

// @beta @legacy
export class TrackingGroupCollection {
    constructor(trackable: Trackable);
    // (undocumented)
    copyTo(trackable: Trackable): void;
    // (undocumented)
    get empty(): boolean;
    // (undocumented)
    link(trackingGroup: ITrackingGroup): void;
    // (undocumented)
    matches(trackingCollection: TrackingGroupCollection): boolean;
    // (undocumented)
    get trackingGroups(): Set<TrackingGroup>;
    // (undocumented)
    unlink(trackingGroup: ITrackingGroup): boolean;
}

// (No @packageDocumentation comment for this package)

```
