@fluidframework/merge-tree 2.2.0 → 2.3.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 (168) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/merge-tree.legacy.alpha.api.md +20 -0
  3. package/dist/attributionCollection.d.ts.map +1 -1
  4. package/dist/attributionCollection.js +1 -29
  5. package/dist/attributionCollection.js.map +1 -1
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +3 -4
  8. package/dist/client.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/legacy.d.ts +1 -0
  13. package/dist/localReference.d.ts.map +1 -1
  14. package/dist/localReference.js +0 -2
  15. package/dist/localReference.js.map +1 -1
  16. package/dist/mergeTree.d.ts +1 -30
  17. package/dist/mergeTree.d.ts.map +1 -1
  18. package/dist/mergeTree.js +131 -167
  19. package/dist/mergeTree.js.map +1 -1
  20. package/dist/mergeTreeNodes.d.ts +16 -1
  21. package/dist/mergeTreeNodes.d.ts.map +1 -1
  22. package/dist/mergeTreeNodes.js +5 -2
  23. package/dist/mergeTreeNodes.js.map +1 -1
  24. package/dist/partialLengths.d.ts.map +1 -1
  25. package/dist/partialLengths.js +8 -54
  26. package/dist/partialLengths.js.map +1 -1
  27. package/dist/properties.d.ts.map +1 -1
  28. package/dist/properties.js +0 -2
  29. package/dist/properties.js.map +1 -1
  30. package/dist/revertibles.d.ts.map +1 -1
  31. package/dist/revertibles.js +0 -14
  32. package/dist/revertibles.js.map +1 -1
  33. package/dist/segmentGroupCollection.d.ts.map +1 -1
  34. package/dist/segmentGroupCollection.js +0 -2
  35. package/dist/segmentGroupCollection.js.map +1 -1
  36. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  37. package/dist/segmentPropertiesManager.js +1 -3
  38. package/dist/segmentPropertiesManager.js.map +1 -1
  39. package/dist/snapshotLoader.d.ts.map +1 -1
  40. package/dist/snapshotLoader.js +1 -4
  41. package/dist/snapshotLoader.js.map +1 -1
  42. package/dist/snapshotV1.d.ts.map +1 -1
  43. package/dist/snapshotV1.js +1 -11
  44. package/dist/snapshotV1.js.map +1 -1
  45. package/dist/snapshotlegacy.d.ts.map +1 -1
  46. package/dist/snapshotlegacy.js +0 -1
  47. package/dist/snapshotlegacy.js.map +1 -1
  48. package/dist/sortedSegmentSet.d.ts +0 -1
  49. package/dist/sortedSegmentSet.d.ts.map +1 -1
  50. package/dist/sortedSegmentSet.js +1 -9
  51. package/dist/sortedSegmentSet.js.map +1 -1
  52. package/dist/sortedSet.d.ts.map +1 -1
  53. package/dist/sortedSet.js +0 -4
  54. package/dist/sortedSet.js.map +1 -1
  55. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  56. package/dist/test/client.conflictFarm.spec.js +36 -27
  57. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  58. package/dist/test/client.replay.spec.js +1 -1
  59. package/dist/test/client.replay.spec.js.map +1 -1
  60. package/dist/test/mergeTreeOperationRunner.d.ts +2 -1
  61. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  62. package/dist/test/mergeTreeOperationRunner.js +29 -11
  63. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  64. package/dist/test/obliterate.spec.js +55 -0
  65. package/dist/test/obliterate.spec.js.map +1 -1
  66. package/dist/test/reconnectHelper.d.ts +0 -1
  67. package/dist/test/reconnectHelper.d.ts.map +1 -1
  68. package/dist/test/reconnectHelper.js +1 -1
  69. package/dist/test/reconnectHelper.js.map +1 -1
  70. package/dist/test/testClientLogger.d.ts.map +1 -1
  71. package/dist/test/testClientLogger.js +17 -7
  72. package/dist/test/testClientLogger.js.map +1 -1
  73. package/dist/zamboni.d.ts.map +1 -1
  74. package/dist/zamboni.js +0 -4
  75. package/dist/zamboni.js.map +1 -1
  76. package/lib/attributionCollection.d.ts.map +1 -1
  77. package/lib/attributionCollection.js +1 -29
  78. package/lib/attributionCollection.js.map +1 -1
  79. package/lib/client.d.ts.map +1 -1
  80. package/lib/client.js +3 -4
  81. package/lib/client.js.map +1 -1
  82. package/lib/index.d.ts +1 -1
  83. package/lib/index.d.ts.map +1 -1
  84. package/lib/index.js.map +1 -1
  85. package/lib/legacy.d.ts +1 -0
  86. package/lib/localReference.d.ts.map +1 -1
  87. package/lib/localReference.js +0 -2
  88. package/lib/localReference.js.map +1 -1
  89. package/lib/mergeTree.d.ts +1 -30
  90. package/lib/mergeTree.d.ts.map +1 -1
  91. package/lib/mergeTree.js +132 -168
  92. package/lib/mergeTree.js.map +1 -1
  93. package/lib/mergeTreeNodes.d.ts +16 -1
  94. package/lib/mergeTreeNodes.d.ts.map +1 -1
  95. package/lib/mergeTreeNodes.js +5 -2
  96. package/lib/mergeTreeNodes.js.map +1 -1
  97. package/lib/partialLengths.d.ts.map +1 -1
  98. package/lib/partialLengths.js +8 -54
  99. package/lib/partialLengths.js.map +1 -1
  100. package/lib/properties.d.ts.map +1 -1
  101. package/lib/properties.js +0 -2
  102. package/lib/properties.js.map +1 -1
  103. package/lib/revertibles.d.ts.map +1 -1
  104. package/lib/revertibles.js +0 -14
  105. package/lib/revertibles.js.map +1 -1
  106. package/lib/segmentGroupCollection.d.ts.map +1 -1
  107. package/lib/segmentGroupCollection.js +0 -2
  108. package/lib/segmentGroupCollection.js.map +1 -1
  109. package/lib/segmentPropertiesManager.d.ts.map +1 -1
  110. package/lib/segmentPropertiesManager.js +1 -3
  111. package/lib/segmentPropertiesManager.js.map +1 -1
  112. package/lib/snapshotLoader.d.ts.map +1 -1
  113. package/lib/snapshotLoader.js +1 -4
  114. package/lib/snapshotLoader.js.map +1 -1
  115. package/lib/snapshotV1.d.ts.map +1 -1
  116. package/lib/snapshotV1.js +1 -11
  117. package/lib/snapshotV1.js.map +1 -1
  118. package/lib/snapshotlegacy.d.ts.map +1 -1
  119. package/lib/snapshotlegacy.js +0 -1
  120. package/lib/snapshotlegacy.js.map +1 -1
  121. package/lib/sortedSegmentSet.d.ts +0 -1
  122. package/lib/sortedSegmentSet.d.ts.map +1 -1
  123. package/lib/sortedSegmentSet.js +1 -9
  124. package/lib/sortedSegmentSet.js.map +1 -1
  125. package/lib/sortedSet.d.ts.map +1 -1
  126. package/lib/sortedSet.js +0 -4
  127. package/lib/sortedSet.js.map +1 -1
  128. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -1
  129. package/lib/test/client.conflictFarm.spec.js +37 -28
  130. package/lib/test/client.conflictFarm.spec.js.map +1 -1
  131. package/lib/test/client.replay.spec.js +1 -1
  132. package/lib/test/client.replay.spec.js.map +1 -1
  133. package/lib/test/mergeTreeOperationRunner.d.ts +2 -1
  134. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
  135. package/lib/test/mergeTreeOperationRunner.js +30 -12
  136. package/lib/test/mergeTreeOperationRunner.js.map +1 -1
  137. package/lib/test/obliterate.spec.js +55 -0
  138. package/lib/test/obliterate.spec.js.map +1 -1
  139. package/lib/test/reconnectHelper.d.ts +0 -1
  140. package/lib/test/reconnectHelper.d.ts.map +1 -1
  141. package/lib/test/reconnectHelper.js +1 -1
  142. package/lib/test/reconnectHelper.js.map +1 -1
  143. package/lib/test/testClientLogger.d.ts.map +1 -1
  144. package/lib/test/testClientLogger.js +18 -8
  145. package/lib/test/testClientLogger.js.map +1 -1
  146. package/lib/tsdoc-metadata.json +1 -1
  147. package/lib/zamboni.d.ts.map +1 -1
  148. package/lib/zamboni.js +0 -4
  149. package/lib/zamboni.js.map +1 -1
  150. package/package.json +22 -21
  151. package/src/attributionCollection.ts +14 -42
  152. package/src/client.ts +8 -9
  153. package/src/index.ts +1 -0
  154. package/src/localReference.ts +1 -3
  155. package/src/mergeTree.ts +185 -208
  156. package/src/mergeTreeNodes.ts +22 -3
  157. package/src/partialLengths.ts +23 -68
  158. package/src/properties.ts +1 -3
  159. package/src/revertibles.ts +7 -21
  160. package/src/segmentGroupCollection.ts +1 -3
  161. package/src/segmentPropertiesManager.ts +0 -1
  162. package/src/snapshotLoader.ts +2 -4
  163. package/src/snapshotV1.ts +5 -15
  164. package/src/snapshotlegacy.ts +1 -2
  165. package/src/sortedSegmentSet.ts +3 -10
  166. package/src/sortedSet.ts +2 -6
  167. package/src/zamboni.ts +4 -8
  168. package/tsconfig.json +1 -0
@@ -92,21 +92,15 @@ class PartialSequenceLengthsSet extends SortedSet<PartialSequenceLength, number>
92
92
  const mindex = this.latestLeqIndex(minSeq);
93
93
  let minLength = 0;
94
94
  if (mindex >= 0) {
95
- // TODO Non null asserting, why is this not null?
96
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
97
- minLength = this.keySortedItems[mindex]!.len;
95
+ minLength = this.keySortedItems[mindex].len;
98
96
  const seqCount = this.size;
99
97
  if (mindex <= seqCount - 1) {
100
98
  // Still some entries remaining
101
99
  const remainingCount = seqCount - mindex - 1;
102
100
  // Copy down
103
101
  for (let i = 0; i < remainingCount; i++) {
104
- // TODO Non null asserting, why is this not null?
105
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
106
- this.keySortedItems[i] = this.keySortedItems[i + mindex + 1]!;
107
- // TODO Non null asserting, why is this not null?
108
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
109
- this.keySortedItems[i]!.len -= minLength;
102
+ this.keySortedItems[i] = this.keySortedItems[i + mindex + 1];
103
+ this.keySortedItems[i].len -= minLength;
110
104
  }
111
105
  this.keySortedItems.length = remainingCount;
112
106
  }
@@ -307,9 +301,7 @@ export class PartialSequenceLengths {
307
301
  let hasInternalChild = false;
308
302
  const childPartials: PartialSequenceLengths[] = [];
309
303
  for (let i = 0; i < block.childCount; i++) {
310
- // TODO Non null asserting, why is this not null?
311
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
312
- const child = block.children[i]!;
304
+ const child = block.children[i];
313
305
  if (!child.isLeaf()) {
314
306
  hasInternalChild = true;
315
307
  if (recur) {
@@ -343,9 +335,7 @@ export class PartialSequenceLengths {
343
335
  const childOverlapRemoves: LocalPartialSequenceLength[][] = [];
344
336
  for (let i = 0; i < childPartialsLen; i++) {
345
337
  const { segmentCount, minLength, partialLengths, unsequencedRecords } =
346
- // TODO Non null asserting, why is this not null?
347
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
348
- childPartials[i]!;
338
+ childPartials[i];
349
339
  combinedPartialLengths.segmentCount += segmentCount;
350
340
  combinedPartialLengths.minLength += minLength;
351
341
  childPartialLengths.push(partialLengths.items as PartialSequenceLength[]);
@@ -397,9 +387,7 @@ export class PartialSequenceLengths {
397
387
  combinedPartialLengths.segmentCount = block.childCount;
398
388
 
399
389
  for (let i = 0; i < block.childCount; i++) {
400
- // TODO Non null asserting, why is this not null?
401
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
402
- const child = block.children[i]!;
390
+ const child = block.children[i];
403
391
  if (child.isLeaf()) {
404
392
  // Leaf segment
405
393
  const segment = child;
@@ -687,17 +675,13 @@ export class PartialSequenceLengths {
687
675
  segmentLen = -segmentLen;
688
676
  // The client who performed the remove is always stored
689
677
  // in the first position of removalInfo.
690
- // TODO Non null asserting, why is this not null?
691
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
692
- clientId = removalInfo.removedClientIds[0]!;
678
+ clientId = removalInfo.removedClientIds[0];
693
679
  const hasOverlap = removalInfo.removedClientIds.length > 1;
694
680
  removeClientOverlap = hasOverlap ? removalInfo.removedClientIds : undefined;
695
681
  } else if (moveInfo) {
696
682
  // The client who performed the move is always stored
697
683
  // in the first position of moveInfo.
698
- // TODO Non null asserting, why is this not null?
699
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
700
- clientId = moveInfo.movedClientIds[0]!;
684
+ clientId = moveInfo.movedClientIds[0];
701
685
 
702
686
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
703
687
  seqOrLocalSeq = moveIsLocal ? moveInfo.localMovedSeq! : moveInfo.movedSeq;
@@ -733,9 +717,7 @@ export class PartialSequenceLengths {
733
717
  if (moveInfo && removalInfo && removeHappenedFirst && !moveIsLocal) {
734
718
  // The client who performed the remove is always stored
735
719
  // in the first position of removalInfo.
736
- // TODO Non null asserting, why is this not null?
737
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
738
- const moveClientId = moveInfo.movedClientIds[0]!;
720
+ const moveClientId = moveInfo.movedClientIds[0];
739
721
  const hasOverlap = moveInfo.movedClientIds.length > 1;
740
722
 
741
723
  PartialSequenceLengths.updatePartialsAfterInsertion(
@@ -758,9 +740,7 @@ export class PartialSequenceLengths {
758
740
  : removalInfo.removedSeq;
759
741
  // The client who performed the remove is always stored
760
742
  // in the first position of removalInfo.
761
- // TODO Non null asserting, why is this not null?
762
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
763
- const removeClientId = removalInfo.removedClientIds[0]!;
743
+ const removeClientId = removalInfo.removedClientIds[0];
764
744
  const hasOverlap = removalInfo.removedClientIds.length > 1;
765
745
 
766
746
  PartialSequenceLengths.updatePartialsAfterInsertion(
@@ -806,11 +786,7 @@ export class PartialSequenceLengths {
806
786
  localIndexFirstGTE < unsequencedRecords.overlappingRemoves.length;
807
787
  localIndexFirstGTE++
808
788
  ) {
809
- if (
810
- // TODO Non null asserting, why is this not null?
811
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
812
- unsequencedRecords.overlappingRemoves[localIndexFirstGTE]!.seq >= seqOrLocalSeq
813
- ) {
789
+ if (unsequencedRecords.overlappingRemoves[localIndexFirstGTE].seq >= seqOrLocalSeq) {
814
790
  break;
815
791
  }
816
792
  }
@@ -938,9 +914,7 @@ export class PartialSequenceLengths {
938
914
  let segCount = 0;
939
915
  // Compute length for seq across children
940
916
  for (let i = 0; i < node.childCount; i++) {
941
- // TODO Non null asserting, why is this not null?
942
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
943
- const child = node.children[i]!;
917
+ const child = node.children[i];
944
918
  if (child.isLeaf()) {
945
919
  const segment = child;
946
920
  const removalInfo = toRemovalInfo(segment);
@@ -1023,9 +997,7 @@ export class PartialSequenceLengths {
1023
997
  );
1024
998
  this.clientSeqNumbers[clientId] ??= new PartialSequenceLengthsSet();
1025
999
  PartialSequenceLengths.addSeq(
1026
- // TODO Non null asserting, why is this not null?
1027
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1028
- this.clientSeqNumbers[clientId]!,
1000
+ this.clientSeqNumbers[clientId],
1029
1001
  seq,
1030
1002
  seqSeglen + remoteObliteratedLen,
1031
1003
  undefined,
@@ -1051,16 +1023,12 @@ export class PartialSequenceLengths {
1051
1023
  public getPartialLength(refSeq: number, clientId: number, localSeq?: number): number {
1052
1024
  let pLen = this.minLength;
1053
1025
  const cliLatestIndex = this.cliLatest(clientId);
1054
- // TODO Non null asserting, why is this not null?
1055
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1056
- const cliSeq = this.clientSeqNumbers[clientId]!;
1026
+ const cliSeq = this.clientSeqNumbers[clientId];
1057
1027
  pLen += this.partialLengths.latestLeq(refSeq)?.len ?? 0;
1058
1028
 
1059
1029
  if (localSeq === undefined) {
1060
1030
  if (cliLatestIndex >= 0) {
1061
- // TODO Non null asserting, why is this not null?
1062
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1063
- const cliLatest = cliSeq.items[cliLatestIndex]!;
1031
+ const cliLatest = cliSeq.items[cliLatestIndex];
1064
1032
  if (cliLatest.seq > refSeq) {
1065
1033
  // The client has local edits after refSeq, add in the length adjustments
1066
1034
  pLen += cliLatest.len;
@@ -1146,15 +1114,13 @@ export class PartialSequenceLengths {
1146
1114
  buf += `(${partial.seq},${partial.len}) `;
1147
1115
  }
1148
1116
 
1149
- // TODO Non null asserting, why is this not null?
1150
- // eslint-disable-next-line @typescript-eslint/no-for-in-array, no-restricted-syntax, guard-for-in
1117
+ // eslint-disable-next-line @typescript-eslint/no-for-in-array, no-restricted-syntax
1151
1118
  for (const clientId in this.clientSeqNumbers) {
1152
- const seqNumber = this.clientSeqNumbers[clientId];
1153
- if (seqNumber !== undefined && seqNumber.size > 0) {
1119
+ if (this.clientSeqNumbers[clientId].size > 0) {
1154
1120
  buf += `Client `;
1155
1121
  buf += glc ? `${glc(+clientId)}` : `${clientId}`;
1156
1122
  buf += "[";
1157
- for (const partial of seqNumber.items) {
1123
+ for (const partial of this.clientSeqNumbers[clientId].items) {
1158
1124
  buf += `(${partial.seq},${partial.len})`;
1159
1125
  }
1160
1126
  buf += "]";
@@ -1180,9 +1146,7 @@ export class PartialSequenceLengths {
1180
1146
 
1181
1147
  private addClientSeqNumber(clientId: number, seq: number, seglen: number): void {
1182
1148
  this.clientSeqNumbers[clientId] ??= new PartialSequenceLengthsSet();
1183
- // TODO Non null asserting, why is this not null?
1184
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1185
- const cli = this.clientSeqNumbers[clientId]!;
1149
+ const cli = this.clientSeqNumbers[clientId];
1186
1150
  cli.addOrUpdate({ seq, len: 0, seglen });
1187
1151
  }
1188
1152
 
@@ -1491,16 +1455,9 @@ function mergeSortedListsBySeq<T extends PartialSequenceLength>(lists: T[][]): I
1491
1455
  let currentMin: T | undefined;
1492
1456
  let currentMinIndex: number | undefined;
1493
1457
  for (let i = 0; i < len; i++) {
1494
- // TODO Non null asserting, why is this not null?
1495
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1496
- const candidateIndex = this.nextSmallestIndex[i]!;
1497
- // TODO Non null asserting, why is this not null?
1498
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1499
- const list = this.sublists[i]!;
1500
- if (candidateIndex < list.length) {
1501
- // TODO Non null asserting, why is this not null?
1502
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1503
- const candidate = list[candidateIndex]!;
1458
+ const candidateIndex = this.nextSmallestIndex[i];
1459
+ if (candidateIndex < this.sublists[i].length) {
1460
+ const candidate = this.sublists[i][candidateIndex];
1504
1461
  if (!currentMin || candidate.seq < currentMin.seq) {
1505
1462
  currentMin = candidate;
1506
1463
  currentMinIndex = i;
@@ -1524,9 +1481,7 @@ function mergeSortedListsBySeq<T extends PartialSequenceLength>(lists: T[][]): I
1524
1481
  function insertIntoList<T>(list: T[], index: number, elem: T): void {
1525
1482
  if (index < list.length) {
1526
1483
  for (let k = list.length; k > index; k--) {
1527
- // TODO Non null asserting, why is this not null?
1528
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1529
- list[k] = list[k - 1]!;
1484
+ list[k] = list[k - 1];
1530
1485
  }
1531
1486
  list[index] = elem;
1532
1487
  } else {
package/src/properties.ts CHANGED
@@ -122,9 +122,7 @@ export function extendIfUndefined<T>(
122
122
  // eslint-disable-next-line no-restricted-syntax
123
123
  for (const key in extension) {
124
124
  if (base[key] === undefined) {
125
- // TODO Non null asserting, why is this not null?
126
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
127
- base[key] = extension[key]!;
125
+ base[key] = extension[key];
128
126
  }
129
127
  }
130
128
  }
@@ -121,9 +121,7 @@ function appendLocalInsertToRevertibles(
121
121
  trackingGroup: new UnorderedTrackingGroup(),
122
122
  });
123
123
  }
124
- // TODO Non null asserting, why is this not null?
125
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
126
- const last = revertibles[revertibles.length - 1]!;
124
+ const last = revertibles[revertibles.length - 1];
127
125
  for (const t of deltaArgs.deltaSegments) last.trackingGroup.link(t.segment);
128
126
 
129
127
  return revertibles;
@@ -139,13 +137,9 @@ function appendLocalRemoveToRevertibles(
139
137
  trackingGroup: new UnorderedTrackingGroup(),
140
138
  });
141
139
  }
142
- // TODO Non null asserting, why is this not null?
143
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
144
- const last = revertibles[revertibles.length - 1]!;
140
+ const last = revertibles[revertibles.length - 1];
145
141
 
146
- // TODO Non null asserting, why is this not null?
147
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
148
- const mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0]!.segment);
142
+ const mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0].segment);
149
143
 
150
144
  for (const t of deltaArgs.deltaSegments) {
151
145
  const props: RemoveSegmentRefProperties = {
@@ -259,9 +253,7 @@ function revertLocalInsert(
259
253
  revertible: TypedRevertible<typeof MergeTreeDeltaType.INSERT>,
260
254
  ): void {
261
255
  while (revertible.trackingGroup.size > 0) {
262
- // TODO Non null asserting, why is this not null?
263
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
264
- const tracked = revertible.trackingGroup.tracked[0]!;
256
+ const tracked = revertible.trackingGroup.tracked[0];
265
257
  assert(
266
258
  tracked.trackingCollection.unlink(revertible.trackingGroup),
267
259
  0x3f1 /* tracking group removed */,
@@ -280,9 +272,7 @@ function revertLocalRemove(
280
272
  revertible: TypedRevertible<typeof MergeTreeDeltaType.REMOVE>,
281
273
  ): void {
282
274
  while (revertible.trackingGroup.size > 0) {
283
- // TODO Non null asserting, why is this not null?
284
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
285
- const tracked = revertible.trackingGroup.tracked[0]!;
275
+ const tracked = revertible.trackingGroup.tracked[0];
286
276
 
287
277
  assert(
288
278
  tracked.trackingCollection.unlink(revertible.trackingGroup),
@@ -386,9 +376,7 @@ function revertLocalAnnotate(
386
376
  revertible: TypedRevertible<typeof MergeTreeDeltaType.ANNOTATE>,
387
377
  ): void {
388
378
  while (revertible.trackingGroup.size > 0) {
389
- // TODO Non null asserting, why is this not null?
390
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
391
- const tracked = revertible.trackingGroup.tracked[0]!;
379
+ const tracked = revertible.trackingGroup.tracked[0];
392
380
  const unlinked = tracked.trackingCollection.unlink(revertible.trackingGroup);
393
381
  assert(unlinked && tracked.isLeaf(), 0x3f7 /* annotates must track segments */);
394
382
  if (toRemovalInfo(tracked) === undefined) {
@@ -423,9 +411,7 @@ export function revertMergeTreeDeltaRevertibles(
423
411
  const r = revertibles.pop()!;
424
412
  const operation = r.operation;
425
413
  if (r.trackingGroup.size > 0) {
426
- // TODO Non null asserting, why is this not null?
427
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
428
- mergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]!);
414
+ mergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]);
429
415
  switch (operation) {
430
416
  case MergeTreeDeltaType.INSERT: {
431
417
  revertLocalInsert(driver, mergeTreeWithRevert, r);
@@ -70,9 +70,7 @@ export class SegmentGroupCollection {
70
70
  // duplicate the previousProps for this segment
71
71
  const index = segmentGroup.segments.indexOf(sourceSegment);
72
72
  if (index !== -1) {
73
- // TODO Non null asserting, why is this not null?
74
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
75
- segmentGroup.previousProps.push(segmentGroup.previousProps[index]!);
73
+ segmentGroup.previousProps.push(segmentGroup.previousProps[index]);
76
74
  }
77
75
  }
78
76
  }
@@ -50,7 +50,6 @@ export class PropertiesManager {
50
50
  for (const [key, value] of Object.entries(props)) {
51
51
  if (value !== undefined && this.pendingKeyUpdateCount?.[key] !== undefined) {
52
52
  assert(
53
- // TODO Non null asserting, why is this not null?
54
53
  this.pendingKeyUpdateCount[key]! > 0,
55
54
  0x05c /* "Trying to update more annotate props than do exist!" */,
56
55
  );
@@ -87,8 +87,7 @@ export class SnapshotLoader {
87
87
  // TODO: The 'Snapshot.catchupOps' tree entry is purely for backwards compatibility.
88
88
  // (See https://github.com/microsoft/FluidFramework/issues/84)
89
89
 
90
- // TODO Non null asserting, why is this not null?
91
- return this.loadCatchupOps(services.readBlob(blobs[0]!), this.serializer);
90
+ return this.loadCatchupOps(services.readBlob(blobs[0]), this.serializer);
92
91
  } else if (blobs.length !== headerChunk.headerMetadata!.orderedChunkMetadata.length) {
93
92
  throw new Error("Unexpected blobs in snapshot");
94
93
  }
@@ -217,8 +216,7 @@ export class SnapshotLoader {
217
216
  ) {
218
217
  const chunk = await SnapshotV1.loadChunk(
219
218
  services,
220
- // TODO Non null asserting, why is this not null?
221
- headerMetadata.orderedChunkMetadata[chunkIndex]!.id,
219
+ headerMetadata.orderedChunkMetadata[chunkIndex].id,
222
220
  this.logger,
223
221
  this.mergeTree.options,
224
222
  this.serializer,
package/src/snapshotV1.ts CHANGED
@@ -92,22 +92,14 @@ export class SnapshotV1 {
92
92
  let segmentCount = 0;
93
93
  let hasAttribution = false;
94
94
  while (length < approxSequenceLength && startIndex + segmentCount < allSegments.length) {
95
- // TODO Non null asserting, why is this not null?
96
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
97
- const pseg = allSegments[startIndex + segmentCount]!;
95
+ const pseg = allSegments[startIndex + segmentCount];
98
96
  segments.push(pseg);
99
- // TODO Non null asserting, why is this not null?
100
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
101
- length += allLengths[startIndex + segmentCount]!;
97
+ length += allLengths[startIndex + segmentCount];
102
98
  if (attributionCollections[startIndex + segmentCount]) {
103
99
  hasAttribution = true;
104
100
  collections.push({
105
- // TODO Non null asserting, why is this not null?
106
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
107
- attribution: attributionCollections[startIndex + segmentCount]!,
108
- // TODO Non null asserting, why is this not null?
109
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
110
- cachedLength: allLengths[startIndex + segmentCount]!,
101
+ attribution: attributionCollections[startIndex + segmentCount],
102
+ cachedLength: allLengths[startIndex + segmentCount],
111
103
  });
112
104
  }
113
105
  segmentCount++;
@@ -314,9 +306,7 @@ export class SnapshotV1 {
314
306
  raw.removedClient =
315
307
  segment.removedClientIds === undefined
316
308
  ? undefined
317
- : // TODO Non null asserting, why is this not null?
318
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
319
- this.getLongClientId(segment.removedClientIds[0]!);
309
+ : this.getLongClientId(segment.removedClientIds[0]);
320
310
 
321
311
  raw.removedClientIds = segment.removedClientIds?.map((id) =>
322
312
  this.getLongClientId(id),
@@ -83,8 +83,7 @@ export class SnapshotLegacy {
83
83
  sequenceLength < approxSequenceLength &&
84
84
  startIndex + segCount < allSegments.length
85
85
  ) {
86
- // TODO Non null asserting, why is this not null?
87
- const pseg = allSegments[startIndex + segCount]!;
86
+ const pseg = allSegments[startIndex + segCount];
88
87
  segs.push(pseg);
89
88
  if (pseg.attribution) {
90
89
  segsWithAttribution++;
@@ -27,7 +27,6 @@ export type SortedSegmentSetItem =
27
27
  * the segments changes. This invariant allows us to ensure the segments stay
28
28
  * ordered and unique, and that new segments can be inserted into that order.
29
29
  *
30
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
31
30
  * @internal
32
31
  */
33
32
  // eslint-disable-next-line import/no-deprecated
@@ -65,9 +64,7 @@ export class SortedSegmentSet<T extends SortedSegmentSetItem = ISegment> extends
65
64
 
66
65
  while (start <= end) {
67
66
  index = start + Math.floor((end - start) / 2);
68
- // TODO Non null asserting, why is this not null?
69
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
- const indexKey = this.getKey(this.keySortedItems[index]!);
67
+ const indexKey = this.getKey(this.keySortedItems[index]);
71
68
  if (indexKey > itemKey) {
72
69
  if (start === index) {
73
70
  return { exists: false, index };
@@ -87,9 +84,7 @@ export class SortedSegmentSet<T extends SortedSegmentSetItem = ISegment> extends
87
84
  }
88
85
  for (
89
86
  let b = index - 1;
90
- // TODO Non null asserting, why is this not null?
91
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92
- b >= 0 && this.getKey(this.keySortedItems[b]!) === itemKey;
87
+ b >= 0 && this.getKey(this.keySortedItems[b]) === itemKey;
93
88
  b--
94
89
  ) {
95
90
  if (this.keySortedItems[b] === item) {
@@ -99,9 +94,7 @@ export class SortedSegmentSet<T extends SortedSegmentSetItem = ISegment> extends
99
94
  for (
100
95
  index + 1;
101
96
  index < this.keySortedItems.length &&
102
- // TODO Non null asserting, why is this not null?
103
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
104
- this.getKey(this.keySortedItems[index]!) === itemKey;
97
+ this.getKey(this.keySortedItems[index]) === itemKey;
105
98
  index++
106
99
  ) {
107
100
  if (this.keySortedItems[index] === item) {
package/src/sortedSet.ts CHANGED
@@ -23,9 +23,7 @@ export abstract class SortedSet<T, U extends string | number> {
23
23
  public addOrUpdate(newItem: T, update?: (existingItem: T, newItem: T) => void): void {
24
24
  const position = this.findItemPosition(newItem);
25
25
  if (position.exists) {
26
- // Non null asserting here because we know the item exists
27
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
- update?.(this.keySortedItems[position.index]!, newItem);
26
+ update?.(this.keySortedItems[position.index], newItem);
29
27
  } else {
30
28
  this.keySortedItems.splice(position.index, 0, newItem);
31
29
  }
@@ -56,9 +54,7 @@ export abstract class SortedSet<T, U extends string | number> {
56
54
 
57
55
  while (start <= end) {
58
56
  index = start + Math.floor((end - start) / 2);
59
- // TODO Non null asserting, why is this not null?
60
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
- const indexKey = this.getKey(this.keySortedItems[index]!);
57
+ const indexKey = this.getKey(this.keySortedItems[index]);
62
58
  if (indexKey > itemKey) {
63
59
  if (start === index) {
64
60
  return { exists: false, index };
package/src/zamboni.ts CHANGED
@@ -57,8 +57,7 @@ export function zamboniSegments(
57
57
  block.childCount = newChildCount;
58
58
  block.children = childrenCopy;
59
59
  for (let j = 0; j < newChildCount; j++) {
60
- // Non null asserting here since its looping though childrenCopy.length so j at childrenCopy will always exist
61
- block.assignChild(childrenCopy[j]!, j, false);
60
+ block.assignChild(childrenCopy[j], j, false);
62
61
  }
63
62
 
64
63
  if (underflow(block) && block.parent) {
@@ -107,8 +106,7 @@ export function packParent(parent: MergeBlock, mergeTree: MergeTree): void {
107
106
  }
108
107
  const packedBlock = mergeTree.makeBlock(nodeCount);
109
108
  for (let packedNodeIndex = 0; packedNodeIndex < nodeCount; packedNodeIndex++) {
110
- // TODO Non null asserting, why is this not null?
111
- const nodeToPack = holdNodes[childrenPackedCount++]!;
109
+ const nodeToPack = holdNodes[childrenPackedCount++];
112
110
  packedBlock.assignChild(nodeToPack, packedNodeIndex, false);
113
111
  }
114
112
  packedBlock.parent = parent;
@@ -117,8 +115,7 @@ export function packParent(parent: MergeBlock, mergeTree: MergeTree): void {
117
115
  }
118
116
  parent.children = packedBlocks;
119
117
  for (let j = 0; j < childCount; j++) {
120
- // TODO Non null asserting, why is this not null?
121
- parent.assignChild(packedBlocks[j]!, j, false);
118
+ parent.assignChild(packedBlocks[j], j, false);
122
119
  }
123
120
  parent.childCount = childCount;
124
121
  } else {
@@ -138,8 +135,7 @@ function scourNode(node: MergeBlock, holdNodes: IMergeNode[], mergeTree: MergeTr
138
135
  // when possible.
139
136
  let prevSegment: ISegment | undefined;
140
137
  for (let k = 0; k < node.childCount; k++) {
141
- // TODO Non null asserting, why is this not null?
142
- const childNode = node.children[k]!;
138
+ const childNode = node.children[k];
143
139
  if (!childNode.isLeaf() || !childNode.segmentGroups.empty) {
144
140
  holdNodes.push(childNode);
145
141
  prevSegment = undefined;
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "outDir": "./lib",
8
8
  "preserveConstEnums": true,
9
9
  "noImplicitAny": true,
10
+ "noUncheckedIndexedAccess": false,
10
11
  "exactOptionalPropertyTypes": false,
11
12
  },
12
13
  }