@fluidframework/merge-tree 0.58.2000 → 0.58.3000-61081
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/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +1 -0
- package/dist/collections.js.map +1 -1
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js +7 -0
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts +0 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +1 -11
- package/dist/mergeTree.js.map +1 -1
- package/dist/partialLengths.d.ts.map +1 -1
- package/dist/partialLengths.js +2 -0
- package/dist/partialLengths.js.map +1 -1
- package/dist/snapshotChunks.d.ts +4 -0
- package/dist/snapshotChunks.d.ts.map +1 -1
- package/dist/snapshotChunks.js.map +1 -1
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +10 -0
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.d.ts.map +1 -1
- package/dist/snapshotV1.js +7 -0
- package/dist/snapshotV1.js.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +2 -0
- package/lib/client.js.map +1 -1
- package/lib/collections.d.ts.map +1 -1
- package/lib/collections.js +1 -0
- package/lib/collections.js.map +1 -1
- package/lib/localReference.d.ts.map +1 -1
- package/lib/localReference.js +7 -0
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts +0 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +1 -11
- package/lib/mergeTree.js.map +1 -1
- package/lib/partialLengths.d.ts.map +1 -1
- package/lib/partialLengths.js +2 -0
- package/lib/partialLengths.js.map +1 -1
- package/lib/snapshotChunks.d.ts +4 -0
- package/lib/snapshotChunks.d.ts.map +1 -1
- package/lib/snapshotChunks.js.map +1 -1
- package/lib/snapshotLoader.d.ts.map +1 -1
- package/lib/snapshotLoader.js +10 -0
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/snapshotV1.d.ts.map +1 -1
- package/lib/snapshotV1.js +7 -0
- package/lib/snapshotV1.js.map +1 -1
- package/package.json +16 -10
- package/src/client.ts +2 -0
- package/src/collections.ts +2 -0
- package/src/localReference.ts +7 -0
- package/src/mergeTree.ts +1 -10
- package/src/partialLengths.ts +2 -0
- package/src/snapshotChunks.ts +4 -0
- package/src/snapshotLoader.ts +11 -0
- package/src/snapshotV1.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/merge-tree",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.3000-61081",
|
|
4
4
|
"description": "Merge tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lint:fix": "npm run eslint:fix",
|
|
32
32
|
"test": "npm run test:mocha",
|
|
33
33
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
34
|
-
"test:mocha": "mocha --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup -r source-map-support/register --unhandled-rejections=strict",
|
|
34
|
+
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup -r source-map-support/register --unhandled-rejections=strict",
|
|
35
35
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
36
36
|
"tsc": "tsc",
|
|
37
37
|
"tsfmt": "tsfmt --verify",
|
|
@@ -62,18 +62,19 @@
|
|
|
62
62
|
"@fluidframework/common-utils": "^0.32.1",
|
|
63
63
|
"@fluidframework/container-definitions": "^0.47.1000",
|
|
64
64
|
"@fluidframework/core-interfaces": "^0.42.0",
|
|
65
|
-
"@fluidframework/datastore-definitions": "
|
|
65
|
+
"@fluidframework/datastore-definitions": "0.58.3000-61081",
|
|
66
66
|
"@fluidframework/protocol-definitions": "^0.1027.1000",
|
|
67
|
-
"@fluidframework/runtime-definitions": "
|
|
68
|
-
"@fluidframework/runtime-utils": "
|
|
69
|
-
"@fluidframework/shared-object-base": "
|
|
70
|
-
"@fluidframework/telemetry-utils": "
|
|
67
|
+
"@fluidframework/runtime-definitions": "0.58.3000-61081",
|
|
68
|
+
"@fluidframework/runtime-utils": "0.58.3000-61081",
|
|
69
|
+
"@fluidframework/shared-object-base": "0.58.3000-61081",
|
|
70
|
+
"@fluidframework/telemetry-utils": "0.58.3000-61081"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@fluidframework/build-common": "^0.23.0",
|
|
74
|
-
"@fluidframework/eslint-config-fluid": "^0.27.
|
|
75
|
-
"@fluidframework/
|
|
76
|
-
"@fluidframework/test-
|
|
74
|
+
"@fluidframework/eslint-config-fluid": "^0.27.2000-59622",
|
|
75
|
+
"@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@0.58.2000",
|
|
76
|
+
"@fluidframework/mocha-test-setup": "0.58.3000-61081",
|
|
77
|
+
"@fluidframework/test-runtime-utils": "0.58.3000-61081",
|
|
77
78
|
"@microsoft/api-extractor": "^7.16.1",
|
|
78
79
|
"@rushstack/eslint-config": "^2.5.1",
|
|
79
80
|
"@types/diff": "^3.5.1",
|
|
@@ -100,5 +101,10 @@
|
|
|
100
101
|
"source-map-support": "^0.5.16",
|
|
101
102
|
"typescript": "~4.1.3",
|
|
102
103
|
"typescript-formatter": "7.1.0"
|
|
104
|
+
},
|
|
105
|
+
"typeValidation": {
|
|
106
|
+
"version": "0.58.3000",
|
|
107
|
+
"broken": {},
|
|
108
|
+
"disabled": true
|
|
103
109
|
}
|
|
104
110
|
}
|
package/src/client.ts
CHANGED
|
@@ -545,6 +545,8 @@ export class Client {
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
|
|
548
|
+
// start and end are guaranteed to be non-null here, otherwise we throw above.
|
|
549
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
548
550
|
return { start, end } as IIntegerRange;
|
|
549
551
|
}
|
|
550
552
|
|
package/src/collections.ts
CHANGED
|
@@ -190,6 +190,7 @@ export class Heap<T> {
|
|
|
190
190
|
this.fixup(this.count());
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
/* eslint-disable no-bitwise */
|
|
193
194
|
private fixup(k: number) {
|
|
194
195
|
let _k = k;
|
|
195
196
|
while (_k > 1 && (this.comp.compare(this.L[_k >> 1], this.L[_k]) > 0)) {
|
|
@@ -216,6 +217,7 @@ export class Heap<T> {
|
|
|
216
217
|
_k = j;
|
|
217
218
|
}
|
|
218
219
|
}
|
|
220
|
+
/* eslint-enable no-bitwise */
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
export const enum RBColor {
|
package/src/localReference.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { assert } from "@fluidframework/common-utils";
|
|
6
7
|
import { Client } from "./client";
|
|
7
8
|
import {
|
|
8
9
|
ISegment,
|
|
@@ -133,8 +134,14 @@ export class LocalReferenceCollection {
|
|
|
133
134
|
if (!seg1.localRefs) {
|
|
134
135
|
seg1.localRefs = new LocalReferenceCollection(seg1);
|
|
135
136
|
}
|
|
137
|
+
assert(seg1.localRefs.refsByOffset.length === seg1.cachedLength, "LocalReferences array contains a gap");
|
|
136
138
|
seg1.localRefs.append(seg2.localRefs);
|
|
137
139
|
}
|
|
140
|
+
else if (seg1.localRefs) {
|
|
141
|
+
// Since creating the LocalReferenceCollection, we may have appended
|
|
142
|
+
// segments that had no local references. Account for them now by padding the array.
|
|
143
|
+
seg1.localRefs.refsByOffset.length += seg2.cachedLength;
|
|
144
|
+
}
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
public hierRefCount: number = 0;
|
package/src/mergeTree.ts
CHANGED
|
@@ -1035,10 +1035,6 @@ export class MergeTree {
|
|
|
1035
1035
|
|
|
1036
1036
|
private static readonly initBlockUpdateActions: BlockUpdateActions;
|
|
1037
1037
|
private static readonly theUnfinishedNode = <IMergeBlock>{ childCount: -1 };
|
|
1038
|
-
// WARNING:
|
|
1039
|
-
// Setting blockUpdateMarkers to false will result in eventual consistency issues
|
|
1040
|
-
// for property updates on markers when loading from snapshots
|
|
1041
|
-
private static readonly blockUpdateMarkers = true;
|
|
1042
1038
|
|
|
1043
1039
|
root: IMergeBlock;
|
|
1044
1040
|
private readonly blockUpdateActions: BlockUpdateActions = MergeTree.initBlockUpdateActions;
|
|
@@ -1059,12 +1055,7 @@ export class MergeTree {
|
|
|
1059
1055
|
}
|
|
1060
1056
|
|
|
1061
1057
|
private makeBlock(childCount: number) {
|
|
1062
|
-
|
|
1063
|
-
if (MergeTree.blockUpdateMarkers) {
|
|
1064
|
-
block = new HierMergeBlock(childCount);
|
|
1065
|
-
} else {
|
|
1066
|
-
block = new MergeBlock(childCount);
|
|
1067
|
-
}
|
|
1058
|
+
const block: MergeBlock = new HierMergeBlock(childCount);
|
|
1068
1059
|
block.ordinal = "";
|
|
1069
1060
|
return block;
|
|
1070
1061
|
}
|
package/src/partialLengths.ts
CHANGED
|
@@ -366,6 +366,8 @@ export class PartialSequenceLengths {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
if (seqPartialLen === undefined) {
|
|
369
|
+
// len will be assigned below, making this assertion true.
|
|
370
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
369
371
|
seqPartialLen = {
|
|
370
372
|
clientId,
|
|
371
373
|
seglen: seqSeglen,
|
package/src/snapshotChunks.ts
CHANGED
|
@@ -62,7 +62,11 @@ export interface IJSONSegmentWithMergeInfo {
|
|
|
62
62
|
json: IJSONSegment;
|
|
63
63
|
client?: string;
|
|
64
64
|
seq?: number;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated - use removedClientIds instead. this only exists for back-compat
|
|
67
|
+
*/
|
|
65
68
|
removedClient?: string;
|
|
69
|
+
removedClientIds?: string[];
|
|
66
70
|
removedSeq?: number;
|
|
67
71
|
}
|
|
68
72
|
|
package/src/snapshotLoader.ts
CHANGED
|
@@ -102,9 +102,20 @@ export class SnapshotLoader {
|
|
|
102
102
|
if (spec.removedSeq !== undefined) {
|
|
103
103
|
seg.removedSeq = spec.removedSeq;
|
|
104
104
|
}
|
|
105
|
+
// this format had a bug where it didn't store all the overlap clients
|
|
106
|
+
// this is for back compat, so we change the singular id to an array
|
|
107
|
+
// this will only cause problems if there is an overlapping delete
|
|
108
|
+
// spanning the snapshot, which should be rare
|
|
105
109
|
if (spec.removedClient !== undefined) {
|
|
106
110
|
seg.removedClientId = this.client.getOrAddShortClientId(spec.removedClient);
|
|
107
111
|
}
|
|
112
|
+
if (spec.removedClientIds !== undefined) {
|
|
113
|
+
seg.removedClientId = this.client.getOrAddShortClientId(spec.removedClientIds[0]);
|
|
114
|
+
if(spec.removedClientIds.length > 1) {
|
|
115
|
+
seg.removedClientOverlap = spec.removedClientIds.slice(1).map(
|
|
116
|
+
(sid)=> this.client.getOrAddShortClientId(sid));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
108
119
|
} else {
|
|
109
120
|
seg = this.client.specToSegment(spec);
|
|
110
121
|
seg.seq = UniversalSequenceNumber;
|
package/src/snapshotV1.ts
CHANGED
|
@@ -218,8 +218,17 @@ export class SnapshotV1 {
|
|
|
218
218
|
assert(segment.removedSeq !== UnassignedSequenceNumber && segment.removedSeq > minSeq,
|
|
219
219
|
0x065 /* "On removal info preservation, segment has invalid removed sequence number!" */);
|
|
220
220
|
raw.removedSeq = segment.removedSeq;
|
|
221
|
+
|
|
222
|
+
// back compat for when we split overlap and removed client
|
|
221
223
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
222
224
|
raw.removedClient = this.getLongClientId(segment.removedClientId!);
|
|
225
|
+
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
227
|
+
const removedClientIds = [segment.removedClientId!];
|
|
228
|
+
if(segment.removedClientOverlap !== undefined) {
|
|
229
|
+
removedClientIds.push(... segment.removedClientOverlap);
|
|
230
|
+
}
|
|
231
|
+
raw.removedClientIds = removedClientIds.map((id)=>this.getLongClientId(id));
|
|
223
232
|
}
|
|
224
233
|
|
|
225
234
|
// Sanity check that we are preserving either the seq < minSeq or a removed segment's info.
|