@fluidframework/sequence 2.0.0-internal.6.1.1 → 2.0.0-internal.6.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 (102) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +4 -3
  3. package/dist/defaultMap.d.ts +1 -1
  4. package/dist/defaultMap.d.ts.map +1 -1
  5. package/dist/defaultMap.js +6 -5
  6. package/dist/defaultMap.js.map +1 -1
  7. package/dist/defaultMapInterfaces.d.ts +1 -1
  8. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  9. package/dist/defaultMapInterfaces.js.map +1 -1
  10. package/dist/intervalCollection.d.ts +2 -42
  11. package/dist/intervalCollection.d.ts.map +1 -1
  12. package/dist/intervalCollection.js +16 -34
  13. package/dist/intervalCollection.js.map +1 -1
  14. package/dist/intervalIndex/idIntervalIndex.js +3 -3
  15. package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
  16. package/dist/intervalIndex/startpointInRangeIndex.js +2 -2
  17. package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
  18. package/dist/intervals/interval.js +2 -2
  19. package/dist/intervals/interval.js.map +1 -1
  20. package/dist/intervals/intervalUtils.d.ts +6 -0
  21. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  22. package/dist/intervals/intervalUtils.js.map +1 -1
  23. package/dist/intervals/sequenceInterval.js +6 -6
  24. package/dist/intervals/sequenceInterval.js.map +1 -1
  25. package/dist/packageVersion.d.ts +1 -1
  26. package/dist/packageVersion.js +1 -1
  27. package/dist/packageVersion.js.map +1 -1
  28. package/dist/revertibles.js +4 -4
  29. package/dist/revertibles.js.map +1 -1
  30. package/dist/sequence.d.ts +23 -2
  31. package/dist/sequence.d.ts.map +1 -1
  32. package/dist/sequence.js +61 -14
  33. package/dist/sequence.js.map +1 -1
  34. package/dist/sequenceDeltaEvent.js +2 -2
  35. package/dist/sequenceDeltaEvent.js.map +1 -1
  36. package/dist/sharedIntervalCollection.js +2 -2
  37. package/dist/sharedIntervalCollection.js.map +1 -1
  38. package/dist/sharedSequence.d.ts +9 -0
  39. package/dist/sharedSequence.d.ts.map +1 -1
  40. package/dist/sharedSequence.js +8 -2
  41. package/dist/sharedSequence.js.map +1 -1
  42. package/dist/sharedString.d.ts.map +1 -1
  43. package/dist/sharedString.js +6 -6
  44. package/dist/sharedString.js.map +1 -1
  45. package/lib/defaultMap.d.ts +1 -1
  46. package/lib/defaultMap.d.ts.map +1 -1
  47. package/lib/defaultMap.js +2 -1
  48. package/lib/defaultMap.js.map +1 -1
  49. package/lib/defaultMapInterfaces.d.ts +1 -1
  50. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  51. package/lib/defaultMapInterfaces.js.map +1 -1
  52. package/lib/intervalCollection.d.ts +2 -42
  53. package/lib/intervalCollection.d.ts.map +1 -1
  54. package/lib/intervalCollection.js +3 -21
  55. package/lib/intervalCollection.js.map +1 -1
  56. package/lib/intervalIndex/idIntervalIndex.js +1 -1
  57. package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
  58. package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
  59. package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
  60. package/lib/intervals/interval.js +1 -1
  61. package/lib/intervals/interval.js.map +1 -1
  62. package/lib/intervals/intervalUtils.d.ts +6 -0
  63. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  64. package/lib/intervals/intervalUtils.js.map +1 -1
  65. package/lib/intervals/sequenceInterval.js +2 -2
  66. package/lib/intervals/sequenceInterval.js.map +1 -1
  67. package/lib/packageVersion.d.ts +1 -1
  68. package/lib/packageVersion.js +1 -1
  69. package/lib/packageVersion.js.map +1 -1
  70. package/lib/revertibles.js +1 -1
  71. package/lib/revertibles.js.map +1 -1
  72. package/lib/sequence.d.ts +23 -2
  73. package/lib/sequence.d.ts.map +1 -1
  74. package/lib/sequence.js +56 -8
  75. package/lib/sequence.js.map +1 -1
  76. package/lib/sequenceDeltaEvent.js +1 -1
  77. package/lib/sequenceDeltaEvent.js.map +1 -1
  78. package/lib/sharedIntervalCollection.js +1 -1
  79. package/lib/sharedIntervalCollection.js.map +1 -1
  80. package/lib/sharedSequence.d.ts +9 -0
  81. package/lib/sharedSequence.d.ts.map +1 -1
  82. package/lib/sharedSequence.js +7 -1
  83. package/lib/sharedSequence.js.map +1 -1
  84. package/lib/sharedString.d.ts.map +1 -1
  85. package/lib/sharedString.js +6 -6
  86. package/lib/sharedString.js.map +1 -1
  87. package/package.json +25 -28
  88. package/src/defaultMap.ts +2 -1
  89. package/src/defaultMapInterfaces.ts +1 -1
  90. package/src/intervalCollection.ts +4 -44
  91. package/src/intervalIndex/idIntervalIndex.ts +1 -1
  92. package/src/intervalIndex/startpointInRangeIndex.ts +1 -1
  93. package/src/intervals/interval.ts +1 -1
  94. package/src/intervals/intervalUtils.ts +7 -0
  95. package/src/intervals/sequenceInterval.ts +2 -2
  96. package/src/packageVersion.ts +1 -1
  97. package/src/revertibles.ts +1 -1
  98. package/src/sequence.ts +80 -9
  99. package/src/sequenceDeltaEvent.ts +1 -1
  100. package/src/sharedIntervalCollection.ts +1 -1
  101. package/src/sharedSequence.ts +10 -1
  102. package/src/sharedString.ts +8 -6
@@ -6,8 +6,8 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.intervalLocatorFromEndpoint = exports.IntervalCollection = exports.makeOpsMap = exports.IntervalCollectionValueType = exports.SequenceIntervalCollectionValueType = exports.LocalIntervalCollection = exports.createIntervalIndex = void 0;
8
8
  /* eslint-disable no-bitwise */
9
- const common_utils_1 = require("@fluidframework/common-utils");
10
- const container_utils_1 = require("@fluidframework/container-utils");
9
+ const client_utils_1 = require("@fluid-internal/client-utils");
10
+ const core_utils_1 = require("@fluidframework/core-utils");
11
11
  const merge_tree_1 = require("@fluidframework/merge-tree");
12
12
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
13
13
  const uuid_1 = require("uuid");
@@ -201,7 +201,7 @@ class LocalIntervalCollection {
201
201
  this.removeIntervalFromIndexes(interval);
202
202
  }
203
203
  }, () => {
204
- (0, common_utils_1.assert)(previousInterval !== undefined, 0x3fa /* Invalid interleaving of before/after slide */);
204
+ (0, core_utils_1.assert)(previousInterval !== undefined, 0x3fa /* Invalid interleaving of before/after slide */);
205
205
  pendingChanges--;
206
206
  if (pendingChanges === 0) {
207
207
  this.addIntervalToIndexes(interval);
@@ -288,7 +288,7 @@ function makeOpsMap() {
288
288
  if (!params) {
289
289
  return;
290
290
  }
291
- (0, common_utils_1.assert)(op !== undefined, 0x3fb /* op should exist here */);
291
+ (0, core_utils_1.assert)(op !== undefined, 0x3fb /* op should exist here */);
292
292
  collection.ackAdd(params, local, op, localOpMetadata);
293
293
  },
294
294
  rebase,
@@ -298,7 +298,7 @@ function makeOpsMap() {
298
298
  intervals_1.IntervalOpType.DELETE,
299
299
  {
300
300
  process: (collection, params, local, op) => {
301
- (0, common_utils_1.assert)(op !== undefined, 0x3fc /* op should exist here */);
301
+ (0, core_utils_1.assert)(op !== undefined, 0x3fc /* op should exist here */);
302
302
  collection.ackDelete(params, local, op);
303
303
  },
304
304
  rebase: (collection, op, localOpMetadata) => {
@@ -316,7 +316,7 @@ function makeOpsMap() {
316
316
  if (!params) {
317
317
  return;
318
318
  }
319
- (0, common_utils_1.assert)(op !== undefined, 0x3fd /* op should exist here */);
319
+ (0, core_utils_1.assert)(op !== undefined, 0x3fd /* op should exist here */);
320
320
  collection.ackChange(params, local, op, localOpMetadata);
321
321
  },
322
322
  rebase,
@@ -347,7 +347,7 @@ class IntervalCollectionIterator {
347
347
  /**
348
348
  * {@inheritdoc IIntervalCollection}
349
349
  */
350
- class IntervalCollection extends common_utils_1.TypedEventEmitter {
350
+ class IntervalCollection extends client_utils_1.TypedEventEmitter {
351
351
  /** @internal */
352
352
  constructor(helpers, requiresClient, emitter, serializedIntervals, options = {}) {
353
353
  super();
@@ -404,19 +404,19 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
404
404
  clientId: this.client.getLongClientId(clientId),
405
405
  }, localSeq);
406
406
  // if segment is undefined, it slid off the string
407
- (0, common_utils_1.assert)(segment !== undefined, 0x54e /* No segment found */);
407
+ (0, core_utils_1.assert)(segment !== undefined, 0x54e /* No segment found */);
408
408
  const segoff = (0, merge_tree_1.getSlideToSegoff)({ segment, offset }) ?? segment;
409
409
  // case happens when rebasing op, but concurrently entire string has been deleted
410
410
  if (segoff.segment === undefined || segoff.offset === undefined) {
411
411
  return merge_tree_1.DetachedReferencePosition;
412
412
  }
413
- (0, common_utils_1.assert)(offset !== undefined && 0 <= offset && offset < segment.cachedLength, 0x54f /* Invalid offset */);
413
+ (0, core_utils_1.assert)(offset !== undefined && 0 <= offset && offset < segment.cachedLength, 0x54f /* Invalid offset */);
414
414
  return this.client.findReconnectionPosition(segoff.segment, localSeq) + segoff.offset;
415
415
  }
416
416
  computeRebasedPositions(localSeq) {
417
- (0, common_utils_1.assert)(this.client !== undefined, 0x550 /* Client should be defined when computing rebased position */);
417
+ (0, core_utils_1.assert)(this.client !== undefined, 0x550 /* Client should be defined when computing rebased position */);
418
418
  const original = this.localSeqToSerializedInterval.get(localSeq);
419
- (0, common_utils_1.assert)(original !== undefined, 0x551 /* Failed to store pending serialized interval info for this localSeq. */);
419
+ (0, core_utils_1.assert)(original !== undefined, 0x551 /* Failed to store pending serialized interval info for this localSeq. */);
420
420
  const rebased = { ...original };
421
421
  const { start, end, sequenceNumber } = original;
422
422
  if (start !== undefined) {
@@ -506,7 +506,7 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
506
506
  throw new telemetry_utils_1.LoggingError("Can not add transient intervals");
507
507
  }
508
508
  if (stickiness !== intervals_1.IntervalStickiness.END && !this.options.intervalStickinessEnabled) {
509
- throw new container_utils_1.UsageError("attempted to set interval stickiness without enabling `intervalStickinessEnabled` feature flag");
509
+ throw new telemetry_utils_1.UsageError("attempted to set interval stickiness without enabling `intervalStickinessEnabled` feature flag");
510
510
  }
511
511
  const interval = this.localCollection.addInterval(start, end, intervalType, props, undefined, stickiness);
512
512
  if (interval) {
@@ -682,7 +682,7 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
682
682
  throw new telemetry_utils_1.LoggingError("Attach must be called before accessing intervals");
683
683
  }
684
684
  if (local) {
685
- (0, common_utils_1.assert)(localOpMetadata !== undefined, 0x552 /* op metadata should be defined for local op */);
685
+ (0, core_utils_1.assert)(localOpMetadata !== undefined, 0x552 /* op metadata should be defined for local op */);
686
686
  this.localSeqToSerializedInterval.delete(localOpMetadata?.localSeq);
687
687
  // This is an ack from the server. Remove the pending change.
688
688
  this.removePendingChange(serializedInterval);
@@ -691,7 +691,7 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
691
691
  // This API cannot change the ID, and writing to the ID property will result in an exception. So we
692
692
  // strip it out of the properties here.
693
693
  const { [reservedIntervalIdKey]: id, ...newProps } = serializedInterval.properties ?? {};
694
- (0, common_utils_1.assert)(id !== undefined, 0x3fe /* id must exist on the interval */);
694
+ (0, core_utils_1.assert)(id !== undefined, 0x3fe /* id must exist on the interval */);
695
695
  const interval = this.getIntervalById(id);
696
696
  if (!interval) {
697
697
  // The interval has been removed locally; no-op.
@@ -793,7 +793,7 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
793
793
  }
794
794
  if (localInterval !== undefined) {
795
795
  // we know we must be using `SequenceInterval` because `this.client` exists
796
- (0, common_utils_1.assert)(localInterval instanceof intervals_1.SequenceInterval, 0x3a0 /* localInterval must be `SequenceInterval` when used with client */);
796
+ (0, core_utils_1.assert)(localInterval instanceof intervals_1.SequenceInterval, 0x3a0 /* localInterval must be `SequenceInterval` when used with client */);
797
797
  // The rebased op may place this interval's endpoints on different segments. Calling `changeInterval` here
798
798
  // updates the local client's state to be consistent with the emitted op.
799
799
  this.localCollection?.changeInterval(localInterval, startRebased, endRebased, undefined, localSeq);
@@ -886,7 +886,7 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
886
886
  /** @internal */
887
887
  ackAdd(serializedInterval, local, op, localOpMetadata) {
888
888
  if (local) {
889
- (0, common_utils_1.assert)(localOpMetadata !== undefined, 0x553 /* op metadata should be defined for local op */);
889
+ (0, core_utils_1.assert)(localOpMetadata !== undefined, 0x553 /* op metadata should be defined for local op */);
890
890
  this.localSeqToSerializedInterval.delete(localOpMetadata.localSeq);
891
891
  const id = serializedInterval.properties?.[reservedIntervalIdKey];
892
892
  const localInterval = this.getIntervalById(id);
@@ -943,8 +943,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
943
943
  }
944
944
  /**
945
945
  * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithStartPosition}
946
- *
947
- * @deprecated - The sequence order of collection order will not be supported
948
946
  */
949
947
  CreateForwardIteratorWithStartPosition(startPosition) {
950
948
  const iterator = new IntervalCollectionIterator(this, true, startPosition);
@@ -952,8 +950,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
952
950
  }
953
951
  /**
954
952
  * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithStartPosition}
955
- *
956
- * @deprecated - The sequence order of collection order will not be supported
957
953
  */
958
954
  CreateBackwardIteratorWithStartPosition(startPosition) {
959
955
  const iterator = new IntervalCollectionIterator(this, false, startPosition);
@@ -961,8 +957,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
961
957
  }
962
958
  /**
963
959
  * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithEndPosition}
964
- *
965
- * @deprecated - The sequence order of collection order will not be supported
966
960
  */
967
961
  CreateForwardIteratorWithEndPosition(endPosition) {
968
962
  const iterator = new IntervalCollectionIterator(this, true, undefined, endPosition);
@@ -970,8 +964,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
970
964
  }
971
965
  /**
972
966
  * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithEndPosition}
973
- *
974
- * @deprecated - The sequence order of collection order will not be supported
975
967
  */
976
968
  CreateBackwardIteratorWithEndPosition(endPosition) {
977
969
  const iterator = new IntervalCollectionIterator(this, false, undefined, endPosition);
@@ -979,8 +971,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
979
971
  }
980
972
  /**
981
973
  * {@inheritdoc IIntervalCollection.gatherIterationResults}
982
- * @deprecated - This API will be deprecated as its functionality will be moved to the `OverlappingIntervalsIndex`.
983
- * We would like the user to attach the index to the collection on their own.
984
974
  */
985
975
  gatherIterationResults(results, iteratesForward, start, end) {
986
976
  if (!this.localCollection) {
@@ -990,8 +980,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
990
980
  }
991
981
  /**
992
982
  * {@inheritdoc IIntervalCollection.findOverlappingIntervals}
993
- * @deprecated - This API will be deprecated as its functionality will be moved to the `OverlappingIntervalsIndex`.
994
- * We would like the user to attach the index to the collection on their own.
995
983
  */
996
984
  findOverlappingIntervals(startPosition, endPosition) {
997
985
  if (!this.localCollection) {
@@ -1012,9 +1000,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
1012
1000
  }
1013
1001
  /**
1014
1002
  * {@inheritdoc IIntervalCollection.previousInterval}
1015
- *
1016
- * @deprecated - This API will be deprecated as its functionality will be moved to the `EndpointIndex`.
1017
- * We would like the user to attach the index to the collection on their own.
1018
1003
  */
1019
1004
  previousInterval(pos) {
1020
1005
  if (!this.localCollection) {
@@ -1024,9 +1009,6 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
1024
1009
  }
1025
1010
  /**
1026
1011
  * {@inheritdoc IIntervalCollection.nextInterval}
1027
- *
1028
- * @deprecated - This API will be deprecated as its functionality will be moved to the `EndpointIndex`.
1029
- * We would like the user to attach the index to the collection on their own.
1030
1012
  */
1031
1013
  nextInterval(pos) {
1032
1014
  if (!this.localCollection) {