@fluidframework/sequence 2.90.0-378676 → 2.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-report/sequence.legacy.beta.api.md +1 -1
  3. package/dist/intervalCollection.d.ts +3 -2
  4. package/dist/intervalCollection.d.ts.map +1 -1
  5. package/dist/intervalCollection.js +5 -5
  6. package/dist/intervalCollection.js.map +1 -1
  7. package/dist/intervalIndex/endpointInRangeIndex.d.ts +3 -3
  8. package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  9. package/dist/intervalIndex/endpointInRangeIndex.js +5 -6
  10. package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
  11. package/dist/intervalIndex/endpointIndex.d.ts +3 -3
  12. package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
  13. package/dist/intervalIndex/endpointIndex.js +5 -6
  14. package/dist/intervalIndex/endpointIndex.js.map +1 -1
  15. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +8 -7
  16. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  17. package/dist/intervalIndex/overlappingIntervalsIndex.js +5 -6
  18. package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  19. package/dist/intervalIndex/startpointInRangeIndex.d.ts +3 -3
  20. package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  21. package/dist/intervalIndex/startpointInRangeIndex.js +5 -6
  22. package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
  23. package/dist/intervals/index.d.ts +1 -1
  24. package/dist/intervals/index.d.ts.map +1 -1
  25. package/dist/intervals/index.js +4 -2
  26. package/dist/intervals/index.js.map +1 -1
  27. package/dist/intervals/sequenceInterval.d.ts +60 -35
  28. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  29. package/dist/intervals/sequenceInterval.js +166 -102
  30. package/dist/intervals/sequenceInterval.js.map +1 -1
  31. package/dist/packageVersion.d.ts +1 -1
  32. package/dist/packageVersion.d.ts.map +1 -1
  33. package/dist/packageVersion.js +1 -1
  34. package/dist/packageVersion.js.map +1 -1
  35. package/dist/sequence.d.ts +3 -6
  36. package/dist/sequence.d.ts.map +1 -1
  37. package/dist/sequence.js +2 -5
  38. package/dist/sequence.js.map +1 -1
  39. package/lib/intervalCollection.d.ts +3 -2
  40. package/lib/intervalCollection.d.ts.map +1 -1
  41. package/lib/intervalCollection.js +5 -5
  42. package/lib/intervalCollection.js.map +1 -1
  43. package/lib/intervalIndex/endpointInRangeIndex.d.ts +3 -3
  44. package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  45. package/lib/intervalIndex/endpointInRangeIndex.js +6 -7
  46. package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
  47. package/lib/intervalIndex/endpointIndex.d.ts +3 -3
  48. package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
  49. package/lib/intervalIndex/endpointIndex.js +6 -7
  50. package/lib/intervalIndex/endpointIndex.js.map +1 -1
  51. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +8 -7
  52. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  53. package/lib/intervalIndex/overlappingIntervalsIndex.js +7 -8
  54. package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  55. package/lib/intervalIndex/startpointInRangeIndex.d.ts +3 -3
  56. package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  57. package/lib/intervalIndex/startpointInRangeIndex.js +6 -7
  58. package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
  59. package/lib/intervals/index.d.ts +1 -1
  60. package/lib/intervals/index.d.ts.map +1 -1
  61. package/lib/intervals/index.js +1 -1
  62. package/lib/intervals/index.js.map +1 -1
  63. package/lib/intervals/sequenceInterval.d.ts +60 -35
  64. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  65. package/lib/intervals/sequenceInterval.js +162 -100
  66. package/lib/intervals/sequenceInterval.js.map +1 -1
  67. package/lib/packageVersion.d.ts +1 -1
  68. package/lib/packageVersion.d.ts.map +1 -1
  69. package/lib/packageVersion.js +1 -1
  70. package/lib/packageVersion.js.map +1 -1
  71. package/lib/sequence.d.ts +3 -6
  72. package/lib/sequence.d.ts.map +1 -1
  73. package/lib/sequence.js +2 -5
  74. package/lib/sequence.js.map +1 -1
  75. package/package.json +21 -21
  76. package/src/intervalCollection.ts +6 -3
  77. package/src/intervalIndex/endpointInRangeIndex.ts +11 -7
  78. package/src/intervalIndex/endpointIndex.ts +7 -7
  79. package/src/intervalIndex/overlappingIntervalsIndex.ts +18 -25
  80. package/src/intervalIndex/startpointInRangeIndex.ts +11 -7
  81. package/src/intervals/index.ts +3 -1
  82. package/src/intervals/sequenceInterval.ts +249 -124
  83. package/src/packageVersion.ts +1 -1
  84. package/src/sequence.ts +8 -11
@@ -2,18 +2,18 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
6
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9
- };
10
5
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11
6
  if (kind === "m") throw new TypeError("Private method is not writable");
12
7
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13
8
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
14
9
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15
10
  };
16
- var _SequenceIntervalClass_props, _SequenceIntervalClass_disposed;
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _BaseSequenceInterval_id, _BaseSequenceInterval_properties, _SequenceIntervalClass_props, _SequenceIntervalClass_disposed;
17
17
  import { assert } from "@fluidframework/core-utils/internal";
18
18
  import { PropertiesManager, ReferenceType, SlidingPreference, compareReferencePositions, createDetachedLocalReferencePosition, createMap, getSlideToSegoff, maxReferencePosition, minReferencePosition, refTypeIncludesFlag, reservedRangeLabelsKey, Side, endpointPosAndSide, addProperties, UnassignedSequenceNumber, UniversalSequenceNumber, } from "@fluidframework/merge-tree/internal";
19
19
  import { LoggingError, UsageError } from "@fluidframework/telemetry-utils/internal";
@@ -49,7 +49,122 @@ export function getSerializedProperties(serializedInterval) {
49
49
  const id = maybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;
50
50
  return { id, labels, properties };
51
51
  }
52
- export class SequenceIntervalClass {
52
+ /**
53
+ * Lightweight interval for index queries (overlap, comparison).
54
+ * Has no Client dependency; cannot serialize or be disposed.
55
+ */
56
+ export class BaseSequenceInterval {
57
+ constructor(id,
58
+ /**
59
+ * Start endpoint of this interval.
60
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
61
+ */
62
+ start,
63
+ /**
64
+ * End endpoint of this interval.
65
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
66
+ */
67
+ end, intervalType, startSide = Side.Before, endSide = Side.Before) {
68
+ this.start = start;
69
+ this.end = end;
70
+ this.intervalType = intervalType;
71
+ this.startSide = startSide;
72
+ this.endSide = endSide;
73
+ _BaseSequenceInterval_id.set(this, void 0);
74
+ _BaseSequenceInterval_properties.set(this, createMap());
75
+ __classPrivateFieldSet(this, _BaseSequenceInterval_id, id, "f");
76
+ }
77
+ get properties() {
78
+ return __classPrivateFieldGet(this, _BaseSequenceInterval_properties, "f");
79
+ }
80
+ /***/
81
+ get stickiness() {
82
+ this.verifyNotDispose();
83
+ const startSegment = this.start.getSegment();
84
+ const endSegment = this.end.getSegment();
85
+ return computeStickinessFromSide(startSegment?.endpointType, this.startSide, endSegment?.endpointType, this.endSide);
86
+ }
87
+ /**
88
+ * {@inheritDoc ISerializableInterval.getIntervalId}
89
+ */
90
+ getIntervalId() {
91
+ return __classPrivateFieldGet(this, _BaseSequenceInterval_id, "f");
92
+ }
93
+ /**
94
+ * {@inheritDoc IInterval.compare}
95
+ */
96
+ compare(b) {
97
+ const startResult = this.compareStart(b);
98
+ if (startResult === 0) {
99
+ const endResult = this.compareEnd(b);
100
+ if (endResult === 0) {
101
+ const thisId = this.getIntervalId();
102
+ if (thisId) {
103
+ const bId = b.getIntervalId();
104
+ if (bId) {
105
+ return thisId > bId ? 1 : thisId < bId ? -1 : 0;
106
+ }
107
+ return 0;
108
+ }
109
+ return 0;
110
+ }
111
+ else {
112
+ return endResult;
113
+ }
114
+ }
115
+ else {
116
+ return startResult;
117
+ }
118
+ }
119
+ /**
120
+ * {@inheritDoc IInterval.compareStart}
121
+ */
122
+ compareStart(b) {
123
+ this.verifyNotDispose();
124
+ const dist = compareReferencePositions(this.start, b.start);
125
+ if (dist === 0) {
126
+ return compareSides(this.startSide, b.startSide);
127
+ }
128
+ return dist;
129
+ }
130
+ /**
131
+ * {@inheritDoc IInterval.compareEnd}
132
+ */
133
+ compareEnd(b) {
134
+ this.verifyNotDispose();
135
+ const dist = compareReferencePositions(this.end, b.end);
136
+ if (dist === 0) {
137
+ return compareSides(b.endSide, this.endSide);
138
+ }
139
+ return dist;
140
+ }
141
+ /**
142
+ * {@inheritDoc IInterval.overlaps}
143
+ */
144
+ overlaps(b) {
145
+ this.verifyNotDispose();
146
+ const result = compareReferencePositions(this.start, b.end) <= 0 &&
147
+ compareReferencePositions(this.end, b.start) >= 0;
148
+ return result;
149
+ }
150
+ /**
151
+ * Whether this interval overlaps the provided numerical positions.
152
+ */
153
+ overlapsPos(_bstart, _bend) {
154
+ assert(false, 0xcd7 /* overlapsPos not supported on BaseSequenceInterval */);
155
+ }
156
+ clone() {
157
+ assert(false, 0xcd8 /* clone not supported on BaseSequenceInterval */);
158
+ }
159
+ union(_b) {
160
+ assert(false, 0xcd9 /* union not supported on BaseSequenceInterval */);
161
+ }
162
+ verifyNotDispose() {
163
+ // No-op: transient intervals are not disposable.
164
+ }
165
+ }
166
+ _BaseSequenceInterval_id = new WeakMap(), _BaseSequenceInterval_properties = new WeakMap();
167
+ export class SequenceIntervalClass extends BaseSequenceInterval {
53
168
  /**
54
169
  * {@inheritDoc ISerializableInterval.properties}
55
170
  */
@@ -66,32 +181,10 @@ export class SequenceIntervalClass {
66
181
  : UniversalSequenceNumber, op?.minimumSequenceNumber ?? UniversalSequenceNumber, this.client.getCollabWindow().collaborating, rollback);
67
182
  }
68
183
  }
69
- /***/
70
- get stickiness() {
71
- this.verifyNotDispose();
72
- const startSegment = this.start.getSegment();
73
- const endSegment = this.end.getSegment();
74
- return computeStickinessFromSide(startSegment?.endpointType, this.startSide, endSegment?.endpointType, this.endSide);
75
- }
76
- constructor(client, id, label,
77
- /**
78
- * Start endpoint of this interval.
79
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
80
- */
81
- start,
82
- /**
83
- * End endpoint of this interval.
84
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
85
- */
86
- end, intervalType, props, startSide = Side.Before, endSide = Side.Before) {
184
+ constructor(client, id, label, start, end, intervalType, props, startSide = Side.Before, endSide = Side.Before) {
185
+ super(id, start, end, intervalType, startSide, endSide);
87
186
  this.client = client;
88
- this.id = id;
89
187
  this.label = label;
90
- this.start = start;
91
- this.end = end;
92
- this.intervalType = intervalType;
93
- this.startSide = startSide;
94
- this.endSide = endSide;
95
188
  _SequenceIntervalClass_props.set(this, { properties: createMap() });
96
189
  _SequenceIntervalClass_disposed.set(this, false);
97
190
  if (props) {
@@ -172,7 +265,7 @@ export class SequenceIntervalClass {
172
265
  endSide: includeEndpoints ? this.endSide : undefined,
173
266
  properties: {
174
267
  ...props,
175
- [reservedIntervalIdKey]: this.id,
268
+ [reservedIntervalIdKey]: this.getIntervalId(),
176
269
  [reservedRangeLabelsKey]: [this.label],
177
270
  },
178
271
  };
@@ -182,70 +275,7 @@ export class SequenceIntervalClass {
182
275
  */
183
276
  clone() {
184
277
  this.verifyNotDispose();
185
- return new SequenceIntervalClass(this.client, this.id, this.label, this.start, this.end, this.intervalType, this.properties, this.startSide, this.endSide);
186
- }
187
- /**
188
- * {@inheritDoc IInterval.compare}
189
- */
190
- compare(b) {
191
- const startResult = this.compareStart(b);
192
- if (startResult === 0) {
193
- const endResult = this.compareEnd(b);
194
- if (endResult === 0) {
195
- const thisId = this.getIntervalId();
196
- if (thisId) {
197
- const bId = b.getIntervalId();
198
- if (bId) {
199
- return thisId > bId ? 1 : thisId < bId ? -1 : 0;
200
- }
201
- return 0;
202
- }
203
- return 0;
204
- }
205
- else {
206
- return endResult;
207
- }
208
- }
209
- else {
210
- return startResult;
211
- }
212
- }
213
- /**
214
- * {@inheritDoc IInterval.compareStart}
215
- */
216
- compareStart(b) {
217
- this.verifyNotDispose();
218
- const dist = compareReferencePositions(this.start, b.start);
219
- if (dist === 0) {
220
- return compareSides(this.startSide, b.startSide);
221
- }
222
- return dist;
223
- }
224
- /**
225
- * {@inheritDoc IInterval.compareEnd}
226
- */
227
- compareEnd(b) {
228
- this.verifyNotDispose();
229
- const dist = compareReferencePositions(this.end, b.end);
230
- if (dist === 0) {
231
- return compareSides(b.endSide, this.endSide);
232
- }
233
- return dist;
234
- }
235
- /**
236
- * {@inheritDoc IInterval.overlaps}
237
- */
238
- overlaps(b) {
239
- this.verifyNotDispose();
240
- const result = compareReferencePositions(this.start, b.end) <= 0 &&
241
- compareReferencePositions(this.end, b.start) >= 0;
242
- return result;
243
- }
244
- /**
245
- * {@inheritDoc ISerializableInterval.getIntervalId}
246
- */
247
- getIntervalId() {
248
- return this.id;
278
+ return new SequenceIntervalClass(this.client, this.getIntervalId(), this.label, this.start, this.end, this.intervalType, this.properties, this.startSide, this.endSide);
249
279
  }
250
280
  /**
251
281
  * {@inheritDoc IInterval.union}
@@ -354,7 +384,7 @@ export class SequenceIntervalClass {
354
384
  endRef.addProperties(this.end.properties);
355
385
  }
356
386
  }
357
- const newInterval = new SequenceIntervalClass(this.client, this.id, this.label, startRef, endRef, this.intervalType, undefined, startSide ?? this.startSide, endSide ?? this.endSide);
387
+ const newInterval = new SequenceIntervalClass(this.client, this.getIntervalId(), this.label, startRef, endRef, this.intervalType, undefined, startSide ?? this.startSide, endSide ?? this.endSide);
358
388
  __classPrivateFieldGet(newInterval, _SequenceIntervalClass_props, "f").propertyManager = __classPrivateFieldGet(this, _SequenceIntervalClass_props, "f").propertyManager ??=
359
389
  new PropertiesManager();
360
390
  __classPrivateFieldGet(newInterval, _SequenceIntervalClass_props, "f").properties = __classPrivateFieldGet(this, _SequenceIntervalClass_props, "f").properties;
@@ -395,6 +425,20 @@ export function createPositionReferenceFromSegoff({ client, segoff, refType, op,
395
425
  }
396
426
  return createDetachedLocalReferencePosition(slidingPreference, refType);
397
427
  }
428
+ /**
429
+ * Resolves a position to a {@link LocalReferencePosition} using an
430
+ * {@link ISharedSegmentSequence} (no Client or op context needed).
431
+ */
432
+ export function resolvePositionRef(sequence, pos, refType, slidingPreference, canSlideToEndpoint) {
433
+ if (pos === "start" || pos === "end") {
434
+ return sequence.createLocalReferencePosition(pos, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
435
+ }
436
+ const segoff = sequence.getContainingSegment(pos);
437
+ if (segoff?.segment !== undefined && segoff?.offset !== undefined) {
438
+ return sequence.createLocalReferencePosition(segoff.segment, segoff.offset, refType, undefined, slidingPreference, canSlideToEndpoint);
439
+ }
440
+ return createDetachedLocalReferencePosition(slidingPreference, refType);
441
+ }
398
442
  function createPositionReference({ client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, canSlideToEndpoint, rollback, }) {
399
443
  let segoff;
400
444
  if (op) {
@@ -429,8 +473,26 @@ function createPositionReference({ client, pos, refType, op, fromSnapshot, local
429
473
  rollback,
430
474
  });
431
475
  }
432
- export function createTransientInterval(start, end, client) {
433
- return createSequenceInterval("transient", uuid(), start, end, client, IntervalType.Transient);
476
+ /**
477
+ * Creates a transient interval using an `ISharedSegmentSequence` instead of a `Client`.
478
+ * This avoids coupling index classes to merge-tree internals.
479
+ */
480
+ export function createTransientIntervalFromSequence(start, end, sequence) {
481
+ const { startPos, startSide, endPos, endSide } = endpointPosAndSide(start ?? "start", end ?? "end");
482
+ assert(startPos !== undefined &&
483
+ endPos !== undefined &&
484
+ startSide !== undefined &&
485
+ endSide !== undefined, 0xcda /* start and end cannot be undefined because they were not passed in as undefined */);
486
+ const startSlidingPref = startReferenceSlidingPreference(startPos, startSide, endPos, endSide);
487
+ const endSlidingPref = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);
488
+ const startLref = resolvePositionRef(sequence, startPos, ReferenceType.Transient, startSlidingPref);
489
+ const endLref = resolvePositionRef(sequence, endPos, ReferenceType.Transient, endSlidingPref);
490
+ const rangeProp = {
491
+ [reservedRangeLabelsKey]: ["transient"],
492
+ };
493
+ startLref.addProperties(rangeProp);
494
+ endLref.addProperties(rangeProp);
495
+ return new BaseSequenceInterval(uuid(), startLref, endLref, IntervalType.Transient, startSide, endSide);
434
496
  }
435
497
  export function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, canSlideToEndpoint = false, props, rollback) {
436
498
  const { startPos, startSide, endPos, endSide } = endpointPosAndSide(start ?? "start", end ?? "end");
@@ -459,6 +521,7 @@ export function createSequenceInterval(label, id, start, end, client, intervalTy
459
521
  }
460
522
  const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
461
523
  const startSlidingPreference = startReferenceSlidingPreference(startPos, startSide, endPos, endSide);
524
+ const endSlidingPreference = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);
462
525
  const startLref = createPositionReference({
463
526
  client,
464
527
  pos: startPos,
@@ -469,7 +532,6 @@ export function createSequenceInterval(label, id, start, end, client, intervalTy
469
532
  canSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,
470
533
  rollback,
471
534
  });
472
- const endSlidingPreference = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);
473
535
  const endLref = createPositionReference({
474
536
  client,
475
537
  pos: endPos,
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAIN,iBAAiB,EAEjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,oCAAoC,EACpC,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EAEtB,IAAI,EACJ,kBAAkB,EAClB,aAAa,EAEb,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAGN,kBAAkB,EAClB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,GAG/B,MAAM,oBAAoB,CAAC;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC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;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,EAAE,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,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\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\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\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tcomputeStickinessFromSide,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IInterval,\n\ttype SerializedIntervalDelta,\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\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\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 * @legacy @beta\n */\nexport interface SequenceInterval extends IInterval {\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/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\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\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\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\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 class SequenceIntervalClass\n\timplements SequenceInterval, ISerializableInterval, IDisposable\n{\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic get properties(): Readonly<PropertySet> {\n\t\tthis.verifyNotDispose();\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(\n\t\tprops: PropertySet | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\trollback?: boolean,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t\trollback,\n\t\t\t);\n\t\t}\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tthis.verifyNotDispose();\n\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\tprivate readonly id: string,\n\t\tprivate readonly label: string,\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.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\t#disposed = false;\n\tpublic get disposed() {\n\t\treturn this.#disposed;\n\t}\n\tpublic dispose(error?: Error): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.client.removeLocalReferencePosition(this.start);\n\t\tthis.client.removeLocalReferencePosition(this.end);\n\t\tthis.removePositionChangeListeners();\n\t\tthis.#props.propertyManager = undefined;\n\t}\n\n\tprivate verifyNotDispose() {\n\t\tif (this.#disposed) {\n\t\t\tthrow new LoggingError(\"Invalid interval access after dispose\");\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\tthis.verifyNotDispose();\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\tthis.verifyNotDispose();\n\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\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: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.id,\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\tthis.verifyNotDispose();\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.id,\n\t\t\tthis.label,\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\tthis.verifyNotDispose();\n\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\tthis.verifyNotDispose();\n\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\tthis.verifyNotDispose();\n\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\treturn this.id;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceIntervalClass) {\n\t\tthis.verifyNotDispose();\n\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\tuuid(),\n\t\t\tthis.label,\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 * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tthis.verifyNotDispose();\n\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\tpublic moveEndpointReferences(\n\t\trebased: Record<\"start\" | \"end\", { segment: ISegment; offset: number }>,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.start,\n\t\t\trefType: this.start.refType,\n\t\t\tslidingPreference: this.start.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.start.canSlideToEndpoint,\n\t\t});\n\t\tif (this.start.properties) {\n\t\t\tstartRef.addProperties(this.start.properties);\n\t\t}\n\t\tthis.start = startRef;\n\n\t\tconst endRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.end,\n\t\t\trefType: this.end.refType,\n\t\t\tslidingPreference: this.end.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.end.canSlideToEndpoint,\n\t\t});\n\t\tif (this.end.properties) {\n\t\t\tendRef.addProperties(this.end.properties);\n\t\t}\n\t\tthis.end = endRef;\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\tcanSlideToEndpoint: boolean = false,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\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} else {\n\t\t\t\trefType &= ~ReferenceType.StayOnRemove;\n\t\t\t\trefType |= ReferenceType.SlideOnRemove;\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\tconst slidingPreference = startReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tstartRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: startPos,\n\t\t\t\trefType: getRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.BACKWARD,\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\tconst slidingPreference = endReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tendRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: endPos,\n\t\t\t\trefType: getRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.FORWARD,\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\tthis.id,\n\t\t\tthis.label,\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\tnewInterval.#props.propertyManager = this.#props.propertyManager ??=\n\t\t\tnew PropertiesManager();\n\t\tnewInterval.#props.properties = this.#props.properties;\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (Object.keys(newProps).length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tthis.#props.propertyManager !== undefined,\n\t\t\t0xbd5 /* must have property manager to ack */,\n\t\t);\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff({\n\tclient,\n\tsegoff,\n\trefType,\n\top,\n\tlocalSeq,\n\tfromSnapshot,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tsegoff: { segment: ISegment; offset: number } | undefined | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tlocalSeq?: number;\n\tfromSnapshot?: boolean;\n\tslidingPreference: SlidingPreference | undefined;\n\tcanSlideToEndpoint: boolean | undefined;\n\trollback?: 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\t!rollback\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,\n\tpos,\n\trefType,\n\top,\n\tfromSnapshot,\n\tlocalSeq,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tpos: number | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tfromSnapshot?: boolean;\n\tlocalSeq?: number;\n\tslidingPreference: SlidingPreference;\n\tcanSlideToEndpoint: boolean;\n\trollback?: boolean;\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, undefined, canSlideToEndpoint);\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\tcanSlideToEndpoint,\n\t\trollback,\n\t});\n}\n\nexport function createTransientInterval(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n) {\n\treturn createSequenceInterval(\n\t\t\"transient\",\n\t\tuuid(),\n\t\tstart,\n\t\tend,\n\t\tclient,\n\t\tIntervalType.Transient,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tcanSlideToEndpoint: boolean = false,\n\tprops?: PropertySet,\n\trollback?: boolean,\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\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 stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\tconst startSlidingPreference = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst startLref = createPositionReference({\n\t\tclient,\n\t\tpos: startPos,\n\t\trefType: beginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: startSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst endSlidingPreference = endReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst endLref = createPositionReference({\n\t\tclient,\n\t\tpos: endPos,\n\t\trefType: endRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: endSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\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\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
1
+ {"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAIN,iBAAiB,EAEjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,oCAAoC,EACpC,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EAEtB,IAAI,EACJ,kBAAkB,EAClB,aAAa,EAEb,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EAGN,kBAAkB,EAClB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,GAG/B,MAAM,oBAAoB,CAAC;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC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,EAAE,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,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\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\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\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { ISharedSegmentSequence } from \"../sequence.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tcomputeStickinessFromSide,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IInterval,\n\ttype SerializedIntervalDelta,\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\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\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 * @legacy @beta\n */\nexport interface SequenceInterval extends IInterval {\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/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\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\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\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\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\n/**\n * Lightweight interval for index queries (overlap, comparison).\n * Has no Client dependency; cannot serialize or be disposed.\n */\nexport class BaseSequenceInterval implements SequenceInterval, ISerializableInterval {\n\treadonly #id: string;\n\treadonly #properties: PropertySet = createMap<any>();\n\n\tconstructor(\n\t\tid: string,\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\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tthis.#id = id;\n\t}\n\n\tpublic get properties(): Readonly<PropertySet> {\n\t\treturn this.#properties;\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tthis.verifyNotDispose();\n\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\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\treturn this.#id;\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\tthis.verifyNotDispose();\n\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\tthis.verifyNotDispose();\n\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\tthis.verifyNotDispose();\n\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 * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic overlapsPos(_bstart: number, _bend: number): boolean {\n\t\tassert(false, 0xcd7 /* overlapsPos not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic clone(): BaseSequenceInterval {\n\t\tassert(false, 0xcd8 /* clone not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic union(_b: BaseSequenceInterval): BaseSequenceInterval {\n\t\tassert(false, 0xcd9 /* union not supported on BaseSequenceInterval */);\n\t}\n\n\tprotected verifyNotDispose(): void {\n\t\t// No-op: transient intervals are not disposable.\n\t}\n}\n\nexport class SequenceIntervalClass\n\textends BaseSequenceInterval\n\timplements ISerializableInterval, IDisposable\n{\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic override get properties(): Readonly<PropertySet> {\n\t\tthis.verifyNotDispose();\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(\n\t\tprops: PropertySet | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\trollback?: boolean,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t\trollback,\n\t\t\t);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tid: string,\n\t\tprivate readonly label: string,\n\t\tstart: LocalReferencePosition,\n\t\tend: LocalReferencePosition,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstartSide: Side = Side.Before,\n\t\tendSide: Side = Side.Before,\n\t) {\n\t\tsuper(id, start, end, intervalType, startSide, endSide);\n\t\tif (props) {\n\t\t\tthis.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\t#disposed = false;\n\tpublic get disposed() {\n\t\treturn this.#disposed;\n\t}\n\tpublic dispose(error?: Error): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.client.removeLocalReferencePosition(this.start);\n\t\tthis.client.removeLocalReferencePosition(this.end);\n\t\tthis.removePositionChangeListeners();\n\t\tthis.#props.propertyManager = undefined;\n\t}\n\n\tprotected override verifyNotDispose() {\n\t\tif (this.#disposed) {\n\t\t\tthrow new LoggingError(\"Invalid interval access after dispose\");\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\tthis.verifyNotDispose();\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\tthis.verifyNotDispose();\n\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\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: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.getIntervalId(),\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\tthis.verifyNotDispose();\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.getIntervalId(),\n\t\t\tthis.label,\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.union}\n\t */\n\tpublic union(b: SequenceIntervalClass) {\n\t\tthis.verifyNotDispose();\n\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\tuuid(),\n\t\t\tthis.label,\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 * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic override overlapsPos(bstart: number, bend: number) {\n\t\tthis.verifyNotDispose();\n\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\tpublic moveEndpointReferences(\n\t\trebased: Record<\"start\" | \"end\", { segment: ISegment; offset: number }>,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.start,\n\t\t\trefType: this.start.refType,\n\t\t\tslidingPreference: this.start.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.start.canSlideToEndpoint,\n\t\t});\n\t\tif (this.start.properties) {\n\t\t\tstartRef.addProperties(this.start.properties);\n\t\t}\n\t\tthis.start = startRef;\n\n\t\tconst endRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.end,\n\t\t\trefType: this.end.refType,\n\t\t\tslidingPreference: this.end.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.end.canSlideToEndpoint,\n\t\t});\n\t\tif (this.end.properties) {\n\t\t\tendRef.addProperties(this.end.properties);\n\t\t}\n\t\tthis.end = endRef;\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\tcanSlideToEndpoint: boolean = false,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\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} else {\n\t\t\t\trefType &= ~ReferenceType.StayOnRemove;\n\t\t\t\trefType |= ReferenceType.SlideOnRemove;\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\tconst slidingPreference = startReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tstartRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: startPos,\n\t\t\t\trefType: getRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.BACKWARD,\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\tconst slidingPreference = endReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tendRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: endPos,\n\t\t\t\trefType: getRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.FORWARD,\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\tthis.getIntervalId(),\n\t\t\tthis.label,\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\tnewInterval.#props.propertyManager = this.#props.propertyManager ??=\n\t\t\tnew PropertiesManager();\n\t\tnewInterval.#props.properties = this.#props.properties;\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (Object.keys(newProps).length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tthis.#props.propertyManager !== undefined,\n\t\t\t0xbd5 /* must have property manager to ack */,\n\t\t);\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff({\n\tclient,\n\tsegoff,\n\trefType,\n\top,\n\tlocalSeq,\n\tfromSnapshot,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tsegoff: { segment: ISegment; offset: number } | undefined | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tlocalSeq?: number;\n\tfromSnapshot?: boolean;\n\tslidingPreference: SlidingPreference | undefined;\n\tcanSlideToEndpoint: boolean | undefined;\n\trollback?: 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\t!rollback\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\n/**\n * Resolves a position to a {@link LocalReferencePosition} using an\n * {@link ISharedSegmentSequence} (no Client or op context needed).\n */\nexport function resolvePositionRef(\n\tsequence: ISharedSegmentSequence<any>,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\tslidingPreference: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (pos === \"start\" || pos === \"end\") {\n\t\treturn sequence.createLocalReferencePosition(\n\t\t\tpos,\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\tconst segoff = sequence.getContainingSegment(pos);\n\tif (segoff?.segment !== undefined && segoff?.offset !== undefined) {\n\t\treturn sequence.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}\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference({\n\tclient,\n\tpos,\n\trefType,\n\top,\n\tfromSnapshot,\n\tlocalSeq,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tpos: number | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tfromSnapshot?: boolean;\n\tlocalSeq?: number;\n\tslidingPreference: SlidingPreference;\n\tcanSlideToEndpoint: boolean;\n\trollback?: boolean;\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, undefined, canSlideToEndpoint);\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\tcanSlideToEndpoint,\n\t\trollback,\n\t});\n}\n\n/**\n * Creates a transient interval using an `ISharedSegmentSequence` instead of a `Client`.\n * This avoids coupling index classes to merge-tree internals.\n */\nexport function createTransientIntervalFromSequence(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tsequence: ISharedSegmentSequence<any>,\n): BaseSequenceInterval {\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\t0xcda /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\n\tconst startSlidingPref = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\tconst endSlidingPref = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);\n\n\tconst startLref = resolvePositionRef(\n\t\tsequence,\n\t\tstartPos,\n\t\tReferenceType.Transient,\n\t\tstartSlidingPref,\n\t);\n\tconst endLref = resolvePositionRef(\n\t\tsequence,\n\t\tendPos,\n\t\tReferenceType.Transient,\n\t\tendSlidingPref,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [\"transient\"],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\treturn new BaseSequenceInterval(\n\t\tuuid(),\n\t\tstartLref,\n\t\tendLref,\n\t\tIntervalType.Transient,\n\t\tstartSide,\n\t\tendSide,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tcanSlideToEndpoint: boolean = false,\n\tprops?: PropertySet,\n\trollback?: boolean,\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\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 stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\tconst startSlidingPreference = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst endSlidingPreference = endReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst startLref = createPositionReference({\n\t\tclient,\n\t\tpos: startPos,\n\t\trefType: beginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: startSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst endLref = createPositionReference({\n\t\tclient,\n\t\tpos: endPos,\n\t\trefType: endRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: endSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\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\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "2.90.0-378676";
8
+ export declare const pkgVersion = "2.91.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/sequence";
8
- export const pkgVersion = "2.90.0-378676";
8
+ export const pkgVersion = "2.91.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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.90.0-378676\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,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.91.0\";\n"]}
package/lib/sequence.d.ts CHANGED
@@ -55,12 +55,12 @@ export interface ISharedSegmentSequence<T extends ISegment> extends ISharedObjec
55
55
  /**
56
56
  * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include
57
57
  * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.
58
- * @param segment - Segment to add the local reference on
58
+ * @param segment - Segment to add the local reference on, or "start"/"end" for endpoint segments
59
59
  * @param offset - Offset on the segment at which to place the local reference
60
60
  * @param refType - ReferenceType for the created local reference
61
61
  * @param properties - PropertySet to place on the created local reference
62
62
  */
63
- createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
63
+ createLocalReferencePosition(segment: T | "start" | "end", offset: number | undefined, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
64
64
  /**
65
65
  * Removes a `LocalReferencePosition` from this SharedString.
66
66
  */
@@ -304,7 +304,7 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
304
304
  posStart: number | undefined;
305
305
  posAfterEnd: number | undefined;
306
306
  };
307
- createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
307
+ createLocalReferencePosition(segment: T | "start" | "end", offset: number | undefined, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
308
308
  localReferencePositionToPosition(lref: ReferencePosition): number;
309
309
  removeLocalReferencePosition(lref: LocalReferencePosition): LocalReferencePosition | undefined;
310
310
  resolveRemoteClientPosition(remoteClientPosition: number, remoteClientRefSeq: number, remoteClientId: string): number | undefined;
@@ -356,9 +356,6 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
356
356
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
357
357
  */
358
358
  protected loadCore(storage: IChannelStorageService): Promise<void>;
359
- /**
360
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
361
- */
362
359
  protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
363
360
  private processMessage;
364
361
  /**