@fluidframework/sequence 2.5.0 → 2.10.0-304831
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/api-report/sequence.legacy.alpha.api.md +16 -131
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +2 -2
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +19 -13
- package/dist/intervalCollection.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/intervals/index.d.ts +2 -2
- package/dist/intervals/index.d.ts.map +1 -1
- package/dist/intervals/index.js +2 -2
- package/dist/intervals/index.js.map +1 -1
- package/dist/intervals/interval.d.ts +1 -8
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +1 -15
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +4 -11
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +69 -13
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +8 -52
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/legacy.d.ts +0 -2
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +2 -2
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence.d.ts +1 -3
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +3 -5
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +36 -13
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +15 -70
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sharedString.d.ts +1 -3
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +1 -3
- package/dist/sharedString.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +2 -2
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +21 -15
- package/lib/intervalCollection.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/intervals/index.d.ts +2 -2
- package/lib/intervals/index.d.ts.map +1 -1
- package/lib/intervals/index.js +1 -1
- package/lib/intervals/index.js.map +1 -1
- package/lib/intervals/interval.d.ts +1 -8
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +2 -16
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +4 -11
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +69 -13
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +7 -51
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/legacy.d.ts +0 -2
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +3 -3
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.d.ts +1 -3
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +4 -6
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +36 -13
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +9 -64
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sharedString.d.ts +1 -3
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +1 -3
- package/lib/sharedString.js.map +1 -1
- package/package.json +90 -20
- package/src/intervalCollection.ts +37 -20
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +2 -1
- package/src/intervals/index.ts +2 -0
- package/src/intervals/interval.ts +3 -24
- package/src/intervals/intervalUtils.ts +7 -16
- package/src/intervals/sequenceInterval.ts +89 -30
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +3 -3
- package/src/sequence.ts +13 -6
- package/src/sequenceDeltaEvent.ts +54 -38
- package/src/sharedString.ts +1 -3
|
@@ -18,10 +18,7 @@ export declare class Interval implements ISerializableInterval {
|
|
|
18
18
|
properties: PropertySet;
|
|
19
19
|
/***/
|
|
20
20
|
auxProps: PropertySet[] | undefined;
|
|
21
|
-
|
|
22
|
-
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
23
|
-
*/
|
|
24
|
-
readonly propertyManager: PropertiesManager;
|
|
21
|
+
propertyManager?: PropertiesManager;
|
|
25
22
|
constructor(start: number, end: number, props?: PropertySet);
|
|
26
23
|
/**
|
|
27
24
|
* {@inheritDoc ISerializableInterval.getIntervalId}
|
|
@@ -69,10 +66,6 @@ export declare class Interval implements ISerializableInterval {
|
|
|
69
66
|
*/
|
|
70
67
|
union(b: Interval): Interval;
|
|
71
68
|
getProperties(): PropertySet;
|
|
72
|
-
/**
|
|
73
|
-
* {@inheritDoc ISerializableInterval.addProperties}
|
|
74
|
-
*/
|
|
75
|
-
addProperties(newProps: PropertySet, collaborating?: boolean, seq?: number): PropertySet | undefined;
|
|
76
69
|
/**
|
|
77
70
|
* {@inheritDoc IInterval.modify}
|
|
78
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,iBAAiB,EACjB,WAAW,EAGX,aAAa,
|
|
1
|
+
{"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,iBAAiB,EACjB,WAAW,EAGX,aAAa,EAGb,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,QAAS,YAAW,qBAAqB;IAY7C,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,MAAM;IAZnB;;OAEG;IACI,UAAU,EAAE,WAAW,CAAoB;IAElD,KAAK;IACE,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAEpC,eAAe,CAAC,EAAE,iBAAiB,CAAC;gBAGnC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,WAAW;IAOpB;;OAEG;IACI,aAAa,IAAI,MAAM;IAM9B;;OAEG;IACI,yBAAyB,IAAI,WAAW,EAAE;IAIjD;;;;;;;OAOG;IACI,cAAc,CAAC,KAAK,EAAE,WAAW;IAOxC;;OAEG;IACI,SAAS,IAAI,mBAAmB;IAgBvC;;OAEG;IACI,KAAK;IAIZ;;OAEG;IACI,OAAO,CAAC,CAAC,EAAE,QAAQ;IAsB1B;;OAEG;IACI,YAAY,CAAC,CAAC,EAAE,QAAQ;IAI/B;;OAEG;IACI,UAAU,CAAC,CAAC,EAAE,QAAQ;IAI7B;;OAEG;IACI,QAAQ,CAAC,CAAC,EAAE,QAAQ;IAK3B;;OAEG;IACI,KAAK,CAAC,CAAC,EAAE,QAAQ;IAQjB,aAAa;IAIpB;;OAEG;IACI,MAAM,CACZ,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,aAAa,EACrB,GAAG,CAAC,EAAE,aAAa,EACnB,EAAE,CAAC,EAAE,yBAAyB;CAmB/B;AAED,wBAAgB,cAAc,CAC7B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,aAAa,GAChB,QAAQ,CAiBV;AAED,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,QAAQ,CAEtD,CAAC"}
|
|
@@ -22,10 +22,6 @@ class Interval {
|
|
|
22
22
|
* {@inheritDoc ISerializableInterval.properties}
|
|
23
23
|
*/
|
|
24
24
|
this.properties = (0, internal_2.createMap)();
|
|
25
|
-
/**
|
|
26
|
-
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
27
|
-
*/
|
|
28
|
-
this.propertyManager = new internal_2.PropertiesManager();
|
|
29
25
|
if (props) {
|
|
30
26
|
this.properties = (0, internal_2.addProperties)(this.properties, props);
|
|
31
27
|
}
|
|
@@ -133,14 +129,6 @@ class Interval {
|
|
|
133
129
|
getProperties() {
|
|
134
130
|
return this.properties;
|
|
135
131
|
}
|
|
136
|
-
/**
|
|
137
|
-
* {@inheritDoc ISerializableInterval.addProperties}
|
|
138
|
-
*/
|
|
139
|
-
addProperties(newProps, collaborating = false, seq) {
|
|
140
|
-
if (newProps) {
|
|
141
|
-
return this.propertyManager.addProperties(this.properties, newProps, seq, collaborating);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
132
|
/**
|
|
145
133
|
* {@inheritDoc IInterval.modify}
|
|
146
134
|
*/
|
|
@@ -155,9 +143,7 @@ class Interval {
|
|
|
155
143
|
return;
|
|
156
144
|
}
|
|
157
145
|
const newInterval = new Interval(startPos, endPos);
|
|
158
|
-
|
|
159
|
-
this.propertyManager.copyTo(this.properties, newInterval.properties, newInterval.propertyManager);
|
|
160
|
-
}
|
|
146
|
+
(0, internal_2.copyPropertiesAndManager)(this, newInterval);
|
|
161
147
|
return newInterval;
|
|
162
148
|
}
|
|
163
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interval.js","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA6D;AAE7D,kEAO6C;AAC7C,uEAAsE;AAEtE,oEAAiE;AAQjE;;;GAGG;AACH,MAAa,QAAQ;IAcpB,YACQ,KAAa,EACb,GAAW,EAClB,KAAmB;QAFZ,UAAK,GAAL,KAAK,CAAQ;QACb,QAAG,GAAH,GAAG,CAAQ;QAfnB;;WAEG;QACI,eAAU,GAAgB,IAAA,oBAAS,GAAO,CAAC;QAKlD;;WAEG;QACa,oBAAe,GAAsB,IAAI,4BAAiB,EAAE,CAAC;QAO5E,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,UAAU,GAAG,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED;;OAEG;IACI,aAAa;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,6CAAqB,CAAC,CAAC;QACpD,IAAA,iBAAM,EAAC,EAAE,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC1E,OAAO,GAAG,EAAE,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,yBAAyB;QAC/B,OAAO,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACI,cAAc,CAAC,KAAkB;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;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C,CAAC,KAAK,CAAC,GAAG,CAAC;IAC/D,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAEvD,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AArBD,wCAqBC;AAEY,QAAA,eAAe,GAA+B;IAC1D,MAAM,EAAE,cAAc;CACtB,CAAC","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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertiesManager,\n\tPropertySet,\n\tcreateMap,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\taddProperties,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { reservedIntervalIdKey } from \"../intervalCollection.js\";\n\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tISerializedInterval,\n} from \"./intervalUtils.js\";\n\n/**\n * Serializable interval whose endpoints are plain-old numbers.\n * @internal\n */\nexport class Interval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/***/\n\tpublic auxProps: PropertySet[] | undefined;\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t */\n\tpublic readonly propertyManager: PropertiesManager = new PropertiesManager();\n\n\tconstructor(\n\t\tpublic start: number,\n\t\tpublic end: number,\n\t\tprops?: PropertySet,\n\t) {\n\t\tif (props) {\n\t\t\tthis.properties = addProperties(this.properties, props);\n\t\t}\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, 0x5e1 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * @returns an array containing any auxiliary property sets added with `addPropertySet`.\n\t */\n\tpublic getAdditionalPropertySets(): PropertySet[] {\n\t\treturn this.auxProps ?? [];\n\t}\n\n\t/**\n\t * Adds an auxiliary set of properties to this interval.\n\t * These properties can be recovered using `getAdditionalPropertySets`\n\t * @param props - set of properties to add\n\t * @remarks This gets called as part of the default conflict resolver for `IIntervalCollection<Interval>`\n\t * (i.e. non-sequence-based interval collections). However, the additional properties don't get serialized.\n\t * This functionality seems half-baked.\n\t */\n\tpublic addPropertySet(props: PropertySet) {\n\t\tif (this.auxProps === undefined) {\n\t\t\tthis.auxProps = [];\n\t\t}\n\t\tthis.auxProps.push(props);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: this.end,\n\t\t\tintervalType: 0,\n\t\t\tsequenceNumber: 0,\n\t\t\tstart: this.start,\n\t\t};\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\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new Interval(this.start, this.end, this.properties);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: Interval) {\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: Interval) {\n\t\treturn this.start - b.start;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: Interval) {\n\t\treturn this.end - b.end;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: Interval) {\n\t\tconst result = this.start <= b.end && this.end >= b.start;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: Interval) {\n\t\treturn new Interval(\n\t\t\tMath.min(this.start, b.start),\n\t\t\tMath.max(this.end, b.end),\n\t\t\tthis.properties,\n\t\t);\n\t}\n\n\tpublic getProperties() {\n\t\treturn this.properties;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.addProperties}\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tcollaborating: boolean = false,\n\t\tseq?: number,\n\t): PropertySet | undefined {\n\t\tif (newProps) {\n\t\t\treturn this.propertyManager.addProperties(this.properties, newProps, seq, collaborating);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t\top?: ISequencedDocumentMessage,\n\t) {\n\t\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t\t);\n\t\t}\n\n\t\tconst startPos = typeof start === \"number\" ? start : (start?.pos ?? this.start);\n\t\tconst endPos = typeof end === \"number\" ? end : (end?.pos ?? this.end);\n\n\t\tif (this.start === startPos && this.end === endPos) {\n\t\t\t// Return undefined to indicate that no change is necessary.\n\t\t\treturn;\n\t\t}\n\t\tconst newInterval = new Interval(startPos, endPos);\n\t\tif (this.properties) {\n\t\t\tthis.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tnewInterval.properties,\n\t\t\t\tnewInterval.propertyManager,\n\t\t\t);\n\t\t}\n\t\treturn newInterval;\n\t}\n}\n\nexport function createInterval(\n\tlabel: string,\n\tstart: SequencePlace,\n\tend: SequencePlace,\n): Interval {\n\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\tthrow new UsageError(\n\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t);\n\t}\n\n\tconst rangeProp: PropertySet = {};\n\n\tif (label && label.length > 0) {\n\t\trangeProp[reservedRangeLabelsKey] = [label];\n\t}\n\n\tconst startPos = typeof start === \"number\" ? start : start.pos;\n\tconst endPos = typeof end === \"number\" ? end : end.pos;\n\n\treturn new Interval(startPos, endPos, rangeProp);\n}\n\nexport const intervalHelpers: IIntervalHelpers<Interval> = {\n\tcreate: createInterval,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interval.js","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA6D;AAE7D,kEAQ6C;AAC7C,uEAAsE;AAEtE,oEAAiE;AAQjE;;;GAGG;AACH,MAAa,QAAQ;IAWpB,YACQ,KAAa,EACb,GAAW,EAClB,KAAmB;QAFZ,UAAK,GAAL,KAAK,CAAQ;QACb,QAAG,GAAH,GAAG,CAAQ;QAZnB;;WAEG;QACI,eAAU,GAAgB,IAAA,oBAAS,GAAO,CAAC;QAYjD,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,UAAU,GAAG,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IAC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AAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,SAAS,CAAC,iCAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAC/D,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAEvD,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AArBD,wCAqBC;AAEY,QAAA,eAAe,GAA+B;IAC1D,MAAM,EAAE,cAAc;CACtB,CAAC","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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertiesManager,\n\tPropertySet,\n\tcreateMap,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\taddProperties,\n\tcopyPropertiesAndManager,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { reservedIntervalIdKey } from \"../intervalCollection.js\";\n\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tISerializedInterval,\n} from \"./intervalUtils.js\";\n\n/**\n * Serializable interval whose endpoints are plain-old numbers.\n * @internal\n */\nexport class Interval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/***/\n\tpublic auxProps: PropertySet[] | undefined;\n\n\tpublic propertyManager?: PropertiesManager;\n\n\tconstructor(\n\t\tpublic start: number,\n\t\tpublic end: number,\n\t\tprops?: PropertySet,\n\t) {\n\t\tif (props) {\n\t\t\tthis.properties = addProperties(this.properties, props);\n\t\t}\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, 0x5e1 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * @returns an array containing any auxiliary property sets added with `addPropertySet`.\n\t */\n\tpublic getAdditionalPropertySets(): PropertySet[] {\n\t\treturn this.auxProps ?? [];\n\t}\n\n\t/**\n\t * Adds an auxiliary set of properties to this interval.\n\t * These properties can be recovered using `getAdditionalPropertySets`\n\t * @param props - set of properties to add\n\t * @remarks This gets called as part of the default conflict resolver for `IIntervalCollection<Interval>`\n\t * (i.e. non-sequence-based interval collections). However, the additional properties don't get serialized.\n\t * This functionality seems half-baked.\n\t */\n\tpublic addPropertySet(props: PropertySet) {\n\t\tif (this.auxProps === undefined) {\n\t\t\tthis.auxProps = [];\n\t\t}\n\t\tthis.auxProps.push(props);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: this.end,\n\t\t\tintervalType: 0,\n\t\t\tsequenceNumber: 0,\n\t\t\tstart: this.start,\n\t\t};\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\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new Interval(this.start, this.end, this.properties);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: Interval) {\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: Interval) {\n\t\treturn this.start - b.start;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: Interval) {\n\t\treturn this.end - b.end;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: Interval) {\n\t\tconst result = this.start <= b.end && this.end >= b.start;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: Interval) {\n\t\treturn new Interval(\n\t\t\tMath.min(this.start, b.start),\n\t\t\tMath.max(this.end, b.end),\n\t\t\tthis.properties,\n\t\t);\n\t}\n\n\tpublic getProperties() {\n\t\treturn this.properties;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t\top?: ISequencedDocumentMessage,\n\t) {\n\t\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t\t);\n\t\t}\n\n\t\tconst startPos = typeof start === \"number\" ? start : (start?.pos ?? this.start);\n\t\tconst endPos = typeof end === \"number\" ? end : (end?.pos ?? this.end);\n\n\t\tif (this.start === startPos && this.end === endPos) {\n\t\t\t// Return undefined to indicate that no change is necessary.\n\t\t\treturn;\n\t\t}\n\t\tconst newInterval = new Interval(startPos, endPos);\n\t\tcopyPropertiesAndManager(this, newInterval);\n\t\treturn newInterval;\n\t}\n}\n\nexport function createInterval(\n\tlabel: string,\n\tstart: SequencePlace,\n\tend: SequencePlace,\n): Interval {\n\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\tthrow new UsageError(\n\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t);\n\t}\n\n\tconst rangeProp: PropertySet = {};\n\n\tif (label && label.length > 0) {\n\t\trangeProp[reservedRangeLabelsKey] = [label];\n\t}\n\n\tconst startPos = typeof start === \"number\" ? start : start.pos;\n\tconst endPos = typeof end === \"number\" ? end : end.pos;\n\n\treturn new Interval(startPos, endPos, rangeProp);\n}\n\nexport const intervalHelpers: IIntervalHelpers<Interval> = {\n\tcreate: createInterval,\n};\n"]}
|
|
@@ -133,25 +133,18 @@ export interface ISerializedInterval {
|
|
|
133
133
|
export interface ISerializableInterval extends IInterval {
|
|
134
134
|
/** Serializable bag of properties associated with the interval. */
|
|
135
135
|
properties: PropertySet;
|
|
136
|
-
/**
|
|
137
|
-
* @deprecated - This property should not be used externally and will be removed in a subsequent release.
|
|
138
|
-
*/
|
|
139
|
-
propertyManager: PropertiesManager;
|
|
140
136
|
/***/
|
|
141
137
|
serialize(): ISerializedInterval;
|
|
142
|
-
/**
|
|
143
|
-
* @deprecated - This function should not be used externally and will be removed in a subsequent release.
|
|
144
|
-
*/
|
|
145
|
-
addProperties(props: PropertySet, collaborating?: boolean, seq?: number): PropertySet | undefined;
|
|
146
138
|
/**
|
|
147
139
|
* Gets the id associated with this interval.
|
|
148
140
|
* When the interval is used as part of an interval collection, this id can be used to modify or remove the
|
|
149
141
|
* interval.
|
|
150
|
-
* @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions
|
|
151
|
-
* of Fluid didn't always write interval ids.
|
|
152
142
|
*/
|
|
153
|
-
getIntervalId(): string
|
|
143
|
+
getIntervalId(): string;
|
|
154
144
|
}
|
|
145
|
+
export type ISerializableIntervalPrivate<T extends ISerializableInterval> = T & {
|
|
146
|
+
propertyManager?: PropertiesManager;
|
|
147
|
+
};
|
|
155
148
|
/**
|
|
156
149
|
* Represents a change that should be applied to an existing interval.
|
|
157
150
|
* Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.
|
|
@@ -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,EAEN,MAAM,EAEN,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,MAAM,qCAAqC,CAAC;AAE7C;;;;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;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC/B;AAED;;;GA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ACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB;AA0ID;;;;;;;;;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\t/**\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpropertyManager: PropertiesManager;\n\t/***/\n\tserialize(): ISerializedInterval;\n\t/**\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t */\n\taddProperties(\n\t\tprops: PropertySet,\n\t\tcollaborating?: boolean,\n\t\tseq?: number,\n\t): PropertySet | undefined;\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 * @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions\n\t * of Fluid didn't always write interval ids.\n\t */\n\tgetIntervalId(): string | undefined;\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,kEAS6C;AAwD7C;;;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;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"]}
|
|
@@ -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 {
|
|
7
|
+
import { ISerializableInterval, ISerializedInterval, IntervalStickiness, IntervalType, type IIntervalHelpers } 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
|
|
@@ -31,10 +31,73 @@ import { IIntervalHelpers, ISerializableInterval, ISerializedInterval, IntervalS
|
|
|
31
31
|
* `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
|
|
32
32
|
* of the interval that are exclusive will have the ability to slide to these
|
|
33
33
|
* special endpoint segments.
|
|
34
|
-
* @legacy
|
|
35
34
|
* @alpha
|
|
35
|
+
* @legacy
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export interface SequenceInterval extends ISerializableInterval {
|
|
38
|
+
readonly start: LocalReferencePosition;
|
|
39
|
+
/**
|
|
40
|
+
* End endpoint of this interval.
|
|
41
|
+
* @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
|
|
42
|
+
*/
|
|
43
|
+
readonly end: LocalReferencePosition;
|
|
44
|
+
readonly intervalType: IntervalType;
|
|
45
|
+
readonly startSide: Side;
|
|
46
|
+
readonly endSide: Side;
|
|
47
|
+
readonly stickiness: IntervalStickiness;
|
|
48
|
+
/**
|
|
49
|
+
* @returns a new interval object with identical semantics.
|
|
50
|
+
*/
|
|
51
|
+
clone(): SequenceInterval;
|
|
52
|
+
/**
|
|
53
|
+
* Compares this interval to `b` with standard comparator semantics:
|
|
54
|
+
* - returns -1 if this is less than `b`
|
|
55
|
+
* - returns 1 if this is greater than `b`
|
|
56
|
+
* - returns 0 if this is equivalent to `b`
|
|
57
|
+
* @param b - Interval to compare against
|
|
58
|
+
*/
|
|
59
|
+
compare(b: SequenceInterval): number;
|
|
60
|
+
/**
|
|
61
|
+
* Compares the start endpoint of this interval to `b`'s start endpoint.
|
|
62
|
+
* Standard comparator semantics apply.
|
|
63
|
+
* @param b - Interval to compare against
|
|
64
|
+
*/
|
|
65
|
+
compareStart(b: SequenceInterval): number;
|
|
66
|
+
/**
|
|
67
|
+
* Compares the end endpoint of this interval to `b`'s end endpoint.
|
|
68
|
+
* Standard comparator semantics apply.
|
|
69
|
+
* @param b - Interval to compare against
|
|
70
|
+
*/
|
|
71
|
+
compareEnd(b: SequenceInterval): number;
|
|
72
|
+
/**
|
|
73
|
+
* Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
|
|
74
|
+
*/
|
|
75
|
+
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* @returns whether this interval overlaps with `b`.
|
|
78
|
+
* Intervals are considered to overlap if their intersection is non-empty.
|
|
79
|
+
*/
|
|
80
|
+
overlaps(b: SequenceInterval): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Unions this interval with `b`, returning a new interval.
|
|
83
|
+
* The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes
|
|
84
|
+
* intermediate values between the two intervals.
|
|
85
|
+
*/
|
|
86
|
+
union(b: SequenceInterval): SequenceInterval;
|
|
87
|
+
/**
|
|
88
|
+
* Subscribes to position change events on this interval if there are no current listeners.
|
|
89
|
+
*/
|
|
90
|
+
addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void;
|
|
91
|
+
/**
|
|
92
|
+
* Removes the currently subscribed position change listeners.
|
|
93
|
+
*/
|
|
94
|
+
removePositionChangeListeners(): void;
|
|
95
|
+
/**
|
|
96
|
+
* @returns whether this interval overlaps two numerical positions.
|
|
97
|
+
*/
|
|
98
|
+
overlapsPos(bstart: number, bend: number): boolean;
|
|
99
|
+
}
|
|
100
|
+
export declare class SequenceIntervalClass implements SequenceInterval {
|
|
38
101
|
private readonly client;
|
|
39
102
|
/**
|
|
40
103
|
* Start endpoint of this interval.
|
|
@@ -56,12 +119,9 @@ export declare class SequenceInterval implements ISerializableInterval {
|
|
|
56
119
|
/**
|
|
57
120
|
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
58
121
|
*/
|
|
59
|
-
propertyManager
|
|
122
|
+
propertyManager?: PropertiesManager;
|
|
60
123
|
/***/
|
|
61
124
|
get stickiness(): IntervalStickiness;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
64
|
-
*/
|
|
65
125
|
constructor(client: Client,
|
|
66
126
|
/**
|
|
67
127
|
* Start endpoint of this interval.
|
|
@@ -113,11 +173,7 @@ export declare class SequenceInterval implements ISerializableInterval {
|
|
|
113
173
|
/**
|
|
114
174
|
* {@inheritDoc IInterval.union}
|
|
115
175
|
*/
|
|
116
|
-
union(b: SequenceInterval):
|
|
117
|
-
/**
|
|
118
|
-
* {@inheritDoc ISerializableInterval.addProperties}
|
|
119
|
-
*/
|
|
120
|
-
addProperties(newProps: PropertySet, collab?: boolean, seq?: number): PropertySet | undefined;
|
|
176
|
+
union(b: SequenceInterval): SequenceIntervalClass;
|
|
121
177
|
/**
|
|
122
178
|
* @returns whether this interval overlaps two numerical positions.
|
|
123
179
|
*/
|
|
@@ -125,7 +181,7 @@ export declare class SequenceInterval implements ISerializableInterval {
|
|
|
125
181
|
/**
|
|
126
182
|
* {@inheritDoc IInterval.modify}
|
|
127
183
|
*/
|
|
128
|
-
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean):
|
|
184
|
+
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceIntervalClass;
|
|
129
185
|
}
|
|
130
186
|
export declare function createPositionReferenceFromSegoff(client: Client, segoff: {
|
|
131
187
|
segment: ISegment | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,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,
|
|
1
|
+
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,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,EAIJ,MAAM,qCAAqC,CAAC;AAS7C,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AA8B5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC9D,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IAExC;;OAEG;IACH,KAAK,IAAI,gBAAgB,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,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,gBAAgB,CAuElB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,gBAAgB,CAEtE,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.sequenceIntervalHelpers = exports.createSequenceInterval = exports.createPositionReferenceFromSegoff = exports.
|
|
7
|
+
exports.sequenceIntervalHelpers = exports.createSequenceInterval = exports.createPositionReferenceFromSegoff = exports.SequenceIntervalClass = void 0;
|
|
8
8
|
/* eslint-disable no-bitwise */
|
|
9
9
|
/* eslint-disable import/no-deprecated */
|
|
10
10
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
@@ -33,45 +33,13 @@ function maxSide(sideA, sideB) {
|
|
|
33
33
|
}
|
|
34
34
|
return internal_2.Side.After;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
* Interval implementation whose ends are associated with positions in a mutatable sequence.
|
|
38
|
-
* As such, when content is inserted into the middle of the interval, the interval expands to
|
|
39
|
-
* include that content.
|
|
40
|
-
*
|
|
41
|
-
* @remarks The endpoints' positions should be treated exclusively to get
|
|
42
|
-
* reasonable behavior. E.g., an interval referring to "hello" in "hello world"
|
|
43
|
-
* should have a start position of 0 and an end position of 5.
|
|
44
|
-
*
|
|
45
|
-
* To see why, consider what happens if "llo wor" is removed from the string to make "held".
|
|
46
|
-
* The interval's startpoint remains on the "h" (it isn't altered), but the interval's endpoint
|
|
47
|
-
* slides forward to the next unremoved position, which is the "l" in "held".
|
|
48
|
-
* Users would generally expect the interval to now refer to "he" (as it is the subset of content
|
|
49
|
-
* remaining after the removal), hence the "l" should be excluded.
|
|
50
|
-
* If the interval endpoint was treated inclusively, the interval would now refer to "hel", which
|
|
51
|
-
* is undesirable.
|
|
52
|
-
*
|
|
53
|
-
* Since the endpoints of an interval are treated exclusively but cannot be greater
|
|
54
|
-
* than or equal to the length of the associated sequence, there exist special
|
|
55
|
-
* endpoint segments, "start" and "end", which represent the position immediately
|
|
56
|
-
* before or immediately after the string respectively.
|
|
57
|
-
*
|
|
58
|
-
* If a `SequenceInterval` is created on a sequence with the
|
|
59
|
-
* `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
|
|
60
|
-
* of the interval that are exclusive will have the ability to slide to these
|
|
61
|
-
* special endpoint segments.
|
|
62
|
-
* @legacy
|
|
63
|
-
* @alpha
|
|
64
|
-
*/
|
|
65
|
-
class SequenceInterval {
|
|
36
|
+
class SequenceIntervalClass {
|
|
66
37
|
/***/
|
|
67
38
|
get stickiness() {
|
|
68
39
|
const startSegment = this.start.getSegment();
|
|
69
40
|
const endSegment = this.end.getSegment();
|
|
70
41
|
return (0, intervalCollection_js_1.computeStickinessFromSide)(startSegment?.endpointType, this.startSide, endSegment?.endpointType, this.endSide);
|
|
71
42
|
}
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
74
|
-
*/
|
|
75
43
|
constructor(client,
|
|
76
44
|
/**
|
|
77
45
|
* Start endpoint of this interval.
|
|
@@ -93,10 +61,6 @@ class SequenceInterval {
|
|
|
93
61
|
* {@inheritDoc ISerializableInterval.properties}
|
|
94
62
|
*/
|
|
95
63
|
this.properties = (0, internal_2.createMap)();
|
|
96
|
-
/**
|
|
97
|
-
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
98
|
-
*/
|
|
99
|
-
this.propertyManager = new internal_2.PropertiesManager();
|
|
100
64
|
if (props) {
|
|
101
65
|
this.properties = (0, internal_2.addProperties)(this.properties, props);
|
|
102
66
|
}
|
|
@@ -152,7 +116,7 @@ class SequenceInterval {
|
|
|
152
116
|
* {@inheritDoc IInterval.clone}
|
|
153
117
|
*/
|
|
154
118
|
clone() {
|
|
155
|
-
return new
|
|
119
|
+
return new SequenceIntervalClass(this.client, this.start, this.end, this.intervalType, this.properties, this.startSide, this.endSide);
|
|
156
120
|
}
|
|
157
121
|
/**
|
|
158
122
|
* {@inheritDoc IInterval.compare}
|
|
@@ -236,13 +200,7 @@ class SequenceInterval {
|
|
|
236
200
|
else {
|
|
237
201
|
endSide = this.end === newEnd ? this.endSide : b.endSide;
|
|
238
202
|
}
|
|
239
|
-
return new
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* {@inheritDoc ISerializableInterval.addProperties}
|
|
243
|
-
*/
|
|
244
|
-
addProperties(newProps, collab = false, seq) {
|
|
245
|
-
return this.propertyManager.addProperties(this.properties, newProps, seq, collab);
|
|
203
|
+
return new SequenceIntervalClass(this.client, newStart, newEnd, this.intervalType, undefined, startSide, endSide);
|
|
246
204
|
}
|
|
247
205
|
/**
|
|
248
206
|
* @returns whether this interval overlaps two numerical positions.
|
|
@@ -280,14 +238,12 @@ class SequenceInterval {
|
|
|
280
238
|
endRef.addProperties(this.end.properties);
|
|
281
239
|
}
|
|
282
240
|
}
|
|
283
|
-
const newInterval = new
|
|
284
|
-
|
|
285
|
-
this.propertyManager.copyTo(this.properties, newInterval.properties, newInterval.propertyManager);
|
|
286
|
-
}
|
|
241
|
+
const newInterval = new SequenceIntervalClass(this.client, startRef, endRef, this.intervalType, undefined, startSide ?? this.startSide, endSide ?? this.endSide);
|
|
242
|
+
(0, internal_2.copyPropertiesAndManager)(this, newInterval);
|
|
287
243
|
return newInterval;
|
|
288
244
|
}
|
|
289
245
|
}
|
|
290
|
-
exports.
|
|
246
|
+
exports.SequenceIntervalClass = SequenceIntervalClass;
|
|
291
247
|
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint) {
|
|
292
248
|
if (segoff === "start" || segoff === "end") {
|
|
293
249
|
return client.createLocalReferencePosition(segoff, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
|
|
@@ -367,7 +323,7 @@ function createSequenceInterval(label, start, end, client, intervalType, op, fro
|
|
|
367
323
|
};
|
|
368
324
|
startLref.addProperties(rangeProp);
|
|
369
325
|
endLref.addProperties(rangeProp);
|
|
370
|
-
const ival = new
|
|
326
|
+
const ival = new SequenceIntervalClass(client, startLref, endLref, intervalType, rangeProp, startSide, endSide);
|
|
371
327
|
return ival;
|
|
372
328
|
}
|
|
373
329
|
exports.createSequenceInterval = createSequenceInterval;
|