@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.
- package/CHANGELOG.md +52 -0
- package/README.md +4 -3
- package/dist/defaultMap.d.ts +1 -1
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +6 -5
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +1 -1
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/intervalCollection.d.ts +2 -42
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +16 -34
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.js +3 -3
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +2 -2
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/interval.js +2 -2
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +6 -0
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.js +6 -6
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.js +4 -4
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence.d.ts +23 -2
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +61 -14
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.js +2 -2
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sharedIntervalCollection.js +2 -2
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +9 -0
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js +8 -2
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +6 -6
- package/dist/sharedString.js.map +1 -1
- package/lib/defaultMap.d.ts +1 -1
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +2 -1
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +1 -1
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/intervalCollection.d.ts +2 -42
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +3 -21
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.js +1 -1
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervals/interval.js +1 -1
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +6 -0
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.js +2 -2
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/revertibles.js +1 -1
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.d.ts +23 -2
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +56 -8
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.js +1 -1
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sharedIntervalCollection.js +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts +9 -0
- package/lib/sharedSequence.d.ts.map +1 -1
- package/lib/sharedSequence.js +7 -1
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +6 -6
- package/lib/sharedString.js.map +1 -1
- package/package.json +25 -28
- package/src/defaultMap.ts +2 -1
- package/src/defaultMapInterfaces.ts +1 -1
- package/src/intervalCollection.ts +4 -44
- package/src/intervalIndex/idIntervalIndex.ts +1 -1
- package/src/intervalIndex/startpointInRangeIndex.ts +1 -1
- package/src/intervals/interval.ts +1 -1
- package/src/intervals/intervalUtils.ts +7 -0
- package/src/intervals/sequenceInterval.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +1 -1
- package/src/sequence.ts +80 -9
- package/src/sequenceDeltaEvent.ts +1 -1
- package/src/sharedIntervalCollection.ts +1 -1
- package/src/sharedSequence.ts +10 -1
- 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
|
|
10
|
-
const
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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) {
|