@fluidframework/sequence 2.23.0 → 2.31.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 +510 -495
- package/api-report/sequence.legacy.alpha.api.md +67 -5
- package/dist/IntervalCollectionValues.d.ts +3 -51
- package/dist/IntervalCollectionValues.d.ts.map +1 -1
- package/dist/IntervalCollectionValues.js +6 -49
- package/dist/IntervalCollectionValues.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +292 -63
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +111 -193
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalCollectionMap.d.ts +11 -32
- package/dist/intervalCollectionMap.d.ts.map +1 -1
- package/dist/intervalCollectionMap.js +37 -90
- package/dist/intervalCollectionMap.js.map +1 -1
- package/dist/intervalCollectionMapInterfaces.d.ts +10 -83
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +10 -11
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js +4 -5
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +12 -13
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js +4 -5
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.d.ts +6 -12
- package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.js +0 -3
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/index.d.ts +2 -2
- package/dist/intervalIndex/index.d.ts.map +1 -1
- package/dist/intervalIndex/index.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +28 -1
- package/dist/intervalIndex/intervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +30 -13
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js +4 -5
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -2
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +10 -11
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +4 -5
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/index.d.ts +2 -3
- package/dist/intervals/index.d.ts.map +1 -1
- package/dist/intervals/index.js +1 -6
- package/dist/intervals/index.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +3 -25
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +3 -8
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +1 -9
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +4 -6
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +3 -5
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +2 -63
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +0 -113
- package/dist/sharedIntervalCollection.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/IntervalCollectionValues.d.ts +3 -51
- package/lib/IntervalCollectionValues.d.ts.map +1 -1
- package/lib/IntervalCollectionValues.js +5 -47
- package/lib/IntervalCollectionValues.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +292 -63
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +113 -191
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalCollectionMap.d.ts +11 -32
- package/lib/intervalCollectionMap.d.ts.map +1 -1
- package/lib/intervalCollectionMap.js +39 -92
- package/lib/intervalCollectionMap.js.map +1 -1
- package/lib/intervalCollectionMapInterfaces.d.ts +10 -83
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +10 -11
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js +5 -6
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +12 -13
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js +5 -6
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.d.ts +6 -12
- package/lib/intervalIndex/idIntervalIndex.d.ts.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.js +0 -3
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/index.d.ts +2 -2
- package/lib/intervalIndex/index.d.ts.map +1 -1
- package/lib/intervalIndex/index.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +28 -1
- package/lib/intervalIndex/intervalIndex.d.ts.map +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +30 -13
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js +5 -6
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +2 -2
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -2
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +10 -11
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +5 -6
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervals/index.d.ts +2 -3
- package/lib/intervals/index.d.ts.map +1 -1
- package/lib/intervals/index.js +1 -2
- package/lib/intervals/index.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +3 -25
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -8
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +0 -8
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +4 -6
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +3 -5
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +2 -63
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js +1 -110
- package/lib/sharedIntervalCollection.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/lib/tsdoc-metadata.json +1 -1
- package/package.json +20 -23
- package/src/IntervalCollectionValues.ts +10 -93
- package/src/index.ts +6 -17
- package/src/intervalCollection.ts +524 -343
- package/src/intervalCollectionMap.ts +72 -140
- package/src/intervalCollectionMapInterfaces.ts +13 -104
- package/src/intervalIndex/endpointInRangeIndex.ts +17 -29
- package/src/intervalIndex/endpointIndex.ts +19 -31
- package/src/intervalIndex/idIntervalIndex.ts +15 -25
- package/src/intervalIndex/index.ts +2 -1
- package/src/intervalIndex/intervalIndex.ts +30 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +50 -27
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +2 -3
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -2
- package/src/intervalIndex/startpointInRangeIndex.ts +17 -29
- package/src/intervals/index.ts +0 -3
- package/src/intervals/intervalUtils.ts +3 -38
- package/src/intervals/sequenceInterval.ts +2 -12
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +8 -20
- package/src/sharedIntervalCollection.ts +5 -183
- package/src/sharedString.ts +6 -24
- package/dist/intervals/interval.d.ts +0 -76
- package/dist/intervals/interval.d.ts.map +0 -1
- package/dist/intervals/interval.js +0 -167
- package/dist/intervals/interval.js.map +0 -1
- package/lib/intervals/interval.d.ts +0 -76
- package/lib/intervals/interval.d.ts.map +0 -1
- package/lib/intervals/interval.js +0 -162
- package/lib/intervals/interval.js.map +0 -1
- package/prettier.config.cjs +0 -8
- package/src/intervals/interval.ts +0 -226
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ISegment } from "@fluidframework/merge-tree/internal";
|
|
6
6
|
import { SequenceInterval } from "../intervals/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { type ISequenceOverlappingIntervalsIndex } from "./overlappingIntervalsIndex.js";
|
|
8
8
|
/**
|
|
9
9
|
* This namespace contains specialiazations of indexes which support spatial queries
|
|
10
10
|
* specifically for `SequenceInterval`s.
|
|
@@ -17,7 +17,7 @@ export declare namespace SequenceIntervalIndexes {
|
|
|
17
17
|
* Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
|
-
interface Overlapping extends
|
|
20
|
+
interface Overlapping extends ISequenceOverlappingIntervalsIndex {
|
|
21
21
|
/**
|
|
22
22
|
* Finds overlapping intervals within the specified range.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceIntervalIndexes.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sequenceIntervalIndexes.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AAEzF;;;;GAIG;AAEH,yBAAiB,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,UAAiB,WAAY,SAAQ,kCAAkC;QACtE;;;;WAIG;QACH,gCAAgC,CAC/B,WAAW,EAAE;YAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;YAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,EAC1E,SAAS,EAAE;YAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;YAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,GACtE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;KAC9B;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceIntervalIndexes.js","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment } from \"@fluidframework/merge-tree/internal\";\n\nimport { SequenceInterval } from \"../intervals/index.js\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"sequenceIntervalIndexes.js","sourceRoot":"","sources":["../../src/intervalIndex/sequenceIntervalIndexes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment } from \"@fluidframework/merge-tree/internal\";\n\nimport { SequenceInterval } from \"../intervals/index.js\";\n\nimport { type ISequenceOverlappingIntervalsIndex } from \"./overlappingIntervalsIndex.js\";\n\n/**\n * This namespace contains specialiazations of indexes which support spatial queries\n * specifically for `SequenceInterval`s.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace SequenceIntervalIndexes {\n\t/**\n\t * Collection of intervals.\n\t *\n\t * Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.\n\t * @internal\n\t */\n\texport interface Overlapping extends ISequenceOverlappingIntervalsIndex {\n\t\t/**\n\t\t * Finds overlapping intervals within the specified range.\n\t\t *\n\t\t * @returns an array of all intervals that overlap with the specified SegOff range (includes both ends)\n\t\t */\n\t\tfindOverlappingIntervalsBySegoff(\n\t\t\tstartSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t\t\tendSegoff: { segment: ISegment | undefined; offset: number | undefined },\n\t\t): Iterable<SequenceInterval>;\n\t}\n}\n"]}
|
|
@@ -3,32 +3,31 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { Client } from "@fluidframework/merge-tree/internal";
|
|
6
|
-
import {
|
|
6
|
+
import { SequenceInterval } from "../intervals/index.js";
|
|
7
7
|
import { ISharedString } from "../sharedString.js";
|
|
8
|
-
import {
|
|
8
|
+
import { type SequenceIntervalIndex } from "./intervalIndex.js";
|
|
9
9
|
/**
|
|
10
10
|
* Collection of intervals.
|
|
11
11
|
*
|
|
12
12
|
* Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
export interface IStartpointInRangeIndex
|
|
15
|
+
export interface IStartpointInRangeIndex extends SequenceIntervalIndex {
|
|
16
16
|
/**
|
|
17
17
|
* @returns an array of all intervals contained in this collection whose startpoints locate in the range [start, end] (includes both ends)
|
|
18
18
|
*/
|
|
19
|
-
findIntervalsWithStartpointInRange(start: number, end: number):
|
|
19
|
+
findIntervalsWithStartpointInRange(start: number, end: number): SequenceInterval[];
|
|
20
20
|
}
|
|
21
|
-
export declare class StartpointInRangeIndex
|
|
21
|
+
export declare class StartpointInRangeIndex implements IStartpointInRangeIndex {
|
|
22
22
|
private readonly client;
|
|
23
|
-
private readonly helpers;
|
|
24
23
|
private readonly intervalTree;
|
|
25
|
-
constructor(client: Client
|
|
26
|
-
add(interval:
|
|
27
|
-
remove(interval:
|
|
28
|
-
findIntervalsWithStartpointInRange(start: number, end: number):
|
|
24
|
+
constructor(client: Client);
|
|
25
|
+
add(interval: SequenceInterval): void;
|
|
26
|
+
remove(interval: SequenceInterval): void;
|
|
27
|
+
findIntervalsWithStartpointInRange(start: number, end: number): SequenceInterval[];
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* @internal
|
|
32
31
|
*/
|
|
33
|
-
export declare function createStartpointInRangeIndex(sharedString: ISharedString): IStartpointInRangeIndex
|
|
32
|
+
export declare function createStartpointInRangeIndex(sharedString: ISharedString): IStartpointInRangeIndex;
|
|
34
33
|
//# sourceMappingURL=startpointInRangeIndex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startpointInRangeIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/startpointInRangeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAgC,MAAM,qCAAqC,CAAC;AAE3F,OAAO,
|
|
1
|
+
{"version":3,"file":"startpointInRangeIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/startpointInRangeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAgC,MAAM,qCAAqC,CAAC;AAE3F,OAAO,EAAgB,gBAAgB,EAA0B,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAOhE;;;;;GAKG;AACH,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACrE;;OAEG;IACH,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;CACnF;AAED,qBAAa,sBAAuB,YAAW,uBAAuB;IAGzD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAED,MAAM,EAAE,MAAM;IAyBpC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIrC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIxC,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE;CAiCzF;AACD;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,YAAY,EAAE,aAAa,GACzB,uBAAuB,CAGzB"}
|
|
@@ -10,9 +10,8 @@ const internal_1 = require("@fluidframework/merge-tree/internal");
|
|
|
10
10
|
const index_js_1 = require("../intervals/index.js");
|
|
11
11
|
const intervalIndexUtils_js_1 = require("./intervalIndexUtils.js");
|
|
12
12
|
class StartpointInRangeIndex {
|
|
13
|
-
constructor(client
|
|
13
|
+
constructor(client) {
|
|
14
14
|
this.client = client;
|
|
15
|
-
this.helpers = helpers;
|
|
16
15
|
this.intervalTree = new internal_1.RedBlackTree((a, b) => {
|
|
17
16
|
const compareStartsResult = a.compareStart(b);
|
|
18
17
|
if (compareStartsResult !== 0) {
|
|
@@ -45,8 +44,8 @@ class StartpointInRangeIndex {
|
|
|
45
44
|
results.push(node.data);
|
|
46
45
|
return true;
|
|
47
46
|
};
|
|
48
|
-
const transientStartInterval =
|
|
49
|
-
const transientEndInterval =
|
|
47
|
+
const transientStartInterval = (0, index_js_1.createSequenceInterval)("transient", start, start, this.client, index_js_1.IntervalType.Transient);
|
|
48
|
+
const transientEndInterval = (0, index_js_1.createSequenceInterval)("transient", end, end, this.client, index_js_1.IntervalType.Transient);
|
|
50
49
|
// Add comparison overrides to the transient intervals
|
|
51
50
|
transientStartInterval[intervalIndexUtils_js_1.forceCompare] = -1;
|
|
52
51
|
transientEndInterval[intervalIndexUtils_js_1.forceCompare] = 1;
|
|
@@ -60,7 +59,7 @@ exports.StartpointInRangeIndex = StartpointInRangeIndex;
|
|
|
60
59
|
*/
|
|
61
60
|
function createStartpointInRangeIndex(sharedString) {
|
|
62
61
|
const client = sharedString.client;
|
|
63
|
-
return new StartpointInRangeIndex(client
|
|
62
|
+
return new StartpointInRangeIndex(client);
|
|
64
63
|
}
|
|
65
64
|
exports.createStartpointInRangeIndex = createStartpointInRangeIndex;
|
|
66
65
|
//# sourceMappingURL=startpointInRangeIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/startpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA2F;AAE3F,
|
|
1
|
+
{"version":3,"file":"startpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/startpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA2F;AAE3F,oDAA+F;AAI/F,mEAIiC;AAejC,MAAa,sBAAsB;IAGlC,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,uBAAY,CACnC,CAAC,CAAmB,EAAE,CAAmB,EAAE,EAAE;YAC5C,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,mBAAmB,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAO,mBAAmB,CAAC;YAC5B,CAAC;YAED,MAAM,uBAAuB,GAAG,IAAA,4CAAoB,EACnD,CAAmC,EACnC,CAAmC,CACnC,CAAC;YACF,IAAI,uBAAuB,KAAK,CAAC,EAAE,CAAC;gBACnC,OAAO,uBAAuB,CAAC;YAChC,CAAC;YACD,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;YAC9B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBAC5C,OAAO,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,CAAC,CAAC;QACV,CAAC,CACD,CAAC;IACH,CAAC;IAEM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OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC;AALD,oEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport { Client, PropertyAction, RedBlackTree } from \"@fluidframework/merge-tree/internal\";\n\nimport { IntervalType, SequenceInterval, createSequenceInterval } from \"../intervals/index.js\";\nimport { ISharedString } from \"../sharedString.js\";\n\nimport { type SequenceIntervalIndex } from \"./intervalIndex.js\";\nimport {\n\tHasComparisonOverride,\n\tcompareOverrideables,\n\tforceCompare,\n} from \"./intervalIndexUtils.js\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.\n * @internal\n */\nexport interface IStartpointInRangeIndex extends SequenceIntervalIndex {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose startpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithStartpointInRange(start: number, end: number): SequenceInterval[];\n}\n\nexport class StartpointInRangeIndex implements IStartpointInRangeIndex {\n\tprivate readonly intervalTree;\n\n\tconstructor(private readonly client: Client) {\n\t\tthis.intervalTree = new RedBlackTree<SequenceInterval, SequenceInterval>(\n\t\t\t(a: SequenceInterval, b: SequenceInterval) => {\n\t\t\t\tconst compareStartsResult = a.compareStart(b);\n\t\t\t\tif (compareStartsResult !== 0) {\n\t\t\t\t\treturn compareStartsResult;\n\t\t\t\t}\n\n\t\t\t\tconst overrideablesComparison = compareOverrideables(\n\t\t\t\t\ta as Partial<HasComparisonOverride>,\n\t\t\t\t\tb as Partial<HasComparisonOverride>,\n\t\t\t\t);\n\t\t\t\tif (overrideablesComparison !== 0) {\n\t\t\t\t\treturn overrideablesComparison;\n\t\t\t\t}\n\t\t\t\tconst aId = a.getIntervalId();\n\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\tif (aId !== undefined && bId !== undefined) {\n\t\t\t\t\treturn aId.localeCompare(bId);\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic add(interval: SequenceInterval): void {\n\t\tthis.intervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: SequenceInterval): void {\n\t\tthis.intervalTree.remove(interval);\n\t}\n\n\tpublic findIntervalsWithStartpointInRange(start: number, end: number): SequenceInterval[] {\n\t\tif (start <= 0 || start > end || this.intervalTree.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results: SequenceInterval[] = [];\n\t\tconst action: PropertyAction<SequenceInterval, SequenceInterval> = (node) => {\n\t\t\tresults.push(node.data);\n\t\t\treturn true;\n\t\t};\n\n\t\tconst transientStartInterval = createSequenceInterval(\n\t\t\t\"transient\",\n\t\t\tstart,\n\t\t\tstart,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\tconst transientEndInterval = createSequenceInterval(\n\t\t\t\"transient\",\n\t\t\tend,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\t// Add comparison overrides to the transient intervals\n\t\t(transientStartInterval as Partial<HasComparisonOverride>)[forceCompare] = -1;\n\t\t(transientEndInterval as Partial<HasComparisonOverride>)[forceCompare] = 1;\n\n\t\tthis.intervalTree.mapRange(action, results, transientStartInterval, transientEndInterval);\n\t\treturn results;\n\t}\n}\n/**\n * @internal\n */\nexport function createStartpointInRangeIndex(\n\tsharedString: ISharedString,\n): IStartpointInRangeIndex {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new StartpointInRangeIndex(client);\n}\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { IInterval, ISerializedInterval, ISerializableInterval, IntervalOpType, IntervalType, IntervalDeltaOpType,
|
|
6
|
-
export {
|
|
7
|
-
export { SequenceInterval, SequenceIntervalClass, createSequenceInterval, createPositionReferenceFromSegoff, sequenceIntervalHelpers, } from "./sequenceInterval.js";
|
|
5
|
+
export { IInterval, ISerializedInterval, ISerializableInterval, IntervalOpType, IntervalType, IntervalDeltaOpType, IntervalStickiness, ISerializableIntervalPrivate, SerializedIntervalDelta, CompressedSerializedInterval, endReferenceSlidingPreference, startReferenceSlidingPreference, } from "./intervalUtils.js";
|
|
6
|
+
export { SequenceInterval, SequenceIntervalClass, createSequenceInterval, createPositionReferenceFromSegoff, } from "./sequenceInterval.js";
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/intervals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,SAAS,EACT,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/intervals/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,SAAS,EACT,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,+BAA+B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,iCAAiC,GACjC,MAAM,uBAAuB,CAAC"}
|
package/dist/intervals/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.createPositionReferenceFromSegoff = exports.createSequenceInterval = exports.SequenceIntervalClass = exports.startReferenceSlidingPreference = exports.endReferenceSlidingPreference = exports.IntervalStickiness = exports.IntervalDeltaOpType = exports.IntervalType = exports.IntervalOpType = void 0;
|
|
8
8
|
var intervalUtils_js_1 = require("./intervalUtils.js");
|
|
9
9
|
Object.defineProperty(exports, "IntervalOpType", { enumerable: true, get: function () { return intervalUtils_js_1.IntervalOpType; } });
|
|
10
10
|
Object.defineProperty(exports, "IntervalType", { enumerable: true, get: function () { return intervalUtils_js_1.IntervalType; } });
|
|
@@ -12,13 +12,8 @@ Object.defineProperty(exports, "IntervalDeltaOpType", { enumerable: true, get: f
|
|
|
12
12
|
Object.defineProperty(exports, "IntervalStickiness", { enumerable: true, get: function () { return intervalUtils_js_1.IntervalStickiness; } });
|
|
13
13
|
Object.defineProperty(exports, "endReferenceSlidingPreference", { enumerable: true, get: function () { return intervalUtils_js_1.endReferenceSlidingPreference; } });
|
|
14
14
|
Object.defineProperty(exports, "startReferenceSlidingPreference", { enumerable: true, get: function () { return intervalUtils_js_1.startReferenceSlidingPreference; } });
|
|
15
|
-
var interval_js_1 = require("./interval.js");
|
|
16
|
-
Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return interval_js_1.Interval; } });
|
|
17
|
-
Object.defineProperty(exports, "createInterval", { enumerable: true, get: function () { return interval_js_1.createInterval; } });
|
|
18
|
-
Object.defineProperty(exports, "intervalHelpers", { enumerable: true, get: function () { return interval_js_1.intervalHelpers; } });
|
|
19
15
|
var sequenceInterval_js_1 = require("./sequenceInterval.js");
|
|
20
16
|
Object.defineProperty(exports, "SequenceIntervalClass", { enumerable: true, get: function () { return sequenceInterval_js_1.SequenceIntervalClass; } });
|
|
21
17
|
Object.defineProperty(exports, "createSequenceInterval", { enumerable: true, get: function () { return sequenceInterval_js_1.createSequenceInterval; } });
|
|
22
18
|
Object.defineProperty(exports, "createPositionReferenceFromSegoff", { enumerable: true, get: function () { return sequenceInterval_js_1.createPositionReferenceFromSegoff; } });
|
|
23
|
-
Object.defineProperty(exports, "sequenceIntervalHelpers", { enumerable: true, get: function () { return sequenceInterval_js_1.sequenceIntervalHelpers; } });
|
|
24
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intervals/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intervals/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAa4B;AAT3B,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AACZ,uHAAA,mBAAmB,OAAA;AACnB,sHAAA,kBAAkB,OAAA;AAIlB,iIAAA,6BAA6B,OAAA;AAC7B,mIAAA,+BAA+B,OAAA;AAEhC,6DAK+B;AAH9B,4HAAA,qBAAqB,OAAA;AACrB,6HAAA,sBAAsB,OAAA;AACtB,wIAAA,iCAAiC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIInterval,\n\tISerializedInterval,\n\tISerializableInterval,\n\tIntervalOpType,\n\tIntervalType,\n\tIntervalDeltaOpType,\n\tIntervalStickiness,\n\tISerializableIntervalPrivate,\n\tSerializedIntervalDelta,\n\tCompressedSerializedInterval,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n} from \"./intervalUtils.js\";\nexport {\n\tSequenceInterval,\n\tSequenceIntervalClass,\n\tcreateSequenceInterval,\n\tcreatePositionReferenceFromSegoff,\n} from \"./sequenceInterval.js\";\n"]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import {
|
|
6
|
+
import { PropertiesManager, PropertySet, SlidingPreference, SequencePlace, Side } from "@fluidframework/merge-tree/internal";
|
|
7
|
+
import type { SequenceIntervalClass } from "./sequenceInterval.js";
|
|
7
8
|
/**
|
|
8
9
|
* Basic interval abstraction
|
|
9
10
|
* @legacy
|
|
@@ -142,7 +143,7 @@ export interface ISerializableInterval extends IInterval {
|
|
|
142
143
|
*/
|
|
143
144
|
getIntervalId(): string;
|
|
144
145
|
}
|
|
145
|
-
export type ISerializableIntervalPrivate
|
|
146
|
+
export type ISerializableIntervalPrivate = SequenceIntervalClass & {
|
|
146
147
|
propertyManager?: PropertiesManager;
|
|
147
148
|
};
|
|
148
149
|
/**
|
|
@@ -176,29 +177,6 @@ export type CompressedSerializedInterval = [
|
|
|
176
177
|
PropertySet,
|
|
177
178
|
IntervalStickiness
|
|
178
179
|
] | [number | "start" | "end", number | "start" | "end", number, IntervalType, PropertySet];
|
|
179
|
-
/**
|
|
180
|
-
* @sealed
|
|
181
|
-
* @deprecated The methods within have substitutions
|
|
182
|
-
* @internal
|
|
183
|
-
*/
|
|
184
|
-
export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
187
|
-
* @param label - label of the interval collection this interval is being added to. This parameter is
|
|
188
|
-
* irrelevant for transient intervals.
|
|
189
|
-
* @param start - numerical start position of the interval
|
|
190
|
-
* @param end - numerical end position of the interval
|
|
191
|
-
* @param client - client creating the interval
|
|
192
|
-
* @param intervalType - Type of interval to create. Default is SlideOnRemove
|
|
193
|
-
* @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)
|
|
194
|
-
* @param fromSnapshot - If this create came from loading a snapshot. Default is false.
|
|
195
|
-
* @param startSide - The side on which the start position lays. See
|
|
196
|
-
* {@link @fluidframework/merge-tree#SequencePlace} for additional context
|
|
197
|
-
* @param endSide - The side on which the end position lays. See
|
|
198
|
-
* {@link @fluidframework/merge-tree#SequencePlace} for additional context
|
|
199
|
-
*/
|
|
200
|
-
create(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client | undefined, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean): TInterval;
|
|
201
|
-
}
|
|
202
180
|
/**
|
|
203
181
|
* Determines how an interval should expand when segments are inserted adjacent
|
|
204
182
|
* to the range it spans
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,KAAK,IAAI,SAAS,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,MAAM,CACL,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,QAAQ,CAAC,EAAE,MAAM,EACjB,qBAAqB,CAAC,EAAE,OAAO,GAC7B,SAAS,GAAG,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC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AG;IAC7B,GAAG,2BAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB;AAiID;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,SAAgB,+BAA+B,CAC9C,UAA8B;IAE9B,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,4BAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,4BAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAPD,0EAOC;AAED,SAAgB,6BAA6B,CAC5C,UAA8B;IAE9B,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,4BAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,4BAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AAPD,sEAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tClient,\n\t// eslint-disable-next-line import/no-deprecated\n\tPropertiesManager,\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/***/\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\nexport type ISerializableIntervalPrivate<T extends ISerializableInterval> = T & {\n\tpropertyManager?: PropertiesManager;\n};\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * @sealed\n * @deprecated The methods within have substitutions\n * @internal\n */\nexport interface IIntervalHelpers<TInterval extends ISerializableInterval> {\n\t/**\n\t *\n\t * @param label - label of the interval collection this interval is being added to. This parameter is\n\t * irrelevant for transient intervals.\n\t * @param start - numerical start position of the interval\n\t * @param end - numerical end position of the interval\n\t * @param client - client creating the interval\n\t * @param intervalType - Type of interval to create. Default is SlideOnRemove\n\t * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)\n\t * @param fromSnapshot - If this create came from loading a snapshot. Default is false.\n\t * @param startSide - The side on which the start position lays. See\n\t * {@link @fluidframework/merge-tree#SequencePlace} for additional context\n\t * @param endSide - The side on which the end position lays. See\n\t * {@link @fluidframework/merge-tree#SequencePlace} for additional context\n\t */\n\tcreate(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client | undefined,\n\t\tintervalType: IntervalType,\n\t\top?: ISequencedDocumentMessage,\n\t\tfromSnapshot?: boolean,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): TInterval;\n}\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,kEAM6C;AA0D7C;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IAClC,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACP,CAAC;AAKX;;;;GAIG;AACU,QAAA,cAAc,GAAG;IAC7B,GAAG,2BAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB;AA+FD;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,SAAgB,+BAA+B,CAC9C,UAA8B;IAE9B,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,4BAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,4BAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAPD,0EAOC;AAED,SAAgB,6BAA6B,CAC5C,UAA8B;IAE9B,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,4BAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,4BAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AAPD,sEAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertiesManager,\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport type { SequenceIntervalClass } from \"./sequenceInterval.js\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/***/\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\nexport type ISerializableIntervalPrivate = SequenceIntervalClass & {\n\tpropertyManager?: PropertiesManager;\n};\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
import { Client, ISegment, LocalReferencePosition, PropertiesManager, PropertySet, ReferenceType, SlidingPreference, SequencePlace, Side } from "@fluidframework/merge-tree/internal";
|
|
7
|
-
import { ISerializableInterval, ISerializedInterval, IntervalStickiness, IntervalType
|
|
7
|
+
import { ISerializableInterval, ISerializedInterval, IntervalStickiness, IntervalType } from "./intervalUtils.js";
|
|
8
8
|
/**
|
|
9
9
|
* Interval implementation whose ends are associated with positions in a mutatable sequence.
|
|
10
10
|
* As such, when content is inserted into the middle of the interval, the interval expands to
|
|
@@ -149,7 +149,7 @@ export declare class SequenceIntervalClass implements SequenceInterval {
|
|
|
149
149
|
/**
|
|
150
150
|
* {@inheritDoc IInterval.clone}
|
|
151
151
|
*/
|
|
152
|
-
clone():
|
|
152
|
+
clone(): SequenceIntervalClass;
|
|
153
153
|
/**
|
|
154
154
|
* {@inheritDoc IInterval.compare}
|
|
155
155
|
*/
|
|
@@ -187,10 +187,5 @@ export declare function createPositionReferenceFromSegoff(client: Client, segoff
|
|
|
187
187
|
segment: ISegment | undefined;
|
|
188
188
|
offset: number | undefined;
|
|
189
189
|
} | "start" | "end", refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
|
|
190
|
-
export declare function createSequenceInterval(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean):
|
|
191
|
-
/**
|
|
192
|
-
* @deprecated The methods within have substitutions
|
|
193
|
-
* @internal
|
|
194
|
-
*/
|
|
195
|
-
export declare const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval>;
|
|
190
|
+
export declare function createSequenceInterval(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean): SequenceIntervalClass;
|
|
196
191
|
//# sourceMappingURL=sequenceInterval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,MAAM,EACN,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,iBAAiB,EASjB,aAAa,EACb,IAAI,EAKJ,MAAM,qCAAqC,CAAC;AAS7C,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,MAAM,oBAAoB,CAAC;AA8B5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC9D,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IAC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AChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,QAAQ,CAAC,EAAE,MAAM,EACjB,qBAAqB,GAAE,OAAe;CAoEvC;AAED,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;IAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,GAAG,KAAK,EACvF,OAAO,EAAE,aAAa,EACtB,EAAE,CAAC,EAAE,yBAAyB,EAC9B,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,OAAO,EACtB,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,kBAAkB,CAAC,EAAE,OAAO,GAC1B,sBAAsB,CAuCxB;AAoDD,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,YAAY,CAAC,EAAE,OAAO,EACtB,qBAAqB,GAAE,OAAe,GACpC,qBAAqB,CAuEvB"}
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.createSequenceInterval = exports.createPositionReferenceFromSegoff = exports.SequenceIntervalClass = void 0;
|
|
8
8
|
/* eslint-disable no-bitwise */
|
|
9
|
-
/* eslint-disable import/no-deprecated */
|
|
10
9
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
11
10
|
const internal_2 = require("@fluidframework/merge-tree/internal");
|
|
12
11
|
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
@@ -328,11 +327,4 @@ function createSequenceInterval(label, start, end, client, intervalType, op, fro
|
|
|
328
327
|
return ival;
|
|
329
328
|
}
|
|
330
329
|
exports.createSequenceInterval = createSequenceInterval;
|
|
331
|
-
/**
|
|
332
|
-
* @deprecated The methods within have substitutions
|
|
333
|
-
* @internal
|
|
334
|
-
*/
|
|
335
|
-
exports.sequenceIntervalHelpers = {
|
|
336
|
-
create: createSequenceInterval,
|
|
337
|
-
};
|
|
338
330
|
//# sourceMappingURL=sequenceInterval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,yCAAyC;AAEzC,kEAA6D;AAE7D,kEAsB6C;AAC7C,uEAAsE;AAEtE,oEAIkC;AAElC,yDAQ4B;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,EAAE,CAAC;QAClD,OAAO,eAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,OAAO,eAAI,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,eAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,eAAI,CAAC,KAAK,CAAC;AACnB,C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AI,YAAY,EAAE,CAAC;YACxB,YAAY,IAAI,wBAAa,CAAC,aAAa,CAAC;YAC5C,UAAU,IAAI,wBAAa,CAAC,aAAa,CAAC;QAC3C,CAAC;aAAM,CAAC;YACP,YAAY,IAAI,wBAAa,CAAC,YAAY,CAAC;YAC3C,UAAU,IAAI,wBAAa,CAAC,YAAY,CAAC;QAC1C,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAG,uBAAuB,CACxC,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,kDAA+B,EAAC,UAAU,CAAC,EAC3C,IAAA,kDAA+B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,QAAQ,EAC1E,qBAAqB,CACrB,CAAC;IAEF,MAAM,OAAO,GAAG,uBAAuB,CACtC,MAAM,EACN,MAAM,EACN,UAAU,EACV,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,gDAA6B,EAAC,UAAU,CAAC,EACzC,IAAA,gDAA6B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,OAAO,EACvE,qBAAqB,CACrB,CAAC;IAEF,MAAM,SAAS,GAAG;QACjB,CAAC,iCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CACrC,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAhFD,wDAgFC;AAED;;;GAGG;AACU,QAAA,uBAAuB,GAAuC;IAC1E,MAAM,EAAE,sBAAsB;CAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n/* eslint-disable import/no-deprecated */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\tcopyPropertiesAndManager,\n\ttype ISegmentInternal,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tcomputeStickinessFromSide,\n\treservedIntervalIdKey,\n\tsidesFromStickiness,\n} from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IIntervalHelpers,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @alpha\n * @legacy\n */\nexport interface SequenceInterval extends ISerializableInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): SequenceInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): SequenceInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: SequenceInterval): SequenceInterval;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\taddPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void;\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tremovePositionChangeListeners(): void;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n}\n\nexport class SequenceIntervalClass implements SequenceInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t */\n\tpublic propertyManager?: PropertiesManager;\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tif (props) {\n\t\t\tthis.properties = addProperties(this.properties, props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst { startSide, endSide } = sidesFromStickiness(this.stickiness);\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = addProperties(\n\t\t\t\tserializedInterval.properties,\n\t\t\t\tthis.properties,\n\t\t\t);\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceInterval {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior: boolean = false,\n\t) {\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst stickiness = computeStickinessFromSide(\n\t\t\tstartPos ?? startSegment?.endpointType,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendPos ?? endSegment?.endpointType,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstartPos,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tendPos,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tcopyPropertiesAndManager(this, newInterval);\n\t\treturn newInterval;\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined } | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient)\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n\texclusive: boolean = false,\n\tuseNewSlidingBehavior: boolean = false,\n): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, useNewSlidingBehavior);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\texclusive,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tuseNewSlidingBehavior: boolean = false,\n): SequenceInterval {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstartPos,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tendPos,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n\n/**\n * @deprecated The methods within have substitutions\n * @internal\n */\nexport const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {\n\tcreate: createSequenceInterval,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,kEAA6D;AAE7D,kEAsB6C;AAC7C,uEAAsE;AAEtE,oEAIkC;AAElC,yDAO4B;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,EAAE,CAAC;QAClD,OAAO,eAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,OAAO,eAAI,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,eAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,eAAI,CAAC,KAAK,CAAC;AACnB,CAAC;AA6GD,MAAa,qBAAqB;IAWjC,KAAK;IACL,IAAW,UAAU;QACpB,MAAM,YAAY,GAAiC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QAC3E,MAAM,UAAU,GAAiC,IAAI,CAAC,GAAG,CAAC,UAAU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C3C,UAAU,IAAI,wBAAa,CAAC,YAAY,CAAC;QAC1C,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAG,uBAAuB,CACxC,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,kDAA+B,EAAC,UAAU,CAAC,EAC3C,IAAA,kDAA+B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,QAAQ,EAC1E,qBAAqB,CACrB,CAAC;IAEF,MAAM,OAAO,GAAG,uBAAuB,CACtC,MAAM,EACN,MAAM,EACN,UAAU,EACV,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,gDAA6B,EAAC,UAAU,CAAC,EACzC,IAAA,gDAA6B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,OAAO,EACvE,qBAAqB,CACrB,CAAC;IAEF,MAAM,SAAS,GAAG;QACjB,CAAC,iCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CACrC,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAhFD,wDAgFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\tcopyPropertiesAndManager,\n\ttype ISegmentInternal,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tcomputeStickinessFromSide,\n\treservedIntervalIdKey,\n\tsidesFromStickiness,\n} from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @alpha\n * @legacy\n */\nexport interface SequenceInterval extends ISerializableInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): SequenceInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): SequenceInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: SequenceInterval): SequenceInterval;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\taddPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void;\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tremovePositionChangeListeners(): void;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n}\n\nexport class SequenceIntervalClass implements SequenceInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t */\n\tpublic propertyManager?: PropertiesManager;\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tif (props) {\n\t\t\tthis.properties = addProperties(this.properties, props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst { startSide, endSide } = sidesFromStickiness(this.stickiness);\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = addProperties(\n\t\t\t\tserializedInterval.properties,\n\t\t\t\tthis.properties,\n\t\t\t);\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior: boolean = false,\n\t) {\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst stickiness = computeStickinessFromSide(\n\t\t\tstartPos ?? startSegment?.endpointType,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendPos ?? endSegment?.endpointType,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstartPos,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tendPos,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tcopyPropertiesAndManager(this, newInterval);\n\t\treturn newInterval;\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined } | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient)\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n\texclusive: boolean = false,\n\tuseNewSlidingBehavior: boolean = false,\n): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, useNewSlidingBehavior);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\texclusive,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tuseNewSlidingBehavior: boolean = false,\n): SequenceIntervalClass {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstartPos,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tendPos,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
|
package/dist/legacy.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export {
|
|
|
31
31
|
IOverlappingIntervalsIndex,
|
|
32
32
|
ISegment,
|
|
33
33
|
ISequenceDeltaRange,
|
|
34
|
+
ISequenceIntervalCollection,
|
|
35
|
+
ISequenceIntervalCollectionEvents,
|
|
36
|
+
ISequenceOverlappingIntervalsIndex,
|
|
34
37
|
ISerializableInterval,
|
|
35
38
|
ISerializedInterval,
|
|
36
39
|
ISharedIntervalCollection,
|
|
@@ -53,6 +56,7 @@ export {
|
|
|
53
56
|
SequenceDeltaEvent,
|
|
54
57
|
SequenceEvent,
|
|
55
58
|
SequenceInterval,
|
|
59
|
+
SequenceIntervalIndex,
|
|
56
60
|
SequenceMaintenanceEvent,
|
|
57
61
|
SequencePlace,
|
|
58
62
|
SharedString,
|
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/sequence";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.31.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.31.0\";\n"]}
|