@fluidframework/merge-tree 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +2 -2
- package/api-report/merge-tree.legacy.alpha.api.md +47 -11
- package/dist/attributionCollection.d.ts.map +1 -1
- package/dist/attributionCollection.js +9 -2
- package/dist/attributionCollection.js.map +1 -1
- package/dist/attributionPolicy.d.ts.map +1 -1
- package/dist/attributionPolicy.js +5 -9
- package/dist/attributionPolicy.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -19
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/localReference.d.ts +6 -0
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts +11 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +51 -14
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +35 -1
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +35 -12
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +7 -21
- package/dist/properties.js.map +1 -1
- package/dist/referencePositions.d.ts +6 -0
- package/dist/referencePositions.d.ts.map +1 -1
- package/dist/referencePositions.js.map +1 -1
- package/dist/segmentGroupCollection.d.ts +3 -0
- package/dist/segmentGroupCollection.d.ts.map +1 -1
- package/dist/segmentGroupCollection.js +3 -0
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentPropertiesManager.d.ts +8 -0
- package/dist/segmentPropertiesManager.d.ts.map +1 -1
- package/dist/segmentPropertiesManager.js +11 -8
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/sequencePlace.d.ts +66 -0
- package/dist/sequencePlace.d.ts.map +1 -0
- package/dist/sequencePlace.js +41 -0
- package/dist/sequencePlace.js.map +1 -0
- package/dist/snapshotlegacy.js +1 -1
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/test/obliterate.rangeExpansion.spec.d.ts +6 -0
- package/dist/test/obliterate.rangeExpansion.spec.d.ts.map +1 -0
- package/dist/test/obliterate.rangeExpansion.spec.js +288 -0
- package/dist/test/obliterate.rangeExpansion.spec.js.map +1 -0
- package/dist/test/obliterate.reconnect.spec.js +5 -5
- package/dist/test/obliterate.reconnect.spec.js.map +1 -1
- package/dist/test/reconnectHelper.d.ts +3 -3
- package/dist/test/reconnectHelper.d.ts.map +1 -1
- package/dist/test/reconnectHelper.js +14 -3
- package/dist/test/reconnectHelper.js.map +1 -1
- package/dist/test/resetPendingSegmentsToOp.spec.js +12 -0
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/dist/test/testClient.d.ts +3 -3
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +4 -16
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/text.js +1 -1
- package/dist/test/text.js.map +1 -1
- package/dist/textSegment.d.ts +2 -2
- package/dist/textSegment.d.ts.map +1 -1
- package/dist/textSegment.js +3 -7
- package/dist/textSegment.js.map +1 -1
- package/lib/attributionCollection.d.ts.map +1 -1
- package/lib/attributionCollection.js +9 -2
- package/lib/attributionCollection.js.map +1 -1
- package/lib/attributionPolicy.d.ts.map +1 -1
- package/lib/attributionPolicy.js +5 -9
- package/lib/attributionPolicy.js.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +21 -22
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/localReference.d.ts +6 -0
- package/lib/localReference.d.ts.map +1 -1
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts +11 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +49 -13
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +35 -1
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +35 -12
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/properties.d.ts.map +1 -1
- package/lib/properties.js +7 -21
- package/lib/properties.js.map +1 -1
- package/lib/referencePositions.d.ts +6 -0
- package/lib/referencePositions.d.ts.map +1 -1
- package/lib/referencePositions.js.map +1 -1
- package/lib/segmentGroupCollection.d.ts +3 -0
- package/lib/segmentGroupCollection.d.ts.map +1 -1
- package/lib/segmentGroupCollection.js +3 -0
- package/lib/segmentGroupCollection.js.map +1 -1
- package/lib/segmentPropertiesManager.d.ts +8 -0
- package/lib/segmentPropertiesManager.d.ts.map +1 -1
- package/lib/segmentPropertiesManager.js +12 -9
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/sequencePlace.d.ts +66 -0
- package/lib/sequencePlace.d.ts.map +1 -0
- package/lib/sequencePlace.js +37 -0
- package/lib/sequencePlace.js.map +1 -0
- package/lib/snapshotlegacy.js +1 -1
- package/lib/snapshotlegacy.js.map +1 -1
- package/lib/test/obliterate.rangeExpansion.spec.d.ts +6 -0
- package/lib/test/obliterate.rangeExpansion.spec.d.ts.map +1 -0
- package/lib/test/obliterate.rangeExpansion.spec.js +286 -0
- package/lib/test/obliterate.rangeExpansion.spec.js.map +1 -0
- package/lib/test/obliterate.reconnect.spec.js +5 -5
- package/lib/test/obliterate.reconnect.spec.js.map +1 -1
- package/lib/test/reconnectHelper.d.ts +3 -3
- package/lib/test/reconnectHelper.d.ts.map +1 -1
- package/lib/test/reconnectHelper.js +14 -3
- package/lib/test/reconnectHelper.js.map +1 -1
- package/lib/test/resetPendingSegmentsToOp.spec.js +12 -0
- package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/lib/test/testClient.d.ts +3 -3
- package/lib/test/testClient.d.ts.map +1 -1
- package/lib/test/testClient.js +4 -16
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/text.js +1 -1
- package/lib/test/text.js.map +1 -1
- package/lib/textSegment.d.ts +2 -2
- package/lib/textSegment.d.ts.map +1 -1
- package/lib/textSegment.js +3 -7
- package/lib/textSegment.js.map +1 -1
- package/package.json +19 -19
- package/src/attributionCollection.ts +12 -2
- package/src/attributionPolicy.ts +6 -7
- package/src/client.ts +28 -23
- package/src/index.ts +6 -0
- package/src/localReference.ts +8 -1
- package/src/mergeTree.ts +74 -17
- package/src/mergeTreeNodes.ts +66 -14
- package/src/properties.ts +7 -22
- package/src/referencePositions.ts +6 -0
- package/src/segmentGroupCollection.ts +3 -0
- package/src/segmentPropertiesManager.ts +13 -9
- package/src/sequencePlace.ts +89 -0
- package/src/snapshotlegacy.ts +1 -1
- package/src/textSegment.ts +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @fluidframework/merge-tree
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- The PropertyManager class and related functions and properties are deprecated ([#22183](https://github.com/microsoft/FluidFramework/pull/22183)) [cbba69554f](https://github.com/microsoft/FluidFramework/commit/cbba69554fc5026f562f44683a902474fabd6e81)
|
|
8
|
+
|
|
9
|
+
The `PropertyManager` class, along with the `propertyManager` properties and `addProperties` functions on segments and intervals, are not intended for external use.
|
|
10
|
+
These elements will be removed in a future release for the following reasons:
|
|
11
|
+
|
|
12
|
+
- There are no scenarios where they need to be used directly.
|
|
13
|
+
- Using them directly will cause eventual consistency problems.
|
|
14
|
+
- Upcoming features will require modifications to these mechanisms.
|
|
15
|
+
|
|
16
|
+
- Deprecate segmentGroups and ack on ISegment ([#22212](https://github.com/microsoft/FluidFramework/pull/22212)) [2b0199dae3](https://github.com/microsoft/FluidFramework/commit/2b0199dae3d73cc7d4fab0f4848614b42e212220)
|
|
17
|
+
|
|
18
|
+
The `SegmentGroupCollection` class, along with the `segmentGroups` property and `ack` function on segments, are not intended for external use.
|
|
19
|
+
These elements will be removed in a future release for the following reasons:
|
|
20
|
+
|
|
21
|
+
- There are no scenarios where they need to be used directly.
|
|
22
|
+
- Using them directly will cause eventual consistency problems.
|
|
23
|
+
- Upcoming features will require modifications to these mechanisms.
|
|
24
|
+
|
|
3
25
|
## 2.1.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ sequence of collaboratively edited items. MergeTree is used in both SharedSequen
|
|
|
5
5
|
|
|
6
6
|
See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
|
|
7
7
|
|
|
8
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
8
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER:) -->
|
|
9
9
|
|
|
10
10
|
<!-- prettier-ignore-start -->
|
|
11
11
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
@@ -136,7 +136,7 @@ consequently should be ignored during the search.
|
|
|
136
136
|
Note that any locally applied operations that are still pending sequencing by the Fluid service are unknown to
|
|
137
137
|
remote clients and should be ignored when processing remote ops.
|
|
138
138
|
|
|
139
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
139
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_FOOTER:) -->
|
|
140
140
|
|
|
141
141
|
<!-- prettier-ignore-start -->
|
|
142
142
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
@@ -18,9 +18,10 @@ export interface AttributionPolicy {
|
|
|
18
18
|
|
|
19
19
|
// @alpha (undocumented)
|
|
20
20
|
export abstract class BaseSegment implements ISegment {
|
|
21
|
-
|
|
21
|
+
constructor(properties?: PropertySet);
|
|
22
|
+
// @deprecated (undocumented)
|
|
22
23
|
ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;
|
|
23
|
-
//
|
|
24
|
+
// @deprecated
|
|
24
25
|
addProperties(newProps: PropertySet, seq?: number, collaborating?: boolean, rollback?: PropertiesRollback): PropertySet;
|
|
25
26
|
// (undocumented)
|
|
26
27
|
protected addSerializedProps(jseg: IJSONSegment): void;
|
|
@@ -64,13 +65,13 @@ export abstract class BaseSegment implements ISegment {
|
|
|
64
65
|
ordinal: string;
|
|
65
66
|
// (undocumented)
|
|
66
67
|
properties?: PropertySet;
|
|
67
|
-
//
|
|
68
|
+
// @deprecated
|
|
68
69
|
propertyManager?: PropertiesManager;
|
|
69
70
|
// (undocumented)
|
|
70
71
|
removedClientIds?: number[];
|
|
71
72
|
// (undocumented)
|
|
72
73
|
removedSeq?: number;
|
|
73
|
-
// (undocumented)
|
|
74
|
+
// @deprecated (undocumented)
|
|
74
75
|
readonly segmentGroups: SegmentGroupCollection;
|
|
75
76
|
// (undocumented)
|
|
76
77
|
seq: number;
|
|
@@ -187,6 +188,14 @@ export class CollaborationWindow {
|
|
|
187
188
|
// @alpha
|
|
188
189
|
export function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;
|
|
189
190
|
|
|
191
|
+
// @alpha
|
|
192
|
+
export function endpointPosAndSide(start: SequencePlace | undefined, end: SequencePlace | undefined): {
|
|
193
|
+
startSide: Side | undefined;
|
|
194
|
+
endSide: Side | undefined;
|
|
195
|
+
startPos: number | "start" | "end" | undefined;
|
|
196
|
+
endPos: number | "start" | "end" | undefined;
|
|
197
|
+
};
|
|
198
|
+
|
|
190
199
|
// @alpha (undocumented)
|
|
191
200
|
export interface IAttributionCollection<T> {
|
|
192
201
|
// (undocumented)
|
|
@@ -369,6 +378,7 @@ export interface IMergeTreeOptions {
|
|
|
369
378
|
// (undocumented)
|
|
370
379
|
catchUpBlobName?: string;
|
|
371
380
|
mergeTreeEnableObliterate?: boolean;
|
|
381
|
+
mergeTreeEnableObliterateReconnect?: boolean;
|
|
372
382
|
mergeTreeReferencesCanSlideToEndpoint?: boolean;
|
|
373
383
|
// (undocumented)
|
|
374
384
|
mergeTreeSnapshotChunkSize?: number;
|
|
@@ -411,6 +421,14 @@ export interface IMoveInfo {
|
|
|
411
421
|
wasMovedOnInsert: boolean;
|
|
412
422
|
}
|
|
413
423
|
|
|
424
|
+
// @alpha
|
|
425
|
+
export interface InteriorSequencePlace {
|
|
426
|
+
// (undocumented)
|
|
427
|
+
pos: number;
|
|
428
|
+
// (undocumented)
|
|
429
|
+
side: Side;
|
|
430
|
+
}
|
|
431
|
+
|
|
414
432
|
// @alpha
|
|
415
433
|
export interface IRelativePosition {
|
|
416
434
|
before?: boolean;
|
|
@@ -427,7 +445,9 @@ export interface IRemovalInfo {
|
|
|
427
445
|
|
|
428
446
|
// @alpha
|
|
429
447
|
export interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {
|
|
448
|
+
// @deprecated (undocumented)
|
|
430
449
|
ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;
|
|
450
|
+
// @deprecated
|
|
431
451
|
addProperties(newProps: PropertySet, seq?: number, collaborating?: boolean, rollback?: PropertiesRollback): PropertySet;
|
|
432
452
|
// (undocumented)
|
|
433
453
|
append(segment: ISegment): void;
|
|
@@ -439,16 +459,19 @@ export interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Parti
|
|
|
439
459
|
// (undocumented)
|
|
440
460
|
clone(): ISegment;
|
|
441
461
|
readonly endpointType?: "start" | "end";
|
|
462
|
+
endSide?: Side.Before | Side.After;
|
|
442
463
|
localRefs?: LocalReferenceCollection;
|
|
443
464
|
localRemovedSeq?: number;
|
|
444
465
|
localSeq?: number;
|
|
445
466
|
properties?: PropertySet;
|
|
467
|
+
// @deprecated
|
|
446
468
|
propertyManager?: PropertiesManager;
|
|
447
|
-
// (undocumented)
|
|
469
|
+
// @deprecated (undocumented)
|
|
448
470
|
readonly segmentGroups: SegmentGroupCollection;
|
|
449
471
|
seq?: number;
|
|
450
472
|
// (undocumented)
|
|
451
473
|
splitAt(pos: number): ISegment | undefined;
|
|
474
|
+
startSide?: Side.Before | Side.After;
|
|
452
475
|
// (undocumented)
|
|
453
476
|
toJSONObject(): any;
|
|
454
477
|
// (undocumented)
|
|
@@ -502,6 +525,8 @@ export class LocalReferenceCollection {
|
|
|
502
525
|
|
|
503
526
|
// @alpha @sealed (undocumented)
|
|
504
527
|
export interface LocalReferencePosition extends ReferencePosition {
|
|
528
|
+
// (undocumented)
|
|
529
|
+
addProperties(newProps: PropertySet): void;
|
|
505
530
|
// (undocumented)
|
|
506
531
|
callbacks?: Partial<Record<"beforeSlide" | "afterSlide", (ref: LocalReferencePosition) => void>>;
|
|
507
532
|
readonly canSlideToEndpoint?: boolean;
|
|
@@ -517,7 +542,7 @@ export interface MapLike<T> {
|
|
|
517
542
|
|
|
518
543
|
// @alpha
|
|
519
544
|
export class Marker extends BaseSegment implements ReferencePosition, ISegment {
|
|
520
|
-
constructor(refType: ReferenceType);
|
|
545
|
+
constructor(refType: ReferenceType, props?: PropertySet);
|
|
521
546
|
// (undocumented)
|
|
522
547
|
append(): void;
|
|
523
548
|
// (undocumented)
|
|
@@ -616,7 +641,7 @@ export interface MergeTreeRevertibleDriver {
|
|
|
616
641
|
removeRange(start: number, end: number): void;
|
|
617
642
|
}
|
|
618
643
|
|
|
619
|
-
// @alpha (undocumented)
|
|
644
|
+
// @alpha @deprecated (undocumented)
|
|
620
645
|
export class PropertiesManager {
|
|
621
646
|
// (undocumented)
|
|
622
647
|
ackPendingProperties(annotateOp: IMergeTreeAnnotateMsg): void;
|
|
@@ -629,7 +654,7 @@ export class PropertiesManager {
|
|
|
629
654
|
hasPendingProperty(key: string): boolean;
|
|
630
655
|
}
|
|
631
656
|
|
|
632
|
-
// @alpha (undocumented)
|
|
657
|
+
// @alpha @deprecated (undocumented)
|
|
633
658
|
export enum PropertiesRollback {
|
|
634
659
|
None = 0,
|
|
635
660
|
Rollback = 1
|
|
@@ -640,7 +665,7 @@ export type PropertySet = MapLike<any>;
|
|
|
640
665
|
|
|
641
666
|
// @alpha
|
|
642
667
|
export interface ReferencePosition {
|
|
643
|
-
// (undocumented)
|
|
668
|
+
// @deprecated (undocumented)
|
|
644
669
|
addProperties(newProps: PropertySet): void;
|
|
645
670
|
getOffset(): number;
|
|
646
671
|
getSegment(): ISegment | undefined;
|
|
@@ -688,7 +713,7 @@ export interface SegmentGroup {
|
|
|
688
713
|
segments: ISegment[];
|
|
689
714
|
}
|
|
690
715
|
|
|
691
|
-
// @alpha (undocumented)
|
|
716
|
+
// @alpha @deprecated (undocumented)
|
|
692
717
|
export class SegmentGroupCollection {
|
|
693
718
|
constructor(segment: ISegment);
|
|
694
719
|
// (undocumented)
|
|
@@ -714,6 +739,9 @@ export interface SequenceOffsets {
|
|
|
714
739
|
seqs: (number | AttributionKey | null)[];
|
|
715
740
|
}
|
|
716
741
|
|
|
742
|
+
// @alpha
|
|
743
|
+
export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
|
|
744
|
+
|
|
717
745
|
// @alpha (undocumented)
|
|
718
746
|
export interface SerializedAttributionCollection extends SequenceOffsets {
|
|
719
747
|
// (undocumented)
|
|
@@ -724,6 +752,14 @@ export interface SerializedAttributionCollection extends SequenceOffsets {
|
|
|
724
752
|
length: number;
|
|
725
753
|
}
|
|
726
754
|
|
|
755
|
+
// @alpha
|
|
756
|
+
export enum Side {
|
|
757
|
+
// (undocumented)
|
|
758
|
+
After = 1,
|
|
759
|
+
// (undocumented)
|
|
760
|
+
Before = 0
|
|
761
|
+
}
|
|
762
|
+
|
|
727
763
|
// @alpha
|
|
728
764
|
export const SlidingPreference: {
|
|
729
765
|
readonly BACKWARD: 0;
|
|
@@ -735,7 +771,7 @@ export type SlidingPreference = (typeof SlidingPreference)[keyof typeof SlidingP
|
|
|
735
771
|
|
|
736
772
|
// @alpha (undocumented)
|
|
737
773
|
export class TextSegment extends BaseSegment {
|
|
738
|
-
constructor(text: string);
|
|
774
|
+
constructor(text: string, props?: PropertySet);
|
|
739
775
|
// (undocumented)
|
|
740
776
|
append(segment: ISegment): void;
|
|
741
777
|
// (undocumented)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributionCollection.d.ts","sourceRoot":"","sources":["../src/attributionCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,cAAc,EAGd,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;;;;;OAWG;IAEH,IAAI,EAAE,CAAC,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC;IACzC,cAAc,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,+BAAgC,SAAQ,eAAe;IACvE,QAAQ,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;IAE/C,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC;IAE5C,IAAI,EAAE,QAAQ,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAElD,QAAQ,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IAC3E,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAChD,KAAK;IACL,+BAA+B,CAC9B,QAAQ,EAAE,QAAQ,CAAC;QAClB,WAA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ACpB,OAAO,EAAE,+BAA+B,GACtC,IAAI;IA+EP;;;;;OAKG;WACW,+BAA+B,CAC5C,QAAQ,EAAE,QAAQ,CAAC;QAClB,WAAW,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;QACrD,YAAY,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,+BAA+B;CAiElC"}
|
|
@@ -234,6 +234,10 @@ class AttributionCollection {
|
|
|
234
234
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
235
235
|
summary.seqs.length === summary.posBreakpoints.length, 0x445 /* Invalid attribution summary blob provided */);
|
|
236
236
|
const extractOntoSegments = ({ seqs, posBreakpoints }, assignToSegment) => {
|
|
237
|
+
if (seqs.length === 0) {
|
|
238
|
+
(0, internal_1.assert)(posBreakpoints.length === 0, 0x9e1 /* seqs and posBreakpoints length should match */);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
237
241
|
let curIndex = 0;
|
|
238
242
|
let cumulativeSegPos = 0;
|
|
239
243
|
for (const segment of segments) {
|
|
@@ -278,8 +282,11 @@ class AttributionCollection {
|
|
|
278
282
|
for (const [name, collectionSpec] of Object.entries(channels)) {
|
|
279
283
|
extractOntoSegments(collectionSpec, (collection, segment) => {
|
|
280
284
|
var _a;
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
if (segment.attribution !== undefined) {
|
|
286
|
+
// Cast is valid as we just assigned this field above
|
|
287
|
+
((_a = segment.attribution).channels ?? (_a.channels = {}))[name] =
|
|
288
|
+
collection;
|
|
289
|
+
}
|
|
283
290
|
});
|
|
284
291
|
}
|
|
285
292
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributionCollection.js","sourceRoot":"","sources":["../src/attributionCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAM9E,uEAAsE;AAsItE,gDAAgD;AAChD,SAAgB,uBAAuB;AACtC,kDAAkD;AAClD,CAAoC;AACpC,kDAAkD;AAClD,CAAoC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C;IACrB,CAAC;CACD;AA1XD,sDA0XC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tAttributionKey,\n\tDetachedAttributionKey,\n\tOpAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISegment } from \"./mergeTreeNodes.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface SequenceOffsets {\n\t/**\n\t * Parallel array with posBreakpoints which tracks the seq of insertion.\n\t *\n\t * @example\n\t *\n\t * If seqs is [45, 46] and posBreakpoints is [0, 3], the section of the string\n\t * between offsets 0 and 3 was inserted at seq 45 and the section of the string between\n\t * 3 and the length of the string was inserted at seq 46.\n\t *\n\t * @remarks We use null here rather than undefined as round-tripping through JSON converts\n\t * undefineds to null anyway\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tseqs: (number | AttributionKey | null)[];\n\tposBreakpoints: number[];\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface SerializedAttributionCollection extends SequenceOffsets {\n\tchannels?: { [name: string]: SequenceOffsets };\n\t/* Total length; only necessary for validation */\n\tlength: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAttributionCollectionSpec<T> {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\troot: Iterable<{ offset: number; key: T | null }>;\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tchannels?: { [name: string]: Iterable<{ offset: number; key: T | null }> };\n\tlength: number;\n}\n\n/**\n * @legacy\n * @alpha\n * @sealed\n */\nexport interface IAttributionCollectionSerializer {\n\t/***/\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\t/**\n\t * Populates attribution information on segments using the provided summary.\n\t */\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAttributionCollection<T> {\n\t/**\n\t * Retrieves the attribution key associated with the provided offset.\n\t * @param channel - When specified, gets an attribution key associated with a particular channel.\n\t */\n\tgetAtOffset(offset: number, channel?: string): AttributionKey | undefined;\n\n\t/**\n\t * Retrieves all the [Offset, Attribution key] pairs for the provided offset range. Note:\n\t * The returned array is sorted by offset.\n\t * The first offset in response could be lower than the startOffset as the Attribution Key for the startOffset\n\t * could start at a lower offset than the startOffset in case where Attribution key offset boundaries don't\n\t * align exactly with startOffset.\n\t * Example: If the Attribution Offsets in the segment is [0, 10, 20, 30, 40] and request is for (startOffset: 5, endOffset: 25),\n\t * then result would be [(offset: 0, key: key1), (offset:10, key: key2), (offset:20, key: key3)].\n\t * @param channel - When specified, gets attribution keys associated with a particular channel.\n\t * @returns - undefined if the provided channel is not found or list of attribution keys along with\n\t * the corresponding offset start boundary.\n\t */\n\tgetKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined;\n\n\t/**\n\t * Total length of all attribution keys in this collection.\n\t */\n\treadonly length: number;\n\n\treadonly channelNames: Iterable<string>;\n\n\t/**\n\t * Retrieve all key/offset pairs stored on this segment. Entries should be ordered by offset, such that\n\t * the `i`th result's attribution key applies to offsets in the open range between the `i`th offset and the\n\t * `i+1`th offset.\n\t * The last entry's key applies to the open interval from the last entry's offset to this collection's length.\n\t */\n\tgetAll(): IAttributionCollectionSpec<T>;\n\n\t/***/\n\tsplitAt(pos: number): IAttributionCollection<T>;\n\n\t/***/\n\tappend(other: IAttributionCollection<T>): void;\n\n\t/***/\n\tclone(): IAttributionCollection<T>;\n\n\t/**\n\t * Updates this collection with new attribution data.\n\t * @param name - Name of the channel that requires an update. Undefined signifies the root channel.\n\t * Updates apply only to the individual channel (i.e. if an attribution policy needs to update the root\n\t * channel and 4 other channels, it should call `.update` 5 times).\n\t * @param channel - Updated collection for that channel.\n\t */\n\tupdate(name: string | undefined, channel: IAttributionCollection<T>): void;\n}\n\n// note: treats null and undefined as equivalent\nexport function areEqualAttributionKeys(\n\t// eslint-disable-next-line @rushstack/no-new-null\n\ta: AttributionKey | null | undefined,\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tb: AttributionKey | null | undefined,\n): boolean {\n\tif (!a && !b) {\n\t\treturn true;\n\t}\n\n\tif (!a || !b) {\n\t\treturn false;\n\t}\n\n\tif (a.type !== b.type) {\n\t\treturn false;\n\t}\n\n\t// Note: TS can't narrow the type of b inside this switch statement, hence the need for casting.\n\tswitch (a.type) {\n\t\tcase \"op\": {\n\t\t\treturn a.seq === (b as OpAttributionKey).seq;\n\t\t}\n\t\tcase \"detached\": {\n\t\t\treturn a.id === (b as DetachedAttributionKey).id;\n\t\t}\n\t\tcase \"local\": {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(a, \"Unhandled AttributionKey type\");\n\t\t}\n\t}\n}\n\nexport class AttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate offsets: number[] = [];\n\tprivate keys: (AttributionKey | null)[] = [];\n\n\tprivate channels?: { [name: string]: AttributionCollection };\n\n\tprivate get channelEntries(): [string, AttributionCollection][] {\n\t\treturn Object.entries(this.channels ?? {});\n\t}\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.offsets.push(0);\n\t\t\tthis.keys.push(baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames(): string[] {\n\t\treturn Object.keys(this.channels ?? {});\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey;\n\tpublic getAtOffset(offset: number, channel: string): AttributionKey | undefined;\n\tpublic getAtOffset(offset: number, channel?: string): AttributionKey | undefined {\n\t\tif (channel !== undefined) {\n\t\t\tconst subCollection = this.channels?.[channel];\n\t\t\treturn subCollection?.getAtOffset(offset);\n\t\t}\n\t\tassert(offset >= 0 && offset < this._length, 0x443 /* Requested offset should be valid */);\n\t\treturn this.get(this.findIndex(offset));\n\t}\n\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t): { offset: number; key: AttributionKey }[];\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined;\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined {\n\t\tif (startOffset < 0 || startOffset >= this._length) {\n\t\t\tthrow new UsageError(\"startOffset should be valid and in range\");\n\t\t}\n\t\tif (\n\t\t\tendOffset !== undefined &&\n\t\t\t(endOffset < 0 || endOffset >= this._length || startOffset > endOffset)\n\t\t) {\n\t\t\tthrow new UsageError(\"endOffset should be valid and in range\");\n\t\t}\n\n\t\tif (channel !== undefined) {\n\t\t\tconst subCollection = this.channels?.[channel];\n\t\t\treturn subCollection?.getKeysInOffsetRange(startOffset, endOffset);\n\t\t}\n\t\tconst result: { offset: number; key: AttributionKey }[] = [];\n\t\tlet index = this.findIndex(startOffset);\n\t\tlet attributionKey = this.get(index);\n\t\tif (attributionKey !== undefined) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tresult.push({ offset: this.offsets[index]!, key: attributionKey });\n\t\t}\n\t\tindex++;\n\t\tconst endOffsetVal = endOffset ?? Number.MAX_SAFE_INTEGER;\n\t\t// TODO Non null asserting, why is this not null?\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\twhile (index < this.offsets.length && endOffsetVal >= this.offsets[index]!) {\n\t\t\tattributionKey = this.get(index);\n\t\t\tif (attributionKey !== undefined) {\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tresult.push({ offset: this.offsets[index]!, key: attributionKey });\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate findIndex(offset: number): number {\n\t\t// Note: maximum length here is 256 for text segments. Perf testing shows that linear scan beats binary search\n\t\t// for attribution collections with under ~64 entries, and even at maximum size (which would require a maximum\n\t\t// length segment with every offset having different attribution), getAtOffset is on the order of 100ns.\n\t\tlet i = 0;\n\t\t// TODO Non null asserting, why is this not null?\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\twhile (i < this.offsets.length && offset > this.offsets[i]!) {\n\t\t\ti++;\n\t\t}\n\t\treturn this.offsets[i] === offset ? i : i - 1;\n\t}\n\n\tprivate get(index: number): AttributionKey | undefined {\n\t\tconst key = this.keys[index];\n\t\treturn key ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): AttributionCollection {\n\t\tconst splitIndex = this.findIndex(pos);\n\t\tconst splitCollection = new AttributionCollection(this.length - pos);\n\t\tfor (let i = splitIndex; i < this.keys.length; i++) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tsplitCollection.offsets.push(Math.max(this.offsets[i]! - pos, 0));\n\t\t\tconst key = this.keys[i];\n\t\t\tif (key !== undefined) {\n\t\t\t\tsplitCollection.keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\tif (this.channels) {\n\t\t\tsplitCollection.channels = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tsplitCollection.channels[key] = collection.splitAt(pos);\n\t\t\t}\n\t\t}\n\n\t\tconst spliceIndex = this.offsets[splitIndex] === pos ? splitIndex : splitIndex + 1;\n\t\tthis.keys.splice(spliceIndex);\n\t\tthis.offsets.splice(spliceIndex);\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: AttributionCollection): void {\n\t\tconst lastEntry = this.keys[this.keys.length - 1];\n\t\tfor (let i = 0; i < other.keys.length; i++) {\n\t\t\tif (i !== 0 || !areEqualAttributionKeys(lastEntry, other.keys[i])) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tthis.offsets.push(other.offsets[i]! + this.length);\n\t\t\t\t// Looping through the keys, so we can be sure that the key is not undefined.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tthis.keys.push(other.keys[i]!);\n\t\t\t}\n\t\t}\n\n\t\tif (other.channels !== undefined || this.channels !== undefined) {\n\t\t\tthis.channels ??= {};\n\t\t\tfor (const [key, collection] of other.channelEntries) {\n\t\t\t\tconst thisCollection = (this.channels[key] ??= new AttributionCollection(\n\t\t\t\t\tthis.length,\n\t\t\t\t\t// Null is needed as null and undefined have different meanings in the context of attribution collections.\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tnull,\n\t\t\t\t));\n\t\t\t\tthisCollection.append(collection);\n\t\t\t}\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tif (other.channels?.[key] === undefined) {\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tcollection.append(new AttributionCollection(other.length, null));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\ttype ExtractGeneric<T> = T extends Iterable<infer Q> ? Q : unknown;\n\t\tconst root: ExtractGeneric<IAttributionCollectionSpec<AttributionKey>[\"root\"]>[] =\n\t\t\tArray.from({ length: this.keys.length });\n\t\tfor (let i = 0; i < this.keys.length; i++) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\troot[i] = { offset: this.offsets[i]!, key: this.keys[i]! };\n\t\t}\n\t\tconst result: IAttributionCollectionSpec<AttributionKey> = {\n\t\t\troot,\n\t\t\tlength: this.length,\n\t\t};\n\t\tif (this.channels !== undefined) {\n\t\t\tresult.channels = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tresult.channels[key] = collection.getAll().root;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic clone(): AttributionCollection {\n\t\tconst copy = new AttributionCollection(this.length);\n\t\tcopy.keys = [...this.keys];\n\t\tcopy.offsets = [...this.offsets];\n\t\tif (this.channels !== undefined) {\n\t\t\tconst channelsCopy: Record<string, AttributionCollection> = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tchannelsCopy[key] = collection.clone();\n\t\t\t}\n\t\t\tcopy.channels = channelsCopy;\n\t\t}\n\t\treturn copy;\n\t}\n\n\tpublic update(name: string | undefined, channel: AttributionCollection): void {\n\t\tassert(\n\t\t\tchannel.length === this.length,\n\t\t\t0x5c0 /* AttributionCollection channel update should have consistent segment length */,\n\t\t);\n\t\tif (name === undefined) {\n\t\t\tthis.offsets = [...channel.offsets];\n\t\t\tthis.keys = [...channel.keys];\n\t\t} else {\n\t\t\tthis.channels ??= {};\n\t\t\tif (this.channels[name] === undefined) {\n\t\t\t\tthis.channels[name] = channel;\n\t\t\t} else {\n\t\t\t\tthis.channels[name]?.update(undefined, channel);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: ISegment[],\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { channels } = summary;\n\t\tassert(\n\t\t\t// Destructuring here would require renaming the variables, since seqs is declared below\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\t\tsummary.seqs.length === summary.posBreakpoints.length,\n\t\t\t0x445 /* Invalid attribution summary blob provided */,\n\t\t);\n\n\t\tconst extractOntoSegments = (\n\t\t\t{ seqs, posBreakpoints }: SequenceOffsets,\n\t\t\tassignToSegment: (collection: AttributionCollection, segment: ISegment) => void,\n\t\t): void => {\n\t\t\tlet curIndex = 0;\n\t\t\tlet cumulativeSegPos = 0;\n\n\t\t\tfor (const segment of segments) {\n\t\t\t\tconst attribution = new AttributionCollection(segment.cachedLength);\n\t\t\t\t// This function is defined here to allow for the creation of a new collection for each segment.\n\t\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t\t\tconst pushEntry = (offset: number, seq: AttributionKey | number | null): void => {\n\t\t\t\t\tattribution.offsets.push(offset);\n\t\t\t\t\tattribution.keys.push(\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tseq === null ? null : typeof seq === \"object\" ? seq : { type: \"op\", seq },\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tif (posBreakpoints[curIndex]! > cumulativeSegPos) {\n\t\t\t\t\tcurIndex--;\n\t\t\t\t}\n\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\twhile (posBreakpoints[curIndex]! < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst nextOffset = Math.max(posBreakpoints[curIndex]! - cumulativeSegPos, 0);\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpushEntry(nextOffset, seqs[curIndex]!);\n\t\t\t\t\tcurIndex++;\n\t\t\t\t}\n\n\t\t\t\tif (attribution.offsets.length === 0) {\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpushEntry(0, seqs[curIndex - 1]!);\n\t\t\t\t}\n\n\t\t\t\tassignToSegment(attribution, segment);\n\t\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t\t}\n\t\t};\n\n\t\textractOntoSegments(summary, (collection, segment) => {\n\t\t\tsegment.attribution = collection;\n\t\t});\n\t\tif (channels) {\n\t\t\tfor (const [name, collectionSpec] of Object.entries(channels)) {\n\t\t\t\textractOntoSegments(collectionSpec, (collection, segment) => {\n\t\t\t\t\t// Cast is valid as we just assigned this field above\n\t\t\t\t\t((segment.attribution as AttributionCollection).channels ??= {})[name] = collection;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t *\n\t * Note: this operates on segments rather than attribution collections directly so that it can handle cases\n\t * where only some segments have attribution defined.\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst allCollectionSpecs: IAttributionCollectionSpec<AttributionKey>[] = [];\n\n\t\tconst allChannelNames = new Set<string>();\n\t\tfor (const segment of segments) {\n\t\t\tconst collection =\n\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\tsegment.attribution ?? new AttributionCollection(segment.cachedLength, null);\n\t\t\tconst spec = collection.getAll();\n\t\t\tallCollectionSpecs.push(spec);\n\t\t\tif (spec.channels) {\n\t\t\t\tfor (const name of Object.keys(spec.channels)) {\n\t\t\t\t\tallChannelNames.add(name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst extractSequenceOffsets = (\n\t\t\tgetSpecEntries: (\n\t\t\t\tspec: IAttributionCollectionSpec<AttributionKey>,\n\t\t\t) => Iterable<{ offset: number; key: AttributionKey | null }>,\n\t\t): SerializedAttributionCollection => {\n\t\t\tconst posBreakpoints: number[] = [];\n\t\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\t\tlet cumulativePos = 0;\n\n\t\t\tfor (const spec of allCollectionSpecs) {\n\t\t\t\tfor (const { offset, key } of getSpecEntries(spec)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tkey?.type !== \"local\",\n\t\t\t\t\t\t0x5c1 /* local attribution keys should never be put in summaries */,\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(key, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tseqs.push(key ? (key.type === \"op\" ? key.seq : key) : null);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = key;\n\t\t\t\t}\n\n\t\t\t\tcumulativePos += spec.length;\n\t\t\t}\n\n\t\t\treturn { seqs, posBreakpoints, length: cumulativePos };\n\t\t};\n\n\t\tconst blobContents = extractSequenceOffsets((spec) => spec.root);\n\t\tif (allChannelNames.size > 0) {\n\t\t\tconst channels: { [name: string]: SequenceOffsets } = {};\n\t\t\tfor (const name of allChannelNames) {\n\t\t\t\tconst { posBreakpoints, seqs } = extractSequenceOffsets(\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t(spec) => spec.channels?.[name] ?? [{ offset: 0, key: null }],\n\t\t\t\t);\n\t\t\t\tchannels[name] = { posBreakpoints, seqs };\n\t\t\t}\n\t\t\tblobContents.channels = channels;\n\t\t}\n\n\t\treturn blobContents;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attributionCollection.js","sourceRoot":"","sources":["../src/attributionCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAM9E,uEAAsE;AAsItE,gDAAgD;AAChD,SAAgB,uBAAuB;AACtC,kDAAkD;AAClD,CAAoC;AACpC,kDAAkD;AAClD,CAAoC;IAEpC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,gGAAgG;IAChG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,CAAC,CAAC;YACX,OAAO,CAAC,CAAC,GAAG,KAAM,CAAsB,CAAC,GAAG,CAAC;QAC9C,CAAC;QACD,KAAK,UAAU,CAAC,CAAC,CAAC;YACjB,OAAO,CAAC,CAAC,EAAE,KAAM,CAA4B,CAAC,EAAE,CAAC;QAClD,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,CAAC,EAAE,+BAA+B,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;AACF,CAAC;AAjCD,0DAiCC;AAED,MAAa,qBAAqB;IAMjC,IAAY,cAAc;QACzB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,YACS,OAAe;IACvB,kDAAkD;IAClD,SAAiC;QAFzB,YAAO,GAAP,OAAO,CAAQ;QAVhB,YAAO,GAAa,EAAE,CAA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M,QAAQ,GAAwC,EAAE,CAAC;YACzD,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;gBACpC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,sBAAsB;gBACtD,2CAA2C;gBAC3C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAC7D,CAAC;gBACF,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;YAC3C,CAAC;YACD,YAAY,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAClC,CAAC;QAED,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AApYD,sDAoYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tAttributionKey,\n\tDetachedAttributionKey,\n\tOpAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISegment } from \"./mergeTreeNodes.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface SequenceOffsets {\n\t/**\n\t * Parallel array with posBreakpoints which tracks the seq of insertion.\n\t *\n\t * @example\n\t *\n\t * If seqs is [45, 46] and posBreakpoints is [0, 3], the section of the string\n\t * between offsets 0 and 3 was inserted at seq 45 and the section of the string between\n\t * 3 and the length of the string was inserted at seq 46.\n\t *\n\t * @remarks We use null here rather than undefined as round-tripping through JSON converts\n\t * undefineds to null anyway\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tseqs: (number | AttributionKey | null)[];\n\tposBreakpoints: number[];\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface SerializedAttributionCollection extends SequenceOffsets {\n\tchannels?: { [name: string]: SequenceOffsets };\n\t/* Total length; only necessary for validation */\n\tlength: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAttributionCollectionSpec<T> {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\troot: Iterable<{ offset: number; key: T | null }>;\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tchannels?: { [name: string]: Iterable<{ offset: number; key: T | null }> };\n\tlength: number;\n}\n\n/**\n * @legacy\n * @alpha\n * @sealed\n */\nexport interface IAttributionCollectionSerializer {\n\t/***/\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\t/**\n\t * Populates attribution information on segments using the provided summary.\n\t */\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAttributionCollection<T> {\n\t/**\n\t * Retrieves the attribution key associated with the provided offset.\n\t * @param channel - When specified, gets an attribution key associated with a particular channel.\n\t */\n\tgetAtOffset(offset: number, channel?: string): AttributionKey | undefined;\n\n\t/**\n\t * Retrieves all the [Offset, Attribution key] pairs for the provided offset range. Note:\n\t * The returned array is sorted by offset.\n\t * The first offset in response could be lower than the startOffset as the Attribution Key for the startOffset\n\t * could start at a lower offset than the startOffset in case where Attribution key offset boundaries don't\n\t * align exactly with startOffset.\n\t * Example: If the Attribution Offsets in the segment is [0, 10, 20, 30, 40] and request is for (startOffset: 5, endOffset: 25),\n\t * then result would be [(offset: 0, key: key1), (offset:10, key: key2), (offset:20, key: key3)].\n\t * @param channel - When specified, gets attribution keys associated with a particular channel.\n\t * @returns - undefined if the provided channel is not found or list of attribution keys along with\n\t * the corresponding offset start boundary.\n\t */\n\tgetKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined;\n\n\t/**\n\t * Total length of all attribution keys in this collection.\n\t */\n\treadonly length: number;\n\n\treadonly channelNames: Iterable<string>;\n\n\t/**\n\t * Retrieve all key/offset pairs stored on this segment. Entries should be ordered by offset, such that\n\t * the `i`th result's attribution key applies to offsets in the open range between the `i`th offset and the\n\t * `i+1`th offset.\n\t * The last entry's key applies to the open interval from the last entry's offset to this collection's length.\n\t */\n\tgetAll(): IAttributionCollectionSpec<T>;\n\n\t/***/\n\tsplitAt(pos: number): IAttributionCollection<T>;\n\n\t/***/\n\tappend(other: IAttributionCollection<T>): void;\n\n\t/***/\n\tclone(): IAttributionCollection<T>;\n\n\t/**\n\t * Updates this collection with new attribution data.\n\t * @param name - Name of the channel that requires an update. Undefined signifies the root channel.\n\t * Updates apply only to the individual channel (i.e. if an attribution policy needs to update the root\n\t * channel and 4 other channels, it should call `.update` 5 times).\n\t * @param channel - Updated collection for that channel.\n\t */\n\tupdate(name: string | undefined, channel: IAttributionCollection<T>): void;\n}\n\n// note: treats null and undefined as equivalent\nexport function areEqualAttributionKeys(\n\t// eslint-disable-next-line @rushstack/no-new-null\n\ta: AttributionKey | null | undefined,\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tb: AttributionKey | null | undefined,\n): boolean {\n\tif (!a && !b) {\n\t\treturn true;\n\t}\n\n\tif (!a || !b) {\n\t\treturn false;\n\t}\n\n\tif (a.type !== b.type) {\n\t\treturn false;\n\t}\n\n\t// Note: TS can't narrow the type of b inside this switch statement, hence the need for casting.\n\tswitch (a.type) {\n\t\tcase \"op\": {\n\t\t\treturn a.seq === (b as OpAttributionKey).seq;\n\t\t}\n\t\tcase \"detached\": {\n\t\t\treturn a.id === (b as DetachedAttributionKey).id;\n\t\t}\n\t\tcase \"local\": {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(a, \"Unhandled AttributionKey type\");\n\t\t}\n\t}\n}\n\nexport class AttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate offsets: number[] = [];\n\tprivate keys: (AttributionKey | null)[] = [];\n\n\tprivate channels?: { [name: string]: AttributionCollection };\n\n\tprivate get channelEntries(): [string, AttributionCollection][] {\n\t\treturn Object.entries(this.channels ?? {});\n\t}\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.offsets.push(0);\n\t\t\tthis.keys.push(baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames(): string[] {\n\t\treturn Object.keys(this.channels ?? {});\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey;\n\tpublic getAtOffset(offset: number, channel: string): AttributionKey | undefined;\n\tpublic getAtOffset(offset: number, channel?: string): AttributionKey | undefined {\n\t\tif (channel !== undefined) {\n\t\t\tconst subCollection = this.channels?.[channel];\n\t\t\treturn subCollection?.getAtOffset(offset);\n\t\t}\n\t\tassert(offset >= 0 && offset < this._length, 0x443 /* Requested offset should be valid */);\n\t\treturn this.get(this.findIndex(offset));\n\t}\n\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t): { offset: number; key: AttributionKey }[];\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined;\n\tpublic getKeysInOffsetRange(\n\t\tstartOffset: number,\n\t\tendOffset?: number,\n\t\tchannel?: string,\n\t): { offset: number; key: AttributionKey }[] | undefined {\n\t\tif (startOffset < 0 || startOffset >= this._length) {\n\t\t\tthrow new UsageError(\"startOffset should be valid and in range\");\n\t\t}\n\t\tif (\n\t\t\tendOffset !== undefined &&\n\t\t\t(endOffset < 0 || endOffset >= this._length || startOffset > endOffset)\n\t\t) {\n\t\t\tthrow new UsageError(\"endOffset should be valid and in range\");\n\t\t}\n\n\t\tif (channel !== undefined) {\n\t\t\tconst subCollection = this.channels?.[channel];\n\t\t\treturn subCollection?.getKeysInOffsetRange(startOffset, endOffset);\n\t\t}\n\t\tconst result: { offset: number; key: AttributionKey }[] = [];\n\t\tlet index = this.findIndex(startOffset);\n\t\tlet attributionKey = this.get(index);\n\t\tif (attributionKey !== undefined) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tresult.push({ offset: this.offsets[index]!, key: attributionKey });\n\t\t}\n\t\tindex++;\n\t\tconst endOffsetVal = endOffset ?? Number.MAX_SAFE_INTEGER;\n\t\t// TODO Non null asserting, why is this not null?\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\twhile (index < this.offsets.length && endOffsetVal >= this.offsets[index]!) {\n\t\t\tattributionKey = this.get(index);\n\t\t\tif (attributionKey !== undefined) {\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tresult.push({ offset: this.offsets[index]!, key: attributionKey });\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate findIndex(offset: number): number {\n\t\t// Note: maximum length here is 256 for text segments. Perf testing shows that linear scan beats binary search\n\t\t// for attribution collections with under ~64 entries, and even at maximum size (which would require a maximum\n\t\t// length segment with every offset having different attribution), getAtOffset is on the order of 100ns.\n\t\tlet i = 0;\n\t\t// TODO Non null asserting, why is this not null?\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\twhile (i < this.offsets.length && offset > this.offsets[i]!) {\n\t\t\ti++;\n\t\t}\n\t\treturn this.offsets[i] === offset ? i : i - 1;\n\t}\n\n\tprivate get(index: number): AttributionKey | undefined {\n\t\tconst key = this.keys[index];\n\t\treturn key ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): AttributionCollection {\n\t\tconst splitIndex = this.findIndex(pos);\n\t\tconst splitCollection = new AttributionCollection(this.length - pos);\n\t\tfor (let i = splitIndex; i < this.keys.length; i++) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tsplitCollection.offsets.push(Math.max(this.offsets[i]! - pos, 0));\n\t\t\tconst key = this.keys[i];\n\t\t\tif (key !== undefined) {\n\t\t\t\tsplitCollection.keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\tif (this.channels) {\n\t\t\tsplitCollection.channels = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tsplitCollection.channels[key] = collection.splitAt(pos);\n\t\t\t}\n\t\t}\n\n\t\tconst spliceIndex = this.offsets[splitIndex] === pos ? splitIndex : splitIndex + 1;\n\t\tthis.keys.splice(spliceIndex);\n\t\tthis.offsets.splice(spliceIndex);\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: AttributionCollection): void {\n\t\tconst lastEntry = this.keys[this.keys.length - 1];\n\t\tfor (let i = 0; i < other.keys.length; i++) {\n\t\t\tif (i !== 0 || !areEqualAttributionKeys(lastEntry, other.keys[i])) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tthis.offsets.push(other.offsets[i]! + this.length);\n\t\t\t\t// Looping through the keys, so we can be sure that the key is not undefined.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tthis.keys.push(other.keys[i]!);\n\t\t\t}\n\t\t}\n\n\t\tif (other.channels !== undefined || this.channels !== undefined) {\n\t\t\tthis.channels ??= {};\n\t\t\tfor (const [key, collection] of other.channelEntries) {\n\t\t\t\tconst thisCollection = (this.channels[key] ??= new AttributionCollection(\n\t\t\t\t\tthis.length,\n\t\t\t\t\t// Null is needed as null and undefined have different meanings in the context of attribution collections.\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tnull,\n\t\t\t\t));\n\t\t\t\tthisCollection.append(collection);\n\t\t\t}\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tif (other.channels?.[key] === undefined) {\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tcollection.append(new AttributionCollection(other.length, null));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\ttype ExtractGeneric<T> = T extends Iterable<infer Q> ? Q : unknown;\n\t\tconst root: ExtractGeneric<IAttributionCollectionSpec<AttributionKey>[\"root\"]>[] =\n\t\t\tArray.from({ length: this.keys.length });\n\t\tfor (let i = 0; i < this.keys.length; i++) {\n\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\troot[i] = { offset: this.offsets[i]!, key: this.keys[i]! };\n\t\t}\n\t\tconst result: IAttributionCollectionSpec<AttributionKey> = {\n\t\t\troot,\n\t\t\tlength: this.length,\n\t\t};\n\t\tif (this.channels !== undefined) {\n\t\t\tresult.channels = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tresult.channels[key] = collection.getAll().root;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic clone(): AttributionCollection {\n\t\tconst copy = new AttributionCollection(this.length);\n\t\tcopy.keys = [...this.keys];\n\t\tcopy.offsets = [...this.offsets];\n\t\tif (this.channels !== undefined) {\n\t\t\tconst channelsCopy: Record<string, AttributionCollection> = {};\n\t\t\tfor (const [key, collection] of this.channelEntries) {\n\t\t\t\tchannelsCopy[key] = collection.clone();\n\t\t\t}\n\t\t\tcopy.channels = channelsCopy;\n\t\t}\n\t\treturn copy;\n\t}\n\n\tpublic update(name: string | undefined, channel: AttributionCollection): void {\n\t\tassert(\n\t\t\tchannel.length === this.length,\n\t\t\t0x5c0 /* AttributionCollection channel update should have consistent segment length */,\n\t\t);\n\t\tif (name === undefined) {\n\t\t\tthis.offsets = [...channel.offsets];\n\t\t\tthis.keys = [...channel.keys];\n\t\t} else {\n\t\t\tthis.channels ??= {};\n\t\t\tif (this.channels[name] === undefined) {\n\t\t\t\tthis.channels[name] = channel;\n\t\t\t} else {\n\t\t\t\tthis.channels[name]?.update(undefined, channel);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: ISegment[],\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { channels } = summary;\n\t\tassert(\n\t\t\t// Destructuring here would require renaming the variables, since seqs is declared below\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\t\tsummary.seqs.length === summary.posBreakpoints.length,\n\t\t\t0x445 /* Invalid attribution summary blob provided */,\n\t\t);\n\n\t\tconst extractOntoSegments = (\n\t\t\t{ seqs, posBreakpoints }: SequenceOffsets,\n\t\t\tassignToSegment: (collection: AttributionCollection, segment: ISegment) => void,\n\t\t): void => {\n\t\t\tif (seqs.length === 0) {\n\t\t\t\tassert(\n\t\t\t\t\tposBreakpoints.length === 0,\n\t\t\t\t\t0x9e1 /* seqs and posBreakpoints length should match */,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet curIndex = 0;\n\t\t\tlet cumulativeSegPos = 0;\n\n\t\t\tfor (const segment of segments) {\n\t\t\t\tconst attribution = new AttributionCollection(segment.cachedLength);\n\t\t\t\t// This function is defined here to allow for the creation of a new collection for each segment.\n\t\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t\t\tconst pushEntry = (offset: number, seq: AttributionKey | number | null): void => {\n\t\t\t\t\tattribution.offsets.push(offset);\n\t\t\t\t\tattribution.keys.push(\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tseq === null ? null : typeof seq === \"object\" ? seq : { type: \"op\", seq },\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tif (posBreakpoints[curIndex]! > cumulativeSegPos) {\n\t\t\t\t\tcurIndex--;\n\t\t\t\t}\n\n\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\twhile (posBreakpoints[curIndex]! < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst nextOffset = Math.max(posBreakpoints[curIndex]! - cumulativeSegPos, 0);\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpushEntry(nextOffset, seqs[curIndex]!);\n\t\t\t\t\tcurIndex++;\n\t\t\t\t}\n\n\t\t\t\tif (attribution.offsets.length === 0) {\n\t\t\t\t\t// TODO Non null asserting, why is this not null?\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpushEntry(0, seqs[curIndex - 1]!);\n\t\t\t\t}\n\n\t\t\t\tassignToSegment(attribution, segment);\n\t\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t\t}\n\t\t};\n\n\t\textractOntoSegments(summary, (collection, segment) => {\n\t\t\tsegment.attribution = collection;\n\t\t});\n\t\tif (channels) {\n\t\t\tfor (const [name, collectionSpec] of Object.entries(channels)) {\n\t\t\t\textractOntoSegments(collectionSpec, (collection, segment) => {\n\t\t\t\t\tif (segment.attribution !== undefined) {\n\t\t\t\t\t\t// Cast is valid as we just assigned this field above\n\t\t\t\t\t\t((segment.attribution as AttributionCollection).channels ??= {})[name] =\n\t\t\t\t\t\t\tcollection;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t *\n\t * Note: this operates on segments rather than attribution collections directly so that it can handle cases\n\t * where only some segments have attribution defined.\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst allCollectionSpecs: IAttributionCollectionSpec<AttributionKey>[] = [];\n\n\t\tconst allChannelNames = new Set<string>();\n\t\tfor (const segment of segments) {\n\t\t\tconst collection =\n\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\tsegment.attribution ?? new AttributionCollection(segment.cachedLength, null);\n\t\t\tconst spec = collection.getAll();\n\t\t\tallCollectionSpecs.push(spec);\n\t\t\tif (spec.channels) {\n\t\t\t\tfor (const name of Object.keys(spec.channels)) {\n\t\t\t\t\tallChannelNames.add(name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst extractSequenceOffsets = (\n\t\t\tgetSpecEntries: (\n\t\t\t\tspec: IAttributionCollectionSpec<AttributionKey>,\n\t\t\t) => Iterable<{ offset: number; key: AttributionKey | null }>,\n\t\t): SerializedAttributionCollection => {\n\t\t\tconst posBreakpoints: number[] = [];\n\t\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\t\tlet cumulativePos = 0;\n\n\t\t\tfor (const spec of allCollectionSpecs) {\n\t\t\t\tfor (const { offset, key } of getSpecEntries(spec)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tkey?.type !== \"local\",\n\t\t\t\t\t\t0x5c1 /* local attribution keys should never be put in summaries */,\n\t\t\t\t\t);\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(key, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tseqs.push(key ? (key.type === \"op\" ? key.seq : key) : null);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = key;\n\t\t\t\t}\n\n\t\t\t\tcumulativePos += spec.length;\n\t\t\t}\n\n\t\t\treturn { seqs, posBreakpoints, length: cumulativePos };\n\t\t};\n\n\t\tconst blobContents = extractSequenceOffsets((spec) => spec.root);\n\t\tif (allChannelNames.size > 0) {\n\t\t\tconst channels: { [name: string]: SequenceOffsets } = {};\n\t\t\tfor (const name of allChannelNames) {\n\t\t\t\tconst { posBreakpoints, seqs } = extractSequenceOffsets(\n\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t(spec) => spec.channels?.[name] ?? [{ offset: 0, key: null }],\n\t\t\t\t);\n\t\t\t\tchannels[name] = { posBreakpoints, seqs };\n\t\t\t}\n\t\t\tblobContents.channels = channels;\n\t\t}\n\n\t\treturn blobContents;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributionPolicy.d.ts","sourceRoot":"","sources":["../src/attributionPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"attributionPolicy.d.ts","sourceRoot":"","sources":["../src/attributionPolicy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA4LnD;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,iBAAiB,CAOrE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,8CAA8C,CAC7D,GAAG,SAAS,EAAE,MAAM,EAAE,GACpB,MAAM,iBAAiB,CAQzB;AAED;;;;;GAKG;AACH,wBAAgB,0DAA0D,CACzE,GAAG,SAAS,EAAE,MAAM,EAAE,GACpB,MAAM,iBAAiB,CASzB"}
|
|
@@ -75,19 +75,15 @@ const insertOnlyAttributionPolicyCallbacks = {
|
|
|
75
75
|
};
|
|
76
76
|
function createPropertyTrackingMergeTreeCallbacks(...propNames) {
|
|
77
77
|
const toTrack = propNames.map((entry) => ({ propName: entry, channelName: entry }));
|
|
78
|
-
const attributeAnnotateOnSegments = (deltaSegments, { op
|
|
79
|
-
for (const { segment } of deltaSegments) {
|
|
78
|
+
const attributeAnnotateOnSegments = (isLocal, deltaSegments, { op }, key) => {
|
|
79
|
+
for (const { segment, propertyDeltas } of deltaSegments) {
|
|
80
80
|
for (const { propName, channelName } of toTrack) {
|
|
81
81
|
const shouldAttributeInsert = op.type === ops_js_1.MergeTreeDeltaType.INSERT &&
|
|
82
82
|
segment.properties?.[propName] !== undefined;
|
|
83
|
-
const isLocal = sequencedMessage === undefined;
|
|
84
83
|
const shouldAttributeAnnotate = op.type === ops_js_1.MergeTreeDeltaType.ANNOTATE &&
|
|
85
84
|
// Only attribute annotations which change the tracked property
|
|
86
85
|
op.props[propName] !== undefined &&
|
|
87
|
-
|
|
88
|
-
(isLocal ||
|
|
89
|
-
// Acked changes only take effect if there isn't a pending local change
|
|
90
|
-
(!isLocal && !segment.propertyManager?.hasPendingProperty(propName)));
|
|
86
|
+
(isLocal || (propertyDeltas !== undefined && propName in propertyDeltas));
|
|
91
87
|
if (shouldAttributeInsert || shouldAttributeAnnotate) {
|
|
92
88
|
segment.attribution?.update(channelName, new attributionCollection_js_1.AttributionCollection(segment.cachedLength, key));
|
|
93
89
|
}
|
|
@@ -98,12 +94,12 @@ function createPropertyTrackingMergeTreeCallbacks(...propNames) {
|
|
|
98
94
|
delta: (opArgs, { deltaSegments }, client) => {
|
|
99
95
|
const { op, sequencedMessage } = opArgs;
|
|
100
96
|
if (op.type === ops_js_1.MergeTreeDeltaType.ANNOTATE || op.type === ops_js_1.MergeTreeDeltaType.INSERT) {
|
|
101
|
-
attributeAnnotateOnSegments(deltaSegments, opArgs, getAttributionKey(client, sequencedMessage));
|
|
97
|
+
attributeAnnotateOnSegments(sequencedMessage === undefined, deltaSegments, opArgs, getAttributionKey(client, sequencedMessage));
|
|
102
98
|
}
|
|
103
99
|
},
|
|
104
100
|
maintenance: ({ deltaSegments, operation }, opArgs, client) => {
|
|
105
101
|
if (operation === mergeTreeDeltaCallback_js_1.MergeTreeMaintenanceType.ACKNOWLEDGED && opArgs !== undefined) {
|
|
106
|
-
attributeAnnotateOnSegments(deltaSegments, opArgs, getAttributionKey(client, opArgs.sequencedMessage));
|
|
102
|
+
attributeAnnotateOnSegments(true, deltaSegments, opArgs, getAttributionKey(client, opArgs.sequencedMessage));
|
|
107
103
|
}
|
|
108
104
|
},
|
|
109
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributionPolicy.js","sourceRoot":"","sources":["../src/attributionPolicy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D,yEAAmE;AAInE,2EAMqC;AACrC,qCAA8C;AAoB9C,SAAS,oCAAoC,CAAC,EAC7C,KAAK,EACL,WAAW,GACW;IACtB,IAAI,WAAqC,CAAC;IAC1C,OAAO;QACN,gDAAgD;QAChD,MAAM,EAAE,CAAC,MAAc,EAAQ,EAAE;YAChC,IAAA,iBAAM,EAAC,WAAW,KAAK,SAAS,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAEzF,MAAM,eAAe,GAAkC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAC5E,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAClC,MAAM,qBAAqB,GAAwC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CACnF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YAEnC,MAAM,CAAC,EAAE,CAAC,OAA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AED;;;;;GAKG;AACH,SAAgB,0DAA0D,CACzE,GAAG,SAAmB;IAEtB,OAAO,GAAG,EAAE,CACX,oCAAoC,CACnC,yBAAyB,CAAC;QACzB,oCAAoC;QACpC,oCAAoC;QACpC,wCAAwC,CAAC,GAAG,SAAS,CAAC;KACtD,CAAC,CACF,CAAC;AACJ,CAAC;AAXD,gIAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { AttributionCollection } from \"./attributionCollection.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { Client } from \"./client.js\";\nimport { AttributionPolicy } from \"./mergeTree.js\";\nimport {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n\tIMergeTreeMaintenanceCallbackArgs,\n\tIMergeTreeSegmentDelta,\n\tMergeTreeMaintenanceType,\n} from \"./mergeTreeDeltaCallback.js\";\nimport { MergeTreeDeltaType } from \"./ops.js\";\n\n// Note: these thinly wrap MergeTreeDeltaCallback and MergeTreeMaintenanceCallback to provide the client.\n// This is because the base callbacks don't always have enough information to infer whether the op being\n// processed is in a detached or attached state, which may affect the attribution key.\ninterface AttributionCallbacks {\n\tdelta: (\n\t\topArgs: IMergeTreeDeltaOpArgs,\n\t\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client,\n\t) => void;\n\tmaintenance: (\n\t\tmaintenanceArgs: IMergeTreeMaintenanceCallbackArgs,\n\t\topArgs: IMergeTreeDeltaOpArgs | undefined,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client,\n\t) => void;\n}\n\nfunction createAttributionPolicyFromCallbacks({\n\tdelta,\n\tmaintenance,\n}: AttributionCallbacks): AttributionPolicy {\n\tlet unsubscribe: undefined | (() => void);\n\treturn {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tattach: (client: Client): void => {\n\t\t\tassert(unsubscribe === undefined, 0x557 /* cannot attach to multiple clients at once */);\n\n\t\t\tconst deltaSubscribed: AttributionCallbacks[\"delta\"] = (opArgs, deltaArgs) =>\n\t\t\t\tdelta(opArgs, deltaArgs, client);\n\t\t\tconst maintenanceSubscribed: AttributionCallbacks[\"maintenance\"] = (args, opArgs) =>\n\t\t\t\tmaintenance(args, opArgs, client);\n\n\t\t\tclient.on(\"delta\", deltaSubscribed);\n\t\t\tclient.on(\"maintenance\", maintenanceSubscribed);\n\n\t\t\tunsubscribe = (): void => {\n\t\t\t\tclient.off(\"delta\", deltaSubscribed);\n\t\t\t\tclient.off(\"maintenance\", maintenanceSubscribed);\n\t\t\t};\n\t\t},\n\t\tdetach: (): void => {\n\t\t\tunsubscribe?.();\n\t\t\tunsubscribe = undefined;\n\t\t},\n\t\tget isAttached(): boolean {\n\t\t\treturn unsubscribe !== undefined;\n\t\t},\n\t\tserializer: AttributionCollection,\n\t};\n}\n\nconst ensureAttributionCollectionCallbacks: AttributionCallbacks = {\n\tdelta: ({ op }, { deltaSegments }) => {\n\t\tif (op.type === MergeTreeDeltaType.INSERT) {\n\t\t\tfor (const { segment } of deltaSegments) {\n\t\t\t\tsegment.attribution = new AttributionCollection(segment.cachedLength);\n\t\t\t}\n\t\t}\n\t},\n\tmaintenance: () => {},\n};\n\nconst getAttributionKey = (\n\t// eslint-disable-next-line import/no-deprecated\n\tclient: Client,\n\tmsg: ISequencedDocumentMessage | undefined,\n): AttributionKey => {\n\tif (msg) {\n\t\treturn { type: \"op\", seq: msg.sequenceNumber };\n\t}\n\tconst collabWindow = client.getCollabWindow();\n\treturn collabWindow.collaborating ? { type: \"local\" } : { type: \"detached\", id: 0 };\n};\n\nconst attributeInsertionOnSegments = (\n\tdeltaSegments: IMergeTreeSegmentDelta[],\n\tkey: AttributionKey,\n): void => {\n\tfor (const { segment } of deltaSegments) {\n\t\tif (segment.seq !== undefined) {\n\t\t\tsegment.attribution?.update(\n\t\t\t\tundefined,\n\t\t\t\tnew AttributionCollection(segment.cachedLength, key),\n\t\t\t);\n\t\t}\n\t}\n};\n\nconst insertOnlyAttributionPolicyCallbacks: AttributionCallbacks = {\n\tdelta: (opArgs, { deltaSegments, operation }, client) => {\n\t\tif (operation === MergeTreeDeltaType.INSERT) {\n\t\t\tattributeInsertionOnSegments(\n\t\t\t\tdeltaSegments,\n\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t);\n\t\t}\n\t},\n\tmaintenance: ({ deltaSegments, operation }, opArgs, client) => {\n\t\tif (\n\t\t\toperation === MergeTreeMaintenanceType.ACKNOWLEDGED &&\n\t\t\topArgs?.op.type === MergeTreeDeltaType.INSERT\n\t\t) {\n\t\t\tattributeInsertionOnSegments(\n\t\t\t\tdeltaSegments,\n\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t);\n\t\t}\n\t},\n};\n\nfunction createPropertyTrackingMergeTreeCallbacks(\n\t...propNames: string[]\n): AttributionCallbacks {\n\tconst toTrack = propNames.map((entry) => ({ propName: entry, channelName: entry }));\n\tconst attributeAnnotateOnSegments = (\n\t\tdeltaSegments: IMergeTreeSegmentDelta[],\n\t\t{ op, sequencedMessage }: IMergeTreeDeltaOpArgs,\n\t\tkey: AttributionKey,\n\t): void => {\n\t\tfor (const { segment } of deltaSegments) {\n\t\t\tfor (const { propName, channelName } of toTrack) {\n\t\t\t\tconst shouldAttributeInsert =\n\t\t\t\t\top.type === MergeTreeDeltaType.INSERT &&\n\t\t\t\t\tsegment.properties?.[propName] !== undefined;\n\n\t\t\t\tconst isLocal = sequencedMessage === undefined;\n\t\t\t\tconst shouldAttributeAnnotate =\n\t\t\t\t\top.type === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\t\t// Only attribute annotations which change the tracked property\n\t\t\t\t\top.props[propName] !== undefined &&\n\t\t\t\t\t// Local changes to the tracked property always take effect\n\t\t\t\t\t(isLocal ||\n\t\t\t\t\t\t// Acked changes only take effect if there isn't a pending local change\n\t\t\t\t\t\t(!isLocal && !segment.propertyManager?.hasPendingProperty(propName)));\n\n\t\t\t\tif (shouldAttributeInsert || shouldAttributeAnnotate) {\n\t\t\t\t\tsegment.attribution?.update(\n\t\t\t\t\t\tchannelName,\n\t\t\t\t\t\tnew AttributionCollection(segment.cachedLength, key),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tdelta: (opArgs, { deltaSegments }, client): void => {\n\t\t\tconst { op, sequencedMessage } = opArgs;\n\t\t\tif (op.type === MergeTreeDeltaType.ANNOTATE || op.type === MergeTreeDeltaType.INSERT) {\n\t\t\t\tattributeAnnotateOnSegments(\n\t\t\t\t\tdeltaSegments,\n\t\t\t\t\topArgs,\n\t\t\t\t\tgetAttributionKey(client, sequencedMessage),\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tmaintenance: ({ deltaSegments, operation }, opArgs, client): void => {\n\t\t\tif (operation === MergeTreeMaintenanceType.ACKNOWLEDGED && opArgs !== undefined) {\n\t\t\t\tattributeAnnotateOnSegments(\n\t\t\t\t\tdeltaSegments,\n\t\t\t\t\topArgs,\n\t\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction combineMergeTreeCallbacks(callbacks: AttributionCallbacks[]): AttributionCallbacks {\n\treturn {\n\t\tdelta: (...args): void => {\n\t\t\tfor (const { delta } of callbacks) delta(...args);\n\t\t},\n\t\tmaintenance: (...args): void => {\n\t\t\tfor (const { maintenance } of callbacks) maintenance(...args);\n\t\t},\n\t};\n}\n\n/**\n * Creates an {@link AttributionPolicy} which only tracks initial insertion of content.\n * @internal\n */\nexport function createInsertOnlyAttributionPolicy(): AttributionPolicy {\n\treturn createAttributionPolicyFromCallbacks(\n\t\tcombineMergeTreeCallbacks([\n\t\t\tensureAttributionCollectionCallbacks,\n\t\t\tinsertOnlyAttributionPolicyCallbacks,\n\t\t]),\n\t);\n}\n\n/**\n * Creates an {@link AttributionPolicy} for tracking annotation of specific properties.\n * @param propNames - List of property names for which attribution should be tracked.\n * @returns A policy which only attributes annotation of the properties specified.\n * Keys for each property are stored under attribution channels of the same name--see example below.\n *\n * @example\n *\n * ```typescript\n * // Use this policy when creating your merge-tree:\n * const policy = createPropertyTrackingAttributionPolicyFactory(\"bold\", \"italic\");\n * // ... later, you can get attribution keys for the last time the \"bold\" and \"italic\"\n * // properties were changed on a segment using `getAtOffset`:\n * const lastBoldedAttributionKey = segment.attribution?.getAtOffset(0, \"bold\");\n * const lastItalicizedAttributionKey = segment.attribution?.getAtOffset(0, \"italic\");\n * ```\n * @internal\n */\nexport function createPropertyTrackingAttributionPolicyFactory(\n\t...propNames: string[]\n): () => AttributionPolicy {\n\treturn () =>\n\t\tcreateAttributionPolicyFromCallbacks(\n\t\t\tcombineMergeTreeCallbacks([\n\t\t\t\tensureAttributionCollectionCallbacks,\n\t\t\t\tcreatePropertyTrackingMergeTreeCallbacks(...propNames),\n\t\t\t]),\n\t\t);\n}\n\n/**\n * Creates an attribution policy which tracks insertion as well as annotation of certain property names.\n * This combines the policies creatable using {@link createPropertyTrackingAttributionPolicyFactory} and\n * {@link createInsertOnlyAttributionPolicy}: see there for more details.\n * @internal\n */\nexport function createPropertyTrackingAndInsertionAttributionPolicyFactory(\n\t...propNames: string[]\n): () => AttributionPolicy {\n\treturn () =>\n\t\tcreateAttributionPolicyFromCallbacks(\n\t\t\tcombineMergeTreeCallbacks([\n\t\t\t\tensureAttributionCollectionCallbacks,\n\t\t\t\tinsertOnlyAttributionPolicyCallbacks,\n\t\t\t\tcreatePropertyTrackingMergeTreeCallbacks(...propNames),\n\t\t\t]),\n\t\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attributionPolicy.js","sourceRoot":"","sources":["../src/attributionPolicy.ts"],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C,GAAG,IAAI,EAAQ,EAAE;YAC9B,KAAK,MAAM,EAAE,WAAW,EAAE,IAAI,SAAS;gBAAE,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/D,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,iCAAiC;IAChD,OAAO,oCAAoC,CAC1C,yBAAyB,CAAC;QACzB,oCAAoC;QACpC,oCAAoC;KACpC,CAAC,CACF,CAAC;AACH,CAAC;AAPD,8EAOC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,8CAA8C,CAC7D,GAAG,SAAmB;IAEtB,OAAO,GAAG,EAAE,CACX,oCAAoC,CACnC,yBAAyB,CAAC;QACzB,oCAAoC;QACpC,wCAAwC,CAAC,GAAG,SAAS,CAAC;KACtD,CAAC,CACF,CAAC;AACJ,CAAC;AAVD,wGAUC;AAED;;;;;GAKG;AACH,SAAgB,0DAA0D,CACzE,GAAG,SAAmB;IAEtB,OAAO,GAAG,EAAE,CACX,oCAAoC,CACnC,yBAAyB,CAAC;QACzB,oCAAoC;QACpC,oCAAoC;QACpC,wCAAwC,CAAC,GAAG,SAAS,CAAC;KACtD,CAAC,CACF,CAAC;AACJ,CAAC;AAXD,gIAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { AttributionCollection } from \"./attributionCollection.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { Client } from \"./client.js\";\nimport { AttributionPolicy } from \"./mergeTree.js\";\nimport {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n\tIMergeTreeMaintenanceCallbackArgs,\n\tIMergeTreeSegmentDelta,\n\tMergeTreeMaintenanceType,\n} from \"./mergeTreeDeltaCallback.js\";\nimport { MergeTreeDeltaType } from \"./ops.js\";\n\n// Note: these thinly wrap MergeTreeDeltaCallback and MergeTreeMaintenanceCallback to provide the client.\n// This is because the base callbacks don't always have enough information to infer whether the op being\n// processed is in a detached or attached state, which may affect the attribution key.\ninterface AttributionCallbacks {\n\tdelta: (\n\t\topArgs: IMergeTreeDeltaOpArgs,\n\t\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client,\n\t) => void;\n\tmaintenance: (\n\t\tmaintenanceArgs: IMergeTreeMaintenanceCallbackArgs,\n\t\topArgs: IMergeTreeDeltaOpArgs | undefined,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client,\n\t) => void;\n}\n\nfunction createAttributionPolicyFromCallbacks({\n\tdelta,\n\tmaintenance,\n}: AttributionCallbacks): AttributionPolicy {\n\tlet unsubscribe: undefined | (() => void);\n\treturn {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tattach: (client: Client): void => {\n\t\t\tassert(unsubscribe === undefined, 0x557 /* cannot attach to multiple clients at once */);\n\n\t\t\tconst deltaSubscribed: AttributionCallbacks[\"delta\"] = (opArgs, deltaArgs) =>\n\t\t\t\tdelta(opArgs, deltaArgs, client);\n\t\t\tconst maintenanceSubscribed: AttributionCallbacks[\"maintenance\"] = (args, opArgs) =>\n\t\t\t\tmaintenance(args, opArgs, client);\n\n\t\t\tclient.on(\"delta\", deltaSubscribed);\n\t\t\tclient.on(\"maintenance\", maintenanceSubscribed);\n\n\t\t\tunsubscribe = (): void => {\n\t\t\t\tclient.off(\"delta\", deltaSubscribed);\n\t\t\t\tclient.off(\"maintenance\", maintenanceSubscribed);\n\t\t\t};\n\t\t},\n\t\tdetach: (): void => {\n\t\t\tunsubscribe?.();\n\t\t\tunsubscribe = undefined;\n\t\t},\n\t\tget isAttached(): boolean {\n\t\t\treturn unsubscribe !== undefined;\n\t\t},\n\t\tserializer: AttributionCollection,\n\t};\n}\n\nconst ensureAttributionCollectionCallbacks: AttributionCallbacks = {\n\tdelta: ({ op }, { deltaSegments }) => {\n\t\tif (op.type === MergeTreeDeltaType.INSERT) {\n\t\t\tfor (const { segment } of deltaSegments) {\n\t\t\t\tsegment.attribution = new AttributionCollection(segment.cachedLength);\n\t\t\t}\n\t\t}\n\t},\n\tmaintenance: () => {},\n};\n\nconst getAttributionKey = (\n\t// eslint-disable-next-line import/no-deprecated\n\tclient: Client,\n\tmsg: ISequencedDocumentMessage | undefined,\n): AttributionKey => {\n\tif (msg) {\n\t\treturn { type: \"op\", seq: msg.sequenceNumber };\n\t}\n\tconst collabWindow = client.getCollabWindow();\n\treturn collabWindow.collaborating ? { type: \"local\" } : { type: \"detached\", id: 0 };\n};\n\nconst attributeInsertionOnSegments = (\n\tdeltaSegments: IMergeTreeSegmentDelta[],\n\tkey: AttributionKey,\n): void => {\n\tfor (const { segment } of deltaSegments) {\n\t\tif (segment.seq !== undefined) {\n\t\t\tsegment.attribution?.update(\n\t\t\t\tundefined,\n\t\t\t\tnew AttributionCollection(segment.cachedLength, key),\n\t\t\t);\n\t\t}\n\t}\n};\n\nconst insertOnlyAttributionPolicyCallbacks: AttributionCallbacks = {\n\tdelta: (opArgs, { deltaSegments, operation }, client) => {\n\t\tif (operation === MergeTreeDeltaType.INSERT) {\n\t\t\tattributeInsertionOnSegments(\n\t\t\t\tdeltaSegments,\n\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t);\n\t\t}\n\t},\n\tmaintenance: ({ deltaSegments, operation }, opArgs, client) => {\n\t\tif (\n\t\t\toperation === MergeTreeMaintenanceType.ACKNOWLEDGED &&\n\t\t\topArgs?.op.type === MergeTreeDeltaType.INSERT\n\t\t) {\n\t\t\tattributeInsertionOnSegments(\n\t\t\t\tdeltaSegments,\n\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t);\n\t\t}\n\t},\n};\n\nfunction createPropertyTrackingMergeTreeCallbacks(\n\t...propNames: string[]\n): AttributionCallbacks {\n\tconst toTrack = propNames.map((entry) => ({ propName: entry, channelName: entry }));\n\tconst attributeAnnotateOnSegments = (\n\t\tisLocal: boolean,\n\t\tdeltaSegments: IMergeTreeSegmentDelta[],\n\t\t{ op }: IMergeTreeDeltaOpArgs,\n\t\tkey: AttributionKey,\n\t): void => {\n\t\tfor (const { segment, propertyDeltas } of deltaSegments) {\n\t\t\tfor (const { propName, channelName } of toTrack) {\n\t\t\t\tconst shouldAttributeInsert =\n\t\t\t\t\top.type === MergeTreeDeltaType.INSERT &&\n\t\t\t\t\tsegment.properties?.[propName] !== undefined;\n\n\t\t\t\tconst shouldAttributeAnnotate =\n\t\t\t\t\top.type === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\t\t// Only attribute annotations which change the tracked property\n\t\t\t\t\top.props[propName] !== undefined &&\n\t\t\t\t\t(isLocal || (propertyDeltas !== undefined && propName in propertyDeltas));\n\n\t\t\t\tif (shouldAttributeInsert || shouldAttributeAnnotate) {\n\t\t\t\t\tsegment.attribution?.update(\n\t\t\t\t\t\tchannelName,\n\t\t\t\t\t\tnew AttributionCollection(segment.cachedLength, key),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tdelta: (opArgs, { deltaSegments }, client): void => {\n\t\t\tconst { op, sequencedMessage } = opArgs;\n\t\t\tif (op.type === MergeTreeDeltaType.ANNOTATE || op.type === MergeTreeDeltaType.INSERT) {\n\t\t\t\tattributeAnnotateOnSegments(\n\t\t\t\t\tsequencedMessage === undefined,\n\t\t\t\t\tdeltaSegments,\n\t\t\t\t\topArgs,\n\t\t\t\t\tgetAttributionKey(client, sequencedMessage),\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tmaintenance: ({ deltaSegments, operation }, opArgs, client): void => {\n\t\t\tif (operation === MergeTreeMaintenanceType.ACKNOWLEDGED && opArgs !== undefined) {\n\t\t\t\tattributeAnnotateOnSegments(\n\t\t\t\t\ttrue,\n\t\t\t\t\tdeltaSegments,\n\t\t\t\t\topArgs,\n\t\t\t\t\tgetAttributionKey(client, opArgs.sequencedMessage),\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction combineMergeTreeCallbacks(callbacks: AttributionCallbacks[]): AttributionCallbacks {\n\treturn {\n\t\tdelta: (...args): void => {\n\t\t\tfor (const { delta } of callbacks) delta(...args);\n\t\t},\n\t\tmaintenance: (...args): void => {\n\t\t\tfor (const { maintenance } of callbacks) maintenance(...args);\n\t\t},\n\t};\n}\n\n/**\n * Creates an {@link AttributionPolicy} which only tracks initial insertion of content.\n * @internal\n */\nexport function createInsertOnlyAttributionPolicy(): AttributionPolicy {\n\treturn createAttributionPolicyFromCallbacks(\n\t\tcombineMergeTreeCallbacks([\n\t\t\tensureAttributionCollectionCallbacks,\n\t\t\tinsertOnlyAttributionPolicyCallbacks,\n\t\t]),\n\t);\n}\n\n/**\n * Creates an {@link AttributionPolicy} for tracking annotation of specific properties.\n * @param propNames - List of property names for which attribution should be tracked.\n * @returns A policy which only attributes annotation of the properties specified.\n * Keys for each property are stored under attribution channels of the same name--see example below.\n *\n * @example\n *\n * ```typescript\n * // Use this policy when creating your merge-tree:\n * const policy = createPropertyTrackingAttributionPolicyFactory(\"bold\", \"italic\");\n * // ... later, you can get attribution keys for the last time the \"bold\" and \"italic\"\n * // properties were changed on a segment using `getAtOffset`:\n * const lastBoldedAttributionKey = segment.attribution?.getAtOffset(0, \"bold\");\n * const lastItalicizedAttributionKey = segment.attribution?.getAtOffset(0, \"italic\");\n * ```\n * @internal\n */\nexport function createPropertyTrackingAttributionPolicyFactory(\n\t...propNames: string[]\n): () => AttributionPolicy {\n\treturn () =>\n\t\tcreateAttributionPolicyFromCallbacks(\n\t\t\tcombineMergeTreeCallbacks([\n\t\t\t\tensureAttributionCollectionCallbacks,\n\t\t\t\tcreatePropertyTrackingMergeTreeCallbacks(...propNames),\n\t\t\t]),\n\t\t);\n}\n\n/**\n * Creates an attribution policy which tracks insertion as well as annotation of certain property names.\n * This combines the policies creatable using {@link createPropertyTrackingAttributionPolicyFactory} and\n * {@link createInsertOnlyAttributionPolicy}: see there for more details.\n * @internal\n */\nexport function createPropertyTrackingAndInsertionAttributionPolicyFactory(\n\t...propNames: string[]\n): () => AttributionPolicy {\n\treturn () =>\n\t\tcreateAttributionPolicyFromCallbacks(\n\t\t\tcombineMergeTreeCallbacks([\n\t\t\t\tensureAttributionCollectionCallbacks,\n\t\t\t\tinsertOnlyAttributionPolicyCallbacks,\n\t\t\t\tcreatePropertyTrackingMergeTreeCallbacks(...propNames),\n\t\t\t]),\n\t\t);\n}\n"]}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,KAAK,qBAAqB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE3F,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EACN,mBAAmB,EAGnB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,KAAK,qBAAqB,EAAE,YAAY,EAAE,MAAM,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