@fluid-experimental/tree 2.0.0-rc.2.0.6 → 2.0.0-rc.2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-report/experimental-tree.api.md +1 -1
- package/dist/SharedTree.d.ts +4 -2
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +16 -5
- package/dist/SharedTree.js.map +1 -1
- package/dist/migration-shim/migrationShim.js +1 -1
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/tree-alpha.d.ts +3 -1
- package/dist/tree-untrimmed.d.ts +3 -1
- package/lib/SharedTree.d.ts +4 -2
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +16 -5
- package/lib/SharedTree.js.map +1 -1
- package/lib/migration-shim/migrationShim.js +1 -1
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/package.json +21 -21
- package/src/SharedTree.ts +25 -6
- package/src/migration-shim/migrationShim.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/tree",
|
|
3
|
-
"version": "2.0.0-rc.2.0.
|
|
3
|
+
"version": "2.0.0-rc.2.0.7",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"main": "dist/index.js",
|
|
38
38
|
"types": "dist/index.d.ts",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fluid-internal/client-utils": ">=2.0.0-rc.2.0.
|
|
41
|
-
"@fluidframework/container-definitions": ">=2.0.0-rc.2.0.
|
|
42
|
-
"@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.
|
|
43
|
-
"@fluidframework/core-utils": ">=2.0.0-rc.2.0.
|
|
44
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-rc.2.0.
|
|
45
|
-
"@fluidframework/id-compressor": ">=2.0.0-rc.2.0.
|
|
40
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
41
|
+
"@fluidframework/container-definitions": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
42
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
43
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
44
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
45
|
+
"@fluidframework/id-compressor": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
46
46
|
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
47
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.
|
|
48
|
-
"@fluidframework/shared-object-base": ">=2.0.0-rc.2.0.
|
|
49
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.
|
|
50
|
-
"@fluidframework/tree": ">=2.0.0-rc.2.0.
|
|
47
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
48
|
+
"@fluidframework/shared-object-base": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
49
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
50
|
+
"@fluidframework/tree": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
51
51
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
52
52
|
"buffer": "^6.0.3",
|
|
53
53
|
"denque": "^1.5.1",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
59
|
-
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.
|
|
60
|
-
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.2.0.
|
|
61
|
-
"@fluid-private/test-drivers": ">=2.0.0-rc.2.0.
|
|
59
|
+
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
60
|
+
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
61
|
+
"@fluid-private/test-drivers": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
62
62
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
63
63
|
"@fluidframework/build-common": "^2.0.3",
|
|
64
64
|
"@fluidframework/build-tools": "^0.34.0",
|
|
65
|
-
"@fluidframework/container-definitions": ">=2.0.0-rc.2.0.
|
|
66
|
-
"@fluidframework/container-loader": ">=2.0.0-rc.2.0.
|
|
67
|
-
"@fluidframework/container-runtime": ">=2.0.0-rc.2.0.
|
|
65
|
+
"@fluidframework/container-definitions": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
66
|
+
"@fluidframework/container-loader": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
67
|
+
"@fluidframework/container-runtime": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
68
68
|
"@fluidframework/eslint-config-fluid": "^4.0.0",
|
|
69
|
-
"@fluidframework/runtime-utils": ">=2.0.0-rc.2.0.
|
|
70
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.2.0.
|
|
71
|
-
"@fluidframework/test-utils": ">=2.0.0-rc.2.0.
|
|
72
|
-
"@fluidframework/undo-redo": ">=2.0.0-rc.2.0.
|
|
69
|
+
"@fluidframework/runtime-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
70
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
71
|
+
"@fluidframework/test-utils": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
72
|
+
"@fluidframework/undo-redo": ">=2.0.0-rc.2.0.7 <2.0.0-rc.2.1.0",
|
|
73
73
|
"@microsoft/api-extractor": "^7.42.3",
|
|
74
74
|
"@types/chai": "^4.0.0",
|
|
75
75
|
"@types/lru-cache": "^5.1.0",
|
package/src/SharedTree.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
IChannelFactory,
|
|
13
13
|
IChannelAttributes,
|
|
14
14
|
IChannelServices,
|
|
15
|
+
IChannel,
|
|
15
16
|
} from '@fluidframework/datastore-definitions';
|
|
16
17
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
17
18
|
import {
|
|
@@ -245,7 +246,7 @@ export class SharedTreeFactory implements IChannelFactory {
|
|
|
245
246
|
id: string,
|
|
246
247
|
services: IChannelServices,
|
|
247
248
|
_channelAttributes: Readonly<IChannelAttributes>
|
|
248
|
-
): Promise<
|
|
249
|
+
): Promise<IChannel> {
|
|
249
250
|
const sharedTree = this.createSharedTree(runtime, id);
|
|
250
251
|
await sharedTree.load(services);
|
|
251
252
|
return sharedTree;
|
|
@@ -1066,14 +1067,28 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1066
1067
|
// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)
|
|
1067
1068
|
switch (op.version) {
|
|
1068
1069
|
case WriteFormat.v0_0_2:
|
|
1069
|
-
return this.encoder_0_0_2.decodeEditOp(op, (
|
|
1070
|
+
return this.encoder_0_0_2.decodeEditOp(op, this.encodeSemiSerializedEdit.bind(this), this);
|
|
1070
1071
|
case WriteFormat.v0_1_1:
|
|
1071
|
-
return this.encoder_0_1_1.decodeEditOp(
|
|
1072
|
+
return this.encoder_0_1_1.decodeEditOp(
|
|
1073
|
+
op,
|
|
1074
|
+
this.encodeSemiSerializedEdit.bind(this),
|
|
1075
|
+
this.idNormalizer,
|
|
1076
|
+
this.interner
|
|
1077
|
+
);
|
|
1072
1078
|
default:
|
|
1073
1079
|
fail('Unknown op version');
|
|
1074
1080
|
}
|
|
1075
1081
|
}
|
|
1076
1082
|
|
|
1083
|
+
private encodeSemiSerializedEdit<T>(semiSerializedEdit: Edit<T>): Edit<T> {
|
|
1084
|
+
// semiSerializedEdit may have handles which have been replaced by `serializer.encode`.
|
|
1085
|
+
// Since there is no API to un-replace them except via parse, re-stringify the edit, then parse it.
|
|
1086
|
+
// Stringify using JSON, not IFluidSerializer since OPs use JSON directly.
|
|
1087
|
+
// TODO:Performance:#48025: Avoid this serialization round trip.
|
|
1088
|
+
const encodedEdit: Edit<T> = this.serializer.parse(JSON.stringify(semiSerializedEdit));
|
|
1089
|
+
return encodedEdit;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1077
1092
|
private processSequencedEdit(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage): void {
|
|
1078
1093
|
const { id: editId } = edit;
|
|
1079
1094
|
const wasLocalEdit = this.editLog.isLocalEdit(editId);
|
|
@@ -1366,13 +1381,13 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1366
1381
|
if (this.isAttached()) {
|
|
1367
1382
|
switch (this.writeFormat) {
|
|
1368
1383
|
case WriteFormat.v0_0_2:
|
|
1369
|
-
this.submitOp(this.encoder_0_0_2.encodeEditOp(edit, (
|
|
1384
|
+
this.submitOp(this.encoder_0_0_2.encodeEditOp(edit, this.serializeEdit.bind(this), this));
|
|
1370
1385
|
break;
|
|
1371
1386
|
case WriteFormat.v0_1_1:
|
|
1372
1387
|
this.submitOp(
|
|
1373
1388
|
this.encoder_0_1_1.encodeEditOp(
|
|
1374
1389
|
edit,
|
|
1375
|
-
(
|
|
1390
|
+
this.serializeEdit.bind(this),
|
|
1376
1391
|
this.idCompressor.takeNextCreationRange(),
|
|
1377
1392
|
this.idNormalizer,
|
|
1378
1393
|
this.interner
|
|
@@ -1385,6 +1400,10 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1385
1400
|
}
|
|
1386
1401
|
}
|
|
1387
1402
|
|
|
1403
|
+
private serializeEdit<TChange>(preparedEdit: Edit<TChange>): Edit<TChange> {
|
|
1404
|
+
return this.serializer.encode(preparedEdit, this.handle) as Edit<TChange>;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1388
1407
|
/** A type-safe `submitLocalMessage` wrapper to enforce op format */
|
|
1389
1408
|
private submitOp(content: SharedTreeOp | SharedTreeOp_0_0_2, localOpMetadata: unknown = undefined): void {
|
|
1390
1409
|
assert(
|
|
@@ -1472,7 +1491,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1472
1491
|
|
|
1473
1492
|
stashedEdit = this.encoder_0_1_1.decodeEditOp(
|
|
1474
1493
|
sharedTreeOp,
|
|
1475
|
-
(
|
|
1494
|
+
this.encodeSemiSerializedEdit.bind(this),
|
|
1476
1495
|
normalizer,
|
|
1477
1496
|
this.interner
|
|
1478
1497
|
);
|
|
@@ -199,12 +199,12 @@ export class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent
|
|
|
199
199
|
this.runtime.attachState === AttachState.Detached
|
|
200
200
|
? new NoDeltasChannelServices(services)
|
|
201
201
|
: this.generateShimServicesOnce(services);
|
|
202
|
-
this._legacyTree = await this.legacyTreeFactory.load(
|
|
202
|
+
this._legacyTree = (await this.legacyTreeFactory.load(
|
|
203
203
|
this.runtime,
|
|
204
204
|
this.id,
|
|
205
205
|
shimServices,
|
|
206
206
|
this.legacyTreeFactory.attributes
|
|
207
|
-
);
|
|
207
|
+
)) as LegacySharedTree;
|
|
208
208
|
}
|
|
209
209
|
public create(): void {
|
|
210
210
|
this._legacyTree = this.legacyTreeFactory.create(this.runtime, this.id);
|