@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
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Side,
|
|
29
29
|
endpointPosAndSide,
|
|
30
30
|
addProperties,
|
|
31
|
+
copyPropertiesAndManager,
|
|
31
32
|
} from "@fluidframework/merge-tree/internal";
|
|
32
33
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
33
34
|
|
|
@@ -38,13 +39,13 @@ import {
|
|
|
38
39
|
} from "../intervalCollection.js";
|
|
39
40
|
|
|
40
41
|
import {
|
|
41
|
-
IIntervalHelpers,
|
|
42
42
|
ISerializableInterval,
|
|
43
43
|
ISerializedInterval,
|
|
44
44
|
IntervalStickiness,
|
|
45
45
|
IntervalType,
|
|
46
46
|
endReferenceSlidingPreference,
|
|
47
47
|
startReferenceSlidingPreference,
|
|
48
|
+
type IIntervalHelpers,
|
|
48
49
|
} from "./intervalUtils.js";
|
|
49
50
|
|
|
50
51
|
function compareSides(sideA: Side, sideB: Side): number {
|
|
@@ -101,10 +102,88 @@ function maxSide(sideA: Side, sideB: Side): Side {
|
|
|
101
102
|
* `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
|
|
102
103
|
* of the interval that are exclusive will have the ability to slide to these
|
|
103
104
|
* special endpoint segments.
|
|
104
|
-
* @legacy
|
|
105
105
|
* @alpha
|
|
106
|
+
* @legacy
|
|
106
107
|
*/
|
|
107
|
-
export
|
|
108
|
+
export interface SequenceInterval extends ISerializableInterval {
|
|
109
|
+
readonly start: LocalReferencePosition;
|
|
110
|
+
/**
|
|
111
|
+
* End endpoint of this interval.
|
|
112
|
+
* @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
|
|
113
|
+
*/
|
|
114
|
+
readonly end: LocalReferencePosition;
|
|
115
|
+
readonly intervalType: IntervalType;
|
|
116
|
+
readonly startSide: Side;
|
|
117
|
+
readonly endSide: Side;
|
|
118
|
+
readonly stickiness: IntervalStickiness;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @returns a new interval object with identical semantics.
|
|
122
|
+
*/
|
|
123
|
+
clone(): SequenceInterval;
|
|
124
|
+
/**
|
|
125
|
+
* Compares this interval to `b` with standard comparator semantics:
|
|
126
|
+
* - returns -1 if this is less than `b`
|
|
127
|
+
* - returns 1 if this is greater than `b`
|
|
128
|
+
* - returns 0 if this is equivalent to `b`
|
|
129
|
+
* @param b - Interval to compare against
|
|
130
|
+
*/
|
|
131
|
+
compare(b: SequenceInterval): number;
|
|
132
|
+
/**
|
|
133
|
+
* Compares the start endpoint of this interval to `b`'s start endpoint.
|
|
134
|
+
* Standard comparator semantics apply.
|
|
135
|
+
* @param b - Interval to compare against
|
|
136
|
+
*/
|
|
137
|
+
compareStart(b: SequenceInterval): number;
|
|
138
|
+
/**
|
|
139
|
+
* Compares the end endpoint of this interval to `b`'s end endpoint.
|
|
140
|
+
* Standard comparator semantics apply.
|
|
141
|
+
* @param b - Interval to compare against
|
|
142
|
+
*/
|
|
143
|
+
compareEnd(b: SequenceInterval): number;
|
|
144
|
+
/**
|
|
145
|
+
* Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
|
|
146
|
+
*/
|
|
147
|
+
modify(
|
|
148
|
+
label: string,
|
|
149
|
+
start: SequencePlace | undefined,
|
|
150
|
+
end: SequencePlace | undefined,
|
|
151
|
+
op?: ISequencedDocumentMessage,
|
|
152
|
+
localSeq?: number,
|
|
153
|
+
useNewSlidingBehavior?: boolean,
|
|
154
|
+
): SequenceInterval | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* @returns whether this interval overlaps with `b`.
|
|
157
|
+
* Intervals are considered to overlap if their intersection is non-empty.
|
|
158
|
+
*/
|
|
159
|
+
overlaps(b: SequenceInterval): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Unions this interval with `b`, returning a new interval.
|
|
162
|
+
* The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes
|
|
163
|
+
* intermediate values between the two intervals.
|
|
164
|
+
*/
|
|
165
|
+
union(b: SequenceInterval): SequenceInterval;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Subscribes to position change events on this interval if there are no current listeners.
|
|
169
|
+
*/
|
|
170
|
+
addPositionChangeListeners(
|
|
171
|
+
beforePositionChange: () => void,
|
|
172
|
+
afterPositionChange: () => void,
|
|
173
|
+
): void;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Removes the currently subscribed position change listeners.
|
|
177
|
+
*/
|
|
178
|
+
removePositionChangeListeners(): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @returns whether this interval overlaps two numerical positions.
|
|
182
|
+
*/
|
|
183
|
+
overlapsPos(bstart: number, bend: number): boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export class SequenceIntervalClass implements SequenceInterval {
|
|
108
187
|
/**
|
|
109
188
|
* {@inheritDoc ISerializableInterval.properties}
|
|
110
189
|
*/
|
|
@@ -113,7 +192,7 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
113
192
|
/**
|
|
114
193
|
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
115
194
|
*/
|
|
116
|
-
public propertyManager
|
|
195
|
+
public propertyManager?: PropertiesManager;
|
|
117
196
|
|
|
118
197
|
/***/
|
|
119
198
|
public get stickiness(): IntervalStickiness {
|
|
@@ -127,9 +206,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
127
206
|
);
|
|
128
207
|
}
|
|
129
208
|
|
|
130
|
-
/**
|
|
131
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
132
|
-
*/
|
|
133
209
|
constructor(
|
|
134
210
|
private readonly client: Client,
|
|
135
211
|
/**
|
|
@@ -215,8 +291,8 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
215
291
|
/**
|
|
216
292
|
* {@inheritDoc IInterval.clone}
|
|
217
293
|
*/
|
|
218
|
-
public clone() {
|
|
219
|
-
return new
|
|
294
|
+
public clone(): SequenceInterval {
|
|
295
|
+
return new SequenceIntervalClass(
|
|
220
296
|
this.client,
|
|
221
297
|
this.start,
|
|
222
298
|
this.end,
|
|
@@ -320,7 +396,7 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
320
396
|
endSide = this.end === newEnd ? this.endSide : b.endSide;
|
|
321
397
|
}
|
|
322
398
|
|
|
323
|
-
return new
|
|
399
|
+
return new SequenceIntervalClass(
|
|
324
400
|
this.client,
|
|
325
401
|
newStart,
|
|
326
402
|
newEnd,
|
|
@@ -331,17 +407,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
331
407
|
);
|
|
332
408
|
}
|
|
333
409
|
|
|
334
|
-
/**
|
|
335
|
-
* {@inheritDoc ISerializableInterval.addProperties}
|
|
336
|
-
*/
|
|
337
|
-
public addProperties(
|
|
338
|
-
newProps: PropertySet,
|
|
339
|
-
collab: boolean = false,
|
|
340
|
-
seq?: number,
|
|
341
|
-
): PropertySet | undefined {
|
|
342
|
-
return this.propertyManager.addProperties(this.properties, newProps, seq, collab);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
410
|
/**
|
|
346
411
|
* @returns whether this interval overlaps two numerical positions.
|
|
347
412
|
*/
|
|
@@ -414,7 +479,7 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
414
479
|
}
|
|
415
480
|
}
|
|
416
481
|
|
|
417
|
-
const newInterval = new
|
|
482
|
+
const newInterval = new SequenceIntervalClass(
|
|
418
483
|
this.client,
|
|
419
484
|
startRef,
|
|
420
485
|
endRef,
|
|
@@ -423,13 +488,7 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
423
488
|
startSide ?? this.startSide,
|
|
424
489
|
endSide ?? this.endSide,
|
|
425
490
|
);
|
|
426
|
-
|
|
427
|
-
this.propertyManager.copyTo(
|
|
428
|
-
this.properties,
|
|
429
|
-
newInterval.properties,
|
|
430
|
-
newInterval.propertyManager,
|
|
431
|
-
);
|
|
432
|
-
}
|
|
491
|
+
copyPropertiesAndManager(this, newInterval);
|
|
433
492
|
return newInterval;
|
|
434
493
|
}
|
|
435
494
|
}
|
|
@@ -604,7 +663,7 @@ export function createSequenceInterval(
|
|
|
604
663
|
startLref.addProperties(rangeProp);
|
|
605
664
|
endLref.addProperties(rangeProp);
|
|
606
665
|
|
|
607
|
-
const ival = new
|
|
666
|
+
const ival = new SequenceIntervalClass(
|
|
608
667
|
client,
|
|
609
668
|
startLref,
|
|
610
669
|
endLref,
|
package/src/packageVersion.ts
CHANGED
package/src/revertibles.ts
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
type ISegmentInternal,
|
|
27
27
|
} from "@fluidframework/merge-tree/internal";
|
|
28
28
|
|
|
29
|
-
import { IntervalOpType, SequenceInterval } from "./intervals/index.js";
|
|
29
|
+
import { IntervalOpType, SequenceInterval, SequenceIntervalClass } from "./intervals/index.js";
|
|
30
30
|
import { ISequenceDeltaRange, SequenceDeltaEvent } from "./sequenceDeltaEvent.js";
|
|
31
31
|
import { ISharedString, SharedStringSegment } from "./sharedString.js";
|
|
32
32
|
|
|
@@ -244,13 +244,13 @@ function addIfIntervalEndpoint(
|
|
|
244
244
|
) {
|
|
245
245
|
if (refTypeIncludesFlag(ref.refType, ReferenceType.RangeBegin)) {
|
|
246
246
|
const interval = ref.properties?.interval;
|
|
247
|
-
if (interval && interval instanceof
|
|
247
|
+
if (interval && interval instanceof SequenceIntervalClass) {
|
|
248
248
|
startIntervals.push({ offset: segmentLengths + interval.start.getOffset(), interval });
|
|
249
249
|
return true;
|
|
250
250
|
}
|
|
251
251
|
} else if (refTypeIncludesFlag(ref.refType, ReferenceType.RangeEnd)) {
|
|
252
252
|
const interval = ref.properties?.interval;
|
|
253
|
-
if (interval && interval instanceof
|
|
253
|
+
if (interval && interval instanceof SequenceIntervalClass) {
|
|
254
254
|
endIntervals.push({ offset: segmentLengths + interval.end.getOffset(), interval });
|
|
255
255
|
return true;
|
|
256
256
|
}
|
package/src/sequence.ts
CHANGED
|
@@ -81,7 +81,12 @@ import {
|
|
|
81
81
|
type SequenceOptions,
|
|
82
82
|
} from "./intervalCollectionMapInterfaces.js";
|
|
83
83
|
import { SequenceInterval } from "./intervals/index.js";
|
|
84
|
-
import {
|
|
84
|
+
import {
|
|
85
|
+
SequenceDeltaEvent,
|
|
86
|
+
SequenceDeltaEventClass,
|
|
87
|
+
SequenceMaintenanceEvent,
|
|
88
|
+
SequenceMaintenanceEventClass,
|
|
89
|
+
} from "./sequenceDeltaEvent.js";
|
|
85
90
|
import { ISharedIntervalCollection } from "./sharedIntervalCollection.js";
|
|
86
91
|
|
|
87
92
|
const snapshotFileName = "header";
|
|
@@ -362,9 +367,7 @@ export interface ISharedSegmentSequence<T extends ISegment>
|
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
/**
|
|
365
|
-
* @
|
|
366
|
-
* @alpha
|
|
367
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
370
|
+
* @internal
|
|
368
371
|
*/
|
|
369
372
|
export abstract class SharedSegmentSequence<T extends ISegment>
|
|
370
373
|
extends SharedObject<ISharedSegmentSequenceEvents>
|
|
@@ -534,7 +537,7 @@ export abstract class SharedSegmentSequence<T extends ISegment>
|
|
|
534
537
|
);
|
|
535
538
|
|
|
536
539
|
this.client.prependListener("delta", (opArgs, deltaArgs) => {
|
|
537
|
-
const event = new
|
|
540
|
+
const event = new SequenceDeltaEventClass(opArgs, deltaArgs, this.client);
|
|
538
541
|
if (event.isLocal) {
|
|
539
542
|
this.submitSequenceMessage(opArgs.op);
|
|
540
543
|
}
|
|
@@ -542,7 +545,11 @@ export abstract class SharedSegmentSequence<T extends ISegment>
|
|
|
542
545
|
});
|
|
543
546
|
|
|
544
547
|
this.client.on("maintenance", (args, opArgs) => {
|
|
545
|
-
this.emit(
|
|
548
|
+
this.emit(
|
|
549
|
+
"maintenance",
|
|
550
|
+
new SequenceMaintenanceEventClass(opArgs, args, this.client),
|
|
551
|
+
this,
|
|
552
|
+
);
|
|
546
553
|
});
|
|
547
554
|
|
|
548
555
|
this.intervalCollections = new IntervalCollectionMap(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import {
|
|
8
8
|
// eslint-disable-next-line import/no-deprecated
|
|
9
9
|
Client,
|
|
@@ -27,19 +27,49 @@ import {
|
|
|
27
27
|
* @legacy
|
|
28
28
|
* @alpha
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export interface SequenceEvent<
|
|
31
31
|
TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,
|
|
32
32
|
> {
|
|
33
|
+
readonly deltaOperation: TOperation;
|
|
34
|
+
|
|
35
|
+
readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>;
|
|
36
|
+
/**
|
|
37
|
+
* The in-order ranges affected by this delta.
|
|
38
|
+
* These are not necessarily contiguous.
|
|
39
|
+
*
|
|
40
|
+
* @remarks - If processing code doesn't care about the order of the ranges, it may instead consider using the
|
|
41
|
+
* {@link @fluidframework/merge-tree#IMergeTreeDeltaCallbackArgs.deltaSegments|deltaSegments} field on {@link SequenceEvent.deltaArgs|deltaArgs}.
|
|
42
|
+
*/
|
|
43
|
+
readonly ranges: readonly Readonly<ISequenceDeltaRange<TOperation>>[];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The client id of the client that made the change which caused the delta event
|
|
47
|
+
*/
|
|
48
|
+
readonly clientId: string | undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The first of the modified ranges.
|
|
52
|
+
*/
|
|
53
|
+
readonly first: Readonly<ISequenceDeltaRange<TOperation>>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The last of the modified ranges.
|
|
57
|
+
*/
|
|
58
|
+
readonly last: Readonly<ISequenceDeltaRange<TOperation>>;
|
|
59
|
+
}
|
|
60
|
+
export abstract class SequenceEventClass<
|
|
61
|
+
TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,
|
|
62
|
+
> implements SequenceEvent<TOperation>
|
|
63
|
+
{
|
|
64
|
+
public readonly isLocal: boolean;
|
|
33
65
|
public readonly deltaOperation: TOperation;
|
|
34
66
|
// eslint-disable-next-line import/no-deprecated
|
|
35
67
|
private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;
|
|
36
68
|
private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;
|
|
37
69
|
private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;
|
|
38
70
|
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
41
|
-
*/
|
|
42
71
|
constructor(
|
|
72
|
+
public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,
|
|
43
73
|
/**
|
|
44
74
|
* Arguments reflecting the type of change that caused this event.
|
|
45
75
|
*/
|
|
@@ -52,6 +82,7 @@ export abstract class SequenceEvent<
|
|
|
52
82
|
0x2d8 /* "Empty change event should not be emitted." */,
|
|
53
83
|
);
|
|
54
84
|
this.deltaOperation = deltaArgs.operation;
|
|
85
|
+
this.isLocal = opArgs?.sequencedMessage === undefined;
|
|
55
86
|
|
|
56
87
|
// eslint-disable-next-line import/no-deprecated
|
|
57
88
|
this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(() => {
|
|
@@ -124,23 +155,25 @@ export abstract class SequenceEvent<
|
|
|
124
155
|
* @legacy
|
|
125
156
|
* @alpha
|
|
126
157
|
*/
|
|
127
|
-
export
|
|
128
|
-
|
|
129
|
-
* Whether the event was caused by a locally-made change.
|
|
130
|
-
*/
|
|
131
|
-
public readonly isLocal: boolean;
|
|
158
|
+
export interface SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {
|
|
159
|
+
readonly opArgs: IMergeTreeDeltaOpArgs;
|
|
132
160
|
|
|
133
161
|
/**
|
|
134
|
-
*
|
|
162
|
+
* Whether the event was caused by a locally-made change.
|
|
135
163
|
*/
|
|
164
|
+
readonly isLocal: boolean;
|
|
165
|
+
}
|
|
166
|
+
export class SequenceDeltaEventClass
|
|
167
|
+
extends SequenceEventClass<MergeTreeDeltaOperationType>
|
|
168
|
+
implements SequenceDeltaEvent
|
|
169
|
+
{
|
|
136
170
|
constructor(
|
|
137
171
|
public readonly opArgs: IMergeTreeDeltaOpArgs,
|
|
138
172
|
deltaArgs: IMergeTreeDeltaCallbackArgs,
|
|
139
173
|
// eslint-disable-next-line import/no-deprecated
|
|
140
174
|
mergeTreeClient: Client,
|
|
141
175
|
) {
|
|
142
|
-
super(deltaArgs, mergeTreeClient);
|
|
143
|
-
this.isLocal = opArgs.sequencedMessage === undefined;
|
|
176
|
+
super(opArgs, deltaArgs, mergeTreeClient);
|
|
144
177
|
}
|
|
145
178
|
}
|
|
146
179
|
|
|
@@ -153,10 +186,13 @@ export class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationTyp
|
|
|
153
186
|
* @legacy
|
|
154
187
|
* @alpha
|
|
155
188
|
*/
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
189
|
+
export interface SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {
|
|
190
|
+
readonly opArgs: IMergeTreeDeltaOpArgs | undefined;
|
|
191
|
+
}
|
|
192
|
+
export class SequenceMaintenanceEventClass
|
|
193
|
+
extends SequenceEventClass<MergeTreeMaintenanceType>
|
|
194
|
+
implements SequenceMaintenanceEvent
|
|
195
|
+
{
|
|
160
196
|
constructor(
|
|
161
197
|
/**
|
|
162
198
|
* Defined iff `deltaArgs.operation` is {@link @fluidframework/merge-tree#MergeTreeMaintenanceType.ACKNOWLEDGED|MergeTreeMaintenanceType.ACKNOWLEDGED}.
|
|
@@ -168,7 +204,7 @@ export class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenance
|
|
|
168
204
|
// eslint-disable-next-line import/no-deprecated
|
|
169
205
|
mergeTreeClient: Client,
|
|
170
206
|
) {
|
|
171
|
-
super(deltaArgs, mergeTreeClient);
|
|
207
|
+
super(opArgs, deltaArgs, mergeTreeClient);
|
|
172
208
|
}
|
|
173
209
|
}
|
|
174
210
|
|
|
@@ -213,23 +249,3 @@ export interface ISequenceDeltaRange<
|
|
|
213
249
|
*/
|
|
214
250
|
propertyDeltas: PropertySet;
|
|
215
251
|
}
|
|
216
|
-
|
|
217
|
-
class Lazy<T> {
|
|
218
|
-
private pValue: T | undefined;
|
|
219
|
-
private pEvaluated: boolean;
|
|
220
|
-
constructor(private readonly valueGenerator: () => T) {
|
|
221
|
-
this.pEvaluated = false;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
public get evaluated(): boolean {
|
|
225
|
-
return this.pEvaluated;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
public get value(): T {
|
|
229
|
-
if (!this.pEvaluated) {
|
|
230
|
-
this.pEvaluated = true;
|
|
231
|
-
this.pValue = this.valueGenerator();
|
|
232
|
-
}
|
|
233
|
-
return this.pValue as T;
|
|
234
|
-
}
|
|
235
|
-
}
|
package/src/sharedString.ts
CHANGED
|
@@ -140,9 +140,7 @@ export type SharedStringSegment = TextSegment | Marker;
|
|
|
140
140
|
* In addition to text, a Shared String can also contain markers. Markers can be
|
|
141
141
|
* used to store metadata at positions within the text, like the details of an
|
|
142
142
|
* image or Fluid object that should be rendered with the text.
|
|
143
|
-
* @
|
|
144
|
-
* @alpha
|
|
145
|
-
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
143
|
+
* @internal
|
|
146
144
|
*/
|
|
147
145
|
export class SharedStringClass
|
|
148
146
|
// eslint-disable-next-line import/no-deprecated
|