@fluidframework/sequence 2.70.0-361248 → 2.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/sequence
2
2
 
3
+ ## 2.70.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.63.0
4
8
 
5
9
  Dependency updates only.
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "2.70.0-361248";
8
+ export declare const pkgVersion = "2.70.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/sequence";
11
- exports.pkgVersion = "2.70.0-361248";
11
+ exports.pkgVersion = "2.70.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.70.0-361248\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.70.0\";\n"]}
@@ -4,9 +4,8 @@
4
4
  */
5
5
  import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
6
6
  import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
7
- import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
8
7
  import { Client, IJSONSegment, IMergeTreeGroupMsg, IRelativePosition, ISegment, ISegmentAction, LocalReferencePosition, MergeTreeRevertibleDriver, PropertySet, ReferencePosition, ReferenceType, SlidingPreference, type AdjustParams, type InteriorSequencePlace, type MapLike } from "@fluidframework/merge-tree/internal";
9
- import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
8
+ import { ISummaryTreeWithStats, ITelemetryContext, IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
10
9
  import { IFluidSerializer, ISharedObjectEvents, SharedObject, type ISharedObject } from "@fluidframework/shared-object-base/internal";
11
10
  import { type ISequenceIntervalCollection } from "./intervalCollection.js";
12
11
  import { SequenceDeltaEvent, SequenceMaintenanceEvent } from "./sequenceDeltaEvent.js";
@@ -358,9 +357,10 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
358
357
  */
359
358
  protected loadCore(storage: IChannelStorageService): Promise<void>;
360
359
  /**
361
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
360
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
362
361
  */
363
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
362
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
363
+ private processMessage;
364
364
  /**
365
365
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}
366
366
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,MAAM,EACN,YAAY,EAIZ,kBAAkB,EAKlB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,sBAAsB,EAEtB,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EAOjB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EACN,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,KAAK,aAAa,EAClB,MAAM,6CAA6C,CAAC;AASrD,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAG3E,OAAO,EACN,kBAAkB,EAElB,wBAAwB,EAExB,MAAM,yBAAyB,CAAC;AAKjC;;;;;;;;;;;;;;;;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KnB;;OAEG;IACH,SAAS,CAAC,YAAY;IAEtB;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAE,OAAe;IAetF,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAI5E;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAYhE;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAoDxD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAOlF,OAAO,CAAC,cAAc;IAyCtB;;OAEG;IACH,SAAS,CAAC,SAAS;IAQnB;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAK7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAM5C,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAuC3B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,6BAA6B;IAoBrC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CASzB;AA4BD;;GAEG;AACH,wBAAgB,yBAAyB,SAExC"}
package/dist/sequence.js CHANGED
@@ -346,9 +346,21 @@ class SharedSegmentSequence extends internal_5.SharedObject {
346
346
  }
347
347
  }
348
348
  /**
349
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
349
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
350
350
  */
351
- processCore(message, local, localOpMetadata) {
351
+ processMessagesCore(messagesCollection) {
352
+ const { envelope, local, messagesContent } = messagesCollection;
353
+ for (const messageContent of messagesContent) {
354
+ this.processMessage(envelope, messageContent, local);
355
+ }
356
+ }
357
+ processMessage(messageEnvelope, messageContent, local) {
358
+ // Reconstruct ISequencedDocumentMessage which is needed by merge tree client
359
+ const message = {
360
+ ...messageEnvelope,
361
+ contents: messageContent.contents,
362
+ clientSequenceNumber: messageContent.clientSequenceNumber,
363
+ };
352
364
  if (local) {
353
365
  const recordedRefSeq = this.inFlightRefSeqs.shift();
354
366
  (0, internal_1.assert)(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);
@@ -361,7 +373,7 @@ class SharedSegmentSequence extends internal_5.SharedObject {
361
373
  // assert(recordedRefSeq <= message.referenceSequenceNumber, "RefSeq mismatch");
362
374
  }
363
375
  (0, internal_1.assert)(message.type === internal_2.MessageType.Operation, 0x073 /* "Sequence message not operation" */);
364
- const handled = this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);
376
+ const handled = this.intervalCollections.tryProcessMessage(message.contents, local, message, messageContent.localOpMetadata);
365
377
  if (!handled) {
366
378
  this.processMergeTreeMsg(message, local);
367
379
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+DAA8D;AAE9D,kEAA6D;AAM7D,0EAGqD;AACrD,kEA8B6C;AAK7C,qEAGgD;AAChD,0EAKqD;AACrD,uEAKkD;AAClD,4EAAuC;AAGvC,yEAAkF;AAElF,mEAKiC;AAEjC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AAgS9B;;GAEG;AACH,MAAsB,qBACrB,SAAQ,uBAA0C;IAiB1C,MAAM,CAAC,kBAAkB,CAAC,KAAyB;QAC1D,MAAM,GAAG,GAAwB,EAAE,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9B,QAAQ,KAAK,CAAC,cAAc,EAAE,CAAC;gBAC9B,KAAK,6BAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAClC,MAAM,YAAY,G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J,QAAQ,EAAE,CAAC;QACZ,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,qBAAqB,GAAG,sBAAsB,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AArpBD,sDAqpBC;AAED,SAAS,wBAAwB,CAChC,YAAqC;IAErC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,SAAS,gBAAgB,CAAI,QAAiB;QAC7C,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QACD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC;YACJ,OAAO,QAAQ,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACV,KAAK,EAAE,CAAC;QACT,CAAC;IACF,CAAC;IAED,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B;;GAEG;AACH,SAAgB,yBAAyB;IACxC,mBAAmB,GAAG,CAAC,CAAC;AACzB,CAAC;AAFD,8DAEC;AAED,MAAM,sBAAsB,GAAG,2CAA2C,CAAC;AAC3E,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,GAAG,EAAE;IACxD,MAAM,IAAI,uBAAY,CAAC,sBAAsB,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tIJSONSegment,\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n\tIMergeTreeOp,\n\tIMergeTreeRemoveMsg,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tLocalReferencePosition,\n\tMergeTreeDeltaType,\n\tMergeTreeRevertibleDriver,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\tSlidingPreference,\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateObliterateRangeOp,\n\tcreateRemoveRangeOp,\n\tmatchProperties,\n\ttype AdjustParams,\n\ttype InteriorSequencePlace,\n\ttype MapLike,\n} from \"@fluidframework/merge-tree/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tObjectStoragePartition,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\ttype ISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\tcreateConfigBasedOptionsProxy,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport Deque from \"double-ended-queue\";\n\nimport { type ISequenceIntervalCollection } from \"./intervalCollection.js\";\nimport { IMapOperation, IntervalCollectionMap } from \"./intervalCollectionMap.js\";\nimport { type SequenceOptions } from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\tSequenceDeltaEvent,\n\tSequenceDeltaEventClass,\n\tSequenceMaintenanceEvent,\n\tSequenceMaintenanceEventClass,\n} from \"./sequenceDeltaEvent.js\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n * @legacy @beta\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"createIntervalCollection\",\n\t\tlistener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"sequenceDelta\",\n\t\tlistener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"maintenance\",\n\t\tlistener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISharedSegmentSequence<T extends ISegment>\n\textends ISharedObject<ISharedSegmentSequenceEvents>,\n\t\tMergeTreeRevertibleDriver {\n\t/**\n\t * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n\t * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n\t * @param segment - Segment to add the local reference on\n\t * @param offset - Offset on the segment at which to place the local reference\n\t * @param refType - ReferenceType for the created local reference\n\t * @param properties - PropertySet to place on the created local reference\n\t */\n\tcreateLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition;\n\n\t/**\n\t * Removes a `LocalReferencePosition` from this SharedString.\n\t */\n\tremoveLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined;\n\n\t/**\n\t * Returns the length of the current sequence for the client\n\t */\n\tgetLength(): number;\n\n\t/**\n\t * Returns the current position of a segment, and -1 if the segment\n\t * does not exist in this sequence\n\t * @param segment - The segment to get the position of\n\t */\n\tgetPosition(segment: ISegment): number;\n\n\t/**\n\t * Resolves a `ReferencePosition` into a character position using this client's perspective.\n\t *\n\t * Reference positions that point to a character that has been removed will\n\t * always return the position of the nearest non-removed character, regardless\n\t * of `ReferenceType`. To handle this case specifically, one may wish\n\t * to look at the segment returned by `ReferencePosition.getSegment`.\n\t */\n\tlocalReferencePositionToPosition(lref: ReferencePosition): number;\n\n\t/**\n\t * Walk the underlying segments of the sequence.\n\t * The walked segments may extend beyond the range if the segments cross the\n\t * ranges start or end boundaries.\n\t *\n\t * Set split range to true to ensure only segments within the range are walked.\n\t *\n\t * @param handler - The function to handle each segment. Traversal ends if\n\t * this function returns true.\n\t * @param start - Optional. The start of range walk.\n\t * @param end - Optional. The end of range walk\n\t * @param accum - Optional. An object that will be passed to the handler for accumulation\n\t * @param splitRange - Optional. Splits boundary segments on the range boundaries. Defaults to false.\n\t */\n\twalkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange?: boolean,\n\t): void;\n\n\t/**\n\t * Inserts a segment directly before a `ReferencePosition`.\n\t * @param refPos - The reference position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tinsertAtReferencePosition(pos: ReferencePosition, segment: T): void;\n\n\t/**\n\t * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n\t * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n\t * @param pos - Character position (index) into the current local view of the SharedString.\n\t */\n\tgetContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t};\n\n\tgetPropertiesAtPosition(pos: number): PropertySet | undefined;\n\n\t/**\n\t * @returns An iterable object that enumerates the IntervalCollection labels.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * const iter = this.getIntervalCollectionKeys();\n\t * for (key of iter)\n\t * const collection = this.getIntervalCollection(key);\n\t * ...\n\t * ```\n\t */\n\tgetIntervalCollectionLabels(): IterableIterator<string>;\n\n\t/**\n\t * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n\t * creates one.\n\t */\n\tgetIntervalCollection(label: string): ISequenceIntervalCollection;\n\n\t/**\n\t * Obliterate is similar to remove, but differs in that segments concurrently\n\t * inserted into an obliterated range will also be removed.\n\t * Inserts are considered concurrent to an obliterate iff the insert op's seq is after the obliterate op's refSeq\n\t * and the insert's refSeq is before the obliterates seq.\n\t * Inserts made by the client which most recently obliterated a range containing the insert position\n\t * are not considered concurrent to any obliteration (the last client to obliterate gets the right to insert).\n\t *\n\t * The endpoints can either be inclusive or exclusive.\n\t * Exclusive endpoints allow the obliterated range to \"grow\" to include adjacent concurrently inserted segments on that side.\n\t *\n\t * @param start - The start of the range to obliterate.\n\t * Inclusive if side is Before or a number is provided.\n\t * @param end - The end of the range to obliterate. Inclusive if side is After.\n\t * If a number is provided it is treated as exclusive,\n\t * but the endpoint does not expand in order to preserve existing behavior.\n\t *\n\t * @example Given the initial state `\"|ABC>\"`,\n\t * `obliterateRange({ pos: 0, side: Side.After }, { pos: 4, side: Side.Before })` obliterates `\"ABC\"`, leaving only `\"|>\"`.\n\t * `insertFromSpec(1, { text: \"AAA\"})` would insert `\"AAA\"` before |, resulting in `\"|AAA>\"`.\n\t * If another client does the same thing but inserts `\"BBB\"` and gets sequenced later, all clients will eventually see `|BBB>`.\n\t */\n\tobliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void;\n\n\t/**\n\t * @returns The most recent sequence number which has been acked by the server and processed by this\n\t * SharedSegmentSequence.\n\t */\n\tgetCurrentSeq(): number;\n\n\t/**\n\t * Annotates the range with the provided properties\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n\n\t/**\n\t * Annotates a specified range within the sequence by applying the provided adjustments.\n\t *\n\t * @param start - The inclusive start position of the range to annotate. This is a zero-based index.\n\t * @param end - The exclusive end position of the range to annotate. This is a zero-based index.\n\t * @param adjust - A map-like object specifying the properties to adjust. Each key-value pair represents a property and its corresponding adjustment to be applied over the range.\n\t * An adjustment is defined by an object containing a `delta` to be added to the current property value, and optional `min` and `max` constraints to limit the adjusted value.\n\t *\n\t * @remarks\n\t * The range is defined by the start and end positions, where the start position is inclusive and the end position is exclusive.\n\t * The properties provided in the adjust parameter will be applied to the specified range. Each adjustment modifies the current value of the property by adding the specified `value`.\n\t * If the current value is not a number, the `delta` will be summed with 0 to compute the new value. The optional `min` and `max` constraints are applied after the adjustment to ensure the final value falls within the specified bounds.\n\t */\n\tannotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void;\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tremoveRange(start: number, end: number): void;\n\n\t/**\n\t * Resolves a remote client's position against the local sequence\n\t * and returns the remote client's position relative to the local\n\t * sequence. The client ref seq must be above the minimum sequence number\n\t * or the return value will be undefined.\n\t * Generally this method is used in conjunction with signals which provide\n\t * point in time values for the below parameters, and is useful for things\n\t * like displaying user position. It should not be used with persisted values\n\t * as persisted values will quickly become invalid as the remoteClientRefSeq\n\t * moves below the minimum sequence number\n\t * @param remoteClientPosition - The remote client's position to resolve\n\t * @param remoteClientRefSeq - The reference sequence number of the remote client\n\t * @param remoteClientId - The client id of the remote client\n\t */\n\tresolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined;\n\n\t// #region APIs we might want to remove\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t * @privateRemarks\n\t * TODO: determine if this API (from SharedObject) is needed by users of the encapsulated API, declarative API or both,\n\t * and handle exposing it in a consistent way for all SharedObjects if needed.\n\t */\n\tinitializeLocal(): void;\n\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming\n\t * release, as group ops are redundant with the native batching capabilities\n\t * of the runtime\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tgroupOperation(groupOp: IMergeTreeGroupMsg): void;\n\n\tgetRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t};\n\n\t/**\n\t * Inserts a segment\n\t * @param start - The position to insert the segment at\n\t * @param spec - The segment to inserts spec\n\t */\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\n\t/**\n\t * Given a position specified relative to a marker id, lookup the marker\n\t * and convert the position to a character position.\n\t * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n\n\t// #endregion\n}\n\n/**\n * @internal\n */\nexport abstract class SharedSegmentSequence<T extends ISegment>\n\textends SharedObject<ISharedSegmentSequenceEvents>\n\timplements ISharedSegmentSequence<T>\n{\n\t/**\n\t * This is a safeguard to avoid problematic reentrancy of local ops. This type of scenario occurs if the user of SharedString subscribes\n\t * to the `sequenceDelta` event and uses the callback for a local op to submit further local ops.\n\t * Historically (before 2.0.0-internal.6.1.0), doing so would result in eventual consistency issues or a corrupted document.\n\t * These issues were fixed in #16815 which makes such reentrancy no different from applying the ops in order but not from within the change events,\n\t * but there is still little test coverage for reentrant scenarios.\n\t * Additionally, applications submitting ops from inside change events need to take extreme care that their data models also support reentrancy.\n\t * Since this is likely not the case, by default SharedString throws when encountering reentrant ops.\n\t *\n\t * An application using SharedString which explicitly wants to opt in to allowing reentrancy anyway can set `sharedStringPreventReentrancy`\n\t * on the data store options to `false`.\n\t */\n\tprotected guardReentrancy: <TRet>(callback: () => TRet) => TRet;\n\n\tprivate static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfor (const r of event.ranges) {\n\t\t\tswitch (event.deltaOperation) {\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\tconst lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n\t\t\t\t\tconst props: PropertySet = {};\n\t\t\t\t\tfor (const key of Object.keys(r.propertyDeltas)) {\n\t\t\t\t\t\tprops[key] = r.segment.properties?.[key] ?? null;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tlastAnnotate &&\n\t\t\t\t\t\tlastAnnotate.pos2 === r.position &&\n\t\t\t\t\t\tmatchProperties(lastAnnotate.props, props)\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastAnnotate.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateAnnotateRangeOp(r.position, r.position + r.segment.cachedLength, props),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\t\tops.push(createInsertOp(r.position, r.segment.clone().toJSONObject()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x3ff /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createRemoveRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeObliterateMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x874 /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createObliterateRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treturn ops;\n\t}\n\n\t/**\n\t * Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.\n\t * The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process\n\t * incoming leave/join ops before putting an op that this DDS submits over the wire.\n\t *\n\t * E.g. SharedString submits an op while deltaManager has lastSequenceNumber = 10, but before the runtime\n\t * puts this op over the wire, it processes a client join/leave op with sequence number 11, so the referenceSequenceNumber\n\t * on the SharedString op is 11.\n\t *\n\t * The reference sequence numbers placed in this queue are also not accurate for stashed ops due to how the applyStashedOp\n\t * flow works at the runtime level. This is a legitimate bug, and AB#6602 tracks one way to fix it (stop reaching all the way\n\t * to deltaManager's lastSequenceNumber to obtain refSeq, instead leveraging some analogous notion on the container or datastore\n\t * runtime).\n\t */\n\tprivate readonly inFlightRefSeqs = new Deque<number>();\n\n\tprivate ongoingResubmitRefSeq: number | undefined;\n\n\t/**\n\t * Gets the reference sequence number (i.e. sequence number of the runtime's last processed op) for an op submitted\n\t * in the current context.\n\t *\n\t * This value can be optionally overridden using `useResubmitRefSeq`.\n\t * IntervalCollection's resubmit logic currently relies on preserving merge information from when the op was originally submitted,\n\t * even if the op is resubmitted more than once. Thus during resubmit, `inFlightRefSeqs` gets populated with the\n\t * original refSeq rather than the refSeq at the time of reconnection.\n\t *\n\t * @remarks In some not fully understood cases, the runtime may process incoming ops before putting an op that this\n\t * DDS submits over the wire. See `inFlightRefSeqs` for more details.\n\t */\n\tprivate get currentRefSeq() {\n\t\treturn this.ongoingResubmitRefSeq ?? this.deltaManager.lastSequenceNumber;\n\t}\n\n\tprotected client: Client;\n\tprivate messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n\tprivate readonly intervalCollections: IntervalCollectionMap;\n\tconstructor(\n\t\tdataStoreRuntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tpublic readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n\t\tconst getMinInFlightRefSeq = () => this.inFlightRefSeqs.get(0);\n\t\tthis.guardReentrancy =\n\t\t\t(dataStoreRuntime.options.sharedStringPreventReentrancy ?? true)\n\t\t\t\t? ensureNoReentrancy\n\t\t\t\t: createReentrancyDetector((depth) => {\n\t\t\t\t\t\tif (totalReentrancyLogs > 0) {\n\t\t\t\t\t\t\ttotalReentrancyLogs--;\n\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t\t\t{ eventName: \"LocalOpReentry\", depth },\n\t\t\t\t\t\t\t\tnew LoggingError(reentrancyErrorMessage),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\tconst options = createConfigBasedOptionsProxy<SequenceOptions>(\n\t\t\tloggerToMonitoringContext(this.logger).config,\n\t\t\t\"Fluid.Sequence\",\n\t\t\t{\n\t\t\t\tmergeTreeEnableObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableSidedObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tintervalStickinessEnabled: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeReferencesCanSlideToEndpoint: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableAnnotateAdjust: (c, n) => c.getBoolean(n),\n\t\t\t},\n\t\t\tdataStoreRuntime.options,\n\t\t);\n\n\t\tthis.client = new Client(\n\t\t\tsegmentFromSpec,\n\t\t\tcreateChildLogger({\n\t\t\t\tlogger: this.logger,\n\t\t\t\tnamespace: \"SharedSegmentSequence.MergeTreeClient\",\n\t\t\t}),\n\t\t\toptions,\n\t\t\tgetMinInFlightRefSeq,\n\t\t);\n\n\t\tthis.client.prependListener(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tconst event = new SequenceDeltaEventClass(opArgs, deltaArgs, this.client);\n\t\t\tif (event.isLocal && event.opArgs.rollback !== true) {\n\t\t\t\tthis.submitSequenceMessage(opArgs.op);\n\t\t\t}\n\t\t\tif (deltaArgs.deltaSegments.length > 0) {\n\t\t\t\tthis.emit(\"sequenceDelta\", event, this);\n\t\t\t}\n\t\t});\n\n\t\tthis.client.on(\"maintenance\", (args, opArgs) => {\n\t\t\tthis.emit(\n\t\t\t\t\"maintenance\",\n\t\t\t\tnew SequenceMaintenanceEventClass(opArgs, args, this.client),\n\t\t\t\tthis,\n\t\t\t);\n\t\t});\n\n\t\tthis.intervalCollections = new IntervalCollectionMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => {\n\t\t\t\tif (!this.isAttached()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\t\t\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic removeRange(start: number, end: number): void {\n\t\tthis.guardReentrancy(() => this.client.removeRangeLocal(start, end));\n\t}\n\n\tpublic obliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void {\n\t\tthis.guardReentrancy(() => this.client.obliterateRangeLocal(start, end));\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic groupOperation(groupOp: IMergeTreeGroupMsg): void {\n\t\tthis.guardReentrancy(() => this.client.localTransaction(groupOp));\n\t}\n\n\tpublic getContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t} {\n\t\treturn (\n\t\t\tthis.client.getContainingSegment<T>(pos) ?? { segment: undefined, offset: undefined }\n\t\t);\n\t}\n\n\tpublic getLength(): number {\n\t\treturn this.client.getLength();\n\t}\n\n\tpublic getPosition(segment: ISegment): number {\n\t\treturn this.client.getPosition(segment);\n\t}\n\n\tpublic annotateRange(start: number, end: number, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));\n\t}\n\n\tpublic annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void {\n\t\tthis.guardReentrancy(() => this.client.annotateAdjustRangeLocal(start, end, adjust));\n\t}\n\n\tpublic getPropertiesAtPosition(pos: number): PropertySet | undefined {\n\t\treturn this.client.getPropertiesAtPosition(pos);\n\t}\n\n\tpublic getRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t} {\n\t\treturn this.client.getRangeExtentsOfPosition(pos);\n\t}\n\n\tpublic createLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition {\n\t\treturn this.client.createLocalReferencePosition(\n\t\t\tsegment,\n\t\t\toffset,\n\t\t\trefType,\n\t\t\tproperties,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tpublic localReferencePositionToPosition(lref: ReferencePosition): number {\n\t\treturn this.client.localReferencePositionToPosition(lref);\n\t}\n\n\tpublic removeLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined {\n\t\treturn this.client.removeLocalReferencePosition(lref);\n\t}\n\n\tpublic resolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined {\n\t\treturn this.client.resolveRemoteClientPosition(\n\t\t\tremoteClientPosition,\n\t\t\tremoteClientRefSeq,\n\t\t\tremoteClientId,\n\t\t);\n\t}\n\n\tprivate submitSequenceMessage(message: IMergeTreeOp) {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\n\t\tconst metadata = this.client.peekPendingSegmentGroups(\n\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t);\n\n\t\tthis.submitLocalMessage(message, metadata);\n\t}\n\n\tpublic posFromRelativePos(relativePos: IRelativePosition): number {\n\t\treturn this.client.posFromRelativePos(relativePos);\n\t}\n\n\tpublic walkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange: boolean = false,\n\t): void {\n\t\tthis.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n\t}\n\n\tpublic getCurrentSeq(): number {\n\t\treturn this.client.getCurrentSeq();\n\t}\n\n\tpublic insertAtReferencePosition(pos: ReferencePosition, segment: T): void {\n\t\tthis.guardReentrancy(() => this.client.insertAtReferencePositionLocal(pos, segment));\n\t}\n\n\tpublic insertFromSpec(pos: number, spec: IJSONSegment): void {\n\t\tconst segment = this.segmentFromSpec(spec);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\tpublic getIntervalCollection(label: string): ISequenceIntervalCollection {\n\t\treturn this.intervalCollections.get(label);\n\t}\n\n\tpublic getIntervalCollectionLabels(): IterableIterator<string> {\n\t\treturn this.intervalCollections.keys();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// conditionally write the interval collection blob\n\t\t// only if it has entries\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tbuilder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n\t\t}\n\n\t\tbuilder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer over the GC data for this SharedMatrix.\n\t * All the IFluidHandle's represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: IFluidSerializer) {\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tthis.intervalCollections.serialize(serializer);\n\t\t}\n\n\t\tthis.client.serializeGCData(this.handle, serializer);\n\t}\n\n\t/**\n\t * Replace the range specified from start to end with the provided segment\n\t * This is done by inserting the segment at the end of the range, followed\n\t * by removing the contents of the range\n\t * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n\t * @param start - The start of the range to replace\n\t * @param end - The end of the range to replace\n\t * @param segment - The segment that will replace the range\n\t */\n\tprotected replaceRange(start: number, end: number, segment: ISegment): void {\n\t\t// Insert at the max end of the range when start > end, but still remove the range later\n\t\tconst insertIndex: number = Math.max(start, end);\n\n\t\t// Insert first, so local references can slide to the inserted seg if any\n\t\tconst insert = this.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(insertIndex, segment),\n\t\t);\n\n\t\tif (insert && start < end) {\n\t\t\tthis.removeRange(start, end);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n\t */\n\tprotected onConnect() {\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown, squash: boolean = false) {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.shift();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0x8bb /* Expected a recorded refSeq when resubmitting an op */,\n\t\t);\n\t\tthis.useResubmitRefSeq(originalRefSeq, () => {\n\t\t\tif (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata, squash)) {\n\t\t\t\tthis.submitSequenceMessage(\n\t\t\t\t\tthis.client.regeneratePendingOp(content as IMergeTreeOp, localOpMetadata, squash),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected reSubmitSquashed(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.reSubmitCore(content, localOpMetadata, true);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.pop();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0xb7f /* Expected a recorded refSeq when rolling back an op */,\n\t\t);\n\n\t\tif (!this.intervalCollections.tryRollback(content, localOpMetadata)) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tif (await storage.contains(snapshotFileName)) {\n\t\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\t\tconst header = bufferToString(blob, \"utf8\");\n\t\t\tthis.intervalCollections.populate(header);\n\t\t}\n\n\t\ttry {\n\t\t\t// this will load the header, and return a promise\n\t\t\t// that will resolve when the body is loaded\n\t\t\t// and the catchup ops are available.\n\t\t\tconst { catchupOpsP } = await this.client.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, contentPath),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\n\t\t\t// process the catch up ops, and finishing the loading process\n\t\t\t(await catchupOpsP).forEach((m) => {\n\t\t\t\tconst collabWindow = this.client.getCollabWindow();\n\t\t\t\tif (\n\t\t\t\t\tm.minimumSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.referenceSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.sequenceNumber <= collabWindow.minSeq ||\n\t\t\t\t\t// sequenceNumber could be the same if messages are part of a grouped batch\n\t\t\t\t\tm.sequenceNumber < collabWindow.currentSeq\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid catchup operations in snapshot: ${JSON.stringify({\n\t\t\t\t\t\t\top: {\n\t\t\t\t\t\t\t\tseq: m.sequenceNumber,\n\t\t\t\t\t\t\t\tminSeq: m.minimumSequenceNumber,\n\t\t\t\t\t\t\t\trefSeq: m.referenceSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcollabWindow: {\n\t\t\t\t\t\t\t\tseq: collabWindow.currentSeq,\n\t\t\t\t\t\t\t\tminSeq: collabWindow.minSeq,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.processMergeTreeMsg(m);\n\t\t\t});\n\n\t\t\t// Initialize the interval collections\n\t\t\tthis.initializeIntervalCollections();\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (local) {\n\t\t\tconst recordedRefSeq = this.inFlightRefSeqs.shift();\n\t\t\tassert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);\n\t\t\t// TODO: AB#7076: Some equivalent assert should be enabled. This fails some e2e stashed op tests because\n\t\t\t// the deltaManager may have seen more messages than the runtime has processed while amidst the stashed op\n\t\t\t// flow, so e.g. when `applyStashedOp` is called and the DDS is put in a state where it expects an ack for\n\t\t\t// one of its messages, the delta manager has actually already seen subsequent messages from collaborators\n\t\t\t// which the in-flight message is concurrent to.\n\t\t\t// See \"handles stashed ops created on top of sequenced local ops\" for one such test case.\n\t\t\t// assert(recordedRefSeq <= message.referenceSequenceNumber, \"RefSeq mismatch\");\n\t\t}\n\n\t\tassert(\n\t\t\tmessage.type === MessageType.Operation,\n\t\t\t0x073 /* \"Sequence message not operation\" */,\n\t\t);\n\n\t\tconst handled = this.intervalCollections.tryProcessMessage(\n\t\t\tmessage.contents as IMapOperation,\n\t\t\tlocal,\n\t\t\tmessage,\n\t\t\tlocalOpMetadata,\n\t\t);\n\n\t\tif (!handled) {\n\t\t\tthis.processMergeTreeMsg(message, local);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n\t */\n\tprotected didAttach() {\n\t\t// If we are not local, and we've attached we need to start generating and sending ops\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n\t */\n\tprotected initializeLocalCore() {\n\t\tsuper.initializeLocalCore();\n\t\tthis.initializeIntervalCollections();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): void {\n\t\tif (!this.intervalCollections.tryApplyStashedOp(content)) {\n\t\t\tthis.client.applyStashedOp(content);\n\t\t}\n\t}\n\n\tprivate summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst minSeq = this.deltaManager.minimumSequenceNumber;\n\n\t\tthis.processMinSequenceNumberChanged(minSeq);\n\n\t\tthis.messagesSinceMSNChange.forEach((m) => {\n\t\t\tm.minimumSequenceNumber = minSeq;\n\t\t});\n\n\t\treturn this.client.summarize(\n\t\t\tthis.runtime,\n\t\t\tthis.handle,\n\t\t\tserializer,\n\t\t\tthis.messagesSinceMSNChange,\n\t\t);\n\t}\n\n\t/**\n\t *\n\t * @param message - Message with decoded and hydrated handles\n\t */\n\tprivate processMergeTreeMsg(message: ISequencedDocumentMessage, local?: boolean) {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfunction transformOps(event: SequenceDeltaEvent) {\n\t\t\tops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n\t\t}\n\t\tconst needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n\t\tlet stashMessage: Readonly<ISequencedDocumentMessage> = message;\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.on(\"sequenceDelta\", transformOps);\n\t\t\t}\n\t\t}\n\n\t\tthis.client.applyMsg(message, local);\n\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.removeListener(\"sequenceDelta\", transformOps);\n\t\t\t\t// shallow clone the message as we only overwrite top level properties,\n\t\t\t\t// like referenceSequenceNumber and content only\n\t\t\t\tstashMessage = {\n\t\t\t\t\t...message,\n\t\t\t\t\treferenceSequenceNumber: stashMessage.sequenceNumber - 1,\n\t\t\t\t\tcontents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.messagesSinceMSNChange.push(stashMessage);\n\n\t\t\t// Do GC every once in a while...\n\t\t\tif (\n\t\t\t\tthis.messagesSinceMSNChange.length > 20 &&\n\t\t\t\tthis.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber\n\t\t\t) {\n\t\t\t\tthis.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processMinSequenceNumberChanged(minSeq: number) {\n\t\tlet index = 0;\n\t\tfor (; index < this.messagesSinceMSNChange.length; index++) {\n\t\t\tif (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (index !== 0) {\n\t\t\tthis.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n\t\t}\n\t}\n\n\tprivate initializeIntervalCollections() {\n\t\t// Listen and initialize new SharedIntervalCollections\n\t\tthis.intervalCollections.events.on(\n\t\t\t\"createIntervalCollection\",\n\t\t\t(key: string, local: boolean) => {\n\t\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\t\tif (!intervalCollection.attached) {\n\t\t\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t\t\t}\n\t\t\t\tthis.emit(\"createIntervalCollection\", key, local, this);\n\t\t\t},\n\t\t);\n\n\t\t// Initialize existing SharedIntervalCollections\n\t\tfor (const key of this.intervalCollections.keys()) {\n\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t}\n\t}\n\n\t/**\n\t * Overrides the \"currently applicable reference sequence number\" for the duration of the callback.\n\t * See remarks on `currentRefSeq` for more context.\n\t */\n\tprivate useResubmitRefSeq(refSeq: number, callback: () => void) {\n\t\tconst previousResubmitRefSeq = this.ongoingResubmitRefSeq;\n\t\tthis.ongoingResubmitRefSeq = refSeq;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.ongoingResubmitRefSeq = previousResubmitRefSeq;\n\t\t}\n\t}\n}\n\nfunction createReentrancyDetector(\n\tonReentrancy: (depth: number) => void,\n): <T>(callback: () => T) => T {\n\tlet depth = 0;\n\tfunction detectReentrancy<T>(callback: () => T): T {\n\t\tif (depth > 0) {\n\t\t\tonReentrancy(depth);\n\t\t}\n\t\tdepth++;\n\t\ttry {\n\t\t\treturn callback();\n\t\t} finally {\n\t\t\tdepth--;\n\t\t}\n\t}\n\n\treturn detectReentrancy;\n}\n\n/**\n * Apps which generate reentrant behavior may do so at a high frequency.\n * Logging even per-SharedSegmentSequence instance might be too noisy, and having a few logs from a session\n * is likely enough.\n */\nlet totalReentrancyLogs = 3;\n\n/**\n * Resets the reentrancy log counter. Test-only API.\n */\nexport function resetReentrancyLogCounter() {\n\ttotalReentrancyLogs = 3;\n}\n\nconst reentrancyErrorMessage = \"Reentrancy detected in sequence local ops\";\nconst ensureNoReentrancy = createReentrancyDetector(() => {\n\tthrow new LoggingError(reentrancyErrorMessage);\n});\n"]}
1
+ {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+DAA8D;AAE9D,kEAA6D;AAM7D,0EAGqD;AACrD,kEA8B6C;AAQ7C,qEAGgD;AAChD,0EAKqD;AACrD,uEAKkD;AAClD,4EAAuC;AAGvC,yEAAkF;AAElF,mEAKiC;AAEjC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AAgS9B;;GAEG;AACH,MAAsB,qBACrB,SAAQ,uBAA0C;IAiB1C,MAAM,CAAC,kBAAkB,CAAC,KAAyB;QAC1D,MAAM,GAAG,GAAwB,EAAE,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9B,QAAQ,KAAK,CAAC,cAAc,EAAE,CAAC;gBAC9B,KAAK,6BAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAClC,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAA0B,CAAC;oBAClE,MAAM,KAAK,GAAgB,EAAE,CAAC;oBAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,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AC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED;;;OAGG;IACK,iBAAiB,CAAC,MAAc,EAAE,QAAoB;QAC7D,MAAM,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAC1D,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC;QACpC,IAAI,CAAC;YACJ,QAAQ,EAAE,CAAC;QACZ,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,qBAAqB,GAAG,sBAAsB,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AAnqBD,sDAmqBC;AAED,SAAS,wBAAwB,CAChC,YAAqC;IAErC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,SAAS,gBAAgB,CAAI,QAAiB;QAC7C,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QACD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC;YACJ,OAAO,QAAQ,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACV,KAAK,EAAE,CAAC;QACT,CAAC;IACF,CAAC;IAED,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B;;GAEG;AACH,SAAgB,yBAAyB;IACxC,mBAAmB,GAAG,CAAC,CAAC;AACzB,CAAC;AAFD,8DAEC;AAED,MAAM,sBAAsB,GAAG,2CAA2C,CAAC;AAC3E,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,GAAG,EAAE;IACxD,MAAM,IAAI,uBAAY,CAAC,sBAAsB,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tIJSONSegment,\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n\tIMergeTreeOp,\n\tIMergeTreeRemoveMsg,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tLocalReferencePosition,\n\tMergeTreeDeltaType,\n\tMergeTreeRevertibleDriver,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\tSlidingPreference,\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateObliterateRangeOp,\n\tcreateRemoveRangeOp,\n\tmatchProperties,\n\ttype AdjustParams,\n\ttype InteriorSequencePlace,\n\ttype MapLike,\n} from \"@fluidframework/merge-tree/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIRuntimeMessageCollection,\n\tIRuntimeMessagesContent,\n\tISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tObjectStoragePartition,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\ttype ISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\tcreateConfigBasedOptionsProxy,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport Deque from \"double-ended-queue\";\n\nimport { type ISequenceIntervalCollection } from \"./intervalCollection.js\";\nimport { IMapOperation, IntervalCollectionMap } from \"./intervalCollectionMap.js\";\nimport { type SequenceOptions } from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\tSequenceDeltaEvent,\n\tSequenceDeltaEventClass,\n\tSequenceMaintenanceEvent,\n\tSequenceMaintenanceEventClass,\n} from \"./sequenceDeltaEvent.js\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n * @legacy @beta\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"createIntervalCollection\",\n\t\tlistener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"sequenceDelta\",\n\t\tlistener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"maintenance\",\n\t\tlistener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISharedSegmentSequence<T extends ISegment>\n\textends ISharedObject<ISharedSegmentSequenceEvents>,\n\t\tMergeTreeRevertibleDriver {\n\t/**\n\t * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n\t * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n\t * @param segment - Segment to add the local reference on\n\t * @param offset - Offset on the segment at which to place the local reference\n\t * @param refType - ReferenceType for the created local reference\n\t * @param properties - PropertySet to place on the created local reference\n\t */\n\tcreateLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition;\n\n\t/**\n\t * Removes a `LocalReferencePosition` from this SharedString.\n\t */\n\tremoveLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined;\n\n\t/**\n\t * Returns the length of the current sequence for the client\n\t */\n\tgetLength(): number;\n\n\t/**\n\t * Returns the current position of a segment, and -1 if the segment\n\t * does not exist in this sequence\n\t * @param segment - The segment to get the position of\n\t */\n\tgetPosition(segment: ISegment): number;\n\n\t/**\n\t * Resolves a `ReferencePosition` into a character position using this client's perspective.\n\t *\n\t * Reference positions that point to a character that has been removed will\n\t * always return the position of the nearest non-removed character, regardless\n\t * of `ReferenceType`. To handle this case specifically, one may wish\n\t * to look at the segment returned by `ReferencePosition.getSegment`.\n\t */\n\tlocalReferencePositionToPosition(lref: ReferencePosition): number;\n\n\t/**\n\t * Walk the underlying segments of the sequence.\n\t * The walked segments may extend beyond the range if the segments cross the\n\t * ranges start or end boundaries.\n\t *\n\t * Set split range to true to ensure only segments within the range are walked.\n\t *\n\t * @param handler - The function to handle each segment. Traversal ends if\n\t * this function returns true.\n\t * @param start - Optional. The start of range walk.\n\t * @param end - Optional. The end of range walk\n\t * @param accum - Optional. An object that will be passed to the handler for accumulation\n\t * @param splitRange - Optional. Splits boundary segments on the range boundaries. Defaults to false.\n\t */\n\twalkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange?: boolean,\n\t): void;\n\n\t/**\n\t * Inserts a segment directly before a `ReferencePosition`.\n\t * @param refPos - The reference position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tinsertAtReferencePosition(pos: ReferencePosition, segment: T): void;\n\n\t/**\n\t * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n\t * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n\t * @param pos - Character position (index) into the current local view of the SharedString.\n\t */\n\tgetContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t};\n\n\tgetPropertiesAtPosition(pos: number): PropertySet | undefined;\n\n\t/**\n\t * @returns An iterable object that enumerates the IntervalCollection labels.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * const iter = this.getIntervalCollectionKeys();\n\t * for (key of iter)\n\t * const collection = this.getIntervalCollection(key);\n\t * ...\n\t * ```\n\t */\n\tgetIntervalCollectionLabels(): IterableIterator<string>;\n\n\t/**\n\t * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n\t * creates one.\n\t */\n\tgetIntervalCollection(label: string): ISequenceIntervalCollection;\n\n\t/**\n\t * Obliterate is similar to remove, but differs in that segments concurrently\n\t * inserted into an obliterated range will also be removed.\n\t * Inserts are considered concurrent to an obliterate iff the insert op's seq is after the obliterate op's refSeq\n\t * and the insert's refSeq is before the obliterates seq.\n\t * Inserts made by the client which most recently obliterated a range containing the insert position\n\t * are not considered concurrent to any obliteration (the last client to obliterate gets the right to insert).\n\t *\n\t * The endpoints can either be inclusive or exclusive.\n\t * Exclusive endpoints allow the obliterated range to \"grow\" to include adjacent concurrently inserted segments on that side.\n\t *\n\t * @param start - The start of the range to obliterate.\n\t * Inclusive if side is Before or a number is provided.\n\t * @param end - The end of the range to obliterate. Inclusive if side is After.\n\t * If a number is provided it is treated as exclusive,\n\t * but the endpoint does not expand in order to preserve existing behavior.\n\t *\n\t * @example Given the initial state `\"|ABC>\"`,\n\t * `obliterateRange({ pos: 0, side: Side.After }, { pos: 4, side: Side.Before })` obliterates `\"ABC\"`, leaving only `\"|>\"`.\n\t * `insertFromSpec(1, { text: \"AAA\"})` would insert `\"AAA\"` before |, resulting in `\"|AAA>\"`.\n\t * If another client does the same thing but inserts `\"BBB\"` and gets sequenced later, all clients will eventually see `|BBB>`.\n\t */\n\tobliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void;\n\n\t/**\n\t * @returns The most recent sequence number which has been acked by the server and processed by this\n\t * SharedSegmentSequence.\n\t */\n\tgetCurrentSeq(): number;\n\n\t/**\n\t * Annotates the range with the provided properties\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n\n\t/**\n\t * Annotates a specified range within the sequence by applying the provided adjustments.\n\t *\n\t * @param start - The inclusive start position of the range to annotate. This is a zero-based index.\n\t * @param end - The exclusive end position of the range to annotate. This is a zero-based index.\n\t * @param adjust - A map-like object specifying the properties to adjust. Each key-value pair represents a property and its corresponding adjustment to be applied over the range.\n\t * An adjustment is defined by an object containing a `delta` to be added to the current property value, and optional `min` and `max` constraints to limit the adjusted value.\n\t *\n\t * @remarks\n\t * The range is defined by the start and end positions, where the start position is inclusive and the end position is exclusive.\n\t * The properties provided in the adjust parameter will be applied to the specified range. Each adjustment modifies the current value of the property by adding the specified `value`.\n\t * If the current value is not a number, the `delta` will be summed with 0 to compute the new value. The optional `min` and `max` constraints are applied after the adjustment to ensure the final value falls within the specified bounds.\n\t */\n\tannotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void;\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tremoveRange(start: number, end: number): void;\n\n\t/**\n\t * Resolves a remote client's position against the local sequence\n\t * and returns the remote client's position relative to the local\n\t * sequence. The client ref seq must be above the minimum sequence number\n\t * or the return value will be undefined.\n\t * Generally this method is used in conjunction with signals which provide\n\t * point in time values for the below parameters, and is useful for things\n\t * like displaying user position. It should not be used with persisted values\n\t * as persisted values will quickly become invalid as the remoteClientRefSeq\n\t * moves below the minimum sequence number\n\t * @param remoteClientPosition - The remote client's position to resolve\n\t * @param remoteClientRefSeq - The reference sequence number of the remote client\n\t * @param remoteClientId - The client id of the remote client\n\t */\n\tresolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined;\n\n\t// #region APIs we might want to remove\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t * @privateRemarks\n\t * TODO: determine if this API (from SharedObject) is needed by users of the encapsulated API, declarative API or both,\n\t * and handle exposing it in a consistent way for all SharedObjects if needed.\n\t */\n\tinitializeLocal(): void;\n\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming\n\t * release, as group ops are redundant with the native batching capabilities\n\t * of the runtime\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tgroupOperation(groupOp: IMergeTreeGroupMsg): void;\n\n\tgetRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t};\n\n\t/**\n\t * Inserts a segment\n\t * @param start - The position to insert the segment at\n\t * @param spec - The segment to inserts spec\n\t */\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\n\t/**\n\t * Given a position specified relative to a marker id, lookup the marker\n\t * and convert the position to a character position.\n\t * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n\n\t// #endregion\n}\n\n/**\n * @internal\n */\nexport abstract class SharedSegmentSequence<T extends ISegment>\n\textends SharedObject<ISharedSegmentSequenceEvents>\n\timplements ISharedSegmentSequence<T>\n{\n\t/**\n\t * This is a safeguard to avoid problematic reentrancy of local ops. This type of scenario occurs if the user of SharedString subscribes\n\t * to the `sequenceDelta` event and uses the callback for a local op to submit further local ops.\n\t * Historically (before 2.0.0-internal.6.1.0), doing so would result in eventual consistency issues or a corrupted document.\n\t * These issues were fixed in #16815 which makes such reentrancy no different from applying the ops in order but not from within the change events,\n\t * but there is still little test coverage for reentrant scenarios.\n\t * Additionally, applications submitting ops from inside change events need to take extreme care that their data models also support reentrancy.\n\t * Since this is likely not the case, by default SharedString throws when encountering reentrant ops.\n\t *\n\t * An application using SharedString which explicitly wants to opt in to allowing reentrancy anyway can set `sharedStringPreventReentrancy`\n\t * on the data store options to `false`.\n\t */\n\tprotected guardReentrancy: <TRet>(callback: () => TRet) => TRet;\n\n\tprivate static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfor (const r of event.ranges) {\n\t\t\tswitch (event.deltaOperation) {\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\tconst lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n\t\t\t\t\tconst props: PropertySet = {};\n\t\t\t\t\tfor (const key of Object.keys(r.propertyDeltas)) {\n\t\t\t\t\t\tprops[key] = r.segment.properties?.[key] ?? null;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tlastAnnotate &&\n\t\t\t\t\t\tlastAnnotate.pos2 === r.position &&\n\t\t\t\t\t\tmatchProperties(lastAnnotate.props, props)\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastAnnotate.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateAnnotateRangeOp(r.position, r.position + r.segment.cachedLength, props),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\t\tops.push(createInsertOp(r.position, r.segment.clone().toJSONObject()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x3ff /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createRemoveRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeObliterateMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x874 /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createObliterateRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treturn ops;\n\t}\n\n\t/**\n\t * Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.\n\t * The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process\n\t * incoming leave/join ops before putting an op that this DDS submits over the wire.\n\t *\n\t * E.g. SharedString submits an op while deltaManager has lastSequenceNumber = 10, but before the runtime\n\t * puts this op over the wire, it processes a client join/leave op with sequence number 11, so the referenceSequenceNumber\n\t * on the SharedString op is 11.\n\t *\n\t * The reference sequence numbers placed in this queue are also not accurate for stashed ops due to how the applyStashedOp\n\t * flow works at the runtime level. This is a legitimate bug, and AB#6602 tracks one way to fix it (stop reaching all the way\n\t * to deltaManager's lastSequenceNumber to obtain refSeq, instead leveraging some analogous notion on the container or datastore\n\t * runtime).\n\t */\n\tprivate readonly inFlightRefSeqs = new Deque<number>();\n\n\tprivate ongoingResubmitRefSeq: number | undefined;\n\n\t/**\n\t * Gets the reference sequence number (i.e. sequence number of the runtime's last processed op) for an op submitted\n\t * in the current context.\n\t *\n\t * This value can be optionally overridden using `useResubmitRefSeq`.\n\t * IntervalCollection's resubmit logic currently relies on preserving merge information from when the op was originally submitted,\n\t * even if the op is resubmitted more than once. Thus during resubmit, `inFlightRefSeqs` gets populated with the\n\t * original refSeq rather than the refSeq at the time of reconnection.\n\t *\n\t * @remarks In some not fully understood cases, the runtime may process incoming ops before putting an op that this\n\t * DDS submits over the wire. See `inFlightRefSeqs` for more details.\n\t */\n\tprivate get currentRefSeq() {\n\t\treturn this.ongoingResubmitRefSeq ?? this.deltaManager.lastSequenceNumber;\n\t}\n\n\tprotected client: Client;\n\tprivate messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n\tprivate readonly intervalCollections: IntervalCollectionMap;\n\tconstructor(\n\t\tdataStoreRuntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tpublic readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n\t\tconst getMinInFlightRefSeq = () => this.inFlightRefSeqs.get(0);\n\t\tthis.guardReentrancy =\n\t\t\t(dataStoreRuntime.options.sharedStringPreventReentrancy ?? true)\n\t\t\t\t? ensureNoReentrancy\n\t\t\t\t: createReentrancyDetector((depth) => {\n\t\t\t\t\t\tif (totalReentrancyLogs > 0) {\n\t\t\t\t\t\t\ttotalReentrancyLogs--;\n\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t\t\t{ eventName: \"LocalOpReentry\", depth },\n\t\t\t\t\t\t\t\tnew LoggingError(reentrancyErrorMessage),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\tconst options = createConfigBasedOptionsProxy<SequenceOptions>(\n\t\t\tloggerToMonitoringContext(this.logger).config,\n\t\t\t\"Fluid.Sequence\",\n\t\t\t{\n\t\t\t\tmergeTreeEnableObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableSidedObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tintervalStickinessEnabled: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeReferencesCanSlideToEndpoint: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableAnnotateAdjust: (c, n) => c.getBoolean(n),\n\t\t\t},\n\t\t\tdataStoreRuntime.options,\n\t\t);\n\n\t\tthis.client = new Client(\n\t\t\tsegmentFromSpec,\n\t\t\tcreateChildLogger({\n\t\t\t\tlogger: this.logger,\n\t\t\t\tnamespace: \"SharedSegmentSequence.MergeTreeClient\",\n\t\t\t}),\n\t\t\toptions,\n\t\t\tgetMinInFlightRefSeq,\n\t\t);\n\n\t\tthis.client.prependListener(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tconst event = new SequenceDeltaEventClass(opArgs, deltaArgs, this.client);\n\t\t\tif (event.isLocal && event.opArgs.rollback !== true) {\n\t\t\t\tthis.submitSequenceMessage(opArgs.op);\n\t\t\t}\n\t\t\tif (deltaArgs.deltaSegments.length > 0) {\n\t\t\t\tthis.emit(\"sequenceDelta\", event, this);\n\t\t\t}\n\t\t});\n\n\t\tthis.client.on(\"maintenance\", (args, opArgs) => {\n\t\t\tthis.emit(\n\t\t\t\t\"maintenance\",\n\t\t\t\tnew SequenceMaintenanceEventClass(opArgs, args, this.client),\n\t\t\t\tthis,\n\t\t\t);\n\t\t});\n\n\t\tthis.intervalCollections = new IntervalCollectionMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => {\n\t\t\t\tif (!this.isAttached()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\t\t\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic removeRange(start: number, end: number): void {\n\t\tthis.guardReentrancy(() => this.client.removeRangeLocal(start, end));\n\t}\n\n\tpublic obliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void {\n\t\tthis.guardReentrancy(() => this.client.obliterateRangeLocal(start, end));\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic groupOperation(groupOp: IMergeTreeGroupMsg): void {\n\t\tthis.guardReentrancy(() => this.client.localTransaction(groupOp));\n\t}\n\n\tpublic getContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t} {\n\t\treturn (\n\t\t\tthis.client.getContainingSegment<T>(pos) ?? { segment: undefined, offset: undefined }\n\t\t);\n\t}\n\n\tpublic getLength(): number {\n\t\treturn this.client.getLength();\n\t}\n\n\tpublic getPosition(segment: ISegment): number {\n\t\treturn this.client.getPosition(segment);\n\t}\n\n\tpublic annotateRange(start: number, end: number, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));\n\t}\n\n\tpublic annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void {\n\t\tthis.guardReentrancy(() => this.client.annotateAdjustRangeLocal(start, end, adjust));\n\t}\n\n\tpublic getPropertiesAtPosition(pos: number): PropertySet | undefined {\n\t\treturn this.client.getPropertiesAtPosition(pos);\n\t}\n\n\tpublic getRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t} {\n\t\treturn this.client.getRangeExtentsOfPosition(pos);\n\t}\n\n\tpublic createLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition {\n\t\treturn this.client.createLocalReferencePosition(\n\t\t\tsegment,\n\t\t\toffset,\n\t\t\trefType,\n\t\t\tproperties,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tpublic localReferencePositionToPosition(lref: ReferencePosition): number {\n\t\treturn this.client.localReferencePositionToPosition(lref);\n\t}\n\n\tpublic removeLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined {\n\t\treturn this.client.removeLocalReferencePosition(lref);\n\t}\n\n\tpublic resolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined {\n\t\treturn this.client.resolveRemoteClientPosition(\n\t\t\tremoteClientPosition,\n\t\t\tremoteClientRefSeq,\n\t\t\tremoteClientId,\n\t\t);\n\t}\n\n\tprivate submitSequenceMessage(message: IMergeTreeOp) {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\n\t\tconst metadata = this.client.peekPendingSegmentGroups(\n\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t);\n\n\t\tthis.submitLocalMessage(message, metadata);\n\t}\n\n\tpublic posFromRelativePos(relativePos: IRelativePosition): number {\n\t\treturn this.client.posFromRelativePos(relativePos);\n\t}\n\n\tpublic walkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange: boolean = false,\n\t): void {\n\t\tthis.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n\t}\n\n\tpublic getCurrentSeq(): number {\n\t\treturn this.client.getCurrentSeq();\n\t}\n\n\tpublic insertAtReferencePosition(pos: ReferencePosition, segment: T): void {\n\t\tthis.guardReentrancy(() => this.client.insertAtReferencePositionLocal(pos, segment));\n\t}\n\n\tpublic insertFromSpec(pos: number, spec: IJSONSegment): void {\n\t\tconst segment = this.segmentFromSpec(spec);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\tpublic getIntervalCollection(label: string): ISequenceIntervalCollection {\n\t\treturn this.intervalCollections.get(label);\n\t}\n\n\tpublic getIntervalCollectionLabels(): IterableIterator<string> {\n\t\treturn this.intervalCollections.keys();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// conditionally write the interval collection blob\n\t\t// only if it has entries\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tbuilder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n\t\t}\n\n\t\tbuilder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer over the GC data for this SharedMatrix.\n\t * All the IFluidHandle's represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: IFluidSerializer) {\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tthis.intervalCollections.serialize(serializer);\n\t\t}\n\n\t\tthis.client.serializeGCData(this.handle, serializer);\n\t}\n\n\t/**\n\t * Replace the range specified from start to end with the provided segment\n\t * This is done by inserting the segment at the end of the range, followed\n\t * by removing the contents of the range\n\t * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n\t * @param start - The start of the range to replace\n\t * @param end - The end of the range to replace\n\t * @param segment - The segment that will replace the range\n\t */\n\tprotected replaceRange(start: number, end: number, segment: ISegment): void {\n\t\t// Insert at the max end of the range when start > end, but still remove the range later\n\t\tconst insertIndex: number = Math.max(start, end);\n\n\t\t// Insert first, so local references can slide to the inserted seg if any\n\t\tconst insert = this.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(insertIndex, segment),\n\t\t);\n\n\t\tif (insert && start < end) {\n\t\t\tthis.removeRange(start, end);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n\t */\n\tprotected onConnect() {\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown, squash: boolean = false) {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.shift();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0x8bb /* Expected a recorded refSeq when resubmitting an op */,\n\t\t);\n\t\tthis.useResubmitRefSeq(originalRefSeq, () => {\n\t\t\tif (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata, squash)) {\n\t\t\t\tthis.submitSequenceMessage(\n\t\t\t\t\tthis.client.regeneratePendingOp(content as IMergeTreeOp, localOpMetadata, squash),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected reSubmitSquashed(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.reSubmitCore(content, localOpMetadata, true);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.pop();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0xb7f /* Expected a recorded refSeq when rolling back an op */,\n\t\t);\n\n\t\tif (!this.intervalCollections.tryRollback(content, localOpMetadata)) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tif (await storage.contains(snapshotFileName)) {\n\t\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\t\tconst header = bufferToString(blob, \"utf8\");\n\t\t\tthis.intervalCollections.populate(header);\n\t\t}\n\n\t\ttry {\n\t\t\t// this will load the header, and return a promise\n\t\t\t// that will resolve when the body is loaded\n\t\t\t// and the catchup ops are available.\n\t\t\tconst { catchupOpsP } = await this.client.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, contentPath),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\n\t\t\t// process the catch up ops, and finishing the loading process\n\t\t\t(await catchupOpsP).forEach((m) => {\n\t\t\t\tconst collabWindow = this.client.getCollabWindow();\n\t\t\t\tif (\n\t\t\t\t\tm.minimumSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.referenceSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.sequenceNumber <= collabWindow.minSeq ||\n\t\t\t\t\t// sequenceNumber could be the same if messages are part of a grouped batch\n\t\t\t\t\tm.sequenceNumber < collabWindow.currentSeq\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid catchup operations in snapshot: ${JSON.stringify({\n\t\t\t\t\t\t\top: {\n\t\t\t\t\t\t\t\tseq: m.sequenceNumber,\n\t\t\t\t\t\t\t\tminSeq: m.minimumSequenceNumber,\n\t\t\t\t\t\t\t\trefSeq: m.referenceSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcollabWindow: {\n\t\t\t\t\t\t\t\tseq: collabWindow.currentSeq,\n\t\t\t\t\t\t\t\tminSeq: collabWindow.minSeq,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.processMergeTreeMsg(m);\n\t\t\t});\n\n\t\t\t// Initialize the interval collections\n\t\t\tthis.initializeIntervalCollections();\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent, local);\n\t\t}\n\t}\n\n\tprivate processMessage(\n\t\tmessageEnvelope: ISequencedMessageEnvelope,\n\t\tmessageContent: IRuntimeMessagesContent,\n\t\tlocal: boolean,\n\t): void {\n\t\t// Reconstruct ISequencedDocumentMessage which is needed by merge tree client\n\t\tconst message: ISequencedDocumentMessage = {\n\t\t\t...messageEnvelope,\n\t\t\tcontents: messageContent.contents,\n\t\t\tclientSequenceNumber: messageContent.clientSequenceNumber,\n\t\t};\n\n\t\tif (local) {\n\t\t\tconst recordedRefSeq = this.inFlightRefSeqs.shift();\n\t\t\tassert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);\n\t\t\t// TODO: AB#7076: Some equivalent assert should be enabled. This fails some e2e stashed op tests because\n\t\t\t// the deltaManager may have seen more messages than the runtime has processed while amidst the stashed op\n\t\t\t// flow, so e.g. when `applyStashedOp` is called and the DDS is put in a state where it expects an ack for\n\t\t\t// one of its messages, the delta manager has actually already seen subsequent messages from collaborators\n\t\t\t// which the in-flight message is concurrent to.\n\t\t\t// See \"handles stashed ops created on top of sequenced local ops\" for one such test case.\n\t\t\t// assert(recordedRefSeq <= message.referenceSequenceNumber, \"RefSeq mismatch\");\n\t\t}\n\n\t\tassert(\n\t\t\tmessage.type === MessageType.Operation,\n\t\t\t0x073 /* \"Sequence message not operation\" */,\n\t\t);\n\n\t\tconst handled = this.intervalCollections.tryProcessMessage(\n\t\t\tmessage.contents as IMapOperation,\n\t\t\tlocal,\n\t\t\tmessage,\n\t\t\tmessageContent.localOpMetadata,\n\t\t);\n\n\t\tif (!handled) {\n\t\t\tthis.processMergeTreeMsg(message, local);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n\t */\n\tprotected didAttach() {\n\t\t// If we are not local, and we've attached we need to start generating and sending ops\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n\t */\n\tprotected initializeLocalCore() {\n\t\tsuper.initializeLocalCore();\n\t\tthis.initializeIntervalCollections();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): void {\n\t\tif (!this.intervalCollections.tryApplyStashedOp(content)) {\n\t\t\tthis.client.applyStashedOp(content);\n\t\t}\n\t}\n\n\tprivate summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst minSeq = this.deltaManager.minimumSequenceNumber;\n\n\t\tthis.processMinSequenceNumberChanged(minSeq);\n\n\t\tthis.messagesSinceMSNChange.forEach((m) => {\n\t\t\tm.minimumSequenceNumber = minSeq;\n\t\t});\n\n\t\treturn this.client.summarize(\n\t\t\tthis.runtime,\n\t\t\tthis.handle,\n\t\t\tserializer,\n\t\t\tthis.messagesSinceMSNChange,\n\t\t);\n\t}\n\n\t/**\n\t *\n\t * @param message - Message with decoded and hydrated handles\n\t */\n\tprivate processMergeTreeMsg(message: ISequencedDocumentMessage, local?: boolean) {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfunction transformOps(event: SequenceDeltaEvent) {\n\t\t\tops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n\t\t}\n\t\tconst needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n\t\tlet stashMessage: Readonly<ISequencedDocumentMessage> = message;\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.on(\"sequenceDelta\", transformOps);\n\t\t\t}\n\t\t}\n\n\t\tthis.client.applyMsg(message, local);\n\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.removeListener(\"sequenceDelta\", transformOps);\n\t\t\t\t// shallow clone the message as we only overwrite top level properties,\n\t\t\t\t// like referenceSequenceNumber and content only\n\t\t\t\tstashMessage = {\n\t\t\t\t\t...message,\n\t\t\t\t\treferenceSequenceNumber: stashMessage.sequenceNumber - 1,\n\t\t\t\t\tcontents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.messagesSinceMSNChange.push(stashMessage);\n\n\t\t\t// Do GC every once in a while...\n\t\t\tif (\n\t\t\t\tthis.messagesSinceMSNChange.length > 20 &&\n\t\t\t\tthis.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber\n\t\t\t) {\n\t\t\t\tthis.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processMinSequenceNumberChanged(minSeq: number) {\n\t\tlet index = 0;\n\t\tfor (; index < this.messagesSinceMSNChange.length; index++) {\n\t\t\tif (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (index !== 0) {\n\t\t\tthis.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n\t\t}\n\t}\n\n\tprivate initializeIntervalCollections() {\n\t\t// Listen and initialize new SharedIntervalCollections\n\t\tthis.intervalCollections.events.on(\n\t\t\t\"createIntervalCollection\",\n\t\t\t(key: string, local: boolean) => {\n\t\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\t\tif (!intervalCollection.attached) {\n\t\t\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t\t\t}\n\t\t\t\tthis.emit(\"createIntervalCollection\", key, local, this);\n\t\t\t},\n\t\t);\n\n\t\t// Initialize existing SharedIntervalCollections\n\t\tfor (const key of this.intervalCollections.keys()) {\n\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t}\n\t}\n\n\t/**\n\t * Overrides the \"currently applicable reference sequence number\" for the duration of the callback.\n\t * See remarks on `currentRefSeq` for more context.\n\t */\n\tprivate useResubmitRefSeq(refSeq: number, callback: () => void) {\n\t\tconst previousResubmitRefSeq = this.ongoingResubmitRefSeq;\n\t\tthis.ongoingResubmitRefSeq = refSeq;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.ongoingResubmitRefSeq = previousResubmitRefSeq;\n\t\t}\n\t}\n}\n\nfunction createReentrancyDetector(\n\tonReentrancy: (depth: number) => void,\n): <T>(callback: () => T) => T {\n\tlet depth = 0;\n\tfunction detectReentrancy<T>(callback: () => T): T {\n\t\tif (depth > 0) {\n\t\t\tonReentrancy(depth);\n\t\t}\n\t\tdepth++;\n\t\ttry {\n\t\t\treturn callback();\n\t\t} finally {\n\t\t\tdepth--;\n\t\t}\n\t}\n\n\treturn detectReentrancy;\n}\n\n/**\n * Apps which generate reentrant behavior may do so at a high frequency.\n * Logging even per-SharedSegmentSequence instance might be too noisy, and having a few logs from a session\n * is likely enough.\n */\nlet totalReentrancyLogs = 3;\n\n/**\n * Resets the reentrancy log counter. Test-only API.\n */\nexport function resetReentrancyLogCounter() {\n\ttotalReentrancyLogs = 3;\n}\n\nconst reentrancyErrorMessage = \"Reentrancy detected in sequence local ops\";\nconst ensureNoReentrancy = createReentrancyDetector(() => {\n\tthrow new LoggingError(reentrancyErrorMessage);\n});\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "2.70.0-361248";
8
+ export declare const pkgVersion = "2.70.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/sequence";
8
- export const pkgVersion = "2.70.0-361248";
8
+ export const pkgVersion = "2.70.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.70.0-361248\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.70.0\";\n"]}
package/lib/sequence.d.ts CHANGED
@@ -4,9 +4,8 @@
4
4
  */
5
5
  import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
6
6
  import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
7
- import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
8
7
  import { Client, IJSONSegment, IMergeTreeGroupMsg, IRelativePosition, ISegment, ISegmentAction, LocalReferencePosition, MergeTreeRevertibleDriver, PropertySet, ReferencePosition, ReferenceType, SlidingPreference, type AdjustParams, type InteriorSequencePlace, type MapLike } from "@fluidframework/merge-tree/internal";
9
- import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
8
+ import { ISummaryTreeWithStats, ITelemetryContext, IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
10
9
  import { IFluidSerializer, ISharedObjectEvents, SharedObject, type ISharedObject } from "@fluidframework/shared-object-base/internal";
11
10
  import { type ISequenceIntervalCollection } from "./intervalCollection.js";
12
11
  import { SequenceDeltaEvent, SequenceMaintenanceEvent } from "./sequenceDeltaEvent.js";
@@ -358,9 +357,10 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
358
357
  */
359
358
  protected loadCore(storage: IChannelStorageService): Promise<void>;
360
359
  /**
361
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
360
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
362
361
  */
363
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
362
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
363
+ private processMessage;
364
364
  /**
365
365
  * {@inheritDoc @fluidframework/shared-object-base#SharedOb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C,OAAO,EAAE,sBAAsB;IAoDxD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAOlF,OAAO,CAAC,cAAc;IAyCtB;;OAEG;IACH,SAAS,CAAC,SAAS;IAQnB;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAK7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAM5C,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAuC3B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,6BAA6B;IAoBrC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CASzB;AA4BD;;GAEG;AACH,wBAAgB,yBAAyB,SAExC"}
package/lib/sequence.js CHANGED
@@ -340,9 +340,21 @@ export class SharedSegmentSequence extends SharedObject {
340
340
  }
341
341
  }
342
342
  /**
343
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
343
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
344
344
  */
345
- processCore(message, local, localOpMetadata) {
345
+ processMessagesCore(messagesCollection) {
346
+ const { envelope, local, messagesContent } = messagesCollection;
347
+ for (const messageContent of messagesContent) {
348
+ this.processMessage(envelope, messageContent, local);
349
+ }
350
+ }
351
+ processMessage(messageEnvelope, messageContent, local) {
352
+ // Reconstruct ISequencedDocumentMessage which is needed by merge tree client
353
+ const message = {
354
+ ...messageEnvelope,
355
+ contents: messageContent.contents,
356
+ clientSequenceNumber: messageContent.clientSequenceNumber,
357
+ };
346
358
  if (local) {
347
359
  const recordedRefSeq = this.inFlightRefSeqs.shift();
348
360
  assert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);
@@ -355,7 +367,7 @@ export class SharedSegmentSequence extends SharedObject {
355
367
  // assert(recordedRefSeq <= message.referenceSequenceNumber, "RefSeq mismatch");
356
368
  }
357
369
  assert(message.type === MessageType.Operation, 0x073 /* "Sequence message not operation" */);
358
- const handled = this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);
370
+ const handled = this.intervalCollections.tryProcessMessage(message.contents, local, message, messageContent.localOpMetadata);
359
371
  if (!handled) {
360
372
  this.processMergeTreeMsg(message, local);
361
373
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EACN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,MAAM,EAcN,kBAAkB,EAMlB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,GAIf,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EACN,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAGN,YAAY,GAEZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAGvC,OAAO,EAAiB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAEN,uBAAuB,EAEvB,6BAA6B,GAC7B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AAgS9B;;GAEG;AACH,MAAM,OAAgB,qBACrB,SAAQ,YAA0C;IAiB1C,MAAM,CAAC,kBAAkB,CAAC,KAAyB;QAC1D,MAAM,GAAG,GAAwB,EAAE,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CA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,CAAC;YACJ,QAAQ,EAAE,CAAC;QACZ,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,qBAAqB,GAAG,sBAAsB,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AAED,SAAS,wBAAwB,CAChC,YAAqC;IAErC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,SAAS,gBAAgB,CAAI,QAAiB;QAC7C,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QACD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC;YACJ,OAAO,QAAQ,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACV,KAAK,EAAE,CAAC;QACT,CAAC;IACF,CAAC;IAED,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACxC,mBAAmB,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,sBAAsB,GAAG,2CAA2C,CAAC;AAC3E,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,GAAG,EAAE;IACxD,MAAM,IAAI,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tIJSONSegment,\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n\tIMergeTreeOp,\n\tIMergeTreeRemoveMsg,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tLocalReferencePosition,\n\tMergeTreeDeltaType,\n\tMergeTreeRevertibleDriver,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\tSlidingPreference,\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateObliterateRangeOp,\n\tcreateRemoveRangeOp,\n\tmatchProperties,\n\ttype AdjustParams,\n\ttype InteriorSequencePlace,\n\ttype MapLike,\n} from \"@fluidframework/merge-tree/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tObjectStoragePartition,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\ttype ISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\tcreateConfigBasedOptionsProxy,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport Deque from \"double-ended-queue\";\n\nimport { type ISequenceIntervalCollection } from \"./intervalCollection.js\";\nimport { IMapOperation, IntervalCollectionMap } from \"./intervalCollectionMap.js\";\nimport { type SequenceOptions } from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\tSequenceDeltaEvent,\n\tSequenceDeltaEventClass,\n\tSequenceMaintenanceEvent,\n\tSequenceMaintenanceEventClass,\n} from \"./sequenceDeltaEvent.js\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n * @legacy @beta\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"createIntervalCollection\",\n\t\tlistener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"sequenceDelta\",\n\t\tlistener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"maintenance\",\n\t\tlistener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISharedSegmentSequence<T extends ISegment>\n\textends ISharedObject<ISharedSegmentSequenceEvents>,\n\t\tMergeTreeRevertibleDriver {\n\t/**\n\t * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n\t * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n\t * @param segment - Segment to add the local reference on\n\t * @param offset - Offset on the segment at which to place the local reference\n\t * @param refType - ReferenceType for the created local reference\n\t * @param properties - PropertySet to place on the created local reference\n\t */\n\tcreateLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition;\n\n\t/**\n\t * Removes a `LocalReferencePosition` from this SharedString.\n\t */\n\tremoveLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined;\n\n\t/**\n\t * Returns the length of the current sequence for the client\n\t */\n\tgetLength(): number;\n\n\t/**\n\t * Returns the current position of a segment, and -1 if the segment\n\t * does not exist in this sequence\n\t * @param segment - The segment to get the position of\n\t */\n\tgetPosition(segment: ISegment): number;\n\n\t/**\n\t * Resolves a `ReferencePosition` into a character position using this client's perspective.\n\t *\n\t * Reference positions that point to a character that has been removed will\n\t * always return the position of the nearest non-removed character, regardless\n\t * of `ReferenceType`. To handle this case specifically, one may wish\n\t * to look at the segment returned by `ReferencePosition.getSegment`.\n\t */\n\tlocalReferencePositionToPosition(lref: ReferencePosition): number;\n\n\t/**\n\t * Walk the underlying segments of the sequence.\n\t * The walked segments may extend beyond the range if the segments cross the\n\t * ranges start or end boundaries.\n\t *\n\t * Set split range to true to ensure only segments within the range are walked.\n\t *\n\t * @param handler - The function to handle each segment. Traversal ends if\n\t * this function returns true.\n\t * @param start - Optional. The start of range walk.\n\t * @param end - Optional. The end of range walk\n\t * @param accum - Optional. An object that will be passed to the handler for accumulation\n\t * @param splitRange - Optional. Splits boundary segments on the range boundaries. Defaults to false.\n\t */\n\twalkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange?: boolean,\n\t): void;\n\n\t/**\n\t * Inserts a segment directly before a `ReferencePosition`.\n\t * @param refPos - The reference position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tinsertAtReferencePosition(pos: ReferencePosition, segment: T): void;\n\n\t/**\n\t * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n\t * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n\t * @param pos - Character position (index) into the current local view of the SharedString.\n\t */\n\tgetContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t};\n\n\tgetPropertiesAtPosition(pos: number): PropertySet | undefined;\n\n\t/**\n\t * @returns An iterable object that enumerates the IntervalCollection labels.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * const iter = this.getIntervalCollectionKeys();\n\t * for (key of iter)\n\t * const collection = this.getIntervalCollection(key);\n\t * ...\n\t * ```\n\t */\n\tgetIntervalCollectionLabels(): IterableIterator<string>;\n\n\t/**\n\t * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n\t * creates one.\n\t */\n\tgetIntervalCollection(label: string): ISequenceIntervalCollection;\n\n\t/**\n\t * Obliterate is similar to remove, but differs in that segments concurrently\n\t * inserted into an obliterated range will also be removed.\n\t * Inserts are considered concurrent to an obliterate iff the insert op's seq is after the obliterate op's refSeq\n\t * and the insert's refSeq is before the obliterates seq.\n\t * Inserts made by the client which most recently obliterated a range containing the insert position\n\t * are not considered concurrent to any obliteration (the last client to obliterate gets the right to insert).\n\t *\n\t * The endpoints can either be inclusive or exclusive.\n\t * Exclusive endpoints allow the obliterated range to \"grow\" to include adjacent concurrently inserted segments on that side.\n\t *\n\t * @param start - The start of the range to obliterate.\n\t * Inclusive if side is Before or a number is provided.\n\t * @param end - The end of the range to obliterate. Inclusive if side is After.\n\t * If a number is provided it is treated as exclusive,\n\t * but the endpoint does not expand in order to preserve existing behavior.\n\t *\n\t * @example Given the initial state `\"|ABC>\"`,\n\t * `obliterateRange({ pos: 0, side: Side.After }, { pos: 4, side: Side.Before })` obliterates `\"ABC\"`, leaving only `\"|>\"`.\n\t * `insertFromSpec(1, { text: \"AAA\"})` would insert `\"AAA\"` before |, resulting in `\"|AAA>\"`.\n\t * If another client does the same thing but inserts `\"BBB\"` and gets sequenced later, all clients will eventually see `|BBB>`.\n\t */\n\tobliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void;\n\n\t/**\n\t * @returns The most recent sequence number which has been acked by the server and processed by this\n\t * SharedSegmentSequence.\n\t */\n\tgetCurrentSeq(): number;\n\n\t/**\n\t * Annotates the range with the provided properties\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n\n\t/**\n\t * Annotates a specified range within the sequence by applying the provided adjustments.\n\t *\n\t * @param start - The inclusive start position of the range to annotate. This is a zero-based index.\n\t * @param end - The exclusive end position of the range to annotate. This is a zero-based index.\n\t * @param adjust - A map-like object specifying the properties to adjust. Each key-value pair represents a property and its corresponding adjustment to be applied over the range.\n\t * An adjustment is defined by an object containing a `delta` to be added to the current property value, and optional `min` and `max` constraints to limit the adjusted value.\n\t *\n\t * @remarks\n\t * The range is defined by the start and end positions, where the start position is inclusive and the end position is exclusive.\n\t * The properties provided in the adjust parameter will be applied to the specified range. Each adjustment modifies the current value of the property by adding the specified `value`.\n\t * If the current value is not a number, the `delta` will be summed with 0 to compute the new value. The optional `min` and `max` constraints are applied after the adjustment to ensure the final value falls within the specified bounds.\n\t */\n\tannotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void;\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tremoveRange(start: number, end: number): void;\n\n\t/**\n\t * Resolves a remote client's position against the local sequence\n\t * and returns the remote client's position relative to the local\n\t * sequence. The client ref seq must be above the minimum sequence number\n\t * or the return value will be undefined.\n\t * Generally this method is used in conjunction with signals which provide\n\t * point in time values for the below parameters, and is useful for things\n\t * like displaying user position. It should not be used with persisted values\n\t * as persisted values will quickly become invalid as the remoteClientRefSeq\n\t * moves below the minimum sequence number\n\t * @param remoteClientPosition - The remote client's position to resolve\n\t * @param remoteClientRefSeq - The reference sequence number of the remote client\n\t * @param remoteClientId - The client id of the remote client\n\t */\n\tresolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined;\n\n\t// #region APIs we might want to remove\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t * @privateRemarks\n\t * TODO: determine if this API (from SharedObject) is needed by users of the encapsulated API, declarative API or both,\n\t * and handle exposing it in a consistent way for all SharedObjects if needed.\n\t */\n\tinitializeLocal(): void;\n\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming\n\t * release, as group ops are redundant with the native batching capabilities\n\t * of the runtime\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tgroupOperation(groupOp: IMergeTreeGroupMsg): void;\n\n\tgetRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t};\n\n\t/**\n\t * Inserts a segment\n\t * @param start - The position to insert the segment at\n\t * @param spec - The segment to inserts spec\n\t */\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\n\t/**\n\t * Given a position specified relative to a marker id, lookup the marker\n\t * and convert the position to a character position.\n\t * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n\n\t// #endregion\n}\n\n/**\n * @internal\n */\nexport abstract class SharedSegmentSequence<T extends ISegment>\n\textends SharedObject<ISharedSegmentSequenceEvents>\n\timplements ISharedSegmentSequence<T>\n{\n\t/**\n\t * This is a safeguard to avoid problematic reentrancy of local ops. This type of scenario occurs if the user of SharedString subscribes\n\t * to the `sequenceDelta` event and uses the callback for a local op to submit further local ops.\n\t * Historically (before 2.0.0-internal.6.1.0), doing so would result in eventual consistency issues or a corrupted document.\n\t * These issues were fixed in #16815 which makes such reentrancy no different from applying the ops in order but not from within the change events,\n\t * but there is still little test coverage for reentrant scenarios.\n\t * Additionally, applications submitting ops from inside change events need to take extreme care that their data models also support reentrancy.\n\t * Since this is likely not the case, by default SharedString throws when encountering reentrant ops.\n\t *\n\t * An application using SharedString which explicitly wants to opt in to allowing reentrancy anyway can set `sharedStringPreventReentrancy`\n\t * on the data store options to `false`.\n\t */\n\tprotected guardReentrancy: <TRet>(callback: () => TRet) => TRet;\n\n\tprivate static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfor (const r of event.ranges) {\n\t\t\tswitch (event.deltaOperation) {\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\tconst lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n\t\t\t\t\tconst props: PropertySet = {};\n\t\t\t\t\tfor (const key of Object.keys(r.propertyDeltas)) {\n\t\t\t\t\t\tprops[key] = r.segment.properties?.[key] ?? null;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tlastAnnotate &&\n\t\t\t\t\t\tlastAnnotate.pos2 === r.position &&\n\t\t\t\t\t\tmatchProperties(lastAnnotate.props, props)\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastAnnotate.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateAnnotateRangeOp(r.position, r.position + r.segment.cachedLength, props),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\t\tops.push(createInsertOp(r.position, r.segment.clone().toJSONObject()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x3ff /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createRemoveRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeObliterateMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x874 /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createObliterateRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treturn ops;\n\t}\n\n\t/**\n\t * Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.\n\t * The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process\n\t * incoming leave/join ops before putting an op that this DDS submits over the wire.\n\t *\n\t * E.g. SharedString submits an op while deltaManager has lastSequenceNumber = 10, but before the runtime\n\t * puts this op over the wire, it processes a client join/leave op with sequence number 11, so the referenceSequenceNumber\n\t * on the SharedString op is 11.\n\t *\n\t * The reference sequence numbers placed in this queue are also not accurate for stashed ops due to how the applyStashedOp\n\t * flow works at the runtime level. This is a legitimate bug, and AB#6602 tracks one way to fix it (stop reaching all the way\n\t * to deltaManager's lastSequenceNumber to obtain refSeq, instead leveraging some analogous notion on the container or datastore\n\t * runtime).\n\t */\n\tprivate readonly inFlightRefSeqs = new Deque<number>();\n\n\tprivate ongoingResubmitRefSeq: number | undefined;\n\n\t/**\n\t * Gets the reference sequence number (i.e. sequence number of the runtime's last processed op) for an op submitted\n\t * in the current context.\n\t *\n\t * This value can be optionally overridden using `useResubmitRefSeq`.\n\t * IntervalCollection's resubmit logic currently relies on preserving merge information from when the op was originally submitted,\n\t * even if the op is resubmitted more than once. Thus during resubmit, `inFlightRefSeqs` gets populated with the\n\t * original refSeq rather than the refSeq at the time of reconnection.\n\t *\n\t * @remarks In some not fully understood cases, the runtime may process incoming ops before putting an op that this\n\t * DDS submits over the wire. See `inFlightRefSeqs` for more details.\n\t */\n\tprivate get currentRefSeq() {\n\t\treturn this.ongoingResubmitRefSeq ?? this.deltaManager.lastSequenceNumber;\n\t}\n\n\tprotected client: Client;\n\tprivate messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n\tprivate readonly intervalCollections: IntervalCollectionMap;\n\tconstructor(\n\t\tdataStoreRuntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tpublic readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n\t\tconst getMinInFlightRefSeq = () => this.inFlightRefSeqs.get(0);\n\t\tthis.guardReentrancy =\n\t\t\t(dataStoreRuntime.options.sharedStringPreventReentrancy ?? true)\n\t\t\t\t? ensureNoReentrancy\n\t\t\t\t: createReentrancyDetector((depth) => {\n\t\t\t\t\t\tif (totalReentrancyLogs > 0) {\n\t\t\t\t\t\t\ttotalReentrancyLogs--;\n\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t\t\t{ eventName: \"LocalOpReentry\", depth },\n\t\t\t\t\t\t\t\tnew LoggingError(reentrancyErrorMessage),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\tconst options = createConfigBasedOptionsProxy<SequenceOptions>(\n\t\t\tloggerToMonitoringContext(this.logger).config,\n\t\t\t\"Fluid.Sequence\",\n\t\t\t{\n\t\t\t\tmergeTreeEnableObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableSidedObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tintervalStickinessEnabled: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeReferencesCanSlideToEndpoint: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableAnnotateAdjust: (c, n) => c.getBoolean(n),\n\t\t\t},\n\t\t\tdataStoreRuntime.options,\n\t\t);\n\n\t\tthis.client = new Client(\n\t\t\tsegmentFromSpec,\n\t\t\tcreateChildLogger({\n\t\t\t\tlogger: this.logger,\n\t\t\t\tnamespace: \"SharedSegmentSequence.MergeTreeClient\",\n\t\t\t}),\n\t\t\toptions,\n\t\t\tgetMinInFlightRefSeq,\n\t\t);\n\n\t\tthis.client.prependListener(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tconst event = new SequenceDeltaEventClass(opArgs, deltaArgs, this.client);\n\t\t\tif (event.isLocal && event.opArgs.rollback !== true) {\n\t\t\t\tthis.submitSequenceMessage(opArgs.op);\n\t\t\t}\n\t\t\tif (deltaArgs.deltaSegments.length > 0) {\n\t\t\t\tthis.emit(\"sequenceDelta\", event, this);\n\t\t\t}\n\t\t});\n\n\t\tthis.client.on(\"maintenance\", (args, opArgs) => {\n\t\t\tthis.emit(\n\t\t\t\t\"maintenance\",\n\t\t\t\tnew SequenceMaintenanceEventClass(opArgs, args, this.client),\n\t\t\t\tthis,\n\t\t\t);\n\t\t});\n\n\t\tthis.intervalCollections = new IntervalCollectionMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => {\n\t\t\t\tif (!this.isAttached()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\t\t\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic removeRange(start: number, end: number): void {\n\t\tthis.guardReentrancy(() => this.client.removeRangeLocal(start, end));\n\t}\n\n\tpublic obliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void {\n\t\tthis.guardReentrancy(() => this.client.obliterateRangeLocal(start, end));\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic groupOperation(groupOp: IMergeTreeGroupMsg): void {\n\t\tthis.guardReentrancy(() => this.client.localTransaction(groupOp));\n\t}\n\n\tpublic getContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t} {\n\t\treturn (\n\t\t\tthis.client.getContainingSegment<T>(pos) ?? { segment: undefined, offset: undefined }\n\t\t);\n\t}\n\n\tpublic getLength(): number {\n\t\treturn this.client.getLength();\n\t}\n\n\tpublic getPosition(segment: ISegment): number {\n\t\treturn this.client.getPosition(segment);\n\t}\n\n\tpublic annotateRange(start: number, end: number, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));\n\t}\n\n\tpublic annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void {\n\t\tthis.guardReentrancy(() => this.client.annotateAdjustRangeLocal(start, end, adjust));\n\t}\n\n\tpublic getPropertiesAtPosition(pos: number): PropertySet | undefined {\n\t\treturn this.client.getPropertiesAtPosition(pos);\n\t}\n\n\tpublic getRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t} {\n\t\treturn this.client.getRangeExtentsOfPosition(pos);\n\t}\n\n\tpublic createLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition {\n\t\treturn this.client.createLocalReferencePosition(\n\t\t\tsegment,\n\t\t\toffset,\n\t\t\trefType,\n\t\t\tproperties,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tpublic localReferencePositionToPosition(lref: ReferencePosition): number {\n\t\treturn this.client.localReferencePositionToPosition(lref);\n\t}\n\n\tpublic removeLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined {\n\t\treturn this.client.removeLocalReferencePosition(lref);\n\t}\n\n\tpublic resolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined {\n\t\treturn this.client.resolveRemoteClientPosition(\n\t\t\tremoteClientPosition,\n\t\t\tremoteClientRefSeq,\n\t\t\tremoteClientId,\n\t\t);\n\t}\n\n\tprivate submitSequenceMessage(message: IMergeTreeOp) {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\n\t\tconst metadata = this.client.peekPendingSegmentGroups(\n\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t);\n\n\t\tthis.submitLocalMessage(message, metadata);\n\t}\n\n\tpublic posFromRelativePos(relativePos: IRelativePosition): number {\n\t\treturn this.client.posFromRelativePos(relativePos);\n\t}\n\n\tpublic walkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange: boolean = false,\n\t): void {\n\t\tthis.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n\t}\n\n\tpublic getCurrentSeq(): number {\n\t\treturn this.client.getCurrentSeq();\n\t}\n\n\tpublic insertAtReferencePosition(pos: ReferencePosition, segment: T): void {\n\t\tthis.guardReentrancy(() => this.client.insertAtReferencePositionLocal(pos, segment));\n\t}\n\n\tpublic insertFromSpec(pos: number, spec: IJSONSegment): void {\n\t\tconst segment = this.segmentFromSpec(spec);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\tpublic getIntervalCollection(label: string): ISequenceIntervalCollection {\n\t\treturn this.intervalCollections.get(label);\n\t}\n\n\tpublic getIntervalCollectionLabels(): IterableIterator<string> {\n\t\treturn this.intervalCollections.keys();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// conditionally write the interval collection blob\n\t\t// only if it has entries\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tbuilder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n\t\t}\n\n\t\tbuilder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer over the GC data for this SharedMatrix.\n\t * All the IFluidHandle's represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: IFluidSerializer) {\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tthis.intervalCollections.serialize(serializer);\n\t\t}\n\n\t\tthis.client.serializeGCData(this.handle, serializer);\n\t}\n\n\t/**\n\t * Replace the range specified from start to end with the provided segment\n\t * This is done by inserting the segment at the end of the range, followed\n\t * by removing the contents of the range\n\t * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n\t * @param start - The start of the range to replace\n\t * @param end - The end of the range to replace\n\t * @param segment - The segment that will replace the range\n\t */\n\tprotected replaceRange(start: number, end: number, segment: ISegment): void {\n\t\t// Insert at the max end of the range when start > end, but still remove the range later\n\t\tconst insertIndex: number = Math.max(start, end);\n\n\t\t// Insert first, so local references can slide to the inserted seg if any\n\t\tconst insert = this.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(insertIndex, segment),\n\t\t);\n\n\t\tif (insert && start < end) {\n\t\t\tthis.removeRange(start, end);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n\t */\n\tprotected onConnect() {\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown, squash: boolean = false) {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.shift();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0x8bb /* Expected a recorded refSeq when resubmitting an op */,\n\t\t);\n\t\tthis.useResubmitRefSeq(originalRefSeq, () => {\n\t\t\tif (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata, squash)) {\n\t\t\t\tthis.submitSequenceMessage(\n\t\t\t\t\tthis.client.regeneratePendingOp(content as IMergeTreeOp, localOpMetadata, squash),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected reSubmitSquashed(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.reSubmitCore(content, localOpMetadata, true);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.pop();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0xb7f /* Expected a recorded refSeq when rolling back an op */,\n\t\t);\n\n\t\tif (!this.intervalCollections.tryRollback(content, localOpMetadata)) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tif (await storage.contains(snapshotFileName)) {\n\t\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\t\tconst header = bufferToString(blob, \"utf8\");\n\t\t\tthis.intervalCollections.populate(header);\n\t\t}\n\n\t\ttry {\n\t\t\t// this will load the header, and return a promise\n\t\t\t// that will resolve when the body is loaded\n\t\t\t// and the catchup ops are available.\n\t\t\tconst { catchupOpsP } = await this.client.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, contentPath),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\n\t\t\t// process the catch up ops, and finishing the loading process\n\t\t\t(await catchupOpsP).forEach((m) => {\n\t\t\t\tconst collabWindow = this.client.getCollabWindow();\n\t\t\t\tif (\n\t\t\t\t\tm.minimumSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.referenceSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.sequenceNumber <= collabWindow.minSeq ||\n\t\t\t\t\t// sequenceNumber could be the same if messages are part of a grouped batch\n\t\t\t\t\tm.sequenceNumber < collabWindow.currentSeq\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid catchup operations in snapshot: ${JSON.stringify({\n\t\t\t\t\t\t\top: {\n\t\t\t\t\t\t\t\tseq: m.sequenceNumber,\n\t\t\t\t\t\t\t\tminSeq: m.minimumSequenceNumber,\n\t\t\t\t\t\t\t\trefSeq: m.referenceSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcollabWindow: {\n\t\t\t\t\t\t\t\tseq: collabWindow.currentSeq,\n\t\t\t\t\t\t\t\tminSeq: collabWindow.minSeq,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.processMergeTreeMsg(m);\n\t\t\t});\n\n\t\t\t// Initialize the interval collections\n\t\t\tthis.initializeIntervalCollections();\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (local) {\n\t\t\tconst recordedRefSeq = this.inFlightRefSeqs.shift();\n\t\t\tassert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);\n\t\t\t// TODO: AB#7076: Some equivalent assert should be enabled. This fails some e2e stashed op tests because\n\t\t\t// the deltaManager may have seen more messages than the runtime has processed while amidst the stashed op\n\t\t\t// flow, so e.g. when `applyStashedOp` is called and the DDS is put in a state where it expects an ack for\n\t\t\t// one of its messages, the delta manager has actually already seen subsequent messages from collaborators\n\t\t\t// which the in-flight message is concurrent to.\n\t\t\t// See \"handles stashed ops created on top of sequenced local ops\" for one such test case.\n\t\t\t// assert(recordedRefSeq <= message.referenceSequenceNumber, \"RefSeq mismatch\");\n\t\t}\n\n\t\tassert(\n\t\t\tmessage.type === MessageType.Operation,\n\t\t\t0x073 /* \"Sequence message not operation\" */,\n\t\t);\n\n\t\tconst handled = this.intervalCollections.tryProcessMessage(\n\t\t\tmessage.contents as IMapOperation,\n\t\t\tlocal,\n\t\t\tmessage,\n\t\t\tlocalOpMetadata,\n\t\t);\n\n\t\tif (!handled) {\n\t\t\tthis.processMergeTreeMsg(message, local);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n\t */\n\tprotected didAttach() {\n\t\t// If we are not local, and we've attached we need to start generating and sending ops\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n\t */\n\tprotected initializeLocalCore() {\n\t\tsuper.initializeLocalCore();\n\t\tthis.initializeIntervalCollections();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): void {\n\t\tif (!this.intervalCollections.tryApplyStashedOp(content)) {\n\t\t\tthis.client.applyStashedOp(content);\n\t\t}\n\t}\n\n\tprivate summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst minSeq = this.deltaManager.minimumSequenceNumber;\n\n\t\tthis.processMinSequenceNumberChanged(minSeq);\n\n\t\tthis.messagesSinceMSNChange.forEach((m) => {\n\t\t\tm.minimumSequenceNumber = minSeq;\n\t\t});\n\n\t\treturn this.client.summarize(\n\t\t\tthis.runtime,\n\t\t\tthis.handle,\n\t\t\tserializer,\n\t\t\tthis.messagesSinceMSNChange,\n\t\t);\n\t}\n\n\t/**\n\t *\n\t * @param message - Message with decoded and hydrated handles\n\t */\n\tprivate processMergeTreeMsg(message: ISequencedDocumentMessage, local?: boolean) {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfunction transformOps(event: SequenceDeltaEvent) {\n\t\t\tops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n\t\t}\n\t\tconst needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n\t\tlet stashMessage: Readonly<ISequencedDocumentMessage> = message;\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.on(\"sequenceDelta\", transformOps);\n\t\t\t}\n\t\t}\n\n\t\tthis.client.applyMsg(message, local);\n\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.removeListener(\"sequenceDelta\", transformOps);\n\t\t\t\t// shallow clone the message as we only overwrite top level properties,\n\t\t\t\t// like referenceSequenceNumber and content only\n\t\t\t\tstashMessage = {\n\t\t\t\t\t...message,\n\t\t\t\t\treferenceSequenceNumber: stashMessage.sequenceNumber - 1,\n\t\t\t\t\tcontents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.messagesSinceMSNChange.push(stashMessage);\n\n\t\t\t// Do GC every once in a while...\n\t\t\tif (\n\t\t\t\tthis.messagesSinceMSNChange.length > 20 &&\n\t\t\t\tthis.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber\n\t\t\t) {\n\t\t\t\tthis.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processMinSequenceNumberChanged(minSeq: number) {\n\t\tlet index = 0;\n\t\tfor (; index < this.messagesSinceMSNChange.length; index++) {\n\t\t\tif (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (index !== 0) {\n\t\t\tthis.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n\t\t}\n\t}\n\n\tprivate initializeIntervalCollections() {\n\t\t// Listen and initialize new SharedIntervalCollections\n\t\tthis.intervalCollections.events.on(\n\t\t\t\"createIntervalCollection\",\n\t\t\t(key: string, local: boolean) => {\n\t\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\t\tif (!intervalCollection.attached) {\n\t\t\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t\t\t}\n\t\t\t\tthis.emit(\"createIntervalCollection\", key, local, this);\n\t\t\t},\n\t\t);\n\n\t\t// Initialize existing SharedIntervalCollections\n\t\tfor (const key of this.intervalCollections.keys()) {\n\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t}\n\t}\n\n\t/**\n\t * Overrides the \"currently applicable reference sequence number\" for the duration of the callback.\n\t * See remarks on `currentRefSeq` for more context.\n\t */\n\tprivate useResubmitRefSeq(refSeq: number, callback: () => void) {\n\t\tconst previousResubmitRefSeq = this.ongoingResubmitRefSeq;\n\t\tthis.ongoingResubmitRefSeq = refSeq;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.ongoingResubmitRefSeq = previousResubmitRefSeq;\n\t\t}\n\t}\n}\n\nfunction createReentrancyDetector(\n\tonReentrancy: (depth: number) => void,\n): <T>(callback: () => T) => T {\n\tlet depth = 0;\n\tfunction detectReentrancy<T>(callback: () => T): T {\n\t\tif (depth > 0) {\n\t\t\tonReentrancy(depth);\n\t\t}\n\t\tdepth++;\n\t\ttry {\n\t\t\treturn callback();\n\t\t} finally {\n\t\t\tdepth--;\n\t\t}\n\t}\n\n\treturn detectReentrancy;\n}\n\n/**\n * Apps which generate reentrant behavior may do so at a high frequency.\n * Logging even per-SharedSegmentSequence instance might be too noisy, and having a few logs from a session\n * is likely enough.\n */\nlet totalReentrancyLogs = 3;\n\n/**\n * Resets the reentrancy log counter. Test-only API.\n */\nexport function resetReentrancyLogCounter() {\n\ttotalReentrancyLogs = 3;\n}\n\nconst reentrancyErrorMessage = \"Reentrancy detected in sequence local ops\";\nconst ensureNoReentrancy = createReentrancyDetector(() => {\n\tthrow new LoggingError(reentrancyErrorMessage);\n});\n"]}
1
+ {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EACN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,MAAM,EAcN,kBAAkB,EAMlB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,GAIf,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EACN,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAGN,YAAY,GAEZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAGvC,OAAO,EAAiB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAEN,uBAAuB,EAEvB,6BAA6B,GAC7B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAA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,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,sBAAsB,GAAG,2CAA2C,CAAC;AAC3E,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,GAAG,EAAE;IACxD,MAAM,IAAI,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tIJSONSegment,\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n\tIMergeTreeOp,\n\tIMergeTreeRemoveMsg,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tLocalReferencePosition,\n\tMergeTreeDeltaType,\n\tMergeTreeRevertibleDriver,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\tSlidingPreference,\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateObliterateRangeOp,\n\tcreateRemoveRangeOp,\n\tmatchProperties,\n\ttype AdjustParams,\n\ttype InteriorSequencePlace,\n\ttype MapLike,\n} from \"@fluidframework/merge-tree/internal\";\nimport {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIRuntimeMessageCollection,\n\tIRuntimeMessagesContent,\n\tISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tObjectStoragePartition,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tSharedObject,\n\ttype ISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tLoggingError,\n\tcreateChildLogger,\n\tcreateConfigBasedOptionsProxy,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport Deque from \"double-ended-queue\";\n\nimport { type ISequenceIntervalCollection } from \"./intervalCollection.js\";\nimport { IMapOperation, IntervalCollectionMap } from \"./intervalCollectionMap.js\";\nimport { type SequenceOptions } from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\tSequenceDeltaEvent,\n\tSequenceDeltaEventClass,\n\tSequenceMaintenanceEvent,\n\tSequenceMaintenanceEventClass,\n} from \"./sequenceDeltaEvent.js\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n * @legacy @beta\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"createIntervalCollection\",\n\t\tlistener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"sequenceDelta\",\n\t\tlistener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n\t(\n\t\tevent: \"maintenance\",\n\t\tlistener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,\n\t): void;\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISharedSegmentSequence<T extends ISegment>\n\textends ISharedObject<ISharedSegmentSequenceEvents>,\n\t\tMergeTreeRevertibleDriver {\n\t/**\n\t * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n\t * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n\t * @param segment - Segment to add the local reference on\n\t * @param offset - Offset on the segment at which to place the local reference\n\t * @param refType - ReferenceType for the created local reference\n\t * @param properties - PropertySet to place on the created local reference\n\t */\n\tcreateLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition;\n\n\t/**\n\t * Removes a `LocalReferencePosition` from this SharedString.\n\t */\n\tremoveLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined;\n\n\t/**\n\t * Returns the length of the current sequence for the client\n\t */\n\tgetLength(): number;\n\n\t/**\n\t * Returns the current position of a segment, and -1 if the segment\n\t * does not exist in this sequence\n\t * @param segment - The segment to get the position of\n\t */\n\tgetPosition(segment: ISegment): number;\n\n\t/**\n\t * Resolves a `ReferencePosition` into a character position using this client's perspective.\n\t *\n\t * Reference positions that point to a character that has been removed will\n\t * always return the position of the nearest non-removed character, regardless\n\t * of `ReferenceType`. To handle this case specifically, one may wish\n\t * to look at the segment returned by `ReferencePosition.getSegment`.\n\t */\n\tlocalReferencePositionToPosition(lref: ReferencePosition): number;\n\n\t/**\n\t * Walk the underlying segments of the sequence.\n\t * The walked segments may extend beyond the range if the segments cross the\n\t * ranges start or end boundaries.\n\t *\n\t * Set split range to true to ensure only segments within the range are walked.\n\t *\n\t * @param handler - The function to handle each segment. Traversal ends if\n\t * this function returns true.\n\t * @param start - Optional. The start of range walk.\n\t * @param end - Optional. The end of range walk\n\t * @param accum - Optional. An object that will be passed to the handler for accumulation\n\t * @param splitRange - Optional. Splits boundary segments on the range boundaries. Defaults to false.\n\t */\n\twalkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange?: boolean,\n\t): void;\n\n\t/**\n\t * Inserts a segment directly before a `ReferencePosition`.\n\t * @param refPos - The reference position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tinsertAtReferencePosition(pos: ReferencePosition, segment: T): void;\n\n\t/**\n\t * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n\t * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n\t * @param pos - Character position (index) into the current local view of the SharedString.\n\t */\n\tgetContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t};\n\n\tgetPropertiesAtPosition(pos: number): PropertySet | undefined;\n\n\t/**\n\t * @returns An iterable object that enumerates the IntervalCollection labels.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * const iter = this.getIntervalCollectionKeys();\n\t * for (key of iter)\n\t * const collection = this.getIntervalCollection(key);\n\t * ...\n\t * ```\n\t */\n\tgetIntervalCollectionLabels(): IterableIterator<string>;\n\n\t/**\n\t * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n\t * creates one.\n\t */\n\tgetIntervalCollection(label: string): ISequenceIntervalCollection;\n\n\t/**\n\t * Obliterate is similar to remove, but differs in that segments concurrently\n\t * inserted into an obliterated range will also be removed.\n\t * Inserts are considered concurrent to an obliterate iff the insert op's seq is after the obliterate op's refSeq\n\t * and the insert's refSeq is before the obliterates seq.\n\t * Inserts made by the client which most recently obliterated a range containing the insert position\n\t * are not considered concurrent to any obliteration (the last client to obliterate gets the right to insert).\n\t *\n\t * The endpoints can either be inclusive or exclusive.\n\t * Exclusive endpoints allow the obliterated range to \"grow\" to include adjacent concurrently inserted segments on that side.\n\t *\n\t * @param start - The start of the range to obliterate.\n\t * Inclusive if side is Before or a number is provided.\n\t * @param end - The end of the range to obliterate. Inclusive if side is After.\n\t * If a number is provided it is treated as exclusive,\n\t * but the endpoint does not expand in order to preserve existing behavior.\n\t *\n\t * @example Given the initial state `\"|ABC>\"`,\n\t * `obliterateRange({ pos: 0, side: Side.After }, { pos: 4, side: Side.Before })` obliterates `\"ABC\"`, leaving only `\"|>\"`.\n\t * `insertFromSpec(1, { text: \"AAA\"})` would insert `\"AAA\"` before |, resulting in `\"|AAA>\"`.\n\t * If another client does the same thing but inserts `\"BBB\"` and gets sequenced later, all clients will eventually see `|BBB>`.\n\t */\n\tobliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void;\n\n\t/**\n\t * @returns The most recent sequence number which has been acked by the server and processed by this\n\t * SharedSegmentSequence.\n\t */\n\tgetCurrentSeq(): number;\n\n\t/**\n\t * Annotates the range with the provided properties\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n\n\t/**\n\t * Annotates a specified range within the sequence by applying the provided adjustments.\n\t *\n\t * @param start - The inclusive start position of the range to annotate. This is a zero-based index.\n\t * @param end - The exclusive end position of the range to annotate. This is a zero-based index.\n\t * @param adjust - A map-like object specifying the properties to adjust. Each key-value pair represents a property and its corresponding adjustment to be applied over the range.\n\t * An adjustment is defined by an object containing a `delta` to be added to the current property value, and optional `min` and `max` constraints to limit the adjusted value.\n\t *\n\t * @remarks\n\t * The range is defined by the start and end positions, where the start position is inclusive and the end position is exclusive.\n\t * The properties provided in the adjust parameter will be applied to the specified range. Each adjustment modifies the current value of the property by adding the specified `value`.\n\t * If the current value is not a number, the `delta` will be summed with 0 to compute the new value. The optional `min` and `max` constraints are applied after the adjustment to ensure the final value falls within the specified bounds.\n\t */\n\tannotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void;\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tremoveRange(start: number, end: number): void;\n\n\t/**\n\t * Resolves a remote client's position against the local sequence\n\t * and returns the remote client's position relative to the local\n\t * sequence. The client ref seq must be above the minimum sequence number\n\t * or the return value will be undefined.\n\t * Generally this method is used in conjunction with signals which provide\n\t * point in time values for the below parameters, and is useful for things\n\t * like displaying user position. It should not be used with persisted values\n\t * as persisted values will quickly become invalid as the remoteClientRefSeq\n\t * moves below the minimum sequence number\n\t * @param remoteClientPosition - The remote client's position to resolve\n\t * @param remoteClientRefSeq - The reference sequence number of the remote client\n\t * @param remoteClientId - The client id of the remote client\n\t */\n\tresolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined;\n\n\t// #region APIs we might want to remove\n\t/**\n\t * Initializes the object as a local, non-shared object. This object can become shared after\n\t * it is attached to the document.\n\t * @privateRemarks\n\t * TODO: determine if this API (from SharedObject) is needed by users of the encapsulated API, declarative API or both,\n\t * and handle exposing it in a consistent way for all SharedObjects if needed.\n\t */\n\tinitializeLocal(): void;\n\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming\n\t * release, as group ops are redundant with the native batching capabilities\n\t * of the runtime\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tgroupOperation(groupOp: IMergeTreeGroupMsg): void;\n\n\tgetRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t};\n\n\t/**\n\t * Inserts a segment\n\t * @param start - The position to insert the segment at\n\t * @param spec - The segment to inserts spec\n\t */\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\n\t/**\n\t * Given a position specified relative to a marker id, lookup the marker\n\t * and convert the position to a character position.\n\t * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n\n\t// #endregion\n}\n\n/**\n * @internal\n */\nexport abstract class SharedSegmentSequence<T extends ISegment>\n\textends SharedObject<ISharedSegmentSequenceEvents>\n\timplements ISharedSegmentSequence<T>\n{\n\t/**\n\t * This is a safeguard to avoid problematic reentrancy of local ops. This type of scenario occurs if the user of SharedString subscribes\n\t * to the `sequenceDelta` event and uses the callback for a local op to submit further local ops.\n\t * Historically (before 2.0.0-internal.6.1.0), doing so would result in eventual consistency issues or a corrupted document.\n\t * These issues were fixed in #16815 which makes such reentrancy no different from applying the ops in order but not from within the change events,\n\t * but there is still little test coverage for reentrant scenarios.\n\t * Additionally, applications submitting ops from inside change events need to take extreme care that their data models also support reentrancy.\n\t * Since this is likely not the case, by default SharedString throws when encountering reentrant ops.\n\t *\n\t * An application using SharedString which explicitly wants to opt in to allowing reentrancy anyway can set `sharedStringPreventReentrancy`\n\t * on the data store options to `false`.\n\t */\n\tprotected guardReentrancy: <TRet>(callback: () => TRet) => TRet;\n\n\tprivate static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfor (const r of event.ranges) {\n\t\t\tswitch (event.deltaOperation) {\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\tconst lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n\t\t\t\t\tconst props: PropertySet = {};\n\t\t\t\t\tfor (const key of Object.keys(r.propertyDeltas)) {\n\t\t\t\t\t\tprops[key] = r.segment.properties?.[key] ?? null;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tlastAnnotate &&\n\t\t\t\t\t\tlastAnnotate.pos2 === r.position &&\n\t\t\t\t\t\tmatchProperties(lastAnnotate.props, props)\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastAnnotate.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateAnnotateRangeOp(r.position, r.position + r.segment.cachedLength, props),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\t\tops.push(createInsertOp(r.position, r.segment.clone().toJSONObject()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x3ff /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createRemoveRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeObliterateMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(lastRem.pos2 !== undefined, 0x874 /* pos2 should not be undefined here */);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(createObliterateRangeOp(r.position, r.position + r.segment.cachedLength));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treturn ops;\n\t}\n\n\t/**\n\t * Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.\n\t * The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process\n\t * incoming leave/join ops before putting an op that this DDS submits over the wire.\n\t *\n\t * E.g. SharedString submits an op while deltaManager has lastSequenceNumber = 10, but before the runtime\n\t * puts this op over the wire, it processes a client join/leave op with sequence number 11, so the referenceSequenceNumber\n\t * on the SharedString op is 11.\n\t *\n\t * The reference sequence numbers placed in this queue are also not accurate for stashed ops due to how the applyStashedOp\n\t * flow works at the runtime level. This is a legitimate bug, and AB#6602 tracks one way to fix it (stop reaching all the way\n\t * to deltaManager's lastSequenceNumber to obtain refSeq, instead leveraging some analogous notion on the container or datastore\n\t * runtime).\n\t */\n\tprivate readonly inFlightRefSeqs = new Deque<number>();\n\n\tprivate ongoingResubmitRefSeq: number | undefined;\n\n\t/**\n\t * Gets the reference sequence number (i.e. sequence number of the runtime's last processed op) for an op submitted\n\t * in the current context.\n\t *\n\t * This value can be optionally overridden using `useResubmitRefSeq`.\n\t * IntervalCollection's resubmit logic currently relies on preserving merge information from when the op was originally submitted,\n\t * even if the op is resubmitted more than once. Thus during resubmit, `inFlightRefSeqs` gets populated with the\n\t * original refSeq rather than the refSeq at the time of reconnection.\n\t *\n\t * @remarks In some not fully understood cases, the runtime may process incoming ops before putting an op that this\n\t * DDS submits over the wire. See `inFlightRefSeqs` for more details.\n\t */\n\tprivate get currentRefSeq() {\n\t\treturn this.ongoingResubmitRefSeq ?? this.deltaManager.lastSequenceNumber;\n\t}\n\n\tprotected client: Client;\n\tprivate messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n\tprivate readonly intervalCollections: IntervalCollectionMap;\n\tconstructor(\n\t\tdataStoreRuntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tpublic readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n\t\tconst getMinInFlightRefSeq = () => this.inFlightRefSeqs.get(0);\n\t\tthis.guardReentrancy =\n\t\t\t(dataStoreRuntime.options.sharedStringPreventReentrancy ?? true)\n\t\t\t\t? ensureNoReentrancy\n\t\t\t\t: createReentrancyDetector((depth) => {\n\t\t\t\t\t\tif (totalReentrancyLogs > 0) {\n\t\t\t\t\t\t\ttotalReentrancyLogs--;\n\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t\t\t{ eventName: \"LocalOpReentry\", depth },\n\t\t\t\t\t\t\t\tnew LoggingError(reentrancyErrorMessage),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\tconst options = createConfigBasedOptionsProxy<SequenceOptions>(\n\t\t\tloggerToMonitoringContext(this.logger).config,\n\t\t\t\"Fluid.Sequence\",\n\t\t\t{\n\t\t\t\tmergeTreeEnableObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableSidedObliterate: (c, n) => c.getBoolean(n),\n\t\t\t\tintervalStickinessEnabled: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeReferencesCanSlideToEndpoint: (c, n) => c.getBoolean(n),\n\t\t\t\tmergeTreeEnableAnnotateAdjust: (c, n) => c.getBoolean(n),\n\t\t\t},\n\t\t\tdataStoreRuntime.options,\n\t\t);\n\n\t\tthis.client = new Client(\n\t\t\tsegmentFromSpec,\n\t\t\tcreateChildLogger({\n\t\t\t\tlogger: this.logger,\n\t\t\t\tnamespace: \"SharedSegmentSequence.MergeTreeClient\",\n\t\t\t}),\n\t\t\toptions,\n\t\t\tgetMinInFlightRefSeq,\n\t\t);\n\n\t\tthis.client.prependListener(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tconst event = new SequenceDeltaEventClass(opArgs, deltaArgs, this.client);\n\t\t\tif (event.isLocal && event.opArgs.rollback !== true) {\n\t\t\t\tthis.submitSequenceMessage(opArgs.op);\n\t\t\t}\n\t\t\tif (deltaArgs.deltaSegments.length > 0) {\n\t\t\t\tthis.emit(\"sequenceDelta\", event, this);\n\t\t\t}\n\t\t});\n\n\t\tthis.client.on(\"maintenance\", (args, opArgs) => {\n\t\t\tthis.emit(\n\t\t\t\t\"maintenance\",\n\t\t\t\tnew SequenceMaintenanceEventClass(opArgs, args, this.client),\n\t\t\t\tthis,\n\t\t\t);\n\t\t});\n\n\t\tthis.intervalCollections = new IntervalCollectionMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => {\n\t\t\t\tif (!this.isAttached()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\t\t\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic removeRange(start: number, end: number): void {\n\t\tthis.guardReentrancy(() => this.client.removeRangeLocal(start, end));\n\t}\n\n\tpublic obliterateRange(\n\t\tstart: number | InteriorSequencePlace,\n\t\tend: number | InteriorSequencePlace,\n\t): void {\n\t\tthis.guardReentrancy(() => this.client.obliterateRangeLocal(start, end));\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic groupOperation(groupOp: IMergeTreeGroupMsg): void {\n\t\tthis.guardReentrancy(() => this.client.localTransaction(groupOp));\n\t}\n\n\tpublic getContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t} {\n\t\treturn (\n\t\t\tthis.client.getContainingSegment<T>(pos) ?? { segment: undefined, offset: undefined }\n\t\t);\n\t}\n\n\tpublic getLength(): number {\n\t\treturn this.client.getLength();\n\t}\n\n\tpublic getPosition(segment: ISegment): number {\n\t\treturn this.client.getPosition(segment);\n\t}\n\n\tpublic annotateRange(start: number, end: number, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));\n\t}\n\n\tpublic annotateAdjustRange(start: number, end: number, adjust: MapLike<AdjustParams>): void {\n\t\tthis.guardReentrancy(() => this.client.annotateAdjustRangeLocal(start, end, adjust));\n\t}\n\n\tpublic getPropertiesAtPosition(pos: number): PropertySet | undefined {\n\t\treturn this.client.getPropertiesAtPosition(pos);\n\t}\n\n\tpublic getRangeExtentsOfPosition(pos: number): {\n\t\tposStart: number | undefined;\n\t\tposAfterEnd: number | undefined;\n\t} {\n\t\treturn this.client.getRangeExtentsOfPosition(pos);\n\t}\n\n\tpublic createLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t\tslidingPreference?: SlidingPreference,\n\t\tcanSlideToEndpoint?: boolean,\n\t): LocalReferencePosition {\n\t\treturn this.client.createLocalReferencePosition(\n\t\t\tsegment,\n\t\t\toffset,\n\t\t\trefType,\n\t\t\tproperties,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tpublic localReferencePositionToPosition(lref: ReferencePosition): number {\n\t\treturn this.client.localReferencePositionToPosition(lref);\n\t}\n\n\tpublic removeLocalReferencePosition(\n\t\tlref: LocalReferencePosition,\n\t): LocalReferencePosition | undefined {\n\t\treturn this.client.removeLocalReferencePosition(lref);\n\t}\n\n\tpublic resolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined {\n\t\treturn this.client.resolveRemoteClientPosition(\n\t\t\tremoteClientPosition,\n\t\t\tremoteClientRefSeq,\n\t\t\tremoteClientId,\n\t\t);\n\t}\n\n\tprivate submitSequenceMessage(message: IMergeTreeOp) {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.inFlightRefSeqs.push(this.currentRefSeq);\n\n\t\tconst metadata = this.client.peekPendingSegmentGroups(\n\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t);\n\n\t\tthis.submitLocalMessage(message, metadata);\n\t}\n\n\tpublic posFromRelativePos(relativePos: IRelativePosition): number {\n\t\treturn this.client.posFromRelativePos(relativePos);\n\t}\n\n\tpublic walkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange: boolean = false,\n\t): void {\n\t\tthis.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n\t}\n\n\tpublic getCurrentSeq(): number {\n\t\treturn this.client.getCurrentSeq();\n\t}\n\n\tpublic insertAtReferencePosition(pos: ReferencePosition, segment: T): void {\n\t\tthis.guardReentrancy(() => this.client.insertAtReferencePositionLocal(pos, segment));\n\t}\n\n\tpublic insertFromSpec(pos: number, spec: IJSONSegment): void {\n\t\tconst segment = this.segmentFromSpec(spec);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\tpublic getIntervalCollection(label: string): ISequenceIntervalCollection {\n\t\treturn this.intervalCollections.get(label);\n\t}\n\n\tpublic getIntervalCollectionLabels(): IterableIterator<string> {\n\t\treturn this.intervalCollections.keys();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// conditionally write the interval collection blob\n\t\t// only if it has entries\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tbuilder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n\t\t}\n\n\t\tbuilder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer over the GC data for this SharedMatrix.\n\t * All the IFluidHandle's represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: IFluidSerializer) {\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tthis.intervalCollections.serialize(serializer);\n\t\t}\n\n\t\tthis.client.serializeGCData(this.handle, serializer);\n\t}\n\n\t/**\n\t * Replace the range specified from start to end with the provided segment\n\t * This is done by inserting the segment at the end of the range, followed\n\t * by removing the contents of the range\n\t * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n\t * @param start - The start of the range to replace\n\t * @param end - The end of the range to replace\n\t * @param segment - The segment that will replace the range\n\t */\n\tprotected replaceRange(start: number, end: number, segment: ISegment): void {\n\t\t// Insert at the max end of the range when start > end, but still remove the range later\n\t\tconst insertIndex: number = Math.max(start, end);\n\n\t\t// Insert first, so local references can slide to the inserted seg if any\n\t\tconst insert = this.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(insertIndex, segment),\n\t\t);\n\n\t\tif (insert && start < end) {\n\t\t\tthis.removeRange(start, end);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n\t */\n\tprotected onConnect() {\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown, squash: boolean = false) {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.shift();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0x8bb /* Expected a recorded refSeq when resubmitting an op */,\n\t\t);\n\t\tthis.useResubmitRefSeq(originalRefSeq, () => {\n\t\t\tif (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata, squash)) {\n\t\t\t\tthis.submitSequenceMessage(\n\t\t\t\t\tthis.client.regeneratePendingOp(content as IMergeTreeOp, localOpMetadata, squash),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected reSubmitSquashed(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.reSubmitCore(content, localOpMetadata, true);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst originalRefSeq = this.inFlightRefSeqs.pop();\n\t\tassert(\n\t\t\toriginalRefSeq !== undefined,\n\t\t\t0xb7f /* Expected a recorded refSeq when rolling back an op */,\n\t\t);\n\n\t\tif (!this.intervalCollections.tryRollback(content, localOpMetadata)) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tif (await storage.contains(snapshotFileName)) {\n\t\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\t\tconst header = bufferToString(blob, \"utf8\");\n\t\t\tthis.intervalCollections.populate(header);\n\t\t}\n\n\t\ttry {\n\t\t\t// this will load the header, and return a promise\n\t\t\t// that will resolve when the body is loaded\n\t\t\t// and the catchup ops are available.\n\t\t\tconst { catchupOpsP } = await this.client.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, contentPath),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\n\t\t\t// process the catch up ops, and finishing the loading process\n\t\t\t(await catchupOpsP).forEach((m) => {\n\t\t\t\tconst collabWindow = this.client.getCollabWindow();\n\t\t\t\tif (\n\t\t\t\t\tm.minimumSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.referenceSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\tm.sequenceNumber <= collabWindow.minSeq ||\n\t\t\t\t\t// sequenceNumber could be the same if messages are part of a grouped batch\n\t\t\t\t\tm.sequenceNumber < collabWindow.currentSeq\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid catchup operations in snapshot: ${JSON.stringify({\n\t\t\t\t\t\t\top: {\n\t\t\t\t\t\t\t\tseq: m.sequenceNumber,\n\t\t\t\t\t\t\t\tminSeq: m.minimumSequenceNumber,\n\t\t\t\t\t\t\t\trefSeq: m.referenceSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcollabWindow: {\n\t\t\t\t\t\t\t\tseq: collabWindow.currentSeq,\n\t\t\t\t\t\t\t\tminSeq: collabWindow.minSeq,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.processMergeTreeMsg(m);\n\t\t\t});\n\n\t\t\t// Initialize the interval collections\n\t\t\tthis.initializeIntervalCollections();\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent, local);\n\t\t}\n\t}\n\n\tprivate processMessage(\n\t\tmessageEnvelope: ISequencedMessageEnvelope,\n\t\tmessageContent: IRuntimeMessagesContent,\n\t\tlocal: boolean,\n\t): void {\n\t\t// Reconstruct ISequencedDocumentMessage which is needed by merge tree client\n\t\tconst message: ISequencedDocumentMessage = {\n\t\t\t...messageEnvelope,\n\t\t\tcontents: messageContent.contents,\n\t\t\tclientSequenceNumber: messageContent.clientSequenceNumber,\n\t\t};\n\n\t\tif (local) {\n\t\t\tconst recordedRefSeq = this.inFlightRefSeqs.shift();\n\t\t\tassert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);\n\t\t\t// TODO: AB#7076: Some equivalent assert should be enabled. This fails some e2e stashed op tests because\n\t\t\t// the deltaManager may have seen more messages than the runtime has processed while amidst the stashed op\n\t\t\t// flow, so e.g. when `applyStashedOp` is called and the DDS is put in a state where it expects an ack for\n\t\t\t// one of its messages, the delta manager has actually already seen subsequent messages from collaborators\n\t\t\t// which the in-flight message is concurrent to.\n\t\t\t// See \"handles stashed ops created on top of sequenced local ops\" for one such test case.\n\t\t\t// assert(recordedRefSeq <= message.referenceSequenceNumber, \"RefSeq mismatch\");\n\t\t}\n\n\t\tassert(\n\t\t\tmessage.type === MessageType.Operation,\n\t\t\t0x073 /* \"Sequence message not operation\" */,\n\t\t);\n\n\t\tconst handled = this.intervalCollections.tryProcessMessage(\n\t\t\tmessage.contents as IMapOperation,\n\t\t\tlocal,\n\t\t\tmessage,\n\t\t\tmessageContent.localOpMetadata,\n\t\t);\n\n\t\tif (!handled) {\n\t\t\tthis.processMergeTreeMsg(message, local);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n\t */\n\tprotected didAttach() {\n\t\t// If we are not local, and we've attached we need to start generating and sending ops\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n\t */\n\tprotected initializeLocalCore() {\n\t\tsuper.initializeLocalCore();\n\t\tthis.initializeIntervalCollections();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): void {\n\t\tif (!this.intervalCollections.tryApplyStashedOp(content)) {\n\t\t\tthis.client.applyStashedOp(content);\n\t\t}\n\t}\n\n\tprivate summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst minSeq = this.deltaManager.minimumSequenceNumber;\n\n\t\tthis.processMinSequenceNumberChanged(minSeq);\n\n\t\tthis.messagesSinceMSNChange.forEach((m) => {\n\t\t\tm.minimumSequenceNumber = minSeq;\n\t\t});\n\n\t\treturn this.client.summarize(\n\t\t\tthis.runtime,\n\t\t\tthis.handle,\n\t\t\tserializer,\n\t\t\tthis.messagesSinceMSNChange,\n\t\t);\n\t}\n\n\t/**\n\t *\n\t * @param message - Message with decoded and hydrated handles\n\t */\n\tprivate processMergeTreeMsg(message: ISequencedDocumentMessage, local?: boolean) {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfunction transformOps(event: SequenceDeltaEvent) {\n\t\t\tops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n\t\t}\n\t\tconst needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n\t\tlet stashMessage: Readonly<ISequencedDocumentMessage> = message;\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.on(\"sequenceDelta\", transformOps);\n\t\t\t}\n\t\t}\n\n\t\tthis.client.applyMsg(message, local);\n\n\t\tif (this.runtime.options.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.removeListener(\"sequenceDelta\", transformOps);\n\t\t\t\t// shallow clone the message as we only overwrite top level properties,\n\t\t\t\t// like referenceSequenceNumber and content only\n\t\t\t\tstashMessage = {\n\t\t\t\t\t...message,\n\t\t\t\t\treferenceSequenceNumber: stashMessage.sequenceNumber - 1,\n\t\t\t\t\tcontents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.messagesSinceMSNChange.push(stashMessage);\n\n\t\t\t// Do GC every once in a while...\n\t\t\tif (\n\t\t\t\tthis.messagesSinceMSNChange.length > 20 &&\n\t\t\t\tthis.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber\n\t\t\t) {\n\t\t\t\tthis.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processMinSequenceNumberChanged(minSeq: number) {\n\t\tlet index = 0;\n\t\tfor (; index < this.messagesSinceMSNChange.length; index++) {\n\t\t\tif (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (index !== 0) {\n\t\t\tthis.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n\t\t}\n\t}\n\n\tprivate initializeIntervalCollections() {\n\t\t// Listen and initialize new SharedIntervalCollections\n\t\tthis.intervalCollections.events.on(\n\t\t\t\"createIntervalCollection\",\n\t\t\t(key: string, local: boolean) => {\n\t\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\t\tif (!intervalCollection.attached) {\n\t\t\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t\t\t}\n\t\t\t\tthis.emit(\"createIntervalCollection\", key, local, this);\n\t\t\t},\n\t\t);\n\n\t\t// Initialize existing SharedIntervalCollections\n\t\tfor (const key of this.intervalCollections.keys()) {\n\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t}\n\t}\n\n\t/**\n\t * Overrides the \"currently applicable reference sequence number\" for the duration of the callback.\n\t * See remarks on `currentRefSeq` for more context.\n\t */\n\tprivate useResubmitRefSeq(refSeq: number, callback: () => void) {\n\t\tconst previousResubmitRefSeq = this.ongoingResubmitRefSeq;\n\t\tthis.ongoingResubmitRefSeq = refSeq;\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis.ongoingResubmitRefSeq = previousResubmitRefSeq;\n\t\t}\n\t}\n}\n\nfunction createReentrancyDetector(\n\tonReentrancy: (depth: number) => void,\n): <T>(callback: () => T) => T {\n\tlet depth = 0;\n\tfunction detectReentrancy<T>(callback: () => T): T {\n\t\tif (depth > 0) {\n\t\t\tonReentrancy(depth);\n\t\t}\n\t\tdepth++;\n\t\ttry {\n\t\t\treturn callback();\n\t\t} finally {\n\t\t\tdepth--;\n\t\t}\n\t}\n\n\treturn detectReentrancy;\n}\n\n/**\n * Apps which generate reentrant behavior may do so at a high frequency.\n * Logging even per-SharedSegmentSequence instance might be too noisy, and having a few logs from a session\n * is likely enough.\n */\nlet totalReentrancyLogs = 3;\n\n/**\n * Resets the reentrancy log counter. Test-only API.\n */\nexport function resetReentrancyLogCounter() {\n\ttotalReentrancyLogs = 3;\n}\n\nconst reentrancyErrorMessage = \"Reentrancy detected in sequence local ops\";\nconst ensureNoReentrancy = createReentrancyDetector(() => {\n\tthrow new LoggingError(reentrancyErrorMessage);\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/sequence",
3
- "version": "2.70.0-361248",
3
+ "version": "2.70.0",
4
4
  "description": "Distributed sequence",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -91,33 +91,33 @@
91
91
  "temp-directory": "nyc/.nyc_output"
92
92
  },
93
93
  "dependencies": {
94
- "@fluid-internal/client-utils": "2.70.0-361248",
95
- "@fluidframework/core-interfaces": "2.70.0-361248",
96
- "@fluidframework/core-utils": "2.70.0-361248",
97
- "@fluidframework/datastore-definitions": "2.70.0-361248",
98
- "@fluidframework/driver-definitions": "2.70.0-361248",
99
- "@fluidframework/merge-tree": "2.70.0-361248",
100
- "@fluidframework/runtime-definitions": "2.70.0-361248",
101
- "@fluidframework/runtime-utils": "2.70.0-361248",
102
- "@fluidframework/shared-object-base": "2.70.0-361248",
103
- "@fluidframework/telemetry-utils": "2.70.0-361248",
94
+ "@fluid-internal/client-utils": "~2.70.0",
95
+ "@fluidframework/core-interfaces": "~2.70.0",
96
+ "@fluidframework/core-utils": "~2.70.0",
97
+ "@fluidframework/datastore-definitions": "~2.70.0",
98
+ "@fluidframework/driver-definitions": "~2.70.0",
99
+ "@fluidframework/merge-tree": "~2.70.0",
100
+ "@fluidframework/runtime-definitions": "~2.70.0",
101
+ "@fluidframework/runtime-utils": "~2.70.0",
102
+ "@fluidframework/shared-object-base": "~2.70.0",
103
+ "@fluidframework/telemetry-utils": "~2.70.0",
104
104
  "double-ended-queue": "^2.1.0-0",
105
105
  "uuid": "^11.1.0"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@arethetypeswrong/cli": "^0.17.1",
109
109
  "@biomejs/biome": "~1.9.3",
110
- "@fluid-internal/mocha-test-setup": "2.70.0-361248",
111
- "@fluid-private/stochastic-test-utils": "2.70.0-361248",
112
- "@fluid-private/test-dds-utils": "2.70.0-361248",
110
+ "@fluid-internal/mocha-test-setup": "~2.70.0",
111
+ "@fluid-private/stochastic-test-utils": "~2.70.0",
112
+ "@fluid-private/test-dds-utils": "~2.70.0",
113
113
  "@fluid-tools/benchmark": "^0.51.0",
114
114
  "@fluid-tools/build-cli": "^0.58.3",
115
115
  "@fluidframework/build-common": "^2.0.3",
116
116
  "@fluidframework/build-tools": "^0.58.3",
117
- "@fluidframework/container-definitions": "2.70.0-361248",
117
+ "@fluidframework/container-definitions": "~2.70.0",
118
118
  "@fluidframework/eslint-config-fluid": "^6.1.0",
119
119
  "@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.63.0",
120
- "@fluidframework/test-runtime-utils": "2.70.0-361248",
120
+ "@fluidframework/test-runtime-utils": "~2.70.0",
121
121
  "@microsoft/api-extractor": "7.52.11",
122
122
  "@types/diff": "^3.5.1",
123
123
  "@types/double-ended-queue": "^2.1.0",
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/sequence";
9
- export const pkgVersion = "2.70.0-361248";
9
+ export const pkgVersion = "2.70.0";
package/src/sequence.ts CHANGED
@@ -49,6 +49,9 @@ import {
49
49
  import {
50
50
  ISummaryTreeWithStats,
51
51
  ITelemetryContext,
52
+ IRuntimeMessageCollection,
53
+ IRuntimeMessagesContent,
54
+ ISequencedMessageEnvelope,
52
55
  } from "@fluidframework/runtime-definitions/internal";
53
56
  import {
54
57
  ObjectStoragePartition,
@@ -862,13 +865,27 @@ export abstract class SharedSegmentSequence<T extends ISegment>
862
865
  }
863
866
 
864
867
  /**
865
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
868
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
866
869
  */
867
- protected processCore(
868
- message: ISequencedDocumentMessage,
870
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
871
+ const { envelope, local, messagesContent } = messagesCollection;
872
+ for (const messageContent of messagesContent) {
873
+ this.processMessage(envelope, messageContent, local);
874
+ }
875
+ }
876
+
877
+ private processMessage(
878
+ messageEnvelope: ISequencedMessageEnvelope,
879
+ messageContent: IRuntimeMessagesContent,
869
880
  local: boolean,
870
- localOpMetadata: unknown,
871
- ) {
881
+ ): void {
882
+ // Reconstruct ISequencedDocumentMessage which is needed by merge tree client
883
+ const message: ISequencedDocumentMessage = {
884
+ ...messageEnvelope,
885
+ contents: messageContent.contents,
886
+ clientSequenceNumber: messageContent.clientSequenceNumber,
887
+ };
888
+
872
889
  if (local) {
873
890
  const recordedRefSeq = this.inFlightRefSeqs.shift();
874
891
  assert(recordedRefSeq !== undefined, 0x8bc /* No pending recorded refSeq found */);
@@ -890,7 +907,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
890
907
  message.contents as IMapOperation,
891
908
  local,
892
909
  message,
893
- localOpMetadata,
910
+ messageContent.localOpMetadata,
894
911
  );
895
912
 
896
913
  if (!handled) {