@fluidframework/sequence 2.0.0-internal.7.4.0 → 2.0.0-internal.8.0.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/api-report/sequence.api.md +52 -30
  3. package/dist/defaultMapInterfaces.d.ts +2 -2
  4. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  5. package/dist/defaultMapInterfaces.js.map +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +11 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/intervalCollection.d.ts +4 -4
  11. package/dist/intervalCollection.d.ts.map +1 -1
  12. package/dist/intervalCollection.js.map +1 -1
  13. package/dist/intervalTree.d.ts +1 -2
  14. package/dist/intervalTree.d.ts.map +1 -1
  15. package/dist/intervalTree.js +1 -3
  16. package/dist/intervalTree.js.map +1 -1
  17. package/dist/intervals/interval.d.ts +3 -4
  18. package/dist/intervals/interval.d.ts.map +1 -1
  19. package/dist/intervals/interval.js +9 -13
  20. package/dist/intervals/interval.js.map +1 -1
  21. package/dist/intervals/intervalUtils.d.ts +0 -4
  22. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  23. package/dist/intervals/intervalUtils.js +0 -5
  24. package/dist/intervals/intervalUtils.js.map +1 -1
  25. package/dist/intervals/sequenceInterval.d.ts +2 -3
  26. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  27. package/dist/intervals/sequenceInterval.js +9 -17
  28. package/dist/intervals/sequenceInterval.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/dist/revertibles.d.ts.map +1 -1
  33. package/dist/revertibles.js +7 -1
  34. package/dist/revertibles.js.map +1 -1
  35. package/dist/sequence-alpha.d.ts +63 -51
  36. package/dist/sequence-beta.d.ts +18 -15
  37. package/dist/sequence-public.d.ts +18 -15
  38. package/dist/sequence-untrimmed.d.ts +69 -55
  39. package/dist/sequence.d.ts +24 -21
  40. package/dist/sequence.d.ts.map +1 -1
  41. package/dist/sequence.js +37 -22
  42. package/dist/sequence.js.map +1 -1
  43. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  44. package/dist/sequenceDeltaEvent.js +11 -4
  45. package/dist/sequenceDeltaEvent.js.map +1 -1
  46. package/dist/sharedSequence.d.ts +1 -1
  47. package/dist/sharedSequence.d.ts.map +1 -1
  48. package/dist/sharedSequence.js +6 -0
  49. package/dist/sharedSequence.js.map +1 -1
  50. package/dist/sharedString.d.ts +5 -17
  51. package/dist/sharedString.d.ts.map +1 -1
  52. package/dist/sharedString.js +7 -22
  53. package/dist/sharedString.js.map +1 -1
  54. package/lib/defaultMapInterfaces.d.ts +2 -2
  55. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  56. package/lib/defaultMapInterfaces.js.map +1 -1
  57. package/lib/index.d.ts +1 -0
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/index.js +11 -1
  60. package/lib/index.js.map +1 -1
  61. package/lib/intervalCollection.d.ts +4 -4
  62. package/lib/intervalCollection.d.ts.map +1 -1
  63. package/lib/intervalCollection.js.map +1 -1
  64. package/lib/intervalTree.d.ts +1 -2
  65. package/lib/intervalTree.d.ts.map +1 -1
  66. package/lib/intervalTree.js +1 -3
  67. package/lib/intervalTree.js.map +1 -1
  68. package/lib/intervals/interval.d.ts +3 -4
  69. package/lib/intervals/interval.d.ts.map +1 -1
  70. package/lib/intervals/interval.js +9 -13
  71. package/lib/intervals/interval.js.map +1 -1
  72. package/lib/intervals/intervalUtils.d.ts +0 -4
  73. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  74. package/lib/intervals/intervalUtils.js +0 -5
  75. package/lib/intervals/intervalUtils.js.map +1 -1
  76. package/lib/intervals/sequenceInterval.d.ts +2 -3
  77. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  78. package/lib/intervals/sequenceInterval.js +9 -17
  79. package/lib/intervals/sequenceInterval.js.map +1 -1
  80. package/lib/packageVersion.d.ts +1 -1
  81. package/lib/packageVersion.js +1 -1
  82. package/lib/packageVersion.js.map +1 -1
  83. package/lib/revertibles.d.ts.map +1 -1
  84. package/lib/revertibles.js +7 -1
  85. package/lib/revertibles.js.map +1 -1
  86. package/lib/sequence-alpha.d.ts +63 -51
  87. package/lib/sequence-beta.d.ts +18 -15
  88. package/lib/sequence-public.d.ts +18 -15
  89. package/lib/sequence-untrimmed.d.ts +69 -55
  90. package/lib/sequence.d.ts +24 -21
  91. package/lib/sequence.d.ts.map +1 -1
  92. package/lib/sequence.js +37 -22
  93. package/lib/sequence.js.map +1 -1
  94. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  95. package/lib/sequenceDeltaEvent.js +11 -4
  96. package/lib/sequenceDeltaEvent.js.map +1 -1
  97. package/lib/sharedSequence.d.ts +1 -1
  98. package/lib/sharedSequence.d.ts.map +1 -1
  99. package/lib/sharedSequence.js +6 -0
  100. package/lib/sharedSequence.js.map +1 -1
  101. package/lib/sharedString.d.ts +5 -17
  102. package/lib/sharedString.d.ts.map +1 -1
  103. package/lib/sharedString.js +7 -22
  104. package/lib/sharedString.js.map +1 -1
  105. package/package.json +36 -16
  106. package/sequence.test-files.tar +0 -0
  107. package/src/defaultMapInterfaces.ts +2 -2
  108. package/src/index.ts +17 -0
  109. package/src/intervalCollection.ts +4 -4
  110. package/src/intervalTree.ts +0 -3
  111. package/src/intervals/interval.ts +5 -19
  112. package/src/intervals/intervalUtils.ts +2 -5
  113. package/src/intervals/sequenceInterval.ts +4 -23
  114. package/src/packageVersion.ts +1 -1
  115. package/src/revertibles.ts +11 -4
  116. package/src/sequence.ts +59 -40
  117. package/src/sequenceDeltaEvent.ts +8 -2
  118. package/src/sharedSequence.ts +9 -3
  119. package/src/sharedString.ts +17 -47
  120. package/tsconfig.json +1 -0
@@ -3,7 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- /* eslint-disable import/no-deprecated */
7
6
  /* eslint-disable no-bitwise */
8
7
 
9
8
  import { assert, unreachableCase } from "@fluidframework/core-utils";
@@ -19,6 +18,7 @@ import {
19
18
  ReferenceType,
20
19
  refTypeIncludesFlag,
21
20
  revertMergeTreeDeltaRevertibles,
21
+ // eslint-disable-next-line import/no-deprecated
22
22
  SortedSet,
23
23
  getSlideToSegoff,
24
24
  SlidingPreference,
@@ -114,13 +114,19 @@ export function appendDeleteIntervalToRevertibles(
114
114
  string: SharedString,
115
115
  interval: SequenceInterval,
116
116
  revertibles: SharedStringRevertible[],
117
- ) {
118
- const startSeg = interval.start.getSegment() as SharedStringSegment;
117
+ ): SharedStringRevertible[] {
118
+ const startSeg = interval.start.getSegment() as SharedStringSegment | undefined;
119
+ if (!startSeg) {
120
+ return revertibles;
121
+ }
119
122
  const startType =
120
123
  startSeg.removedSeq !== undefined
121
124
  ? ReferenceType.SlideOnRemove | ReferenceType.RangeBegin
122
125
  : ReferenceType.StayOnRemove | ReferenceType.RangeBegin;
123
- const endSeg = interval.end.getSegment() as SharedStringSegment;
126
+ const endSeg = interval.end.getSegment() as SharedStringSegment | undefined;
127
+ if (!endSeg) {
128
+ return revertibles;
129
+ }
124
130
  const endType =
125
131
  endSeg.removedSeq !== undefined
126
132
  ? ReferenceType.SlideOnRemove | ReferenceType.RangeEnd
@@ -560,6 +566,7 @@ interface RangeInfo {
560
566
  length: number;
561
567
  }
562
568
 
569
+ // eslint-disable-next-line import/no-deprecated
563
570
  class SortedRangeSet extends SortedSet<RangeInfo, string> {
564
571
  protected getKey(item: RangeInfo): string {
565
572
  return item.ranges[0].segment.ordinal;
package/src/sequence.ts CHANGED
@@ -3,8 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- /* eslint-disable import/no-deprecated */
7
-
8
6
  import { assert, Deferred } from "@fluidframework/core-utils";
9
7
  import { bufferToString } from "@fluid-internal/client-utils";
10
8
  import { LoggingError, createChildLogger } from "@fluidframework/telemetry-utils";
@@ -15,12 +13,13 @@ import {
15
13
  IChannelStorageService,
16
14
  } from "@fluidframework/datastore-definitions";
17
15
  import {
16
+ // eslint-disable-next-line import/no-deprecated
18
17
  Client,
19
18
  createAnnotateRangeOp,
19
+ // eslint-disable-next-line import/no-deprecated
20
20
  createGroupOp,
21
21
  createInsertOp,
22
22
  createRemoveRangeOp,
23
- ICombiningOp,
24
23
  IJSONSegment,
25
24
  IMergeTreeAnnotateMsg,
26
25
  IMergeTreeDeltaOp,
@@ -34,11 +33,12 @@ import {
34
33
  matchProperties,
35
34
  MergeTreeDeltaType,
36
35
  PropertySet,
37
- RangeStackMap,
38
36
  ReferencePosition,
39
37
  ReferenceType,
40
38
  MergeTreeRevertibleDriver,
41
39
  SegmentGroup,
40
+ IMergeTreeObliterateMsg,
41
+ createObliterateRangeOp,
42
42
  SlidingPreference,
43
43
  } from "@fluidframework/merge-tree";
44
44
  import { ObjectStoragePartition, SummaryTreeBuilder } from "@fluidframework/runtime-utils";
@@ -104,15 +104,15 @@ export interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {
104
104
  (
105
105
  event: "createIntervalCollection",
106
106
  listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,
107
- );
107
+ ): void;
108
108
  (
109
109
  event: "sequenceDelta",
110
110
  listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,
111
- );
111
+ ): void;
112
112
  (
113
113
  event: "maintenance",
114
114
  listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,
115
- );
115
+ ): void;
116
116
  }
117
117
 
118
118
  /**
@@ -146,7 +146,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
146
146
  switch (event.deltaOperation) {
147
147
  case MergeTreeDeltaType.ANNOTATE: {
148
148
  const lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;
149
- const props = {};
149
+ const props: PropertySet = {};
150
150
  for (const key of Object.keys(r.propertyDeltas)) {
151
151
  props[key] = r.segment.properties?.[key] ?? null;
152
152
  }
@@ -162,7 +162,6 @@ export abstract class SharedSegmentSequence<T extends ISegment>
162
162
  r.position,
163
163
  r.position + r.segment.cachedLength,
164
164
  props,
165
- undefined,
166
165
  ),
167
166
  );
168
167
  }
@@ -189,12 +188,32 @@ export abstract class SharedSegmentSequence<T extends ISegment>
189
188
  break;
190
189
  }
191
190
 
191
+ case MergeTreeDeltaType.OBLITERATE: {
192
+ const lastRem = ops[ops.length - 1] as IMergeTreeObliterateMsg;
193
+ if (lastRem?.pos1 === r.position) {
194
+ assert(
195
+ lastRem.pos2 !== undefined,
196
+ 0x874 /* pos2 should not be undefined here */,
197
+ );
198
+ lastRem.pos2 += r.segment.cachedLength;
199
+ } else {
200
+ ops.push(
201
+ createObliterateRangeOp(
202
+ r.position,
203
+ r.position + r.segment.cachedLength,
204
+ ),
205
+ );
206
+ }
207
+ break;
208
+ }
209
+
192
210
  default:
193
211
  }
194
212
  }
195
213
  return ops;
196
214
  }
197
215
 
216
+ // eslint-disable-next-line import/no-deprecated
198
217
  protected client: Client;
199
218
  /** `Deferred` that triggers once the object is loaded */
200
219
  protected loadedDeferred = new Deferred<void>();
@@ -232,6 +251,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
232
251
  this.logger.sendErrorEvent({ eventName: "SequenceLoadFailed" }, error);
233
252
  });
234
253
 
254
+ // eslint-disable-next-line import/no-deprecated
235
255
  this.client = new Client(
236
256
  segmentFromSpec,
237
257
  createChildLogger({
@@ -266,12 +286,25 @@ export abstract class SharedSegmentSequence<T extends ISegment>
266
286
  * @param start - The inclusive start of the range to remove
267
287
  * @param end - The exclusive end of the range to remove
268
288
  */
269
- public removeRange(start: number, end: number): IMergeTreeRemoveMsg {
270
- return this.guardReentrancy(() => this.client.removeRangeLocal(start, end));
289
+ public removeRange(start: number, end: number): void {
290
+ this.guardReentrancy(() => this.client.removeRangeLocal(start, end));
271
291
  }
272
292
 
273
293
  /**
274
- * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with the native batching capabilities of the runtime
294
+ * Obliterate is similar to remove, but differs in that segments concurrently
295
+ * inserted into an obliterated range will also be removed
296
+ *
297
+ * @param start - The inclusive start of the range to obliterate
298
+ * @param end - The exclusive end of the range to obliterate
299
+ */
300
+ public obliterateRange(start: number, end: number): void {
301
+ this.guardReentrancy(() => this.client.obliterateRangeLocal(start, end));
302
+ }
303
+
304
+ /**
305
+ * @deprecated The ability to create group ops will be removed in an upcoming
306
+ * release, as group ops are redundant with the native batching capabilities
307
+ * of the runtime
275
308
  */
276
309
  public groupOperation(groupOp: IMergeTreeGroupMsg) {
277
310
  this.guardReentrancy(() => this.client.localTransaction(groupOp));
@@ -311,16 +344,10 @@ export abstract class SharedSegmentSequence<T extends ISegment>
311
344
  * @param start - The inclusive start position of the range to annotate
312
345
  * @param end - The exclusive end position of the range to annotate
313
346
  * @param props - The properties to annotate the range with
314
- * @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
315
347
  *
316
348
  */
317
- public annotateRange(
318
- start: number,
319
- end: number,
320
- props: PropertySet,
321
- combiningOp?: ICombiningOp,
322
- ) {
323
- this.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props, combiningOp));
349
+ public annotateRange(start: number, end: number, props: PropertySet): void {
350
+ this.guardReentrancy(() => this.client.annotateRangeLocal(start, end, props));
324
351
  }
325
352
 
326
353
  public getPropertiesAtPosition(pos: number) {
@@ -397,10 +424,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
397
424
  );
398
425
  }
399
426
 
400
- /**
401
- * @deprecated This method will no longer be public in an upcoming release as it is not safe to use outside of this class
402
- */
403
- public submitSequenceMessage(message: IMergeTreeOp) {
427
+ private submitSequenceMessage(message: IMergeTreeOp) {
404
428
  if (!this.isAttached()) {
405
429
  return;
406
430
  }
@@ -411,7 +435,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
411
435
 
412
436
  // if loading isn't complete, we need to cache
413
437
  // local ops until loading is complete, and then
414
- // they will be resent
438
+ // they will be present
415
439
  if (!this.loadedDeferred.isCompleted) {
416
440
  this.loadedDeferredOutgoingOps.push(metadata ? [translated, metadata] : translated);
417
441
  } else {
@@ -430,12 +454,13 @@ export abstract class SharedSegmentSequence<T extends ISegment>
430
454
 
431
455
  /**
432
456
  * Walk the underlying segments of the sequence.
433
- * The walked segments may extend beyond the range
434
- * if the segments cross the ranges start or end boundaries.
435
- * Set split range to true to ensure only segments within the
436
- * range are walked.
457
+ * The walked segments may extend beyond the range if the segments cross the
458
+ * ranges start or end boundaries.
437
459
  *
438
- * @param handler - The function to handle each segment
460
+ * Set split range to true to ensure only segments within the range are walked.
461
+ *
462
+ * @param handler - The function to handle each segment. Traversal ends if
463
+ * this function returns true.
439
464
  * @param start - Optional. The start of range walk.
440
465
  * @param end - Optional. The end of range walk
441
466
  * @param accum - Optional. An object that will be passed to the handler for accumulation
@@ -451,13 +476,6 @@ export abstract class SharedSegmentSequence<T extends ISegment>
451
476
  this.client.walkSegments(handler, start, end, accum as TClientData, splitRange);
452
477
  }
453
478
 
454
- /**
455
- * @deprecated this functionality is no longer supported and will be removed
456
- */
457
- public getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {
458
- return this.client.getStackContext(startPos, rangeLabels);
459
- }
460
-
461
479
  /**
462
480
  * @returns The most recent sequence number which has been acked by the server and processed by this
463
481
  * SharedSegmentSequence.
@@ -471,7 +489,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
471
489
  * @param refPos - The reference position to insert the segment at
472
490
  * @param segment - The segment to insert
473
491
  */
474
- public insertAtReferencePosition(pos: ReferencePosition, segment: T) {
492
+ public insertAtReferencePosition(pos: ReferencePosition, segment: T): void {
475
493
  this.guardReentrancy(() => this.client.insertAtReferencePositionLocal(pos, segment));
476
494
  }
477
495
  /**
@@ -479,7 +497,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
479
497
  * @param start - The position to insert the segment at
480
498
  * @param spec - The segment to inserts spec
481
499
  */
482
- public insertFromSpec(pos: number, spec: IJSONSegment) {
500
+ public insertFromSpec(pos: number, spec: IJSONSegment): void {
483
501
  const segment = this.segmentFromSpec(spec);
484
502
  this.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));
485
503
  }
@@ -549,7 +567,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
549
567
  * @param end - The end of the range to replace
550
568
  * @param segment - The segment that will replace the range
551
569
  */
552
- protected replaceRange(start: number, end: number, segment: ISegment) {
570
+ protected replaceRange(start: number, end: number, segment: ISegment): void {
553
571
  // Insert at the max end of the range when start > end, but still remove the range later
554
572
  const insertIndex: number = Math.max(start, end);
555
573
 
@@ -763,6 +781,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
763
781
  stashMessage = {
764
782
  ...message,
765
783
  referenceSequenceNumber: stashMessage.sequenceNumber - 1,
784
+ // eslint-disable-next-line import/no-deprecated
766
785
  contents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],
767
786
  };
768
787
  }
@@ -3,10 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- /* eslint-disable import/no-deprecated */
7
-
8
6
  import { assert } from "@fluidframework/core-utils";
9
7
  import {
8
+ // eslint-disable-next-line import/no-deprecated
10
9
  Client,
11
10
  IMergeTreeDeltaCallbackArgs,
12
11
  IMergeTreeDeltaOpArgs,
@@ -16,6 +15,7 @@ import {
16
15
  MergeTreeDeltaOperationTypes,
17
16
  MergeTreeMaintenanceType,
18
17
  PropertySet,
18
+ // eslint-disable-next-line import/no-deprecated
19
19
  SortedSegmentSet,
20
20
  } from "@fluidframework/merge-tree";
21
21
 
@@ -31,12 +31,14 @@ export abstract class SequenceEvent<
31
31
  TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,
32
32
  > {
33
33
  public readonly deltaOperation: TOperation;
34
+ // eslint-disable-next-line import/no-deprecated
34
35
  private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;
35
36
  private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;
36
37
  private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;
37
38
 
38
39
  constructor(
39
40
  public readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,
41
+ // eslint-disable-next-line import/no-deprecated
40
42
  private readonly mergeTreeClient: Client,
41
43
  ) {
42
44
  assert(
@@ -45,7 +47,9 @@ export abstract class SequenceEvent<
45
47
  );
46
48
  this.deltaOperation = deltaArgs.operation;
47
49
 
50
+ // eslint-disable-next-line import/no-deprecated
48
51
  this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(() => {
52
+ // eslint-disable-next-line import/no-deprecated
49
53
  const set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();
50
54
  this.deltaArgs.deltaSegments.forEach((delta) => {
51
55
  const newRange: ISequenceDeltaRange<TOperation> = {
@@ -119,6 +123,7 @@ export class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationTyp
119
123
  constructor(
120
124
  public readonly opArgs: IMergeTreeDeltaOpArgs,
121
125
  deltaArgs: IMergeTreeDeltaCallbackArgs,
126
+ // eslint-disable-next-line import/no-deprecated
122
127
  mergeTreeClient: Client,
123
128
  ) {
124
129
  super(deltaArgs, mergeTreeClient);
@@ -138,6 +143,7 @@ export class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenance
138
143
  constructor(
139
144
  public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,
140
145
  deltaArgs: IMergeTreeMaintenanceCallbackArgs,
146
+ // eslint-disable-next-line import/no-deprecated
141
147
  mergeTreeClient: Client,
142
148
  ) {
143
149
  super(deltaArgs, mergeTreeClient);
@@ -31,7 +31,7 @@ export class SubSequence<T> extends BaseSegment {
31
31
  public static is(segment: ISegment): segment is SubSequence<any> {
32
32
  return segment.type === SubSequence.typeString;
33
33
  }
34
- public static fromJSONObject<U>(spec: Serializable) {
34
+ public static fromJSONObject<U>(spec: any) {
35
35
  if (spec && typeof spec === "object" && "items" in spec) {
36
36
  const segment = new SubSequence<U>(spec.items);
37
37
  if (spec.props) {
@@ -76,7 +76,10 @@ export class SubSequence<T> extends BaseSegment {
76
76
  public append(segment: ISegment) {
77
77
  assert(SubSequence.is(segment), 0x448 /* can only append to another run segment */);
78
78
  super.append(segment);
79
- this.items = this.items.concat(segment.items);
79
+ // assert above checks that segment is a SubSequence but not that generic T matches.
80
+ // Since SubSequence is already deprecated, assume that usage is generic T consistent
81
+ // and just cast here to satisfy concat.
82
+ this.items = this.items.concat((segment as SubSequence<T>).items);
80
83
  }
81
84
 
82
85
  // TODO: retain removed items for undo
@@ -169,7 +172,10 @@ export class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
169
172
  if (firstSegment === undefined) {
170
173
  firstSegment = segment;
171
174
  }
172
- items.push(...segment.items);
175
+ // Condition above checks that segment is a SubSequence but not that
176
+ // generic T matches. Since SubSequence is already deprecated, assume
177
+ // that walk only has SubSequence<T> segments and just cast here.
178
+ items.push(...(segment as SubSequence<T>).items);
173
179
  }
174
180
  return true;
175
181
  },
@@ -4,9 +4,6 @@
4
4
  */
5
5
 
6
6
  import {
7
- ICombiningOp,
8
- IMergeTreeInsertMsg,
9
- IMergeTreeRemoveMsg,
10
7
  IMergeTreeTextHelper,
11
8
  IRelativePosition,
12
9
  ISegment,
@@ -41,11 +38,7 @@ export interface ISharedString extends SharedSegmentSequence<SharedStringSegment
41
38
  * @param refType - The reference type of the marker
42
39
  * @param props - The properties of the marker
43
40
  */
44
- insertMarker(
45
- pos: number,
46
- refType: ReferenceType,
47
- props?: PropertySet,
48
- ): IMergeTreeInsertMsg | undefined;
41
+ insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void;
49
42
 
50
43
  /**
51
44
  * {@inheritDoc SharedSegmentSequence.posFromRelativePos}
@@ -115,7 +108,7 @@ export class SharedString
115
108
  relativePos1: IRelativePosition,
116
109
  refType: ReferenceType,
117
110
  props?: PropertySet,
118
- ) {
111
+ ): void {
119
112
  const segment = new Marker(refType);
120
113
  if (props) {
121
114
  segment.addProperties(props);
@@ -128,17 +121,13 @@ export class SharedString
128
121
  /**
129
122
  * {@inheritDoc ISharedString.insertMarker}
130
123
  */
131
- public insertMarker(
132
- pos: number,
133
- refType: ReferenceType,
134
- props?: PropertySet,
135
- ): IMergeTreeInsertMsg | undefined {
124
+ public insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void {
136
125
  const segment = new Marker(refType);
137
126
  if (props) {
138
127
  segment.addProperties(props);
139
128
  }
140
129
 
141
- return this.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));
130
+ this.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));
142
131
  }
143
132
 
144
133
  /**
@@ -147,7 +136,11 @@ export class SharedString
147
136
  * @param text - The text to insert
148
137
  * @param props - The properties of text
149
138
  */
150
- public insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {
139
+ public insertTextRelative(
140
+ relativePos1: IRelativePosition,
141
+ text: string,
142
+ props?: PropertySet,
143
+ ): void {
151
144
  const segment = new TextSegment(text);
152
145
  if (props) {
153
146
  segment.addProperties(props);
@@ -160,7 +153,7 @@ export class SharedString
160
153
  /**
161
154
  * {@inheritDoc ISharedString.insertText}
162
155
  */
163
- public insertText(pos: number, text: string, props?: PropertySet) {
156
+ public insertText(pos: number, text: string, props?: PropertySet): void {
164
157
  const segment = new TextSegment(text);
165
158
  if (props) {
166
159
  segment.addProperties(props);
@@ -176,7 +169,7 @@ export class SharedString
176
169
  * @param text - The text to replace the range with
177
170
  * @param props - Optional. The properties of the replacement text
178
171
  */
179
- public replaceText(start: number, end: number, text: string, props?: PropertySet) {
172
+ public replaceText(start: number, end: number, text: string, props?: PropertySet): void {
180
173
  this.replaceRange(start, end, TextSegment.make(text, props));
181
174
  }
182
175
 
@@ -186,38 +179,17 @@ export class SharedString
186
179
  * @param end - The exclusive end of the range to replace
187
180
  * @returns the message sent.
188
181
  */
189
- public removeText(start: number, end: number): IMergeTreeRemoveMsg {
190
- return this.removeRange(start, end);
191
- }
192
-
193
- /**
194
- * Annotates the marker with the provided properties and calls the callback on consensus.
195
- * @param marker - The marker to annotate
196
- * @param props - The properties to annotate the marker with
197
- * @param consensusCallback - The callback called when consensus is reached
198
- *
199
- * @deprecated We no longer intend to support this functionality and it will
200
- * be removed in a future release. There is no replacement for this
201
- * functionality.
202
- */
203
- public annotateMarkerNotifyConsensus(
204
- marker: Marker,
205
- props: PropertySet,
206
- callback: (m: Marker) => void,
207
- ) {
208
- this.guardReentrancy(() =>
209
- this.client.annotateMarkerNotifyConsensus(marker, props, callback),
210
- );
182
+ public removeText(start: number, end: number): void {
183
+ this.removeRange(start, end);
211
184
  }
212
185
 
213
186
  /**
214
187
  * Annotates the marker with the provided properties.
215
188
  * @param marker - The marker to annotate
216
189
  * @param props - The properties to annotate the marker with
217
- * @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
218
190
  */
219
- public annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp) {
220
- this.guardReentrancy(() => this.client.annotateMarker(marker, props, combiningOp));
191
+ public annotateMarker(marker: Marker, props: PropertySet) {
192
+ this.guardReentrancy(() => this.client.annotateMarker(marker, props));
221
193
  }
222
194
 
223
195
  /**
@@ -430,10 +402,8 @@ const gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (
430
402
  } else {
431
403
  if (placeholder && placeholder.length > 0) {
432
404
  const placeholderText =
433
- placeholder === "*"
434
- ? // eslint-disable-next-line @typescript-eslint/no-base-to-string
435
- `\n${segment.toString()}`
436
- : placeholder.repeat(segment.cachedLength);
405
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
406
+ placeholder === "*" ? `\n${segment}` : placeholder.repeat(segment.cachedLength);
437
407
  textSegment.text += placeholderText;
438
408
  } else {
439
409
  const marker = segment as Marker;
package/tsconfig.json CHANGED
@@ -8,5 +8,6 @@
8
8
  "compilerOptions": {
9
9
  "rootDir": "./src",
10
10
  "outDir": "./dist",
11
+ "noImplicitAny": true,
11
12
  },
12
13
  }