@fluid-experimental/property-dds 2.0.2 → 2.1.0-276326
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/property-dds.alpha.api.md +0 -14
- package/api-report/property-dds.beta.api.md +0 -14
- package/api-report/property-dds.public.api.md +0 -14
- package/dist/propertyTree.d.ts.map +1 -1
- package/dist/propertyTree.js +11 -12
- package/dist/propertyTree.js.map +1 -1
- package/lib/propertyTree.d.ts.map +1 -1
- package/lib/propertyTree.js +1 -2
- package/lib/propertyTree.js.map +1 -1
- package/package.json +20 -21
- package/src/propertyTree.ts +4 -3
|
@@ -4,20 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IChannelAttributes } from '@fluidframework/datastore-definitions/internal';
|
|
8
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions/internal';
|
|
9
|
-
import { IChannelServices } from '@fluidframework/datastore-definitions/internal';
|
|
10
|
-
import { IChannelStorageService } from '@fluidframework/datastore-definitions/internal';
|
|
11
|
-
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions/internal';
|
|
12
|
-
import { IFluidSerializer } from '@fluidframework/shared-object-base/internal';
|
|
13
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
15
|
-
import { IsoBuffer } from '@fluid-internal/client-utils';
|
|
16
|
-
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions/internal';
|
|
17
|
-
import { NodeProperty } from '@fluid-experimental/property-properties';
|
|
18
|
-
import { SharedObject } from '@fluidframework/shared-object-base/internal';
|
|
19
|
-
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
20
|
-
|
|
21
7
|
// (No @packageDocumentation comment for this package)
|
|
22
8
|
|
|
23
9
|
```
|
|
@@ -4,20 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IChannelAttributes } from '@fluidframework/datastore-definitions/internal';
|
|
8
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions/internal';
|
|
9
|
-
import { IChannelServices } from '@fluidframework/datastore-definitions/internal';
|
|
10
|
-
import { IChannelStorageService } from '@fluidframework/datastore-definitions/internal';
|
|
11
|
-
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions/internal';
|
|
12
|
-
import { IFluidSerializer } from '@fluidframework/shared-object-base/internal';
|
|
13
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
15
|
-
import { IsoBuffer } from '@fluid-internal/client-utils';
|
|
16
|
-
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions/internal';
|
|
17
|
-
import { NodeProperty } from '@fluid-experimental/property-properties';
|
|
18
|
-
import { SharedObject } from '@fluidframework/shared-object-base/internal';
|
|
19
|
-
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
20
|
-
|
|
21
7
|
// (No @packageDocumentation comment for this package)
|
|
22
8
|
|
|
23
9
|
```
|
|
@@ -4,20 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { IChannelAttributes } from '@fluidframework/datastore-definitions/internal';
|
|
8
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions/internal';
|
|
9
|
-
import { IChannelServices } from '@fluidframework/datastore-definitions/internal';
|
|
10
|
-
import { IChannelStorageService } from '@fluidframework/datastore-definitions/internal';
|
|
11
|
-
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions/internal';
|
|
12
|
-
import { IFluidSerializer } from '@fluidframework/shared-object-base/internal';
|
|
13
|
-
import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
|
|
14
|
-
import { ISharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
15
|
-
import { IsoBuffer } from '@fluid-internal/client-utils';
|
|
16
|
-
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions/internal';
|
|
17
|
-
import { NodeProperty } from '@fluid-experimental/property-properties';
|
|
18
|
-
import { SharedObject } from '@fluidframework/shared-object-base/internal';
|
|
19
|
-
import { SharedObjectKind } from '@fluidframework/shared-object-base/internal';
|
|
20
|
-
|
|
21
7
|
// (No @packageDocumentation comment for this package)
|
|
22
8
|
|
|
23
9
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTree.d.ts","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAEN,YAAY,EAEZ,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkC,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,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,YAAY,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"propertyTree.d.ts","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAEN,YAAY,EAEZ,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkC,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,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,YAAY,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,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,kBAAkB;IAgG1B,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAoB7D,SAAS,CAAC,cAAc,IAAI,IAAI;CAGhC"}
|
package/dist/propertyTree.js
CHANGED
|
@@ -16,12 +16,11 @@ const internal_1 = require("@fluidframework/driver-definitions/internal");
|
|
|
16
16
|
const internal_2 = require("@fluidframework/runtime-utils/internal");
|
|
17
17
|
const internal_3 = require("@fluidframework/shared-object-base/internal");
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
|
-
const fastest_json_copy_1 = require("fastest-json-copy");
|
|
20
19
|
const lodash_1 = __importDefault(require("lodash"));
|
|
21
20
|
const msgpackr_1 = require("msgpackr");
|
|
22
21
|
const uuid_1 = require("uuid");
|
|
23
22
|
// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.
|
|
24
|
-
const { isEmpty, findIndex, find, isEqual, range } = lodash_1.default;
|
|
23
|
+
const { isEmpty, findIndex, find, isEqual, range, cloneDeep } = lodash_1.default;
|
|
25
24
|
const propertyTreeFactory_js_1 = require("./propertyTreeFactory.js");
|
|
26
25
|
const defaultEncDec = {
|
|
27
26
|
messageEncoder: {
|
|
@@ -176,7 +175,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
176
175
|
};
|
|
177
176
|
this._applyLocalChangeSet(change);
|
|
178
177
|
// Queue the op for transmission to the Fluid service.
|
|
179
|
-
const transferChange = this.encodeMessage((
|
|
178
|
+
const transferChange = this.encodeMessage(cloneDeep(change));
|
|
180
179
|
if (this.transmissionsHaveBeenStopped) {
|
|
181
180
|
this.enqueuedMessages.push(transferChange);
|
|
182
181
|
}
|
|
@@ -227,7 +226,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
227
226
|
processCore(message, local, localOpMetadata) {
|
|
228
227
|
if (message.type === internal_1.MessageType.Operation &&
|
|
229
228
|
message.sequenceNumber > this.skipSequenceNumber) {
|
|
230
|
-
const change = this.decodeMessage((
|
|
229
|
+
const change = this.decodeMessage(cloneDeep(message.contents));
|
|
231
230
|
const content = {
|
|
232
231
|
...change,
|
|
233
232
|
sequenceNumber: message.sequenceNumber,
|
|
@@ -236,7 +235,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
236
235
|
case 0 /* OpKind.ChangeSet */:
|
|
237
236
|
// If the op originated locally from this client, we've already accounted for it
|
|
238
237
|
// by advancing the state. Otherwise, advance the PRNG now.
|
|
239
|
-
this._applyRemoteChangeSet((
|
|
238
|
+
this._applyRemoteChangeSet(cloneDeep(content));
|
|
240
239
|
break;
|
|
241
240
|
default:
|
|
242
241
|
break;
|
|
@@ -459,7 +458,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
459
458
|
if (isPartialCheckoutActive && this.options.paths) {
|
|
460
459
|
this.remoteTipView = property_changeset_1.Utils.getFilteredChangeSetByPaths(this.remoteTipView, this.options.paths);
|
|
461
460
|
}
|
|
462
|
-
this.tipView = (
|
|
461
|
+
this.tipView = cloneDeep(this.remoteTipView);
|
|
463
462
|
this.skipSequenceNumber = 0;
|
|
464
463
|
}
|
|
465
464
|
else {
|
|
@@ -473,7 +472,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
473
472
|
materializedView = property_changeset_1.Utils.getFilteredChangeSetByPaths(materializedView, this.options.paths);
|
|
474
473
|
}
|
|
475
474
|
this.tipView = materializedView;
|
|
476
|
-
this.remoteTipView = (
|
|
475
|
+
this.remoteTipView = cloneDeep(this.tipView);
|
|
477
476
|
this.remoteChanges = [];
|
|
478
477
|
let missingDeltas = [];
|
|
479
478
|
const firstDelta = Math.min(commitMetadata.minimumSequenceNumber, summaryMinimumSequenceNumber);
|
|
@@ -533,7 +532,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
533
532
|
}
|
|
534
533
|
}
|
|
535
534
|
_applyRemoteChangeSet(change) {
|
|
536
|
-
this.unrebasedRemoteChanges[change.guid] = (
|
|
535
|
+
this.unrebasedRemoteChanges[change.guid] = cloneDeep(change);
|
|
537
536
|
// This is the first message in the history of the document.
|
|
538
537
|
if (this.remoteChanges.length !== 0) {
|
|
539
538
|
(0, property_changeset_1.rebaseToRemoteChanges)(change, this.getUnrebasedChange.bind(this), this.getRebasedChanges.bind(this));
|
|
@@ -606,13 +605,13 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
606
605
|
}
|
|
607
606
|
}
|
|
608
607
|
else {
|
|
609
|
-
rebaseBaseChangeSet = (
|
|
608
|
+
rebaseBaseChangeSet = cloneDeep(change.changeSet);
|
|
610
609
|
}
|
|
611
610
|
for (let i = 0; i < this.localChanges.length; i++) {
|
|
612
611
|
// Make sure we never receive changes out of order
|
|
613
612
|
console.assert(this.localChanges[i].guid !== change.guid);
|
|
614
613
|
const rebaseMetaInformation = new Map();
|
|
615
|
-
const copiedChangeSet = new property_changeset_1.ChangeSet((
|
|
614
|
+
const copiedChangeSet = new property_changeset_1.ChangeSet(cloneDeep(this.localChanges[i].changeSet));
|
|
616
615
|
new property_changeset_1.ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(this.localChanges[i].changeSet, conflicts, {
|
|
617
616
|
applyAfterMetaInformation: rebaseMetaInformation,
|
|
618
617
|
});
|
|
@@ -643,7 +642,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
643
642
|
deltaToTipCS.applyChangeSet(rebaseBaseChangeSet);
|
|
644
643
|
// Update the tip view
|
|
645
644
|
if (!this.tipView) {
|
|
646
|
-
this.tipView = (
|
|
645
|
+
this.tipView = cloneDeep(this.remoteTipView);
|
|
647
646
|
const changeSet = new property_changeset_1.ChangeSet(this.tipView);
|
|
648
647
|
changeSet.applyChangeSet(accumulatedChanges);
|
|
649
648
|
}
|
|
@@ -664,7 +663,7 @@ class SharedPropertyTree extends internal_3.SharedObject {
|
|
|
664
663
|
// localChanges array and submits this up-to-date version instead of the old operation.
|
|
665
664
|
const rebasedOperation = find(this.localChanges, (op) => op.guid === content.guid);
|
|
666
665
|
if (rebasedOperation) {
|
|
667
|
-
this.submitLocalMessage((
|
|
666
|
+
this.submitLocalMessage(cloneDeep(rebasedOperation), localOpMetadata);
|
|
668
667
|
}
|
|
669
668
|
else {
|
|
670
669
|
// Could this happen or is there a guard that we will never resubmit an already submitted op?
|
package/dist/propertyTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTree.js","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+EAIgD;AAChD,iFAIiD;AACjD,+DAAyF;AACzF,iFAAoE;AAOpE,0EAGqD;AAErD,qEAA4E;AAC5E,0EAA6F;AAC7F,kDAA0B;AAC1B,yDAAsD;AACtD,oDAA4B;AAC5B,uCAAiC;AACjC,+BAAoC;AAEpC,4FAA4F;AAC5F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,gBAAM,CAAC;AAE5D,qEAA+D;AA2F/D,MAAM,aAAa,GAA8B;IAChD,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,GAAyB,EAAE,EAAE,CAAC,GAAG;QAC1C,MAAM,EAAE,CAAC,GAAyB,EAAE,EAAE,CAAC,GAAG;KAC1C;IACD,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,OAAyB,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,gBAAK,EAAE,CAAC;YAC1B,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,iBAAiB,CAAC;QAC1B,CAAC;QACD,MAAM,EAAE,CAAC,iBAAiB,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,IAAI,gBAAK,EAAE,CAAC;YAC1B,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YACxD,OAAO,eAAmC,CAAC;QAC5C,CAAC;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Licensed under the MIT License.\n */\n\nimport {\n\tChangeSet,\n\tUtils as ChangeSetUtils,\n\trebaseToRemoteChanges,\n} from \"@fluid-experimental/property-changeset\";\nimport {\n\tBaseProperty,\n\tNodeProperty,\n\tPropertyFactory,\n} from \"@fluid-experimental/property-properties\";\nimport { IsoBuffer, bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport { SharedObject, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport axios from \"axios\";\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport lodash from \"lodash\";\nimport { Packr } from \"msgpackr\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.\nconst { isEmpty, findIndex, find, isEqual, range } = lodash;\n\nimport { PropertyTreeFactory } from \"./propertyTreeFactory.js\";\n\n/**\n * @internal\n */\nexport type SerializedChangeSet = any;\n\n/**\n * @internal\n */\nexport type Metadata = any;\n\ntype FetchUnrebasedChangeFn = (guid: string) => IRemotePropertyTreeMessage;\ntype FetchRebasedChangesFn = (startGuid: string, endGuid?: string) => IPropertyTreeMessage[];\n\n/**\n * @internal\n */\nexport const enum OpKind {\n\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\tChangeSet = 0,\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeMessage {\n\top: OpKind;\n\tchangeSet: SerializedChangeSet;\n\tmetadata: Metadata;\n\tguid: string;\n\treferenceGuid: string;\n\tremoteHeadGuid: string;\n\tlocalBranchStart: string | undefined;\n\trebaseMetaInformation?: Map<any, any>;\n\tuseMH?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IRemotePropertyTreeMessage extends IPropertyTreeMessage {\n\tsequenceNumber: number;\n}\ninterface ISnapshot {\n\tbranchGuid: string;\n\tsummaryMinimumSequenceNumber: number;\n\tuseMH: boolean;\n\tnumChunks: number;\n}\n/**\n * @internal\n */\nexport interface ISnapshotSummary {\n\tremoteTipView?: SerializedChangeSet;\n\tremoteChanges?: IPropertyTreeMessage[];\n\tunrebasedRemoteChanges?: Record<string, IRemotePropertyTreeMessage>;\n\tremoteHeadGuid: string;\n}\n\n/**\n * @internal\n */\nexport interface SharedPropertyTreeOptions {\n\tpaths?: string[];\n\tclientFiltering?: boolean;\n\tuseMH?: boolean;\n\tdisablePartialCheckout?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISharedPropertyTreeEncDec {\n\tmessageEncoder: {\n\t\tencode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t\tdecode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t};\n\tsummaryEncoder: {\n\t\tencode: (ISnapshotSummary) => IsoBuffer;\n\t\tdecode: (IsoBuffer) => ISnapshotSummary;\n\t};\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeConfig {\n\tencDec: ISharedPropertyTreeEncDec;\n}\n\nconst defaultEncDec: ISharedPropertyTreeEncDec = {\n\tmessageEncoder: {\n\t\tencode: (msg: IPropertyTreeMessage) => msg,\n\t\tdecode: (msg: IPropertyTreeMessage) => msg,\n\t},\n\tsummaryEncoder: {\n\t\tencode: (summary: ISnapshotSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst serializedSummary = packr.pack(summary);\n\t\t\treturn serializedSummary;\n\t\t},\n\t\tdecode: (serializedSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst snapshotSummary = packr.unpack(serializedSummary);\n\t\t\treturn snapshotSummary as ISnapshotSummary;\n\t\t},\n\t},\n};\n\n/**\n * DDS that models a tree made of objects with properties under string keys.\n * @internal\n */\nexport class SharedPropertyTree extends SharedObject {\n\ttipView: SerializedChangeSet = {};\n\tremoteTipView: SerializedChangeSet = {};\n\tlocalChanges: IPropertyTreeMessage[] = [];\n\tremoteChanges: IPropertyTreeMessage[] = [];\n\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\ttransmissionsHaveBeenStopped = false;\n\tenqueuedMessages: IPropertyTreeMessage[] = [];\n\tnotificationDelayScope: number = 0;\n\t_root: any = PropertyFactory.create(\"NodeProperty\");\n\toptions: SharedPropertyTreeOptions;\n\tskipSequenceNumber: number = -1;\n\theadCommitGuid: string = \"\";\n\tuseMH: boolean = false;\n\tpropertyTreeConfig: IPropertyTreeConfig;\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptions: SharedPropertyTreeOptions,\n\t\tpropertyTreeConfig: IPropertyTreeConfig = { encDec: defaultEncDec },\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_propertyTree_\");\n\n\t\tthis.options = options;\n\t\t// Quick hack to let the root be aware of the DDS hosting it.\n\t\tthis._root._tree = this;\n\n\t\t// By default, we currently don't use the MH\n\t\tthis.useMH = options.useMH ?? false;\n\t\tthis.propertyTreeConfig = propertyTreeConfig;\n\t}\n\n\t/**\n\t * Create a new shared cell\n\t *\n\t * @param runtime - data store runtime the new shared map belongs to\n\t * @param id - optional name of the shared map\n\t * @returns newly create shared map (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n\t\treturn runtime.createChannel(id, PropertyTreeFactory.Type) as SharedPropertyTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedDie to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedDie\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new PropertyTreeFactory();\n\t}\n\n\t/**\n\t * in case of partial checkout we want to send the paths we are interested in once we are connected\n\t */\n\tprotected onConnect() {\n\t\t// on connect we scope all deltas such that we only get relevant changes\n\t\t// since we know the paths already at construction time this is okay\n\t\tthis.scopeFutureDeltasToPaths(this.options.paths);\n\t}\n\n\tprivate scopeFutureDeltasToPaths(paths?: string[]) {\n\t\t// Backdoor to emit \"partial_checkout\" events on the socket. The delta manager at container runtime layer is\n\t\t// a proxy and the delta manager at the container context layer is yet another proxy, so account for that.\n\t\tif (!this.options.disablePartialCheckout) {\n\t\t\tlet dm = (this.deltaManager as any).deltaManager;\n\t\t\tif (dm.deltaManager !== undefined) {\n\t\t\t\tdm = dm.deltaManager;\n\t\t\t}\n\t\t\tconst socket = dm.connectionManager.connection.socket;\n\t\t\tsocket.emit(\"partial_checkout\", { paths });\n\t\t}\n\t}\n\n\tpublic _reportDirtinessToView() {\n\t\t// Check whether anybody is listening. If not, we don't want to pay the price\n\t\t// for the serialization of the data structure\n\t\tif (this.listenerCount(\"localModification\") > 0) {\n\t\t\tconst changes = this._root._serialize(\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY,\n\t\t\t);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t\tconst _changeSet = new ChangeSet(changes);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t}\n\t}\n\n\tpublic get changeSet(): SerializedChangeSet {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.tipView;\n\t}\n\n\tpublic get activeCommit(): IPropertyTreeMessage {\n\t\treturn this.localChanges.length > 0\n\t\t\t? this.localChanges[this.localChanges.length - 1]\n\t\t\t: this.remoteChanges[this.remoteChanges.length - 1];\n\t}\n\tpublic get root(): NodeProperty {\n\t\treturn this._root as NodeProperty;\n\t}\n\n\tpublic commit(metadata?: Metadata, submitEmptyChange?: boolean) {\n\t\tconst changes = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\n\t\tlet doSubmit = !!submitEmptyChange;\n\n\t\t// if no override provided dont submit unless metadata are provided\n\t\tif (submitEmptyChange === undefined) {\n\t\t\tdoSubmit = metadata !== undefined;\n\t\t}\n\n\t\tif (doSubmit || !isEmpty(changes)) {\n\t\t\tthis.applyChangeSet(changes, metadata || {});\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\t/**\n\t * This method encodes the given message to the transfer form\n\t * @param change - The message to be encoded.\n\t */\n\tprivate encodeMessage(change: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.encode(change);\n\t}\n\n\t/**\n\t * This method decodes message from the transfer form.\n\t * @param transferChange - The message to be decoded.\n\t */\n\tprivate decodeMessage(transferChange: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.decode(transferChange);\n\t}\n\n\tprivate applyChangeSet(changeSet: SerializedChangeSet, metadata: Metadata) {\n\t\tconst _changeSet = new ChangeSet(changeSet);\n\t\t_changeSet._toReversibleChangeSet(this.tipView);\n\n\t\tthis.updateRemoteHeadGuid();\n\n\t\tconst change = {\n\t\t\top: OpKind.ChangeSet,\n\t\t\tchangeSet,\n\t\t\tmetadata,\n\t\t\tguid: uuidv4(),\n\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\treferenceGuid:\n\t\t\t\tthis.localChanges.length > 0\n\t\t\t\t\t? this.localChanges[this.localChanges.length - 1].guid\n\t\t\t\t\t: this.headCommitGuid,\n\t\t\tlocalBranchStart: this.localChanges.length > 0 ? this.localChanges[0].guid : undefined,\n\t\t\tuseMH: this.useMH,\n\t\t};\n\t\tthis._applyLocalChangeSet(change);\n\t\t// Queue the op for transmission to the Fluid service.\n\t\tconst transferChange = this.encodeMessage(cloneDeep(change));\n\t\tif (this.transmissionsHaveBeenStopped) {\n\t\t\tthis.enqueuedMessages.push(transferChange);\n\t\t} else {\n\t\t\tthis.submitLocalMessage(transferChange);\n\t\t}\n\t}\n\n\tstopTransmission(stop: boolean) {\n\t\tthis.transmissionsHaveBeenStopped = stop;\n\t\tif (stop === false) {\n\t\t\tfor (const message of this.enqueuedMessages) {\n\t\t\t\tthis.submitLocalMessage(message);\n\t\t\t}\n\t\t\tthis.enqueuedMessages = [];\n\t\t}\n\t}\n\t/**\n\t * Delays notifications until popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic pushNotificationDelayScope() {\n\t\t// set the scope counter\n\t\tthis.notificationDelayScope++;\n\n\t\t// If we reach 0, we have to report unreported changes\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tthis._root._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Re-enables notifications when popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic popNotificationDelayScope() {\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tconsole.error(\"Unbalanced push/pop calls.\");\n\t\t}\n\t\tthis.notificationDelayScope--;\n\t\tthis._root._reportDirtinessToView();\n\t}\n\n\t/**\n\t * Process an operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\tmessage.sequenceNumber > this.skipSequenceNumber\n\t\t) {\n\t\t\tconst change: IPropertyTreeMessage = this.decodeMessage(cloneDeep(message.contents));\n\t\t\tconst content: IRemotePropertyTreeMessage = {\n\t\t\t\t...change,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t};\n\t\t\tswitch (content.op) {\n\t\t\t\tcase OpKind.ChangeSet:\n\t\t\t\t\t// If the op originated locally from this client, we've already accounted for it\n\t\t\t\t\t// by advancing the state. Otherwise, advance the PRNG now.\n\t\t\t\t\tthis._applyRemoteChangeSet(cloneDeep(content));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addRemoteChange(change: IPropertyTreeMessage) {\n\t\tthis.remoteChanges.push(change);\n\t\tthis.updateRemoteHeadGuid();\n\t}\n\n\tprivate updateRemoteHeadGuid() {\n\t\tthis.headCommitGuid =\n\t\t\tthis.remoteChanges.length > 0\n\t\t\t\t? this.remoteChanges[this.remoteChanges.length - 1].guid\n\t\t\t\t: this.headCommitGuid;\n\t}\n\n\tpublic static prune(\n\t\tminimumSequenceNumber: number,\n\t\tremoteChanges: IPropertyTreeMessage[],\n\t\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage>,\n\t\tremoteHeadGuid: string,\n\t) {\n\t\t// for faster lookup of remote change guids\n\t\tconst remoteChangeMap = new Map<string, number>();\n\t\tremoteChanges.forEach((change, index) => {\n\t\t\tremoteChangeMap.set(change.guid, index);\n\t\t});\n\n\t\t// we will track visited nodes\n\t\tconst visitedUnrebasedRemoteChanges = new Set<string>();\n\t\tconst visitedRemoteChanges = new Set<string>();\n\n\t\tfor (const id of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tconst unrebasedChange = unrebasedRemoteChanges[id];\n\n\t\t\t// we are only interested in changes that are newer than the sequence number\n\t\t\t// and that were not yet visited previously\n\t\t\tif (\n\t\t\t\tunrebasedChange.sequenceNumber >= minimumSequenceNumber &&\n\t\t\t\t!visitedUnrebasedRemoteChanges.has(unrebasedChange.guid)\n\t\t\t) {\n\t\t\t\t// we visited that unrebased change and mark it as visited\n\t\t\t\tvisitedUnrebasedRemoteChanges.add(unrebasedChange.guid);\n\n\t\t\t\tlet visitor = unrebasedChange;\n\t\t\t\t// we will walk along the commit chain until we hit a remote change or a visited unrebased commit\n\t\t\t\t// at that point we can skip since we already traced the rest of the commit chain\n\t\t\t\twhile (\n\t\t\t\t\tvisitor.remoteHeadGuid !== visitor.referenceGuid ||\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tconst guid = visitor.referenceGuid;\n\t\t\t\t\tif (guid === \"\" || guid === remoteHeadGuid) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// since the change is not in remote it must be in unrebased\n\t\t\t\t\tvisitor = unrebasedRemoteChanges[visitor.referenceGuid];\n\t\t\t\t\tif (!visitor) {\n\t\t\t\t\t\tthrow new Error(`no visitor found for guid \"${guid}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.add(visitor.guid);\n\t\t\t\t}\n\t\t\t\t// if we exited the loop because we hit a remote change than add it as visited\n\t\t\t\tif (\n\t\t\t\t\tvisitor.remoteHeadGuid === visitor.referenceGuid &&\n\t\t\t\t\tremoteChangeMap.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tvisitedRemoteChanges.add(visitor.referenceGuid);\n\t\t\t\t}\n\n\t\t\t\t// If we have a change that refers to the start of the history (remoteHeadGuid === \"\" or the\n\t\t\t\t// provided remote head guid), we have to keep all remote Changes until this change has been processed\n\t\t\t\tif (visitor.remoteHeadGuid === \"\" || visitor.remoteHeadGuid === remoteHeadGuid) {\n\t\t\t\t\tvisitedRemoteChanges.add(remoteChanges[0].guid);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlet pruned = 0;\n\t\t// we can now filter the unrebased changes by removing any changes\n\t\t// we have not visited at all during our traversal\n\t\tconst prunedUnrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\t\tfor (const key of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tif (visitedUnrebasedRemoteChanges.has(key)) {\n\t\t\t\tprunedUnrebasedRemoteChanges[key] = unrebasedRemoteChanges[key];\n\t\t\t} else {\n\t\t\t\tpruned++;\n\t\t\t}\n\t\t}\n\n\t\t// find minimum index\n\t\tconst minIndex = Math.min(\n\t\t\t...[...visitedRemoteChanges].map((key) => remoteChangeMap.get(key) as number),\n\t\t);\n\n\t\tconst prunedRemoteChanges = remoteChanges.slice(minIndex);\n\t\tpruned += minIndex;\n\n\t\treturn {\n\t\t\tremoteChanges: prunedRemoteChanges,\n\t\t\tunrebasedRemoteChanges: prunedUnrebasedRemoteChanges,\n\t\t\tprunedCount: pruned,\n\t\t};\n\t}\n\tpublic pruneHistory() {\n\t\tconst msn = this.deltaManager.minimumSequenceNumber;\n\n\t\tlet lastKnownRemoteGuid = this.headCommitGuid;\n\t\t// We use the reference GUID of the first change in the list\n\t\t// of remote changes as lastKnownRemoteGuid, because there\n\t\t// might still be unrebased changes that reference this GUID\n\t\t// as referenceGUID / remoteHeadGuid and if this happens\n\t\t// we must make sure we preserve the remote changes and\n\t\t// unrebased remote changes\n\t\tif (this.remoteChanges.length > 0) {\n\t\t\tlastKnownRemoteGuid = this.remoteChanges[0].referenceGuid;\n\t\t}\n\n\t\tconst { remoteChanges, unrebasedRemoteChanges } = SharedPropertyTree.prune(\n\t\t\tmsn,\n\t\t\tthis.remoteChanges,\n\t\t\tthis.unrebasedRemoteChanges,\n\t\t\tlastKnownRemoteGuid,\n\t\t);\n\n\t\tthis.remoteChanges = remoteChanges;\n\t\tthis.unrebasedRemoteChanges = unrebasedRemoteChanges;\n\t}\n\n\t/**\n\t * This method encodes the local summary (snapshot) object into the serialized form.\n\t * @param summary - The local summary (snapshot)representation.\n\t * @returns The serialized summary representation.\n\t */\n\tprivate encodeSummary(summary: ISnapshotSummary) {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.encode(summary);\n\t}\n\n\t/**\n\t * This method decodes the serialized form of the summary into the local summary (snapshot) object.\n\t * @param serializedSummary - The serialized summary representation.\n\t * @returns The local summary (snapshot)representation.\n\t */\n\tprivate decodeSummary(serializedSummary): ISnapshotSummary {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.decode(serializedSummary);\n\t}\n\n\t/**\n\t * This method writes the log message if the logging is enabled in the extended DDS.\n\t * The logging is not enabled in the default Property DDS\n\t * @param message - The message to be logged.\n\t */\n\tprotected logIfEnabled(message) {}\n\n\t/**\n\t * This method encodes the binary representation of the\n\t * blob.\n\t * @param blob - The binary representation of the blob.\n\t * @returns The encoded representation of the blob.\n\t */\n\tprivate encodeSummaryBlob(blob: ArrayBuffer): any {\n\t\treturn bufferToString(blob, \"base64\");\n\t}\n\n\t/**\n\t * This method decodes the encoded representation of the\n\t * blob.\n\t * @param blob - The encoded representation of the blob.\n\t * @returns The binary representation of the blob.\n\t */\n\tprivate decodeSummaryBlob(encoded: any): ArrayBuffer {\n\t\tconst buffer = bufferToString(encoded, \"utf8\");\n\t\treturn stringToBuffer(buffer, \"base64\");\n\t}\n\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tthis.pruneHistory();\n\t\tconst snapshot: ISnapshot = {\n\t\t\tbranchGuid: this.handle.absolutePath.split(\"/\").pop() as string,\n\t\t\tsummaryMinimumSequenceNumber: this.deltaManager.minimumSequenceNumber,\n\t\t\tuseMH: this.useMH,\n\t\t\tnumChunks: 0,\n\t\t};\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (!this.useMH) {\n\t\t\t// If the MH is not used, we have to include the tip view, the remote changes and the received\n\t\t\t// deltas to the summary\n\t\t\tconst summary: ISnapshotSummary = {\n\t\t\t\tremoteTipView: this.remoteTipView,\n\t\t\t\tremoteChanges: this.remoteChanges,\n\t\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\t\tunrebasedRemoteChanges: this.unrebasedRemoteChanges,\n\t\t\t};\n\n\t\t\tconst chunkSize = 5000 * 1024; // Default limit seems to be 5MB\n\t\t\tlet totalBlobsSize = 0;\n\t\t\tconst serializedSummary = this.encodeSummary(summary);\n\t\t\tfor (let pos = 0, i = 0; pos < serializedSummary.length; pos += chunkSize, i++) {\n\t\t\t\tconst summaryBlob = this.encodeSummaryBlob(\n\t\t\t\t\tserializedSummary.slice(pos, pos + chunkSize),\n\t\t\t\t);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\ttotalBlobsSize += summaryBlob[\"length\"];\n\t\t\t\tbuilder.addBlob(`summaryChunk_${i}`, summaryBlob);\n\t\t\t\tsnapshot.numChunks++;\n\t\t\t}\n\t\t\tthis.logIfEnabled(`Total blobs transfer size: ${totalBlobsSize}`);\n\t\t}\n\n\t\tbuilder.addBlob(\n\t\t\t\"properties\",\n\t\t\tserializer !== undefined\n\t\t\t\t? serializer.stringify(snapshot, this.handle)\n\t\t\t\t: JSON.stringify(snapshot),\n\t\t);\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst runtime = this.runtime;\n\t\tconst handleTableChunk = await storage.readBlob(\"properties\");\n\t\tconst utf8 = bufferToString(handleTableChunk, \"utf8\");\n\n\t\tconst snapshot: ISnapshot = this.serializer.parse(utf8);\n\t\tthis.useMH = snapshot.useMH;\n\n\t\ttry {\n\t\t\tif (!snapshot.useMH) {\n\t\t\t\t// We load all chunks\n\t\t\t\tconst chunks: ArrayBufferLike[] = await Promise.all(\n\t\t\t\t\trange(snapshot.numChunks).map(async (i) => {\n\t\t\t\t\t\treturn this.decodeSummaryBlob(await storage.readBlob(`summaryChunk_${i}`));\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst totalLength = chunks.reduce((a, b) => a + b.byteLength, 0);\n\t\t\t\tconst serializedSummary = new Uint8Array(totalLength);\n\t\t\t\tchunks.reduce((offset, chunk) => {\n\t\t\t\t\tserializedSummary.set(new Uint8Array(chunk), offset);\n\t\t\t\t\treturn offset + chunk.byteLength;\n\t\t\t\t}, 0);\n\t\t\t\tconst snapshotSummary = this.decodeSummary(serializedSummary);\n\t\t\t\tif (\n\t\t\t\t\tsnapshotSummary.remoteChanges === undefined ||\n\t\t\t\t\tsnapshotSummary.remoteTipView === undefined ||\n\t\t\t\t\tsnapshotSummary.unrebasedRemoteChanges === undefined\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\"Invalid Snapshot.\");\n\t\t\t\t}\n\n\t\t\t\tif (snapshotSummary.remoteHeadGuid === undefined) {\n\t\t\t\t\t// The summary does not contain a remoteHeadGuid. This means the summary has\n\t\t\t\t\t// been created by an old version of PropertyDDS, that did not yet have this patch.\n\t\t\t\t\tsnapshotSummary.remoteHeadGuid =\n\t\t\t\t\t\tsnapshotSummary.remoteChanges.length > 0\n\t\t\t\t\t\t\t? // If there are remote changes in the\n\t\t\t\t\t\t\t\t// summary we can deduce the head GUID from these changes.\n\t\t\t\t\t\t\t\tsnapshotSummary.remoteChanges[snapshotSummary.remoteChanges.length - 1].guid\n\t\t\t\t\t\t\t: // If no remote head GUID is available, we will fall back to the old behaviour,\n\t\t\t\t\t\t\t\t// where the head GUID was set to an empty string. However, this could lead to\n\t\t\t\t\t\t\t\t// divergence between the clients, if there is still a client in the session\n\t\t\t\t\t\t\t\t// that is using a version of this library without this patch and which\n\t\t\t\t\t\t\t\t// has started the session at a different summary.\n\t\t\t\t\t\t\t\t\"\";\n\t\t\t\t}\n\n\t\t\t\tthis.remoteTipView = snapshotSummary.remoteTipView;\n\t\t\t\tthis.remoteChanges = snapshotSummary.remoteChanges;\n\t\t\t\tthis.unrebasedRemoteChanges = snapshotSummary.unrebasedRemoteChanges;\n\t\t\t\tthis.headCommitGuid = snapshotSummary.remoteHeadGuid;\n\t\t\t\tconst isPartialCheckoutActive = !!(this.options.clientFiltering && this.options.paths);\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tthis.remoteTipView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tthis.remoteTipView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\n\t\t\t\tthis.skipSequenceNumber = 0;\n\t\t\t} else {\n\t\t\t\tconst { branchGuid, summaryMinimumSequenceNumber } = snapshot;\n\t\t\t\tconst branchResponse = await axios.get(`http://localhost:3000/branch/${branchGuid}`);\n\t\t\t\tthis.headCommitGuid = branchResponse.data.headCommitGuid;\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { meta: commitMetadata },\n\t\t\t\t} = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\t\t\t\tlet { changeSet: materializedView } = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}/materializedView`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\n\t\t\t\tconst isPartialCheckoutActive = this.options.clientFiltering && this.options.paths;\n\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tmaterializedView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tmaterializedView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.tipView = materializedView;\n\t\t\t\tthis.remoteTipView = cloneDeep(this.tipView);\n\t\t\t\tthis.remoteChanges = [];\n\n\t\t\t\tlet missingDeltas: ISequencedDocumentMessage[] = [];\n\t\t\t\tconst firstDelta = Math.min(\n\t\t\t\t\tcommitMetadata.minimumSequenceNumber,\n\t\t\t\t\tsummaryMinimumSequenceNumber,\n\t\t\t\t);\n\t\t\t\tconst lastDelta = commitMetadata.sequenceNumber;\n\n\t\t\t\tconst dm = (this.deltaManager as any).deltaManager;\n\t\t\t\t// TODO: This is accessing a private member of the delta manager, and should not be.\n\t\t\t\tawait dm.getDeltas(\n\t\t\t\t\t\"DocumentOpen\",\n\t\t\t\t\tfirstDelta,\n\t\t\t\t\tlastDelta,\n\t\t\t\t\t(messages: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tmissingDeltas = messages.filter((x) => x.type === \"op\");\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\t\t\tfor (let i = 0; i < missingDeltas.length; i++) {\n\t\t\t\t\tif (missingDeltas[i].sequenceNumber < commitMetadata.sequenceNumber) {\n\t\t\t\t\t\t// TODO: Don't spy on the DeltaManager's private internals.\n\t\t\t\t\t\t// This is trying to mimic what DeltaManager does in processInboundMessage, but there's no guarantee that\n\t\t\t\t\t\t// private implementation won't change.\n\t\t\t\t\t\tconst remoteChange: IPropertyTreeMessage = JSON.parse(\n\t\t\t\t\t\t\tmissingDeltas[i].contents as string,\n\t\t\t\t\t\t).contents.contents.content.contents;\n\t\t\t\t\t\tconst { changeSet } = (\n\t\t\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${remoteChange.guid}/changeSet`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).data;\n\t\t\t\t\t\tremoteChange.changeSet = changeSet;\n\n\t\t\t\t\t\tif (remoteChange) {\n\t\t\t\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\t\t\t\tremoteChange.changeSet = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\t\t\t\tremoteChange.changeSet,\n\t\t\t\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.addRemoteChange(remoteChange);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.processCore(missingDeltas[i], false, {});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.skipSequenceNumber = lastDelta ?? -1;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.tipView = {};\n\t\t\tthis.remoteTipView = {};\n\t\t\tthis.remoteChanges = [];\n\t\t} finally {\n\t\t\tthis._root.deserialize(this.tipView, undefined, false, false);\n\t\t\tconst _changeSet = new ChangeSet(this.tipView);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprivate _applyLocalChangeSet(change: IPropertyTreeMessage) {\n\t\tconst changeSetWrapper = new ChangeSet(this.tipView);\n\t\tchangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\t\t} else {\n\t\t\tthis.localChanges.push(change);\n\t\t}\n\t}\n\n\tprivate _applyRemoteChangeSet(change: IRemotePropertyTreeMessage) {\n\t\tthis.unrebasedRemoteChanges[change.guid] = cloneDeep(change);\n\n\t\t// This is the first message in the history of the document.\n\t\tif (this.remoteChanges.length !== 0) {\n\t\t\trebaseToRemoteChanges(\n\t\t\t\tchange,\n\t\t\t\tthis.getUnrebasedChange.bind(this),\n\t\t\t\tthis.getRebasedChanges.bind(this),\n\t\t\t);\n\t\t}\n\n\t\tthis.addRemoteChange(change);\n\t\t// Apply the remote change set to the remote tip view\n\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\t// Rebase the local changes\n\t\tconst pendingChanges = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\t\tnew ChangeSet(pendingChanges)._toReversibleChangeSet(this.tipView);\n\n\t\tconst changesToTip: SerializedChangeSet = {};\n\t\tconst changesNeeded = this.rebaseLocalChanges(change, pendingChanges, changesToTip);\n\n\t\tif (changesNeeded) {\n\t\t\tthis.pushNotificationDelayScope();\n\t\t\t// Checkout the new tip\n\t\t\tthis._root.applyChangeSet(changesToTip);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n\t\t\tthis._root.applyChangeSet(pendingChanges);\n\t\t\tthis.popNotificationDelayScope();\n\t\t}\n\n\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t// assert(JSON.stringify(this.root.serialize()) === JSON.stringify(this.tipView));\n\t}\n\n\tgetUnrebasedChange(guid: string) {\n\t\treturn this.unrebasedRemoteChanges[guid];\n\t}\n\n\tgetRebasedChanges(startGuid: string, endGuid?: string) {\n\t\tconst startIndex = findIndex(this.remoteChanges, (c) => c.guid === startGuid);\n\t\tif (\n\t\t\tstartIndex === -1 &&\n\t\t\tstartGuid !== \"\" &&\n\t\t\t// If the start GUID is the referenceGUID of the first change,\n\t\t\t// we still can get the correct range, because the change with the startGuid itself\n\t\t\t// if not included in the range.\n\t\t\t(this.remoteChanges.length === 0 || startGuid !== this.remoteChanges[0].referenceGuid)\n\t\t) {\n\t\t\t// TODO: Consider throwing an error once clients have picked up PR #16277.\n\t\t\tconsole.error(\"Unknown start GUID specified.\");\n\t\t}\n\t\tif (endGuid !== undefined) {\n\t\t\tconst endIndex = findIndex(this.remoteChanges, (c) => c.guid === endGuid);\n\t\t\treturn this.remoteChanges.slice(startIndex + 1, endIndex + 1);\n\t\t}\n\t\treturn this.remoteChanges.slice(startIndex + 1);\n\t}\n\n\tprivate rebaseLocalChanges(\n\t\tchange: IPropertyTreeMessage,\n\t\tpendingChanges: SerializedChangeSet,\n\t\tnewTipDelta: SerializedChangeSet,\n\t): boolean {\n\t\tlet rebaseBaseChangeSet;\n\n\t\tconst accumulatedChanges: SerializedChangeSet = {};\n\t\tconst conflicts = [] as any[];\n\n\t\tif (this.localChanges.length > 0 && this.localChanges[0].guid === change.guid) {\n\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t// assert(JSON.stringify(this.localChanges[0].changeSet) === JSON.stringify(change.changeSet),\n\t\t\t// \"Local change different than rebased remote change.\");\n\n\t\t\tif (isEqual(this.localChanges[0].changeSet, change.changeSet)) {\n\t\t\t\t// If we got a confirmation of the commit on the tip of the localChanges array,\n\t\t\t\t// there will be no update of the tip view at all. We just move it from local changes\n\t\t\t\t// to remote changes\n\t\t\t\tthis.localChanges.shift();\n\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t// There is a case where the localChanges that were created by incrementally rebasing with respect\n\t\t\t\t// to every incoming change do no exactly agree with the rebased remote change (this happens\n\t\t\t\t// when there are changes that cancel out with each other that have happened in the meantime).\n\t\t\t\t// In that case, we must make sure, we correctly update the local view to take this difference into\n\t\t\t\t// account by rebasing with respect to the changeset that is obtained by combining the inverse of the\n\t\t\t\t// local change with the incoming remote change.\n\n\t\t\t\trebaseBaseChangeSet = new ChangeSet(this.localChanges.shift()?.changeSet);\n\t\t\t\trebaseBaseChangeSet.toInverseChangeSet();\n\t\t\t\trebaseBaseChangeSet.applyChangeSet(change.changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\trebaseBaseChangeSet = cloneDeep(change.changeSet);\n\t\t}\n\n\t\tfor (let i = 0; i < this.localChanges.length; i++) {\n\t\t\t// Make sure we never receive changes out of order\n\t\t\tconsole.assert(this.localChanges[i].guid !== change.guid);\n\n\t\t\tconst rebaseMetaInformation = new Map();\n\n\t\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(this.localChanges[i].changeSet));\n\t\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(\n\t\t\t\tthis.localChanges[i].changeSet,\n\t\t\t\tconflicts,\n\t\t\t\t{\n\t\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tcopiedChangeSet.toInverseChangeSet();\n\t\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\t\tcopiedChangeSet.applyChangeSet(this.localChanges[i].changeSet, {\n\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t});\n\t\t\trebaseBaseChangeSet = copiedChangeSet.getSerializedChangeSet();\n\n\t\t\tnew ChangeSet(accumulatedChanges).applyChangeSet(this.localChanges[i].changeSet);\n\n\t\t\t// Update the reference and head guids\n\t\t\tthis.localChanges[i].remoteHeadGuid = change.guid;\n\t\t\tif (i === 0) {\n\t\t\t\tthis.localChanges[i].referenceGuid = change.guid;\n\t\t\t}\n\t\t}\n\n\t\t// Compute the inverse of the pending changes and store the result in newTipDelta\n\t\tconst pendingChangesRebaseMetaInformation = new Map();\n\t\tconst deltaToTipCS = new ChangeSet(newTipDelta);\n\t\tdeltaToTipCS.applyChangeSet(pendingChanges);\n\t\tdeltaToTipCS.toInverseChangeSet();\n\n\t\t// Perform a rebase of the pending changes\n\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(pendingChanges, conflicts, {\n\t\t\tapplyAfterMetaInformation: pendingChangesRebaseMetaInformation,\n\t\t});\n\n\t\t// Compute the delta between the old tip (including pending changes)\n\t\t// and the new tip (not including the rebased pending changes)\n\t\tdeltaToTipCS.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t// Update the tip view\n\t\tif (!this.tipView) {\n\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\t\t\tconst changeSet = new ChangeSet(this.tipView);\n\t\t\tchangeSet.applyChangeSet(accumulatedChanges);\n\t\t} else {\n\t\t\tnew ChangeSet(this.tipView).applyChangeSet(newTipDelta);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\t// We have to provide our own implementation of the resubmit core function, to\n\t\t// handle the case where an operation is no longer referencing a commit within\n\t\t// the collaboration window as its referenceGuid. Other clients would not be\n\t\t// able to perform the rebase for such an operation. To handle this problem\n\t\t// we have to resubmit a version of the operations which has been rebased to\n\t\t// the current remote tip. We already have these rebased versions of the operations\n\t\t// in our localChanges, because we continuously update those to follow the tip.\n\t\t// Therefore our reSubmitCore function searches for the rebased operation in the\n\t\t// localChanges array and submits this up-to-date version instead of the old operation.\n\t\tconst rebasedOperation = find(this.localChanges, (op) => op.guid === content.guid);\n\n\t\tif (rebasedOperation) {\n\t\t\tthis.submitLocalMessage(cloneDeep(rebasedOperation), localOpMetadata);\n\t\t} else {\n\t\t\t// Could this happen or is there a guard that we will never resubmit an already submitted op?\n\t\t\tconsole.warn(\"Resubmitting operation which has already been received back.\");\n\t\t}\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\tthrow new Error(\"not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTree.js","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+EAIgD;AAChD,iFAIiD;AACjD,+DAAyF;AACzF,iFAAoE;AAOpE,0EAGqD;AAErD,qEAA4E;AAC5E,0EAA6F;AAC7F,kDAA0B;AAC1B,oDAA4B;AAC5B,uCAAiC;AACjC,+BAAoC;AAEpC,4FAA4F;AAC5F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,gBAAM,CAAC;AAEvE,qEAA+D;AA2F/D,MAAM,aAAa,GAA8B;IAChD,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,GAAyB,EAAE,EAAE,CAAC,GAAG;QAC1C,MAAM,EAAE,CAAC,GAAyB,EAAE,EAAE,CAAC,GAAG;KAC1C;IACD,cAAc,EAAE;QACf,MAAM,EAAE,CAAC,OAAyB,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,gBAAK,EAAE,CAAC;Y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ACP,6FAA6F;YAC7F,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC9E,CAAC;IACF,CAAC;IAES,cAAc;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;AA9yBD,gDA8yBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tChangeSet,\n\tUtils as ChangeSetUtils,\n\trebaseToRemoteChanges,\n} from \"@fluid-experimental/property-changeset\";\nimport {\n\tBaseProperty,\n\tNodeProperty,\n\tPropertyFactory,\n} from \"@fluid-experimental/property-properties\";\nimport { IsoBuffer, bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport { SharedObject, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport axios from \"axios\";\nimport lodash from \"lodash\";\nimport { Packr } from \"msgpackr\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.\nconst { isEmpty, findIndex, find, isEqual, range, cloneDeep } = lodash;\n\nimport { PropertyTreeFactory } from \"./propertyTreeFactory.js\";\n\n/**\n * @internal\n */\nexport type SerializedChangeSet = any;\n\n/**\n * @internal\n */\nexport type Metadata = any;\n\ntype FetchUnrebasedChangeFn = (guid: string) => IRemotePropertyTreeMessage;\ntype FetchRebasedChangesFn = (startGuid: string, endGuid?: string) => IPropertyTreeMessage[];\n\n/**\n * @internal\n */\nexport const enum OpKind {\n\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\tChangeSet = 0,\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeMessage {\n\top: OpKind;\n\tchangeSet: SerializedChangeSet;\n\tmetadata: Metadata;\n\tguid: string;\n\treferenceGuid: string;\n\tremoteHeadGuid: string;\n\tlocalBranchStart: string | undefined;\n\trebaseMetaInformation?: Map<any, any>;\n\tuseMH?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IRemotePropertyTreeMessage extends IPropertyTreeMessage {\n\tsequenceNumber: number;\n}\ninterface ISnapshot {\n\tbranchGuid: string;\n\tsummaryMinimumSequenceNumber: number;\n\tuseMH: boolean;\n\tnumChunks: number;\n}\n/**\n * @internal\n */\nexport interface ISnapshotSummary {\n\tremoteTipView?: SerializedChangeSet;\n\tremoteChanges?: IPropertyTreeMessage[];\n\tunrebasedRemoteChanges?: Record<string, IRemotePropertyTreeMessage>;\n\tremoteHeadGuid: string;\n}\n\n/**\n * @internal\n */\nexport interface SharedPropertyTreeOptions {\n\tpaths?: string[];\n\tclientFiltering?: boolean;\n\tuseMH?: boolean;\n\tdisablePartialCheckout?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISharedPropertyTreeEncDec {\n\tmessageEncoder: {\n\t\tencode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t\tdecode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t};\n\tsummaryEncoder: {\n\t\tencode: (ISnapshotSummary) => IsoBuffer;\n\t\tdecode: (IsoBuffer) => ISnapshotSummary;\n\t};\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeConfig {\n\tencDec: ISharedPropertyTreeEncDec;\n}\n\nconst defaultEncDec: ISharedPropertyTreeEncDec = {\n\tmessageEncoder: {\n\t\tencode: (msg: IPropertyTreeMessage) => msg,\n\t\tdecode: (msg: IPropertyTreeMessage) => msg,\n\t},\n\tsummaryEncoder: {\n\t\tencode: (summary: ISnapshotSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst serializedSummary = packr.pack(summary);\n\t\t\treturn serializedSummary;\n\t\t},\n\t\tdecode: (serializedSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst snapshotSummary = packr.unpack(serializedSummary);\n\t\t\treturn snapshotSummary as ISnapshotSummary;\n\t\t},\n\t},\n};\n\n/**\n * DDS that models a tree made of objects with properties under string keys.\n * @internal\n */\nexport class SharedPropertyTree extends SharedObject {\n\ttipView: SerializedChangeSet = {};\n\tremoteTipView: SerializedChangeSet = {};\n\tlocalChanges: IPropertyTreeMessage[] = [];\n\tremoteChanges: IPropertyTreeMessage[] = [];\n\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\ttransmissionsHaveBeenStopped = false;\n\tenqueuedMessages: IPropertyTreeMessage[] = [];\n\tnotificationDelayScope: number = 0;\n\t_root: any = PropertyFactory.create(\"NodeProperty\");\n\toptions: SharedPropertyTreeOptions;\n\tskipSequenceNumber: number = -1;\n\theadCommitGuid: string = \"\";\n\tuseMH: boolean = false;\n\tpropertyTreeConfig: IPropertyTreeConfig;\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptions: SharedPropertyTreeOptions,\n\t\tpropertyTreeConfig: IPropertyTreeConfig = { encDec: defaultEncDec },\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_propertyTree_\");\n\n\t\tthis.options = options;\n\t\t// Quick hack to let the root be aware of the DDS hosting it.\n\t\tthis._root._tree = this;\n\n\t\t// By default, we currently don't use the MH\n\t\tthis.useMH = options.useMH ?? false;\n\t\tthis.propertyTreeConfig = propertyTreeConfig;\n\t}\n\n\t/**\n\t * Create a new shared cell\n\t *\n\t * @param runtime - data store runtime the new shared map belongs to\n\t * @param id - optional name of the shared map\n\t * @returns newly create shared map (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n\t\treturn runtime.createChannel(id, PropertyTreeFactory.Type) as SharedPropertyTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedDie to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedDie\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new PropertyTreeFactory();\n\t}\n\n\t/**\n\t * in case of partial checkout we want to send the paths we are interested in once we are connected\n\t */\n\tprotected onConnect() {\n\t\t// on connect we scope all deltas such that we only get relevant changes\n\t\t// since we know the paths already at construction time this is okay\n\t\tthis.scopeFutureDeltasToPaths(this.options.paths);\n\t}\n\n\tprivate scopeFutureDeltasToPaths(paths?: string[]) {\n\t\t// Backdoor to emit \"partial_checkout\" events on the socket. The delta manager at container runtime layer is\n\t\t// a proxy and the delta manager at the container context layer is yet another proxy, so account for that.\n\t\tif (!this.options.disablePartialCheckout) {\n\t\t\tlet dm = (this.deltaManager as any).deltaManager;\n\t\t\tif (dm.deltaManager !== undefined) {\n\t\t\t\tdm = dm.deltaManager;\n\t\t\t}\n\t\t\tconst socket = dm.connectionManager.connection.socket;\n\t\t\tsocket.emit(\"partial_checkout\", { paths });\n\t\t}\n\t}\n\n\tpublic _reportDirtinessToView() {\n\t\t// Check whether anybody is listening. If not, we don't want to pay the price\n\t\t// for the serialization of the data structure\n\t\tif (this.listenerCount(\"localModification\") > 0) {\n\t\t\tconst changes = this._root._serialize(\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY,\n\t\t\t);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t\tconst _changeSet = new ChangeSet(changes);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t}\n\t}\n\n\tpublic get changeSet(): SerializedChangeSet {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.tipView;\n\t}\n\n\tpublic get activeCommit(): IPropertyTreeMessage {\n\t\treturn this.localChanges.length > 0\n\t\t\t? this.localChanges[this.localChanges.length - 1]\n\t\t\t: this.remoteChanges[this.remoteChanges.length - 1];\n\t}\n\tpublic get root(): NodeProperty {\n\t\treturn this._root as NodeProperty;\n\t}\n\n\tpublic commit(metadata?: Metadata, submitEmptyChange?: boolean) {\n\t\tconst changes = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\n\t\tlet doSubmit = !!submitEmptyChange;\n\n\t\t// if no override provided dont submit unless metadata are provided\n\t\tif (submitEmptyChange === undefined) {\n\t\t\tdoSubmit = metadata !== undefined;\n\t\t}\n\n\t\tif (doSubmit || !isEmpty(changes)) {\n\t\t\tthis.applyChangeSet(changes, metadata || {});\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\t/**\n\t * This method encodes the given message to the transfer form\n\t * @param change - The message to be encoded.\n\t */\n\tprivate encodeMessage(change: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.encode(change);\n\t}\n\n\t/**\n\t * This method decodes message from the transfer form.\n\t * @param transferChange - The message to be decoded.\n\t */\n\tprivate decodeMessage(transferChange: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.decode(transferChange);\n\t}\n\n\tprivate applyChangeSet(changeSet: SerializedChangeSet, metadata: Metadata) {\n\t\tconst _changeSet = new ChangeSet(changeSet);\n\t\t_changeSet._toReversibleChangeSet(this.tipView);\n\n\t\tthis.updateRemoteHeadGuid();\n\n\t\tconst change = {\n\t\t\top: OpKind.ChangeSet,\n\t\t\tchangeSet,\n\t\t\tmetadata,\n\t\t\tguid: uuidv4(),\n\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\treferenceGuid:\n\t\t\t\tthis.localChanges.length > 0\n\t\t\t\t\t? this.localChanges[this.localChanges.length - 1].guid\n\t\t\t\t\t: this.headCommitGuid,\n\t\t\tlocalBranchStart: this.localChanges.length > 0 ? this.localChanges[0].guid : undefined,\n\t\t\tuseMH: this.useMH,\n\t\t};\n\t\tthis._applyLocalChangeSet(change);\n\t\t// Queue the op for transmission to the Fluid service.\n\t\tconst transferChange = this.encodeMessage(cloneDeep(change));\n\t\tif (this.transmissionsHaveBeenStopped) {\n\t\t\tthis.enqueuedMessages.push(transferChange);\n\t\t} else {\n\t\t\tthis.submitLocalMessage(transferChange);\n\t\t}\n\t}\n\n\tstopTransmission(stop: boolean) {\n\t\tthis.transmissionsHaveBeenStopped = stop;\n\t\tif (stop === false) {\n\t\t\tfor (const message of this.enqueuedMessages) {\n\t\t\t\tthis.submitLocalMessage(message);\n\t\t\t}\n\t\t\tthis.enqueuedMessages = [];\n\t\t}\n\t}\n\t/**\n\t * Delays notifications until popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic pushNotificationDelayScope() {\n\t\t// set the scope counter\n\t\tthis.notificationDelayScope++;\n\n\t\t// If we reach 0, we have to report unreported changes\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tthis._root._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Re-enables notifications when popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic popNotificationDelayScope() {\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tconsole.error(\"Unbalanced push/pop calls.\");\n\t\t}\n\t\tthis.notificationDelayScope--;\n\t\tthis._root._reportDirtinessToView();\n\t}\n\n\t/**\n\t * Process an operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\tmessage.sequenceNumber > this.skipSequenceNumber\n\t\t) {\n\t\t\tconst change: IPropertyTreeMessage = this.decodeMessage(\n\t\t\t\tcloneDeep(message.contents as IPropertyTreeMessage),\n\t\t\t);\n\t\t\tconst content: IRemotePropertyTreeMessage = {\n\t\t\t\t...change,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t};\n\t\t\tswitch (content.op) {\n\t\t\t\tcase OpKind.ChangeSet:\n\t\t\t\t\t// If the op originated locally from this client, we've already accounted for it\n\t\t\t\t\t// by advancing the state. Otherwise, advance the PRNG now.\n\t\t\t\t\tthis._applyRemoteChangeSet(cloneDeep(content));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addRemoteChange(change: IPropertyTreeMessage) {\n\t\tthis.remoteChanges.push(change);\n\t\tthis.updateRemoteHeadGuid();\n\t}\n\n\tprivate updateRemoteHeadGuid() {\n\t\tthis.headCommitGuid =\n\t\t\tthis.remoteChanges.length > 0\n\t\t\t\t? this.remoteChanges[this.remoteChanges.length - 1].guid\n\t\t\t\t: this.headCommitGuid;\n\t}\n\n\tpublic static prune(\n\t\tminimumSequenceNumber: number,\n\t\tremoteChanges: IPropertyTreeMessage[],\n\t\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage>,\n\t\tremoteHeadGuid: string,\n\t) {\n\t\t// for faster lookup of remote change guids\n\t\tconst remoteChangeMap = new Map<string, number>();\n\t\tremoteChanges.forEach((change, index) => {\n\t\t\tremoteChangeMap.set(change.guid, index);\n\t\t});\n\n\t\t// we will track visited nodes\n\t\tconst visitedUnrebasedRemoteChanges = new Set<string>();\n\t\tconst visitedRemoteChanges = new Set<string>();\n\n\t\tfor (const id of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tconst unrebasedChange = unrebasedRemoteChanges[id];\n\n\t\t\t// we are only interested in changes that are newer than the sequence number\n\t\t\t// and that were not yet visited previously\n\t\t\tif (\n\t\t\t\tunrebasedChange.sequenceNumber >= minimumSequenceNumber &&\n\t\t\t\t!visitedUnrebasedRemoteChanges.has(unrebasedChange.guid)\n\t\t\t) {\n\t\t\t\t// we visited that unrebased change and mark it as visited\n\t\t\t\tvisitedUnrebasedRemoteChanges.add(unrebasedChange.guid);\n\n\t\t\t\tlet visitor = unrebasedChange;\n\t\t\t\t// we will walk along the commit chain until we hit a remote change or a visited unrebased commit\n\t\t\t\t// at that point we can skip since we already traced the rest of the commit chain\n\t\t\t\twhile (\n\t\t\t\t\tvisitor.remoteHeadGuid !== visitor.referenceGuid ||\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tconst guid = visitor.referenceGuid;\n\t\t\t\t\tif (guid === \"\" || guid === remoteHeadGuid) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// since the change is not in remote it must be in unrebased\n\t\t\t\t\tvisitor = unrebasedRemoteChanges[visitor.referenceGuid];\n\t\t\t\t\tif (!visitor) {\n\t\t\t\t\t\tthrow new Error(`no visitor found for guid \"${guid}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.add(visitor.guid);\n\t\t\t\t}\n\t\t\t\t// if we exited the loop because we hit a remote change than add it as visited\n\t\t\t\tif (\n\t\t\t\t\tvisitor.remoteHeadGuid === visitor.referenceGuid &&\n\t\t\t\t\tremoteChangeMap.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tvisitedRemoteChanges.add(visitor.referenceGuid);\n\t\t\t\t}\n\n\t\t\t\t// If we have a change that refers to the start of the history (remoteHeadGuid === \"\" or the\n\t\t\t\t// provided remote head guid), we have to keep all remote Changes until this change has been processed\n\t\t\t\tif (visitor.remoteHeadGuid === \"\" || visitor.remoteHeadGuid === remoteHeadGuid) {\n\t\t\t\t\tvisitedRemoteChanges.add(remoteChanges[0].guid);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlet pruned = 0;\n\t\t// we can now filter the unrebased changes by removing any changes\n\t\t// we have not visited at all during our traversal\n\t\tconst prunedUnrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\t\tfor (const key of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tif (visitedUnrebasedRemoteChanges.has(key)) {\n\t\t\t\tprunedUnrebasedRemoteChanges[key] = unrebasedRemoteChanges[key];\n\t\t\t} else {\n\t\t\t\tpruned++;\n\t\t\t}\n\t\t}\n\n\t\t// find minimum index\n\t\tconst minIndex = Math.min(\n\t\t\t...[...visitedRemoteChanges].map((key) => remoteChangeMap.get(key) as number),\n\t\t);\n\n\t\tconst prunedRemoteChanges = remoteChanges.slice(minIndex);\n\t\tpruned += minIndex;\n\n\t\treturn {\n\t\t\tremoteChanges: prunedRemoteChanges,\n\t\t\tunrebasedRemoteChanges: prunedUnrebasedRemoteChanges,\n\t\t\tprunedCount: pruned,\n\t\t};\n\t}\n\tpublic pruneHistory() {\n\t\tconst msn = this.deltaManager.minimumSequenceNumber;\n\n\t\tlet lastKnownRemoteGuid = this.headCommitGuid;\n\t\t// We use the reference GUID of the first change in the list\n\t\t// of remote changes as lastKnownRemoteGuid, because there\n\t\t// might still be unrebased changes that reference this GUID\n\t\t// as referenceGUID / remoteHeadGuid and if this happens\n\t\t// we must make sure we preserve the remote changes and\n\t\t// unrebased remote changes\n\t\tif (this.remoteChanges.length > 0) {\n\t\t\tlastKnownRemoteGuid = this.remoteChanges[0].referenceGuid;\n\t\t}\n\n\t\tconst { remoteChanges, unrebasedRemoteChanges } = SharedPropertyTree.prune(\n\t\t\tmsn,\n\t\t\tthis.remoteChanges,\n\t\t\tthis.unrebasedRemoteChanges,\n\t\t\tlastKnownRemoteGuid,\n\t\t);\n\n\t\tthis.remoteChanges = remoteChanges;\n\t\tthis.unrebasedRemoteChanges = unrebasedRemoteChanges;\n\t}\n\n\t/**\n\t * This method encodes the local summary (snapshot) object into the serialized form.\n\t * @param summary - The local summary (snapshot)representation.\n\t * @returns The serialized summary representation.\n\t */\n\tprivate encodeSummary(summary: ISnapshotSummary) {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.encode(summary);\n\t}\n\n\t/**\n\t * This method decodes the serialized form of the summary into the local summary (snapshot) object.\n\t * @param serializedSummary - The serialized summary representation.\n\t * @returns The local summary (snapshot)representation.\n\t */\n\tprivate decodeSummary(serializedSummary): ISnapshotSummary {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.decode(serializedSummary);\n\t}\n\n\t/**\n\t * This method writes the log message if the logging is enabled in the extended DDS.\n\t * The logging is not enabled in the default Property DDS\n\t * @param message - The message to be logged.\n\t */\n\tprotected logIfEnabled(message) {}\n\n\t/**\n\t * This method encodes the binary representation of the\n\t * blob.\n\t * @param blob - The binary representation of the blob.\n\t * @returns The encoded representation of the blob.\n\t */\n\tprivate encodeSummaryBlob(blob: ArrayBuffer): any {\n\t\treturn bufferToString(blob, \"base64\");\n\t}\n\n\t/**\n\t * This method decodes the encoded representation of the\n\t * blob.\n\t * @param blob - The encoded representation of the blob.\n\t * @returns The binary representation of the blob.\n\t */\n\tprivate decodeSummaryBlob(encoded: any): ArrayBuffer {\n\t\tconst buffer = bufferToString(encoded, \"utf8\");\n\t\treturn stringToBuffer(buffer, \"base64\");\n\t}\n\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tthis.pruneHistory();\n\t\tconst snapshot: ISnapshot = {\n\t\t\tbranchGuid: this.handle.absolutePath.split(\"/\").pop() as string,\n\t\t\tsummaryMinimumSequenceNumber: this.deltaManager.minimumSequenceNumber,\n\t\t\tuseMH: this.useMH,\n\t\t\tnumChunks: 0,\n\t\t};\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (!this.useMH) {\n\t\t\t// If the MH is not used, we have to include the tip view, the remote changes and the received\n\t\t\t// deltas to the summary\n\t\t\tconst summary: ISnapshotSummary = {\n\t\t\t\tremoteTipView: this.remoteTipView,\n\t\t\t\tremoteChanges: this.remoteChanges,\n\t\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\t\tunrebasedRemoteChanges: this.unrebasedRemoteChanges,\n\t\t\t};\n\n\t\t\tconst chunkSize = 5000 * 1024; // Default limit seems to be 5MB\n\t\t\tlet totalBlobsSize = 0;\n\t\t\tconst serializedSummary = this.encodeSummary(summary);\n\t\t\tfor (let pos = 0, i = 0; pos < serializedSummary.length; pos += chunkSize, i++) {\n\t\t\t\tconst summaryBlob = this.encodeSummaryBlob(\n\t\t\t\t\tserializedSummary.slice(pos, pos + chunkSize),\n\t\t\t\t);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\ttotalBlobsSize += summaryBlob[\"length\"];\n\t\t\t\tbuilder.addBlob(`summaryChunk_${i}`, summaryBlob);\n\t\t\t\tsnapshot.numChunks++;\n\t\t\t}\n\t\t\tthis.logIfEnabled(`Total blobs transfer size: ${totalBlobsSize}`);\n\t\t}\n\n\t\tbuilder.addBlob(\n\t\t\t\"properties\",\n\t\t\tserializer !== undefined\n\t\t\t\t? serializer.stringify(snapshot, this.handle)\n\t\t\t\t: JSON.stringify(snapshot),\n\t\t);\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst runtime = this.runtime;\n\t\tconst handleTableChunk = await storage.readBlob(\"properties\");\n\t\tconst utf8 = bufferToString(handleTableChunk, \"utf8\");\n\n\t\tconst snapshot: ISnapshot = this.serializer.parse(utf8);\n\t\tthis.useMH = snapshot.useMH;\n\n\t\ttry {\n\t\t\tif (!snapshot.useMH) {\n\t\t\t\t// We load all chunks\n\t\t\t\tconst chunks: ArrayBufferLike[] = await Promise.all(\n\t\t\t\t\trange(snapshot.numChunks).map(async (i) => {\n\t\t\t\t\t\treturn this.decodeSummaryBlob(await storage.readBlob(`summaryChunk_${i}`));\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst totalLength = chunks.reduce((a, b) => a + b.byteLength, 0);\n\t\t\t\tconst serializedSummary = new Uint8Array(totalLength);\n\t\t\t\tchunks.reduce((offset, chunk) => {\n\t\t\t\t\tserializedSummary.set(new Uint8Array(chunk), offset);\n\t\t\t\t\treturn offset + chunk.byteLength;\n\t\t\t\t}, 0);\n\t\t\t\tconst snapshotSummary = this.decodeSummary(serializedSummary);\n\t\t\t\tif (\n\t\t\t\t\tsnapshotSummary.remoteChanges === undefined ||\n\t\t\t\t\tsnapshotSummary.remoteTipView === undefined ||\n\t\t\t\t\tsnapshotSummary.unrebasedRemoteChanges === undefined\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\"Invalid Snapshot.\");\n\t\t\t\t}\n\n\t\t\t\tif (snapshotSummary.remoteHeadGuid === undefined) {\n\t\t\t\t\t// The summary does not contain a remoteHeadGuid. This means the summary has\n\t\t\t\t\t// been created by an old version of PropertyDDS, that did not yet have this patch.\n\t\t\t\t\tsnapshotSummary.remoteHeadGuid =\n\t\t\t\t\t\tsnapshotSummary.remoteChanges.length > 0\n\t\t\t\t\t\t\t? // If there are remote changes in the\n\t\t\t\t\t\t\t\t// summary we can deduce the head GUID from these changes.\n\t\t\t\t\t\t\t\tsnapshotSummary.remoteChanges[snapshotSummary.remoteChanges.length - 1].guid\n\t\t\t\t\t\t\t: // If no remote head GUID is available, we will fall back to the old behaviour,\n\t\t\t\t\t\t\t\t// where the head GUID was set to an empty string. However, this could lead to\n\t\t\t\t\t\t\t\t// divergence between the clients, if there is still a client in the session\n\t\t\t\t\t\t\t\t// that is using a version of this library without this patch and which\n\t\t\t\t\t\t\t\t// has started the session at a different summary.\n\t\t\t\t\t\t\t\t\"\";\n\t\t\t\t}\n\n\t\t\t\tthis.remoteTipView = snapshotSummary.remoteTipView;\n\t\t\t\tthis.remoteChanges = snapshotSummary.remoteChanges;\n\t\t\t\tthis.unrebasedRemoteChanges = snapshotSummary.unrebasedRemoteChanges;\n\t\t\t\tthis.headCommitGuid = snapshotSummary.remoteHeadGuid;\n\t\t\t\tconst isPartialCheckoutActive = !!(this.options.clientFiltering && this.options.paths);\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tthis.remoteTipView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tthis.remoteTipView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\n\t\t\t\tthis.skipSequenceNumber = 0;\n\t\t\t} else {\n\t\t\t\tconst { branchGuid, summaryMinimumSequenceNumber } = snapshot;\n\t\t\t\tconst branchResponse = await axios.get(`http://localhost:3000/branch/${branchGuid}`);\n\t\t\t\tthis.headCommitGuid = branchResponse.data.headCommitGuid;\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { meta: commitMetadata },\n\t\t\t\t} = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\t\t\t\tlet { changeSet: materializedView } = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}/materializedView`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\n\t\t\t\tconst isPartialCheckoutActive = this.options.clientFiltering && this.options.paths;\n\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tmaterializedView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tmaterializedView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.tipView = materializedView;\n\t\t\t\tthis.remoteTipView = cloneDeep(this.tipView);\n\t\t\t\tthis.remoteChanges = [];\n\n\t\t\t\tlet missingDeltas: ISequencedDocumentMessage[] = [];\n\t\t\t\tconst firstDelta = Math.min(\n\t\t\t\t\tcommitMetadata.minimumSequenceNumber,\n\t\t\t\t\tsummaryMinimumSequenceNumber,\n\t\t\t\t);\n\t\t\t\tconst lastDelta = commitMetadata.sequenceNumber;\n\n\t\t\t\tconst dm = (this.deltaManager as any).deltaManager;\n\t\t\t\t// TODO: This is accessing a private member of the delta manager, and should not be.\n\t\t\t\tawait dm.getDeltas(\n\t\t\t\t\t\"DocumentOpen\",\n\t\t\t\t\tfirstDelta,\n\t\t\t\t\tlastDelta,\n\t\t\t\t\t(messages: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tmissingDeltas = messages.filter((x) => x.type === \"op\");\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\t\t\tfor (let i = 0; i < missingDeltas.length; i++) {\n\t\t\t\t\tif (missingDeltas[i].sequenceNumber < commitMetadata.sequenceNumber) {\n\t\t\t\t\t\t// TODO: Don't spy on the DeltaManager's private internals.\n\t\t\t\t\t\t// This is trying to mimic what DeltaManager does in processInboundMessage, but there's no guarantee that\n\t\t\t\t\t\t// private implementation won't change.\n\t\t\t\t\t\tconst remoteChange: IPropertyTreeMessage = JSON.parse(\n\t\t\t\t\t\t\tmissingDeltas[i].contents as string,\n\t\t\t\t\t\t).contents.contents.content.contents;\n\t\t\t\t\t\tconst { changeSet } = (\n\t\t\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${remoteChange.guid}/changeSet`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).data;\n\t\t\t\t\t\tremoteChange.changeSet = changeSet;\n\n\t\t\t\t\t\tif (remoteChange) {\n\t\t\t\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\t\t\t\tremoteChange.changeSet = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\t\t\t\tremoteChange.changeSet,\n\t\t\t\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.addRemoteChange(remoteChange);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.processCore(missingDeltas[i], false, {});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.skipSequenceNumber = lastDelta ?? -1;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.tipView = {};\n\t\t\tthis.remoteTipView = {};\n\t\t\tthis.remoteChanges = [];\n\t\t} finally {\n\t\t\tthis._root.deserialize(this.tipView, undefined, false, false);\n\t\t\tconst _changeSet = new ChangeSet(this.tipView);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprivate _applyLocalChangeSet(change: IPropertyTreeMessage) {\n\t\tconst changeSetWrapper = new ChangeSet(this.tipView);\n\t\tchangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\t\t} else {\n\t\t\tthis.localChanges.push(change);\n\t\t}\n\t}\n\n\tprivate _applyRemoteChangeSet(change: IRemotePropertyTreeMessage) {\n\t\tthis.unrebasedRemoteChanges[change.guid] = cloneDeep(change);\n\n\t\t// This is the first message in the history of the document.\n\t\tif (this.remoteChanges.length !== 0) {\n\t\t\trebaseToRemoteChanges(\n\t\t\t\tchange,\n\t\t\t\tthis.getUnrebasedChange.bind(this),\n\t\t\t\tthis.getRebasedChanges.bind(this),\n\t\t\t);\n\t\t}\n\n\t\tthis.addRemoteChange(change);\n\t\t// Apply the remote change set to the remote tip view\n\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\t// Rebase the local changes\n\t\tconst pendingChanges = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\t\tnew ChangeSet(pendingChanges)._toReversibleChangeSet(this.tipView);\n\n\t\tconst changesToTip: SerializedChangeSet = {};\n\t\tconst changesNeeded = this.rebaseLocalChanges(change, pendingChanges, changesToTip);\n\n\t\tif (changesNeeded) {\n\t\t\tthis.pushNotificationDelayScope();\n\t\t\t// Checkout the new tip\n\t\t\tthis._root.applyChangeSet(changesToTip);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n\t\t\tthis._root.applyChangeSet(pendingChanges);\n\t\t\tthis.popNotificationDelayScope();\n\t\t}\n\n\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t// assert(JSON.stringify(this.root.serialize()) === JSON.stringify(this.tipView));\n\t}\n\n\tgetUnrebasedChange(guid: string) {\n\t\treturn this.unrebasedRemoteChanges[guid];\n\t}\n\n\tgetRebasedChanges(startGuid: string, endGuid?: string) {\n\t\tconst startIndex = findIndex(this.remoteChanges, (c) => c.guid === startGuid);\n\t\tif (\n\t\t\tstartIndex === -1 &&\n\t\t\tstartGuid !== \"\" &&\n\t\t\t// If the start GUID is the referenceGUID of the first change,\n\t\t\t// we still can get the correct range, because the change with the startGuid itself\n\t\t\t// if not included in the range.\n\t\t\t(this.remoteChanges.length === 0 || startGuid !== this.remoteChanges[0].referenceGuid)\n\t\t) {\n\t\t\t// TODO: Consider throwing an error once clients have picked up PR #16277.\n\t\t\tconsole.error(\"Unknown start GUID specified.\");\n\t\t}\n\t\tif (endGuid !== undefined) {\n\t\t\tconst endIndex = findIndex(this.remoteChanges, (c) => c.guid === endGuid);\n\t\t\treturn this.remoteChanges.slice(startIndex + 1, endIndex + 1);\n\t\t}\n\t\treturn this.remoteChanges.slice(startIndex + 1);\n\t}\n\n\tprivate rebaseLocalChanges(\n\t\tchange: IPropertyTreeMessage,\n\t\tpendingChanges: SerializedChangeSet,\n\t\tnewTipDelta: SerializedChangeSet,\n\t): boolean {\n\t\tlet rebaseBaseChangeSet;\n\n\t\tconst accumulatedChanges: SerializedChangeSet = {};\n\t\tconst conflicts = [] as any[];\n\n\t\tif (this.localChanges.length > 0 && this.localChanges[0].guid === change.guid) {\n\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t// assert(JSON.stringify(this.localChanges[0].changeSet) === JSON.stringify(change.changeSet),\n\t\t\t// \"Local change different than rebased remote change.\");\n\n\t\t\tif (isEqual(this.localChanges[0].changeSet, change.changeSet)) {\n\t\t\t\t// If we got a confirmation of the commit on the tip of the localChanges array,\n\t\t\t\t// there will be no update of the tip view at all. We just move it from local changes\n\t\t\t\t// to remote changes\n\t\t\t\tthis.localChanges.shift();\n\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t// There is a case where the localChanges that were created by incrementally rebasing with respect\n\t\t\t\t// to every incoming change do no exactly agree with the rebased remote change (this happens\n\t\t\t\t// when there are changes that cancel out with each other that have happened in the meantime).\n\t\t\t\t// In that case, we must make sure, we correctly update the local view to take this difference into\n\t\t\t\t// account by rebasing with respect to the changeset that is obtained by combining the inverse of the\n\t\t\t\t// local change with the incoming remote change.\n\n\t\t\t\trebaseBaseChangeSet = new ChangeSet(this.localChanges.shift()?.changeSet);\n\t\t\t\trebaseBaseChangeSet.toInverseChangeSet();\n\t\t\t\trebaseBaseChangeSet.applyChangeSet(change.changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\trebaseBaseChangeSet = cloneDeep(change.changeSet);\n\t\t}\n\n\t\tfor (let i = 0; i < this.localChanges.length; i++) {\n\t\t\t// Make sure we never receive changes out of order\n\t\t\tconsole.assert(this.localChanges[i].guid !== change.guid);\n\n\t\t\tconst rebaseMetaInformation = new Map();\n\n\t\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(this.localChanges[i].changeSet));\n\t\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(\n\t\t\t\tthis.localChanges[i].changeSet,\n\t\t\t\tconflicts,\n\t\t\t\t{\n\t\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tcopiedChangeSet.toInverseChangeSet();\n\t\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\t\tcopiedChangeSet.applyChangeSet(this.localChanges[i].changeSet, {\n\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t});\n\t\t\trebaseBaseChangeSet = copiedChangeSet.getSerializedChangeSet();\n\n\t\t\tnew ChangeSet(accumulatedChanges).applyChangeSet(this.localChanges[i].changeSet);\n\n\t\t\t// Update the reference and head guids\n\t\t\tthis.localChanges[i].remoteHeadGuid = change.guid;\n\t\t\tif (i === 0) {\n\t\t\t\tthis.localChanges[i].referenceGuid = change.guid;\n\t\t\t}\n\t\t}\n\n\t\t// Compute the inverse of the pending changes and store the result in newTipDelta\n\t\tconst pendingChangesRebaseMetaInformation = new Map();\n\t\tconst deltaToTipCS = new ChangeSet(newTipDelta);\n\t\tdeltaToTipCS.applyChangeSet(pendingChanges);\n\t\tdeltaToTipCS.toInverseChangeSet();\n\n\t\t// Perform a rebase of the pending changes\n\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(pendingChanges, conflicts, {\n\t\t\tapplyAfterMetaInformation: pendingChangesRebaseMetaInformation,\n\t\t});\n\n\t\t// Compute the delta between the old tip (including pending changes)\n\t\t// and the new tip (not including the rebased pending changes)\n\t\tdeltaToTipCS.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t// Update the tip view\n\t\tif (!this.tipView) {\n\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\t\t\tconst changeSet = new ChangeSet(this.tipView);\n\t\t\tchangeSet.applyChangeSet(accumulatedChanges);\n\t\t} else {\n\t\t\tnew ChangeSet(this.tipView).applyChangeSet(newTipDelta);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\t// We have to provide our own implementation of the resubmit core function, to\n\t\t// handle the case where an operation is no longer referencing a commit within\n\t\t// the collaboration window as its referenceGuid. Other clients would not be\n\t\t// able to perform the rebase for such an operation. To handle this problem\n\t\t// we have to resubmit a version of the operations which has been rebased to\n\t\t// the current remote tip. We already have these rebased versions of the operations\n\t\t// in our localChanges, because we continuously update those to follow the tip.\n\t\t// Therefore our reSubmitCore function searches for the rebased operation in the\n\t\t// localChanges array and submits this up-to-date version instead of the old operation.\n\t\tconst rebasedOperation = find(this.localChanges, (op) => op.guid === content.guid);\n\n\t\tif (rebasedOperation) {\n\t\t\tthis.submitLocalMessage(cloneDeep(rebasedOperation), localOpMetadata);\n\t\t} else {\n\t\t\t// Could this happen or is there a guard that we will never resubmit an already submitted op?\n\t\t\tconsole.warn(\"Resubmitting operation which has already been received back.\");\n\t\t}\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\tthrow new Error(\"not implemented\");\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTree.d.ts","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAEN,YAAY,EAEZ,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkC,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAErF,OA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;;;OAIG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,KAAA;IAE9B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAKlB,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;cA4CzD,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4JxE,SAAS,CAAC,YAAY;IAEtB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,qBAAqB;IAyC7B,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAI/B,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAoBrD,OAAO,CAAC,kBAAkB;IAgG1B,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAoB7D,SAAS,CAAC,cAAc,IAAI,IAAI;CAGhC"}
|
package/lib/propertyTree.js
CHANGED
|
@@ -10,12 +10,11 @@ import { MessageType, } from "@fluidframework/driver-definitions/internal";
|
|
|
10
10
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
11
11
|
import { SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
12
12
|
import axios from "axios";
|
|
13
|
-
import { copy as cloneDeep } from "fastest-json-copy";
|
|
14
13
|
import lodash from "lodash";
|
|
15
14
|
import { Packr } from "msgpackr";
|
|
16
15
|
import { v4 as uuidv4 } from "uuid";
|
|
17
16
|
// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.
|
|
18
|
-
const { isEmpty, findIndex, find, isEqual, range } = lodash;
|
|
17
|
+
const { isEmpty, findIndex, find, isEqual, range, cloneDeep } = lodash;
|
|
19
18
|
import { PropertyTreeFactory } from "./propertyTreeFactory.js";
|
|
20
19
|
const defaultEncDec = {
|
|
21
20
|
messageEnc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,CAAC,CAAC;QAC9E,CAAC;IACF,CAAC;IAES,cAAc;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tChangeSet,\n\tUtils as ChangeSetUtils,\n\trebaseToRemoteChanges,\n} from \"@fluid-experimental/property-changeset\";\nimport {\n\tBaseProperty,\n\tNodeProperty,\n\tPropertyFactory,\n} from \"@fluid-experimental/property-properties\";\nimport { IsoBuffer, bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport { SharedObject, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport axios from \"axios\";\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport lodash from \"lodash\";\nimport { Packr } from \"msgpackr\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.\nconst { isEmpty, findIndex, find, isEqual, range } = lodash;\n\nimport { PropertyTreeFactory } from \"./propertyTreeFactory.js\";\n\n/**\n * @internal\n */\nexport type SerializedChangeSet = any;\n\n/**\n * @internal\n */\nexport type Metadata = any;\n\ntype FetchUnrebasedChangeFn = (guid: string) => IRemotePropertyTreeMessage;\ntype FetchRebasedChangesFn = (startGuid: string, endGuid?: string) => IPropertyTreeMessage[];\n\n/**\n * @internal\n */\nexport const enum OpKind {\n\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\tChangeSet = 0,\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeMessage {\n\top: OpKind;\n\tchangeSet: SerializedChangeSet;\n\tmetadata: Metadata;\n\tguid: string;\n\treferenceGuid: string;\n\tremoteHeadGuid: string;\n\tlocalBranchStart: string | undefined;\n\trebaseMetaInformation?: Map<any, any>;\n\tuseMH?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IRemotePropertyTreeMessage extends IPropertyTreeMessage {\n\tsequenceNumber: number;\n}\ninterface ISnapshot {\n\tbranchGuid: string;\n\tsummaryMinimumSequenceNumber: number;\n\tuseMH: boolean;\n\tnumChunks: number;\n}\n/**\n * @internal\n */\nexport interface ISnapshotSummary {\n\tremoteTipView?: SerializedChangeSet;\n\tremoteChanges?: IPropertyTreeMessage[];\n\tunrebasedRemoteChanges?: Record<string, IRemotePropertyTreeMessage>;\n\tremoteHeadGuid: string;\n}\n\n/**\n * @internal\n */\nexport interface SharedPropertyTreeOptions {\n\tpaths?: string[];\n\tclientFiltering?: boolean;\n\tuseMH?: boolean;\n\tdisablePartialCheckout?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISharedPropertyTreeEncDec {\n\tmessageEncoder: {\n\t\tencode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t\tdecode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t};\n\tsummaryEncoder: {\n\t\tencode: (ISnapshotSummary) => IsoBuffer;\n\t\tdecode: (IsoBuffer) => ISnapshotSummary;\n\t};\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeConfig {\n\tencDec: ISharedPropertyTreeEncDec;\n}\n\nconst defaultEncDec: ISharedPropertyTreeEncDec = {\n\tmessageEncoder: {\n\t\tencode: (msg: IPropertyTreeMessage) => msg,\n\t\tdecode: (msg: IPropertyTreeMessage) => msg,\n\t},\n\tsummaryEncoder: {\n\t\tencode: (summary: ISnapshotSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst serializedSummary = packr.pack(summary);\n\t\t\treturn serializedSummary;\n\t\t},\n\t\tdecode: (serializedSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst snapshotSummary = packr.unpack(serializedSummary);\n\t\t\treturn snapshotSummary as ISnapshotSummary;\n\t\t},\n\t},\n};\n\n/**\n * DDS that models a tree made of objects with properties under string keys.\n * @internal\n */\nexport class SharedPropertyTree extends SharedObject {\n\ttipView: SerializedChangeSet = {};\n\tremoteTipView: SerializedChangeSet = {};\n\tlocalChanges: IPropertyTreeMessage[] = [];\n\tremoteChanges: IPropertyTreeMessage[] = [];\n\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\ttransmissionsHaveBeenStopped = false;\n\tenqueuedMessages: IPropertyTreeMessage[] = [];\n\tnotificationDelayScope: number = 0;\n\t_root: any = PropertyFactory.create(\"NodeProperty\");\n\toptions: SharedPropertyTreeOptions;\n\tskipSequenceNumber: number = -1;\n\theadCommitGuid: string = \"\";\n\tuseMH: boolean = false;\n\tpropertyTreeConfig: IPropertyTreeConfig;\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptions: SharedPropertyTreeOptions,\n\t\tpropertyTreeConfig: IPropertyTreeConfig = { encDec: defaultEncDec },\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_propertyTree_\");\n\n\t\tthis.options = options;\n\t\t// Quick hack to let the root be aware of the DDS hosting it.\n\t\tthis._root._tree = this;\n\n\t\t// By default, we currently don't use the MH\n\t\tthis.useMH = options.useMH ?? false;\n\t\tthis.propertyTreeConfig = propertyTreeConfig;\n\t}\n\n\t/**\n\t * Create a new shared cell\n\t *\n\t * @param runtime - data store runtime the new shared map belongs to\n\t * @param id - optional name of the shared map\n\t * @returns newly create shared map (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n\t\treturn runtime.createChannel(id, PropertyTreeFactory.Type) as SharedPropertyTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedDie to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedDie\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new PropertyTreeFactory();\n\t}\n\n\t/**\n\t * in case of partial checkout we want to send the paths we are interested in once we are connected\n\t */\n\tprotected onConnect() {\n\t\t// on connect we scope all deltas such that we only get relevant changes\n\t\t// since we know the paths already at construction time this is okay\n\t\tthis.scopeFutureDeltasToPaths(this.options.paths);\n\t}\n\n\tprivate scopeFutureDeltasToPaths(paths?: string[]) {\n\t\t// Backdoor to emit \"partial_checkout\" events on the socket. The delta manager at container runtime layer is\n\t\t// a proxy and the delta manager at the container context layer is yet another proxy, so account for that.\n\t\tif (!this.options.disablePartialCheckout) {\n\t\t\tlet dm = (this.deltaManager as any).deltaManager;\n\t\t\tif (dm.deltaManager !== undefined) {\n\t\t\t\tdm = dm.deltaManager;\n\t\t\t}\n\t\t\tconst socket = dm.connectionManager.connection.socket;\n\t\t\tsocket.emit(\"partial_checkout\", { paths });\n\t\t}\n\t}\n\n\tpublic _reportDirtinessToView() {\n\t\t// Check whether anybody is listening. If not, we don't want to pay the price\n\t\t// for the serialization of the data structure\n\t\tif (this.listenerCount(\"localModification\") > 0) {\n\t\t\tconst changes = this._root._serialize(\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY,\n\t\t\t);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t\tconst _changeSet = new ChangeSet(changes);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t}\n\t}\n\n\tpublic get changeSet(): SerializedChangeSet {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.tipView;\n\t}\n\n\tpublic get activeCommit(): IPropertyTreeMessage {\n\t\treturn this.localChanges.length > 0\n\t\t\t? this.localChanges[this.localChanges.length - 1]\n\t\t\t: this.remoteChanges[this.remoteChanges.length - 1];\n\t}\n\tpublic get root(): NodeProperty {\n\t\treturn this._root as NodeProperty;\n\t}\n\n\tpublic commit(metadata?: Metadata, submitEmptyChange?: boolean) {\n\t\tconst changes = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\n\t\tlet doSubmit = !!submitEmptyChange;\n\n\t\t// if no override provided dont submit unless metadata are provided\n\t\tif (submitEmptyChange === undefined) {\n\t\t\tdoSubmit = metadata !== undefined;\n\t\t}\n\n\t\tif (doSubmit || !isEmpty(changes)) {\n\t\t\tthis.applyChangeSet(changes, metadata || {});\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\t/**\n\t * This method encodes the given message to the transfer form\n\t * @param change - The message to be encoded.\n\t */\n\tprivate encodeMessage(change: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.encode(change);\n\t}\n\n\t/**\n\t * This method decodes message from the transfer form.\n\t * @param transferChange - The message to be decoded.\n\t */\n\tprivate decodeMessage(transferChange: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.decode(transferChange);\n\t}\n\n\tprivate applyChangeSet(changeSet: SerializedChangeSet, metadata: Metadata) {\n\t\tconst _changeSet = new ChangeSet(changeSet);\n\t\t_changeSet._toReversibleChangeSet(this.tipView);\n\n\t\tthis.updateRemoteHeadGuid();\n\n\t\tconst change = {\n\t\t\top: OpKind.ChangeSet,\n\t\t\tchangeSet,\n\t\t\tmetadata,\n\t\t\tguid: uuidv4(),\n\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\treferenceGuid:\n\t\t\t\tthis.localChanges.length > 0\n\t\t\t\t\t? this.localChanges[this.localChanges.length - 1].guid\n\t\t\t\t\t: this.headCommitGuid,\n\t\t\tlocalBranchStart: this.localChanges.length > 0 ? this.localChanges[0].guid : undefined,\n\t\t\tuseMH: this.useMH,\n\t\t};\n\t\tthis._applyLocalChangeSet(change);\n\t\t// Queue the op for transmission to the Fluid service.\n\t\tconst transferChange = this.encodeMessage(cloneDeep(change));\n\t\tif (this.transmissionsHaveBeenStopped) {\n\t\t\tthis.enqueuedMessages.push(transferChange);\n\t\t} else {\n\t\t\tthis.submitLocalMessage(transferChange);\n\t\t}\n\t}\n\n\tstopTransmission(stop: boolean) {\n\t\tthis.transmissionsHaveBeenStopped = stop;\n\t\tif (stop === false) {\n\t\t\tfor (const message of this.enqueuedMessages) {\n\t\t\t\tthis.submitLocalMessage(message);\n\t\t\t}\n\t\t\tthis.enqueuedMessages = [];\n\t\t}\n\t}\n\t/**\n\t * Delays notifications until popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic pushNotificationDelayScope() {\n\t\t// set the scope counter\n\t\tthis.notificationDelayScope++;\n\n\t\t// If we reach 0, we have to report unreported changes\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tthis._root._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Re-enables notifications when popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic popNotificationDelayScope() {\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tconsole.error(\"Unbalanced push/pop calls.\");\n\t\t}\n\t\tthis.notificationDelayScope--;\n\t\tthis._root._reportDirtinessToView();\n\t}\n\n\t/**\n\t * Process an operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\tmessage.sequenceNumber > this.skipSequenceNumber\n\t\t) {\n\t\t\tconst change: IPropertyTreeMessage = this.decodeMessage(cloneDeep(message.contents));\n\t\t\tconst content: IRemotePropertyTreeMessage = {\n\t\t\t\t...change,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t};\n\t\t\tswitch (content.op) {\n\t\t\t\tcase OpKind.ChangeSet:\n\t\t\t\t\t// If the op originated locally from this client, we've already accounted for it\n\t\t\t\t\t// by advancing the state. Otherwise, advance the PRNG now.\n\t\t\t\t\tthis._applyRemoteChangeSet(cloneDeep(content));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addRemoteChange(change: IPropertyTreeMessage) {\n\t\tthis.remoteChanges.push(change);\n\t\tthis.updateRemoteHeadGuid();\n\t}\n\n\tprivate updateRemoteHeadGuid() {\n\t\tthis.headCommitGuid =\n\t\t\tthis.remoteChanges.length > 0\n\t\t\t\t? this.remoteChanges[this.remoteChanges.length - 1].guid\n\t\t\t\t: this.headCommitGuid;\n\t}\n\n\tpublic static prune(\n\t\tminimumSequenceNumber: number,\n\t\tremoteChanges: IPropertyTreeMessage[],\n\t\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage>,\n\t\tremoteHeadGuid: string,\n\t) {\n\t\t// for faster lookup of remote change guids\n\t\tconst remoteChangeMap = new Map<string, number>();\n\t\tremoteChanges.forEach((change, index) => {\n\t\t\tremoteChangeMap.set(change.guid, index);\n\t\t});\n\n\t\t// we will track visited nodes\n\t\tconst visitedUnrebasedRemoteChanges = new Set<string>();\n\t\tconst visitedRemoteChanges = new Set<string>();\n\n\t\tfor (const id of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tconst unrebasedChange = unrebasedRemoteChanges[id];\n\n\t\t\t// we are only interested in changes that are newer than the sequence number\n\t\t\t// and that were not yet visited previously\n\t\t\tif (\n\t\t\t\tunrebasedChange.sequenceNumber >= minimumSequenceNumber &&\n\t\t\t\t!visitedUnrebasedRemoteChanges.has(unrebasedChange.guid)\n\t\t\t) {\n\t\t\t\t// we visited that unrebased change and mark it as visited\n\t\t\t\tvisitedUnrebasedRemoteChanges.add(unrebasedChange.guid);\n\n\t\t\t\tlet visitor = unrebasedChange;\n\t\t\t\t// we will walk along the commit chain until we hit a remote change or a visited unrebased commit\n\t\t\t\t// at that point we can skip since we already traced the rest of the commit chain\n\t\t\t\twhile (\n\t\t\t\t\tvisitor.remoteHeadGuid !== visitor.referenceGuid ||\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tconst guid = visitor.referenceGuid;\n\t\t\t\t\tif (guid === \"\" || guid === remoteHeadGuid) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// since the change is not in remote it must be in unrebased\n\t\t\t\t\tvisitor = unrebasedRemoteChanges[visitor.referenceGuid];\n\t\t\t\t\tif (!visitor) {\n\t\t\t\t\t\tthrow new Error(`no visitor found for guid \"${guid}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.add(visitor.guid);\n\t\t\t\t}\n\t\t\t\t// if we exited the loop because we hit a remote change than add it as visited\n\t\t\t\tif (\n\t\t\t\t\tvisitor.remoteHeadGuid === visitor.referenceGuid &&\n\t\t\t\t\tremoteChangeMap.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tvisitedRemoteChanges.add(visitor.referenceGuid);\n\t\t\t\t}\n\n\t\t\t\t// If we have a change that refers to the start of the history (remoteHeadGuid === \"\" or the\n\t\t\t\t// provided remote head guid), we have to keep all remote Changes until this change has been processed\n\t\t\t\tif (visitor.remoteHeadGuid === \"\" || visitor.remoteHeadGuid === remoteHeadGuid) {\n\t\t\t\t\tvisitedRemoteChanges.add(remoteChanges[0].guid);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlet pruned = 0;\n\t\t// we can now filter the unrebased changes by removing any changes\n\t\t// we have not visited at all during our traversal\n\t\tconst prunedUnrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\t\tfor (const key of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tif (visitedUnrebasedRemoteChanges.has(key)) {\n\t\t\t\tprunedUnrebasedRemoteChanges[key] = unrebasedRemoteChanges[key];\n\t\t\t} else {\n\t\t\t\tpruned++;\n\t\t\t}\n\t\t}\n\n\t\t// find minimum index\n\t\tconst minIndex = Math.min(\n\t\t\t...[...visitedRemoteChanges].map((key) => remoteChangeMap.get(key) as number),\n\t\t);\n\n\t\tconst prunedRemoteChanges = remoteChanges.slice(minIndex);\n\t\tpruned += minIndex;\n\n\t\treturn {\n\t\t\tremoteChanges: prunedRemoteChanges,\n\t\t\tunrebasedRemoteChanges: prunedUnrebasedRemoteChanges,\n\t\t\tprunedCount: pruned,\n\t\t};\n\t}\n\tpublic pruneHistory() {\n\t\tconst msn = this.deltaManager.minimumSequenceNumber;\n\n\t\tlet lastKnownRemoteGuid = this.headCommitGuid;\n\t\t// We use the reference GUID of the first change in the list\n\t\t// of remote changes as lastKnownRemoteGuid, because there\n\t\t// might still be unrebased changes that reference this GUID\n\t\t// as referenceGUID / remoteHeadGuid and if this happens\n\t\t// we must make sure we preserve the remote changes and\n\t\t// unrebased remote changes\n\t\tif (this.remoteChanges.length > 0) {\n\t\t\tlastKnownRemoteGuid = this.remoteChanges[0].referenceGuid;\n\t\t}\n\n\t\tconst { remoteChanges, unrebasedRemoteChanges } = SharedPropertyTree.prune(\n\t\t\tmsn,\n\t\t\tthis.remoteChanges,\n\t\t\tthis.unrebasedRemoteChanges,\n\t\t\tlastKnownRemoteGuid,\n\t\t);\n\n\t\tthis.remoteChanges = remoteChanges;\n\t\tthis.unrebasedRemoteChanges = unrebasedRemoteChanges;\n\t}\n\n\t/**\n\t * This method encodes the local summary (snapshot) object into the serialized form.\n\t * @param summary - The local summary (snapshot)representation.\n\t * @returns The serialized summary representation.\n\t */\n\tprivate encodeSummary(summary: ISnapshotSummary) {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.encode(summary);\n\t}\n\n\t/**\n\t * This method decodes the serialized form of the summary into the local summary (snapshot) object.\n\t * @param serializedSummary - The serialized summary representation.\n\t * @returns The local summary (snapshot)representation.\n\t */\n\tprivate decodeSummary(serializedSummary): ISnapshotSummary {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.decode(serializedSummary);\n\t}\n\n\t/**\n\t * This method writes the log message if the logging is enabled in the extended DDS.\n\t * The logging is not enabled in the default Property DDS\n\t * @param message - The message to be logged.\n\t */\n\tprotected logIfEnabled(message) {}\n\n\t/**\n\t * This method encodes the binary representation of the\n\t * blob.\n\t * @param blob - The binary representation of the blob.\n\t * @returns The encoded representation of the blob.\n\t */\n\tprivate encodeSummaryBlob(blob: ArrayBuffer): any {\n\t\treturn bufferToString(blob, \"base64\");\n\t}\n\n\t/**\n\t * This method decodes the encoded representation of the\n\t * blob.\n\t * @param blob - The encoded representation of the blob.\n\t * @returns The binary representation of the blob.\n\t */\n\tprivate decodeSummaryBlob(encoded: any): ArrayBuffer {\n\t\tconst buffer = bufferToString(encoded, \"utf8\");\n\t\treturn stringToBuffer(buffer, \"base64\");\n\t}\n\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tthis.pruneHistory();\n\t\tconst snapshot: ISnapshot = {\n\t\t\tbranchGuid: this.handle.absolutePath.split(\"/\").pop() as string,\n\t\t\tsummaryMinimumSequenceNumber: this.deltaManager.minimumSequenceNumber,\n\t\t\tuseMH: this.useMH,\n\t\t\tnumChunks: 0,\n\t\t};\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (!this.useMH) {\n\t\t\t// If the MH is not used, we have to include the tip view, the remote changes and the received\n\t\t\t// deltas to the summary\n\t\t\tconst summary: ISnapshotSummary = {\n\t\t\t\tremoteTipView: this.remoteTipView,\n\t\t\t\tremoteChanges: this.remoteChanges,\n\t\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\t\tunrebasedRemoteChanges: this.unrebasedRemoteChanges,\n\t\t\t};\n\n\t\t\tconst chunkSize = 5000 * 1024; // Default limit seems to be 5MB\n\t\t\tlet totalBlobsSize = 0;\n\t\t\tconst serializedSummary = this.encodeSummary(summary);\n\t\t\tfor (let pos = 0, i = 0; pos < serializedSummary.length; pos += chunkSize, i++) {\n\t\t\t\tconst summaryBlob = this.encodeSummaryBlob(\n\t\t\t\t\tserializedSummary.slice(pos, pos + chunkSize),\n\t\t\t\t);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\ttotalBlobsSize += summaryBlob[\"length\"];\n\t\t\t\tbuilder.addBlob(`summaryChunk_${i}`, summaryBlob);\n\t\t\t\tsnapshot.numChunks++;\n\t\t\t}\n\t\t\tthis.logIfEnabled(`Total blobs transfer size: ${totalBlobsSize}`);\n\t\t}\n\n\t\tbuilder.addBlob(\n\t\t\t\"properties\",\n\t\t\tserializer !== undefined\n\t\t\t\t? serializer.stringify(snapshot, this.handle)\n\t\t\t\t: JSON.stringify(snapshot),\n\t\t);\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst runtime = this.runtime;\n\t\tconst handleTableChunk = await storage.readBlob(\"properties\");\n\t\tconst utf8 = bufferToString(handleTableChunk, \"utf8\");\n\n\t\tconst snapshot: ISnapshot = this.serializer.parse(utf8);\n\t\tthis.useMH = snapshot.useMH;\n\n\t\ttry {\n\t\t\tif (!snapshot.useMH) {\n\t\t\t\t// We load all chunks\n\t\t\t\tconst chunks: ArrayBufferLike[] = await Promise.all(\n\t\t\t\t\trange(snapshot.numChunks).map(async (i) => {\n\t\t\t\t\t\treturn this.decodeSummaryBlob(await storage.readBlob(`summaryChunk_${i}`));\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst totalLength = chunks.reduce((a, b) => a + b.byteLength, 0);\n\t\t\t\tconst serializedSummary = new Uint8Array(totalLength);\n\t\t\t\tchunks.reduce((offset, chunk) => {\n\t\t\t\t\tserializedSummary.set(new Uint8Array(chunk), offset);\n\t\t\t\t\treturn offset + chunk.byteLength;\n\t\t\t\t}, 0);\n\t\t\t\tconst snapshotSummary = this.decodeSummary(serializedSummary);\n\t\t\t\tif (\n\t\t\t\t\tsnapshotSummary.remoteChanges === undefined ||\n\t\t\t\t\tsnapshotSummary.remoteTipView === undefined ||\n\t\t\t\t\tsnapshotSummary.unrebasedRemoteChanges === undefined\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\"Invalid Snapshot.\");\n\t\t\t\t}\n\n\t\t\t\tif (snapshotSummary.remoteHeadGuid === undefined) {\n\t\t\t\t\t// The summary does not contain a remoteHeadGuid. This means the summary has\n\t\t\t\t\t// been created by an old version of PropertyDDS, that did not yet have this patch.\n\t\t\t\t\tsnapshotSummary.remoteHeadGuid =\n\t\t\t\t\t\tsnapshotSummary.remoteChanges.length > 0\n\t\t\t\t\t\t\t? // If there are remote changes in the\n\t\t\t\t\t\t\t\t// summary we can deduce the head GUID from these changes.\n\t\t\t\t\t\t\t\tsnapshotSummary.remoteChanges[snapshotSummary.remoteChanges.length - 1].guid\n\t\t\t\t\t\t\t: // If no remote head GUID is available, we will fall back to the old behaviour,\n\t\t\t\t\t\t\t\t// where the head GUID was set to an empty string. However, this could lead to\n\t\t\t\t\t\t\t\t// divergence between the clients, if there is still a client in the session\n\t\t\t\t\t\t\t\t// that is using a version of this library without this patch and which\n\t\t\t\t\t\t\t\t// has started the session at a different summary.\n\t\t\t\t\t\t\t\t\"\";\n\t\t\t\t}\n\n\t\t\t\tthis.remoteTipView = snapshotSummary.remoteTipView;\n\t\t\t\tthis.remoteChanges = snapshotSummary.remoteChanges;\n\t\t\t\tthis.unrebasedRemoteChanges = snapshotSummary.unrebasedRemoteChanges;\n\t\t\t\tthis.headCommitGuid = snapshotSummary.remoteHeadGuid;\n\t\t\t\tconst isPartialCheckoutActive = !!(this.options.clientFiltering && this.options.paths);\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tthis.remoteTipView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tthis.remoteTipView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\n\t\t\t\tthis.skipSequenceNumber = 0;\n\t\t\t} else {\n\t\t\t\tconst { branchGuid, summaryMinimumSequenceNumber } = snapshot;\n\t\t\t\tconst branchResponse = await axios.get(`http://localhost:3000/branch/${branchGuid}`);\n\t\t\t\tthis.headCommitGuid = branchResponse.data.headCommitGuid;\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { meta: commitMetadata },\n\t\t\t\t} = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\t\t\t\tlet { changeSet: materializedView } = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}/materializedView`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\n\t\t\t\tconst isPartialCheckoutActive = this.options.clientFiltering && this.options.paths;\n\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tmaterializedView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tmaterializedView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.tipView = materializedView;\n\t\t\t\tthis.remoteTipView = cloneDeep(this.tipView);\n\t\t\t\tthis.remoteChanges = [];\n\n\t\t\t\tlet missingDeltas: ISequencedDocumentMessage[] = [];\n\t\t\t\tconst firstDelta = Math.min(\n\t\t\t\t\tcommitMetadata.minimumSequenceNumber,\n\t\t\t\t\tsummaryMinimumSequenceNumber,\n\t\t\t\t);\n\t\t\t\tconst lastDelta = commitMetadata.sequenceNumber;\n\n\t\t\t\tconst dm = (this.deltaManager as any).deltaManager;\n\t\t\t\t// TODO: This is accessing a private member of the delta manager, and should not be.\n\t\t\t\tawait dm.getDeltas(\n\t\t\t\t\t\"DocumentOpen\",\n\t\t\t\t\tfirstDelta,\n\t\t\t\t\tlastDelta,\n\t\t\t\t\t(messages: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tmissingDeltas = messages.filter((x) => x.type === \"op\");\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\t\t\tfor (let i = 0; i < missingDeltas.length; i++) {\n\t\t\t\t\tif (missingDeltas[i].sequenceNumber < commitMetadata.sequenceNumber) {\n\t\t\t\t\t\t// TODO: Don't spy on the DeltaManager's private internals.\n\t\t\t\t\t\t// This is trying to mimic what DeltaManager does in processInboundMessage, but there's no guarantee that\n\t\t\t\t\t\t// private implementation won't change.\n\t\t\t\t\t\tconst remoteChange: IPropertyTreeMessage = JSON.parse(\n\t\t\t\t\t\t\tmissingDeltas[i].contents as string,\n\t\t\t\t\t\t).contents.contents.content.contents;\n\t\t\t\t\t\tconst { changeSet } = (\n\t\t\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${remoteChange.guid}/changeSet`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).data;\n\t\t\t\t\t\tremoteChange.changeSet = changeSet;\n\n\t\t\t\t\t\tif (remoteChange) {\n\t\t\t\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\t\t\t\tremoteChange.changeSet = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\t\t\t\tremoteChange.changeSet,\n\t\t\t\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.addRemoteChange(remoteChange);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.processCore(missingDeltas[i], false, {});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.skipSequenceNumber = lastDelta ?? -1;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.tipView = {};\n\t\t\tthis.remoteTipView = {};\n\t\t\tthis.remoteChanges = [];\n\t\t} finally {\n\t\t\tthis._root.deserialize(this.tipView, undefined, false, false);\n\t\t\tconst _changeSet = new ChangeSet(this.tipView);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprivate _applyLocalChangeSet(change: IPropertyTreeMessage) {\n\t\tconst changeSetWrapper = new ChangeSet(this.tipView);\n\t\tchangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\t\t} else {\n\t\t\tthis.localChanges.push(change);\n\t\t}\n\t}\n\n\tprivate _applyRemoteChangeSet(change: IRemotePropertyTreeMessage) {\n\t\tthis.unrebasedRemoteChanges[change.guid] = cloneDeep(change);\n\n\t\t// This is the first message in the history of the document.\n\t\tif (this.remoteChanges.length !== 0) {\n\t\t\trebaseToRemoteChanges(\n\t\t\t\tchange,\n\t\t\t\tthis.getUnrebasedChange.bind(this),\n\t\t\t\tthis.getRebasedChanges.bind(this),\n\t\t\t);\n\t\t}\n\n\t\tthis.addRemoteChange(change);\n\t\t// Apply the remote change set to the remote tip view\n\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\t// Rebase the local changes\n\t\tconst pendingChanges = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\t\tnew ChangeSet(pendingChanges)._toReversibleChangeSet(this.tipView);\n\n\t\tconst changesToTip: SerializedChangeSet = {};\n\t\tconst changesNeeded = this.rebaseLocalChanges(change, pendingChanges, changesToTip);\n\n\t\tif (changesNeeded) {\n\t\t\tthis.pushNotificationDelayScope();\n\t\t\t// Checkout the new tip\n\t\t\tthis._root.applyChangeSet(changesToTip);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n\t\t\tthis._root.applyChangeSet(pendingChanges);\n\t\t\tthis.popNotificationDelayScope();\n\t\t}\n\n\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t// assert(JSON.stringify(this.root.serialize()) === JSON.stringify(this.tipView));\n\t}\n\n\tgetUnrebasedChange(guid: string) {\n\t\treturn this.unrebasedRemoteChanges[guid];\n\t}\n\n\tgetRebasedChanges(startGuid: string, endGuid?: string) {\n\t\tconst startIndex = findIndex(this.remoteChanges, (c) => c.guid === startGuid);\n\t\tif (\n\t\t\tstartIndex === -1 &&\n\t\t\tstartGuid !== \"\" &&\n\t\t\t// If the start GUID is the referenceGUID of the first change,\n\t\t\t// we still can get the correct range, because the change with the startGuid itself\n\t\t\t// if not included in the range.\n\t\t\t(this.remoteChanges.length === 0 || startGuid !== this.remoteChanges[0].referenceGuid)\n\t\t) {\n\t\t\t// TODO: Consider throwing an error once clients have picked up PR #16277.\n\t\t\tconsole.error(\"Unknown start GUID specified.\");\n\t\t}\n\t\tif (endGuid !== undefined) {\n\t\t\tconst endIndex = findIndex(this.remoteChanges, (c) => c.guid === endGuid);\n\t\t\treturn this.remoteChanges.slice(startIndex + 1, endIndex + 1);\n\t\t}\n\t\treturn this.remoteChanges.slice(startIndex + 1);\n\t}\n\n\tprivate rebaseLocalChanges(\n\t\tchange: IPropertyTreeMessage,\n\t\tpendingChanges: SerializedChangeSet,\n\t\tnewTipDelta: SerializedChangeSet,\n\t): boolean {\n\t\tlet rebaseBaseChangeSet;\n\n\t\tconst accumulatedChanges: SerializedChangeSet = {};\n\t\tconst conflicts = [] as any[];\n\n\t\tif (this.localChanges.length > 0 && this.localChanges[0].guid === change.guid) {\n\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t// assert(JSON.stringify(this.localChanges[0].changeSet) === JSON.stringify(change.changeSet),\n\t\t\t// \"Local change different than rebased remote change.\");\n\n\t\t\tif (isEqual(this.localChanges[0].changeSet, change.changeSet)) {\n\t\t\t\t// If we got a confirmation of the commit on the tip of the localChanges array,\n\t\t\t\t// there will be no update of the tip view at all. We just move it from local changes\n\t\t\t\t// to remote changes\n\t\t\t\tthis.localChanges.shift();\n\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t// There is a case where the localChanges that were created by incrementally rebasing with respect\n\t\t\t\t// to every incoming change do no exactly agree with the rebased remote change (this happens\n\t\t\t\t// when there are changes that cancel out with each other that have happened in the meantime).\n\t\t\t\t// In that case, we must make sure, we correctly update the local view to take this difference into\n\t\t\t\t// account by rebasing with respect to the changeset that is obtained by combining the inverse of the\n\t\t\t\t// local change with the incoming remote change.\n\n\t\t\t\trebaseBaseChangeSet = new ChangeSet(this.localChanges.shift()?.changeSet);\n\t\t\t\trebaseBaseChangeSet.toInverseChangeSet();\n\t\t\t\trebaseBaseChangeSet.applyChangeSet(change.changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\trebaseBaseChangeSet = cloneDeep(change.changeSet);\n\t\t}\n\n\t\tfor (let i = 0; i < this.localChanges.length; i++) {\n\t\t\t// Make sure we never receive changes out of order\n\t\t\tconsole.assert(this.localChanges[i].guid !== change.guid);\n\n\t\t\tconst rebaseMetaInformation = new Map();\n\n\t\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(this.localChanges[i].changeSet));\n\t\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(\n\t\t\t\tthis.localChanges[i].changeSet,\n\t\t\t\tconflicts,\n\t\t\t\t{\n\t\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tcopiedChangeSet.toInverseChangeSet();\n\t\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\t\tcopiedChangeSet.applyChangeSet(this.localChanges[i].changeSet, {\n\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t});\n\t\t\trebaseBaseChangeSet = copiedChangeSet.getSerializedChangeSet();\n\n\t\t\tnew ChangeSet(accumulatedChanges).applyChangeSet(this.localChanges[i].changeSet);\n\n\t\t\t// Update the reference and head guids\n\t\t\tthis.localChanges[i].remoteHeadGuid = change.guid;\n\t\t\tif (i === 0) {\n\t\t\t\tthis.localChanges[i].referenceGuid = change.guid;\n\t\t\t}\n\t\t}\n\n\t\t// Compute the inverse of the pending changes and store the result in newTipDelta\n\t\tconst pendingChangesRebaseMetaInformation = new Map();\n\t\tconst deltaToTipCS = new ChangeSet(newTipDelta);\n\t\tdeltaToTipCS.applyChangeSet(pendingChanges);\n\t\tdeltaToTipCS.toInverseChangeSet();\n\n\t\t// Perform a rebase of the pending changes\n\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(pendingChanges, conflicts, {\n\t\t\tapplyAfterMetaInformation: pendingChangesRebaseMetaInformation,\n\t\t});\n\n\t\t// Compute the delta between the old tip (including pending changes)\n\t\t// and the new tip (not including the rebased pending changes)\n\t\tdeltaToTipCS.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t// Update the tip view\n\t\tif (!this.tipView) {\n\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\t\t\tconst changeSet = new ChangeSet(this.tipView);\n\t\t\tchangeSet.applyChangeSet(accumulatedChanges);\n\t\t} else {\n\t\t\tnew ChangeSet(this.tipView).applyChangeSet(newTipDelta);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\t// We have to provide our own implementation of the resubmit core function, to\n\t\t// handle the case where an operation is no longer referencing a commit within\n\t\t// the collaboration window as its referenceGuid. Other clients would not be\n\t\t// able to perform the rebase for such an operation. To handle this problem\n\t\t// we have to resubmit a version of the operations which has been rebased to\n\t\t// the current remote tip. We already have these rebased versions of the operations\n\t\t// in our localChanges, because we continuously update those to follow the tip.\n\t\t// Therefore our reSubmitCore function searches for the rebased operation in the\n\t\t// localChanges array and submits this up-to-date version instead of the old operation.\n\t\tconst rebasedOperation = find(this.localChanges, (op) => op.guid === content.guid);\n\n\t\tif (rebasedOperation) {\n\t\t\tthis.submitLocalMessage(cloneDeep(rebasedOperation), localOpMetadata);\n\t\t} else {\n\t\t\t// Could this happen or is there a guard that we will never resubmit an already submitted op?\n\t\t\tconsole.warn(\"Resubmitting operation which has already been received back.\");\n\t\t}\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\tthrow new Error(\"not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTree.js","sourceRoot":"","sources":["../src/propertyTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,SAAS,EACT,KAAK,IAAI,cAAc,EACvB,qBAAqB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,YAAY,EAEZ,eAAe,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAOpE,OAAO,EACN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAoB,MAAM,6CAA6C,CAAC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AAI,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAES,YAAY,CAAC,OAAY,EAAE,eAAwB;QAC5D,8EAA8E;QAC9E,8EAA8E;QAC9E,4EAA4E;QAC5E,2EAA2E;QAC3E,4EAA4E;QAC5E,mFAAmF;QACnF,+EAA+E;QAC/E,gFAAgF;QAChF,uFAAuF;QACvF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAEnF,IAAI,gBAAgB,EAAE,CAAC;YACtB,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,eAAe,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACP,6FAA6F;YAC7F,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC9E,CAAC;IACF,CAAC;IAES,cAAc;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tChangeSet,\n\tUtils as ChangeSetUtils,\n\trebaseToRemoteChanges,\n} from \"@fluid-experimental/property-changeset\";\nimport {\n\tBaseProperty,\n\tNodeProperty,\n\tPropertyFactory,\n} from \"@fluid-experimental/property-properties\";\nimport { IsoBuffer, bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport { SharedObject, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport axios from \"axios\";\nimport lodash from \"lodash\";\nimport { Packr } from \"msgpackr\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.\nconst { isEmpty, findIndex, find, isEqual, range, cloneDeep } = lodash;\n\nimport { PropertyTreeFactory } from \"./propertyTreeFactory.js\";\n\n/**\n * @internal\n */\nexport type SerializedChangeSet = any;\n\n/**\n * @internal\n */\nexport type Metadata = any;\n\ntype FetchUnrebasedChangeFn = (guid: string) => IRemotePropertyTreeMessage;\ntype FetchRebasedChangesFn = (startGuid: string, endGuid?: string) => IPropertyTreeMessage[];\n\n/**\n * @internal\n */\nexport const enum OpKind {\n\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\tChangeSet = 0,\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeMessage {\n\top: OpKind;\n\tchangeSet: SerializedChangeSet;\n\tmetadata: Metadata;\n\tguid: string;\n\treferenceGuid: string;\n\tremoteHeadGuid: string;\n\tlocalBranchStart: string | undefined;\n\trebaseMetaInformation?: Map<any, any>;\n\tuseMH?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IRemotePropertyTreeMessage extends IPropertyTreeMessage {\n\tsequenceNumber: number;\n}\ninterface ISnapshot {\n\tbranchGuid: string;\n\tsummaryMinimumSequenceNumber: number;\n\tuseMH: boolean;\n\tnumChunks: number;\n}\n/**\n * @internal\n */\nexport interface ISnapshotSummary {\n\tremoteTipView?: SerializedChangeSet;\n\tremoteChanges?: IPropertyTreeMessage[];\n\tunrebasedRemoteChanges?: Record<string, IRemotePropertyTreeMessage>;\n\tremoteHeadGuid: string;\n}\n\n/**\n * @internal\n */\nexport interface SharedPropertyTreeOptions {\n\tpaths?: string[];\n\tclientFiltering?: boolean;\n\tuseMH?: boolean;\n\tdisablePartialCheckout?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISharedPropertyTreeEncDec {\n\tmessageEncoder: {\n\t\tencode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t\tdecode: (IPropertyTreeMessage) => IPropertyTreeMessage;\n\t};\n\tsummaryEncoder: {\n\t\tencode: (ISnapshotSummary) => IsoBuffer;\n\t\tdecode: (IsoBuffer) => ISnapshotSummary;\n\t};\n}\n\n/**\n * @internal\n */\nexport interface IPropertyTreeConfig {\n\tencDec: ISharedPropertyTreeEncDec;\n}\n\nconst defaultEncDec: ISharedPropertyTreeEncDec = {\n\tmessageEncoder: {\n\t\tencode: (msg: IPropertyTreeMessage) => msg,\n\t\tdecode: (msg: IPropertyTreeMessage) => msg,\n\t},\n\tsummaryEncoder: {\n\t\tencode: (summary: ISnapshotSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst serializedSummary = packr.pack(summary);\n\t\t\treturn serializedSummary;\n\t\t},\n\t\tdecode: (serializedSummary) => {\n\t\t\tconst packr = new Packr();\n\t\t\tconst snapshotSummary = packr.unpack(serializedSummary);\n\t\t\treturn snapshotSummary as ISnapshotSummary;\n\t\t},\n\t},\n};\n\n/**\n * DDS that models a tree made of objects with properties under string keys.\n * @internal\n */\nexport class SharedPropertyTree extends SharedObject {\n\ttipView: SerializedChangeSet = {};\n\tremoteTipView: SerializedChangeSet = {};\n\tlocalChanges: IPropertyTreeMessage[] = [];\n\tremoteChanges: IPropertyTreeMessage[] = [];\n\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\ttransmissionsHaveBeenStopped = false;\n\tenqueuedMessages: IPropertyTreeMessage[] = [];\n\tnotificationDelayScope: number = 0;\n\t_root: any = PropertyFactory.create(\"NodeProperty\");\n\toptions: SharedPropertyTreeOptions;\n\tskipSequenceNumber: number = -1;\n\theadCommitGuid: string = \"\";\n\tuseMH: boolean = false;\n\tpropertyTreeConfig: IPropertyTreeConfig;\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptions: SharedPropertyTreeOptions,\n\t\tpropertyTreeConfig: IPropertyTreeConfig = { encDec: defaultEncDec },\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_propertyTree_\");\n\n\t\tthis.options = options;\n\t\t// Quick hack to let the root be aware of the DDS hosting it.\n\t\tthis._root._tree = this;\n\n\t\t// By default, we currently don't use the MH\n\t\tthis.useMH = options.useMH ?? false;\n\t\tthis.propertyTreeConfig = propertyTreeConfig;\n\t}\n\n\t/**\n\t * Create a new shared cell\n\t *\n\t * @param runtime - data store runtime the new shared map belongs to\n\t * @param id - optional name of the shared map\n\t * @returns newly create shared map (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n\t\treturn runtime.createChannel(id, PropertyTreeFactory.Type) as SharedPropertyTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedDie to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedDie\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new PropertyTreeFactory();\n\t}\n\n\t/**\n\t * in case of partial checkout we want to send the paths we are interested in once we are connected\n\t */\n\tprotected onConnect() {\n\t\t// on connect we scope all deltas such that we only get relevant changes\n\t\t// since we know the paths already at construction time this is okay\n\t\tthis.scopeFutureDeltasToPaths(this.options.paths);\n\t}\n\n\tprivate scopeFutureDeltasToPaths(paths?: string[]) {\n\t\t// Backdoor to emit \"partial_checkout\" events on the socket. The delta manager at container runtime layer is\n\t\t// a proxy and the delta manager at the container context layer is yet another proxy, so account for that.\n\t\tif (!this.options.disablePartialCheckout) {\n\t\t\tlet dm = (this.deltaManager as any).deltaManager;\n\t\t\tif (dm.deltaManager !== undefined) {\n\t\t\t\tdm = dm.deltaManager;\n\t\t\t}\n\t\t\tconst socket = dm.connectionManager.connection.socket;\n\t\t\tsocket.emit(\"partial_checkout\", { paths });\n\t\t}\n\t}\n\n\tpublic _reportDirtinessToView() {\n\t\t// Check whether anybody is listening. If not, we don't want to pay the price\n\t\t// for the serialization of the data structure\n\t\tif (this.listenerCount(\"localModification\") > 0) {\n\t\t\tconst changes = this._root._serialize(\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.DIRTY,\n\t\t\t);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t\tconst _changeSet = new ChangeSet(changes);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);\n\t\t}\n\t}\n\n\tpublic get changeSet(): SerializedChangeSet {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.tipView;\n\t}\n\n\tpublic get activeCommit(): IPropertyTreeMessage {\n\t\treturn this.localChanges.length > 0\n\t\t\t? this.localChanges[this.localChanges.length - 1]\n\t\t\t: this.remoteChanges[this.remoteChanges.length - 1];\n\t}\n\tpublic get root(): NodeProperty {\n\t\treturn this._root as NodeProperty;\n\t}\n\n\tpublic commit(metadata?: Metadata, submitEmptyChange?: boolean) {\n\t\tconst changes = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\n\t\tlet doSubmit = !!submitEmptyChange;\n\n\t\t// if no override provided dont submit unless metadata are provided\n\t\tif (submitEmptyChange === undefined) {\n\t\t\tdoSubmit = metadata !== undefined;\n\t\t}\n\n\t\tif (doSubmit || !isEmpty(changes)) {\n\t\t\tthis.applyChangeSet(changes, metadata || {});\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\t/**\n\t * This method encodes the given message to the transfer form\n\t * @param change - The message to be encoded.\n\t */\n\tprivate encodeMessage(change: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.encode(change);\n\t}\n\n\t/**\n\t * This method decodes message from the transfer form.\n\t * @param transferChange - The message to be decoded.\n\t */\n\tprivate decodeMessage(transferChange: IPropertyTreeMessage): IPropertyTreeMessage {\n\t\treturn this.propertyTreeConfig.encDec.messageEncoder.decode(transferChange);\n\t}\n\n\tprivate applyChangeSet(changeSet: SerializedChangeSet, metadata: Metadata) {\n\t\tconst _changeSet = new ChangeSet(changeSet);\n\t\t_changeSet._toReversibleChangeSet(this.tipView);\n\n\t\tthis.updateRemoteHeadGuid();\n\n\t\tconst change = {\n\t\t\top: OpKind.ChangeSet,\n\t\t\tchangeSet,\n\t\t\tmetadata,\n\t\t\tguid: uuidv4(),\n\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\treferenceGuid:\n\t\t\t\tthis.localChanges.length > 0\n\t\t\t\t\t? this.localChanges[this.localChanges.length - 1].guid\n\t\t\t\t\t: this.headCommitGuid,\n\t\t\tlocalBranchStart: this.localChanges.length > 0 ? this.localChanges[0].guid : undefined,\n\t\t\tuseMH: this.useMH,\n\t\t};\n\t\tthis._applyLocalChangeSet(change);\n\t\t// Queue the op for transmission to the Fluid service.\n\t\tconst transferChange = this.encodeMessage(cloneDeep(change));\n\t\tif (this.transmissionsHaveBeenStopped) {\n\t\t\tthis.enqueuedMessages.push(transferChange);\n\t\t} else {\n\t\t\tthis.submitLocalMessage(transferChange);\n\t\t}\n\t}\n\n\tstopTransmission(stop: boolean) {\n\t\tthis.transmissionsHaveBeenStopped = stop;\n\t\tif (stop === false) {\n\t\t\tfor (const message of this.enqueuedMessages) {\n\t\t\t\tthis.submitLocalMessage(message);\n\t\t\t}\n\t\t\tthis.enqueuedMessages = [];\n\t\t}\n\t}\n\t/**\n\t * Delays notifications until popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic pushNotificationDelayScope() {\n\t\t// set the scope counter\n\t\tthis.notificationDelayScope++;\n\n\t\t// If we reach 0, we have to report unreported changes\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tthis._root._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Re-enables notifications when popNotificationDelayScope has been called the same number of times as\n\t * pushNotificationDelayScope.\n\t */\n\tpublic popNotificationDelayScope() {\n\t\tif (this.notificationDelayScope === 0) {\n\t\t\tconsole.error(\"Unbalanced push/pop calls.\");\n\t\t}\n\t\tthis.notificationDelayScope--;\n\t\tthis._root._reportDirtinessToView();\n\t}\n\n\t/**\n\t * Process an operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\tmessage.sequenceNumber > this.skipSequenceNumber\n\t\t) {\n\t\t\tconst change: IPropertyTreeMessage = this.decodeMessage(\n\t\t\t\tcloneDeep(message.contents as IPropertyTreeMessage),\n\t\t\t);\n\t\t\tconst content: IRemotePropertyTreeMessage = {\n\t\t\t\t...change,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t};\n\t\t\tswitch (content.op) {\n\t\t\t\tcase OpKind.ChangeSet:\n\t\t\t\t\t// If the op originated locally from this client, we've already accounted for it\n\t\t\t\t\t// by advancing the state. Otherwise, advance the PRNG now.\n\t\t\t\t\tthis._applyRemoteChangeSet(cloneDeep(content));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addRemoteChange(change: IPropertyTreeMessage) {\n\t\tthis.remoteChanges.push(change);\n\t\tthis.updateRemoteHeadGuid();\n\t}\n\n\tprivate updateRemoteHeadGuid() {\n\t\tthis.headCommitGuid =\n\t\t\tthis.remoteChanges.length > 0\n\t\t\t\t? this.remoteChanges[this.remoteChanges.length - 1].guid\n\t\t\t\t: this.headCommitGuid;\n\t}\n\n\tpublic static prune(\n\t\tminimumSequenceNumber: number,\n\t\tremoteChanges: IPropertyTreeMessage[],\n\t\tunrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage>,\n\t\tremoteHeadGuid: string,\n\t) {\n\t\t// for faster lookup of remote change guids\n\t\tconst remoteChangeMap = new Map<string, number>();\n\t\tremoteChanges.forEach((change, index) => {\n\t\t\tremoteChangeMap.set(change.guid, index);\n\t\t});\n\n\t\t// we will track visited nodes\n\t\tconst visitedUnrebasedRemoteChanges = new Set<string>();\n\t\tconst visitedRemoteChanges = new Set<string>();\n\n\t\tfor (const id of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tconst unrebasedChange = unrebasedRemoteChanges[id];\n\n\t\t\t// we are only interested in changes that are newer than the sequence number\n\t\t\t// and that were not yet visited previously\n\t\t\tif (\n\t\t\t\tunrebasedChange.sequenceNumber >= minimumSequenceNumber &&\n\t\t\t\t!visitedUnrebasedRemoteChanges.has(unrebasedChange.guid)\n\t\t\t) {\n\t\t\t\t// we visited that unrebased change and mark it as visited\n\t\t\t\tvisitedUnrebasedRemoteChanges.add(unrebasedChange.guid);\n\n\t\t\t\tlet visitor = unrebasedChange;\n\t\t\t\t// we will walk along the commit chain until we hit a remote change or a visited unrebased commit\n\t\t\t\t// at that point we can skip since we already traced the rest of the commit chain\n\t\t\t\twhile (\n\t\t\t\t\tvisitor.remoteHeadGuid !== visitor.referenceGuid ||\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tconst guid = visitor.referenceGuid;\n\t\t\t\t\tif (guid === \"\" || guid === remoteHeadGuid) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// since the change is not in remote it must be in unrebased\n\t\t\t\t\tvisitor = unrebasedRemoteChanges[visitor.referenceGuid];\n\t\t\t\t\tif (!visitor) {\n\t\t\t\t\t\tthrow new Error(`no visitor found for guid \"${guid}\"`);\n\t\t\t\t\t}\n\n\t\t\t\t\tvisitedUnrebasedRemoteChanges.add(visitor.guid);\n\t\t\t\t}\n\t\t\t\t// if we exited the loop because we hit a remote change than add it as visited\n\t\t\t\tif (\n\t\t\t\t\tvisitor.remoteHeadGuid === visitor.referenceGuid &&\n\t\t\t\t\tremoteChangeMap.has(visitor.referenceGuid)\n\t\t\t\t) {\n\t\t\t\t\tvisitedRemoteChanges.add(visitor.referenceGuid);\n\t\t\t\t}\n\n\t\t\t\t// If we have a change that refers to the start of the history (remoteHeadGuid === \"\" or the\n\t\t\t\t// provided remote head guid), we have to keep all remote Changes until this change has been processed\n\t\t\t\tif (visitor.remoteHeadGuid === \"\" || visitor.remoteHeadGuid === remoteHeadGuid) {\n\t\t\t\t\tvisitedRemoteChanges.add(remoteChanges[0].guid);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlet pruned = 0;\n\t\t// we can now filter the unrebased changes by removing any changes\n\t\t// we have not visited at all during our traversal\n\t\tconst prunedUnrebasedRemoteChanges: Record<string, IRemotePropertyTreeMessage> = {};\n\t\tfor (const key of Object.keys(unrebasedRemoteChanges)) {\n\t\t\tif (visitedUnrebasedRemoteChanges.has(key)) {\n\t\t\t\tprunedUnrebasedRemoteChanges[key] = unrebasedRemoteChanges[key];\n\t\t\t} else {\n\t\t\t\tpruned++;\n\t\t\t}\n\t\t}\n\n\t\t// find minimum index\n\t\tconst minIndex = Math.min(\n\t\t\t...[...visitedRemoteChanges].map((key) => remoteChangeMap.get(key) as number),\n\t\t);\n\n\t\tconst prunedRemoteChanges = remoteChanges.slice(minIndex);\n\t\tpruned += minIndex;\n\n\t\treturn {\n\t\t\tremoteChanges: prunedRemoteChanges,\n\t\t\tunrebasedRemoteChanges: prunedUnrebasedRemoteChanges,\n\t\t\tprunedCount: pruned,\n\t\t};\n\t}\n\tpublic pruneHistory() {\n\t\tconst msn = this.deltaManager.minimumSequenceNumber;\n\n\t\tlet lastKnownRemoteGuid = this.headCommitGuid;\n\t\t// We use the reference GUID of the first change in the list\n\t\t// of remote changes as lastKnownRemoteGuid, because there\n\t\t// might still be unrebased changes that reference this GUID\n\t\t// as referenceGUID / remoteHeadGuid and if this happens\n\t\t// we must make sure we preserve the remote changes and\n\t\t// unrebased remote changes\n\t\tif (this.remoteChanges.length > 0) {\n\t\t\tlastKnownRemoteGuid = this.remoteChanges[0].referenceGuid;\n\t\t}\n\n\t\tconst { remoteChanges, unrebasedRemoteChanges } = SharedPropertyTree.prune(\n\t\t\tmsn,\n\t\t\tthis.remoteChanges,\n\t\t\tthis.unrebasedRemoteChanges,\n\t\t\tlastKnownRemoteGuid,\n\t\t);\n\n\t\tthis.remoteChanges = remoteChanges;\n\t\tthis.unrebasedRemoteChanges = unrebasedRemoteChanges;\n\t}\n\n\t/**\n\t * This method encodes the local summary (snapshot) object into the serialized form.\n\t * @param summary - The local summary (snapshot)representation.\n\t * @returns The serialized summary representation.\n\t */\n\tprivate encodeSummary(summary: ISnapshotSummary) {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.encode(summary);\n\t}\n\n\t/**\n\t * This method decodes the serialized form of the summary into the local summary (snapshot) object.\n\t * @param serializedSummary - The serialized summary representation.\n\t * @returns The local summary (snapshot)representation.\n\t */\n\tprivate decodeSummary(serializedSummary): ISnapshotSummary {\n\t\treturn this.propertyTreeConfig.encDec.summaryEncoder.decode(serializedSummary);\n\t}\n\n\t/**\n\t * This method writes the log message if the logging is enabled in the extended DDS.\n\t * The logging is not enabled in the default Property DDS\n\t * @param message - The message to be logged.\n\t */\n\tprotected logIfEnabled(message) {}\n\n\t/**\n\t * This method encodes the binary representation of the\n\t * blob.\n\t * @param blob - The binary representation of the blob.\n\t * @returns The encoded representation of the blob.\n\t */\n\tprivate encodeSummaryBlob(blob: ArrayBuffer): any {\n\t\treturn bufferToString(blob, \"base64\");\n\t}\n\n\t/**\n\t * This method decodes the encoded representation of the\n\t * blob.\n\t * @param blob - The encoded representation of the blob.\n\t * @returns The binary representation of the blob.\n\t */\n\tprivate decodeSummaryBlob(encoded: any): ArrayBuffer {\n\t\tconst buffer = bufferToString(encoded, \"utf8\");\n\t\treturn stringToBuffer(buffer, \"base64\");\n\t}\n\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tthis.pruneHistory();\n\t\tconst snapshot: ISnapshot = {\n\t\t\tbranchGuid: this.handle.absolutePath.split(\"/\").pop() as string,\n\t\t\tsummaryMinimumSequenceNumber: this.deltaManager.minimumSequenceNumber,\n\t\t\tuseMH: this.useMH,\n\t\t\tnumChunks: 0,\n\t\t};\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (!this.useMH) {\n\t\t\t// If the MH is not used, we have to include the tip view, the remote changes and the received\n\t\t\t// deltas to the summary\n\t\t\tconst summary: ISnapshotSummary = {\n\t\t\t\tremoteTipView: this.remoteTipView,\n\t\t\t\tremoteChanges: this.remoteChanges,\n\t\t\t\tremoteHeadGuid: this.headCommitGuid,\n\t\t\t\tunrebasedRemoteChanges: this.unrebasedRemoteChanges,\n\t\t\t};\n\n\t\t\tconst chunkSize = 5000 * 1024; // Default limit seems to be 5MB\n\t\t\tlet totalBlobsSize = 0;\n\t\t\tconst serializedSummary = this.encodeSummary(summary);\n\t\t\tfor (let pos = 0, i = 0; pos < serializedSummary.length; pos += chunkSize, i++) {\n\t\t\t\tconst summaryBlob = this.encodeSummaryBlob(\n\t\t\t\t\tserializedSummary.slice(pos, pos + chunkSize),\n\t\t\t\t);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\t\t\t\ttotalBlobsSize += summaryBlob[\"length\"];\n\t\t\t\tbuilder.addBlob(`summaryChunk_${i}`, summaryBlob);\n\t\t\t\tsnapshot.numChunks++;\n\t\t\t}\n\t\t\tthis.logIfEnabled(`Total blobs transfer size: ${totalBlobsSize}`);\n\t\t}\n\n\t\tbuilder.addBlob(\n\t\t\t\"properties\",\n\t\t\tserializer !== undefined\n\t\t\t\t? serializer.stringify(snapshot, this.handle)\n\t\t\t\t: JSON.stringify(snapshot),\n\t\t);\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst runtime = this.runtime;\n\t\tconst handleTableChunk = await storage.readBlob(\"properties\");\n\t\tconst utf8 = bufferToString(handleTableChunk, \"utf8\");\n\n\t\tconst snapshot: ISnapshot = this.serializer.parse(utf8);\n\t\tthis.useMH = snapshot.useMH;\n\n\t\ttry {\n\t\t\tif (!snapshot.useMH) {\n\t\t\t\t// We load all chunks\n\t\t\t\tconst chunks: ArrayBufferLike[] = await Promise.all(\n\t\t\t\t\trange(snapshot.numChunks).map(async (i) => {\n\t\t\t\t\t\treturn this.decodeSummaryBlob(await storage.readBlob(`summaryChunk_${i}`));\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst totalLength = chunks.reduce((a, b) => a + b.byteLength, 0);\n\t\t\t\tconst serializedSummary = new Uint8Array(totalLength);\n\t\t\t\tchunks.reduce((offset, chunk) => {\n\t\t\t\t\tserializedSummary.set(new Uint8Array(chunk), offset);\n\t\t\t\t\treturn offset + chunk.byteLength;\n\t\t\t\t}, 0);\n\t\t\t\tconst snapshotSummary = this.decodeSummary(serializedSummary);\n\t\t\t\tif (\n\t\t\t\t\tsnapshotSummary.remoteChanges === undefined ||\n\t\t\t\t\tsnapshotSummary.remoteTipView === undefined ||\n\t\t\t\t\tsnapshotSummary.unrebasedRemoteChanges === undefined\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\"Invalid Snapshot.\");\n\t\t\t\t}\n\n\t\t\t\tif (snapshotSummary.remoteHeadGuid === undefined) {\n\t\t\t\t\t// The summary does not contain a remoteHeadGuid. This means the summary has\n\t\t\t\t\t// been created by an old version of PropertyDDS, that did not yet have this patch.\n\t\t\t\t\tsnapshotSummary.remoteHeadGuid =\n\t\t\t\t\t\tsnapshotSummary.remoteChanges.length > 0\n\t\t\t\t\t\t\t? // If there are remote changes in the\n\t\t\t\t\t\t\t\t// summary we can deduce the head GUID from these changes.\n\t\t\t\t\t\t\t\tsnapshotSummary.remoteChanges[snapshotSummary.remoteChanges.length - 1].guid\n\t\t\t\t\t\t\t: // If no remote head GUID is available, we will fall back to the old behaviour,\n\t\t\t\t\t\t\t\t// where the head GUID was set to an empty string. However, this could lead to\n\t\t\t\t\t\t\t\t// divergence between the clients, if there is still a client in the session\n\t\t\t\t\t\t\t\t// that is using a version of this library without this patch and which\n\t\t\t\t\t\t\t\t// has started the session at a different summary.\n\t\t\t\t\t\t\t\t\"\";\n\t\t\t\t}\n\n\t\t\t\tthis.remoteTipView = snapshotSummary.remoteTipView;\n\t\t\t\tthis.remoteChanges = snapshotSummary.remoteChanges;\n\t\t\t\tthis.unrebasedRemoteChanges = snapshotSummary.unrebasedRemoteChanges;\n\t\t\t\tthis.headCommitGuid = snapshotSummary.remoteHeadGuid;\n\t\t\t\tconst isPartialCheckoutActive = !!(this.options.clientFiltering && this.options.paths);\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tthis.remoteTipView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tthis.remoteTipView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\n\t\t\t\tthis.skipSequenceNumber = 0;\n\t\t\t} else {\n\t\t\t\tconst { branchGuid, summaryMinimumSequenceNumber } = snapshot;\n\t\t\t\tconst branchResponse = await axios.get(`http://localhost:3000/branch/${branchGuid}`);\n\t\t\t\tthis.headCommitGuid = branchResponse.data.headCommitGuid;\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { meta: commitMetadata },\n\t\t\t\t} = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\t\t\t\tlet { changeSet: materializedView } = (\n\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${this.headCommitGuid}/materializedView`,\n\t\t\t\t\t)\n\t\t\t\t).data;\n\n\t\t\t\tconst isPartialCheckoutActive = this.options.clientFiltering && this.options.paths;\n\n\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\tmaterializedView = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\tmaterializedView,\n\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.tipView = materializedView;\n\t\t\t\tthis.remoteTipView = cloneDeep(this.tipView);\n\t\t\t\tthis.remoteChanges = [];\n\n\t\t\t\tlet missingDeltas: ISequencedDocumentMessage[] = [];\n\t\t\t\tconst firstDelta = Math.min(\n\t\t\t\t\tcommitMetadata.minimumSequenceNumber,\n\t\t\t\t\tsummaryMinimumSequenceNumber,\n\t\t\t\t);\n\t\t\t\tconst lastDelta = commitMetadata.sequenceNumber;\n\n\t\t\t\tconst dm = (this.deltaManager as any).deltaManager;\n\t\t\t\t// TODO: This is accessing a private member of the delta manager, and should not be.\n\t\t\t\tawait dm.getDeltas(\n\t\t\t\t\t\"DocumentOpen\",\n\t\t\t\t\tfirstDelta,\n\t\t\t\t\tlastDelta,\n\t\t\t\t\t(messages: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tmissingDeltas = messages.filter((x) => x.type === \"op\");\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\t\t\tfor (let i = 0; i < missingDeltas.length; i++) {\n\t\t\t\t\tif (missingDeltas[i].sequenceNumber < commitMetadata.sequenceNumber) {\n\t\t\t\t\t\t// TODO: Don't spy on the DeltaManager's private internals.\n\t\t\t\t\t\t// This is trying to mimic what DeltaManager does in processInboundMessage, but there's no guarantee that\n\t\t\t\t\t\t// private implementation won't change.\n\t\t\t\t\t\tconst remoteChange: IPropertyTreeMessage = JSON.parse(\n\t\t\t\t\t\t\tmissingDeltas[i].contents as string,\n\t\t\t\t\t\t).contents.contents.content.contents;\n\t\t\t\t\t\tconst { changeSet } = (\n\t\t\t\t\t\t\tawait axios.get(\n\t\t\t\t\t\t\t\t`http://localhost:3000/branch/${branchGuid}/commit/${remoteChange.guid}/changeSet`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t).data;\n\t\t\t\t\t\tremoteChange.changeSet = changeSet;\n\n\t\t\t\t\t\tif (remoteChange) {\n\t\t\t\t\t\t\tif (isPartialCheckoutActive && this.options.paths) {\n\t\t\t\t\t\t\t\tremoteChange.changeSet = ChangeSetUtils.getFilteredChangeSetByPaths(\n\t\t\t\t\t\t\t\t\tremoteChange.changeSet,\n\t\t\t\t\t\t\t\t\tthis.options.paths,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.addRemoteChange(remoteChange);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.processCore(missingDeltas[i], false, {});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.skipSequenceNumber = lastDelta ?? -1;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.tipView = {};\n\t\t\tthis.remoteTipView = {};\n\t\t\tthis.remoteChanges = [];\n\t\t} finally {\n\t\t\tthis._root.deserialize(this.tipView, undefined, false, false);\n\t\t\tconst _changeSet = new ChangeSet(this.tipView);\n\t\t\tif (!isEmpty(_changeSet.getSerializedChangeSet())) {\n\t\t\t\tthis.emit(\"localModification\", _changeSet);\n\t\t\t}\n\t\t\tthis.root.cleanDirty();\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprivate _applyLocalChangeSet(change: IPropertyTreeMessage) {\n\t\tconst changeSetWrapper = new ChangeSet(this.tipView);\n\t\tchangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\t\t} else {\n\t\t\tthis.localChanges.push(change);\n\t\t}\n\t}\n\n\tprivate _applyRemoteChangeSet(change: IRemotePropertyTreeMessage) {\n\t\tthis.unrebasedRemoteChanges[change.guid] = cloneDeep(change);\n\n\t\t// This is the first message in the history of the document.\n\t\tif (this.remoteChanges.length !== 0) {\n\t\t\trebaseToRemoteChanges(\n\t\t\t\tchange,\n\t\t\t\tthis.getUnrebasedChange.bind(this),\n\t\t\t\tthis.getRebasedChanges.bind(this),\n\t\t\t);\n\t\t}\n\n\t\tthis.addRemoteChange(change);\n\t\t// Apply the remote change set to the remote tip view\n\t\tconst remoteChangeSetWrapper = new ChangeSet(this.remoteTipView);\n\t\tremoteChangeSetWrapper.applyChangeSet(change.changeSet);\n\n\t\t// Rebase the local changes\n\t\tconst pendingChanges = this._root._serialize(\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t\tBaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE,\n\t\t);\n\t\tnew ChangeSet(pendingChanges)._toReversibleChangeSet(this.tipView);\n\n\t\tconst changesToTip: SerializedChangeSet = {};\n\t\tconst changesNeeded = this.rebaseLocalChanges(change, pendingChanges, changesToTip);\n\n\t\tif (changesNeeded) {\n\t\t\tthis.pushNotificationDelayScope();\n\t\t\t// Checkout the new tip\n\t\t\tthis._root.applyChangeSet(changesToTip);\n\t\t\tthis._root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);\n\t\t\tthis._root.applyChangeSet(pendingChanges);\n\t\t\tthis.popNotificationDelayScope();\n\t\t}\n\n\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t// assert(JSON.stringify(this.root.serialize()) === JSON.stringify(this.tipView));\n\t}\n\n\tgetUnrebasedChange(guid: string) {\n\t\treturn this.unrebasedRemoteChanges[guid];\n\t}\n\n\tgetRebasedChanges(startGuid: string, endGuid?: string) {\n\t\tconst startIndex = findIndex(this.remoteChanges, (c) => c.guid === startGuid);\n\t\tif (\n\t\t\tstartIndex === -1 &&\n\t\t\tstartGuid !== \"\" &&\n\t\t\t// If the start GUID is the referenceGUID of the first change,\n\t\t\t// we still can get the correct range, because the change with the startGuid itself\n\t\t\t// if not included in the range.\n\t\t\t(this.remoteChanges.length === 0 || startGuid !== this.remoteChanges[0].referenceGuid)\n\t\t) {\n\t\t\t// TODO: Consider throwing an error once clients have picked up PR #16277.\n\t\t\tconsole.error(\"Unknown start GUID specified.\");\n\t\t}\n\t\tif (endGuid !== undefined) {\n\t\t\tconst endIndex = findIndex(this.remoteChanges, (c) => c.guid === endGuid);\n\t\t\treturn this.remoteChanges.slice(startIndex + 1, endIndex + 1);\n\t\t}\n\t\treturn this.remoteChanges.slice(startIndex + 1);\n\t}\n\n\tprivate rebaseLocalChanges(\n\t\tchange: IPropertyTreeMessage,\n\t\tpendingChanges: SerializedChangeSet,\n\t\tnewTipDelta: SerializedChangeSet,\n\t): boolean {\n\t\tlet rebaseBaseChangeSet;\n\n\t\tconst accumulatedChanges: SerializedChangeSet = {};\n\t\tconst conflicts = [] as any[];\n\n\t\tif (this.localChanges.length > 0 && this.localChanges[0].guid === change.guid) {\n\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t// assert(JSON.stringify(this.localChanges[0].changeSet) === JSON.stringify(change.changeSet),\n\t\t\t// \"Local change different than rebased remote change.\");\n\n\t\t\tif (isEqual(this.localChanges[0].changeSet, change.changeSet)) {\n\t\t\t\t// If we got a confirmation of the commit on the tip of the localChanges array,\n\t\t\t\t// there will be no update of the tip view at all. We just move it from local changes\n\t\t\t\t// to remote changes\n\t\t\t\tthis.localChanges.shift();\n\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t// There is a case where the localChanges that were created by incrementally rebasing with respect\n\t\t\t\t// to every incoming change do no exactly agree with the rebased remote change (this happens\n\t\t\t\t// when there are changes that cancel out with each other that have happened in the meantime).\n\t\t\t\t// In that case, we must make sure, we correctly update the local view to take this difference into\n\t\t\t\t// account by rebasing with respect to the changeset that is obtained by combining the inverse of the\n\t\t\t\t// local change with the incoming remote change.\n\n\t\t\t\trebaseBaseChangeSet = new ChangeSet(this.localChanges.shift()?.changeSet);\n\t\t\t\trebaseBaseChangeSet.toInverseChangeSet();\n\t\t\t\trebaseBaseChangeSet.applyChangeSet(change.changeSet);\n\t\t\t}\n\t\t} else {\n\t\t\trebaseBaseChangeSet = cloneDeep(change.changeSet);\n\t\t}\n\n\t\tfor (let i = 0; i < this.localChanges.length; i++) {\n\t\t\t// Make sure we never receive changes out of order\n\t\t\tconsole.assert(this.localChanges[i].guid !== change.guid);\n\n\t\t\tconst rebaseMetaInformation = new Map();\n\n\t\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(this.localChanges[i].changeSet));\n\t\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(\n\t\t\t\tthis.localChanges[i].changeSet,\n\t\t\t\tconflicts,\n\t\t\t\t{\n\t\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tcopiedChangeSet.toInverseChangeSet();\n\t\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\t\tcopiedChangeSet.applyChangeSet(this.localChanges[i].changeSet, {\n\t\t\t\tapplyAfterMetaInformation: rebaseMetaInformation,\n\t\t\t});\n\t\t\trebaseBaseChangeSet = copiedChangeSet.getSerializedChangeSet();\n\n\t\t\tnew ChangeSet(accumulatedChanges).applyChangeSet(this.localChanges[i].changeSet);\n\n\t\t\t// Update the reference and head guids\n\t\t\tthis.localChanges[i].remoteHeadGuid = change.guid;\n\t\t\tif (i === 0) {\n\t\t\t\tthis.localChanges[i].referenceGuid = change.guid;\n\t\t\t}\n\t\t}\n\n\t\t// Compute the inverse of the pending changes and store the result in newTipDelta\n\t\tconst pendingChangesRebaseMetaInformation = new Map();\n\t\tconst deltaToTipCS = new ChangeSet(newTipDelta);\n\t\tdeltaToTipCS.applyChangeSet(pendingChanges);\n\t\tdeltaToTipCS.toInverseChangeSet();\n\n\t\t// Perform a rebase of the pending changes\n\t\tnew ChangeSet(rebaseBaseChangeSet)._rebaseChangeSet(pendingChanges, conflicts, {\n\t\t\tapplyAfterMetaInformation: pendingChangesRebaseMetaInformation,\n\t\t});\n\n\t\t// Compute the delta between the old tip (including pending changes)\n\t\t// and the new tip (not including the rebased pending changes)\n\t\tdeltaToTipCS.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t// Update the tip view\n\t\tif (!this.tipView) {\n\t\t\tthis.tipView = cloneDeep(this.remoteTipView);\n\t\t\tconst changeSet = new ChangeSet(this.tipView);\n\t\t\tchangeSet.applyChangeSet(accumulatedChanges);\n\t\t} else {\n\t\t\tnew ChangeSet(this.tipView).applyChangeSet(newTipDelta);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\t// We have to provide our own implementation of the resubmit core function, to\n\t\t// handle the case where an operation is no longer referencing a commit within\n\t\t// the collaboration window as its referenceGuid. Other clients would not be\n\t\t// able to perform the rebase for such an operation. To handle this problem\n\t\t// we have to resubmit a version of the operations which has been rebased to\n\t\t// the current remote tip. We already have these rebased versions of the operations\n\t\t// in our localChanges, because we continuously update those to follow the tip.\n\t\t// Therefore our reSubmitCore function searches for the rebased operation in the\n\t\t// localChanges array and submits this up-to-date version instead of the old operation.\n\t\tconst rebasedOperation = find(this.localChanges, (op) => op.guid === content.guid);\n\n\t\tif (rebasedOperation) {\n\t\t\tthis.submitLocalMessage(cloneDeep(rebasedOperation), localOpMetadata);\n\t\t} else {\n\t\t\t// Could this happen or is there a guard that we will never resubmit an already submitted op?\n\t\t\tconsole.warn(\"Resubmitting operation which has already been received back.\");\n\t\t}\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\tthrow new Error(\"not implemented\");\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/property-dds",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0-276326",
|
|
4
4
|
"description": "definition of the property distributed data store",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -27,19 +27,18 @@
|
|
|
27
27
|
"main": "lib/index.js",
|
|
28
28
|
"types": "lib/index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@fluid-experimental/property-changeset": "
|
|
31
|
-
"@fluid-experimental/property-properties": "
|
|
32
|
-
"@fluid-internal/client-utils": "
|
|
33
|
-
"@fluidframework/container-definitions": "
|
|
34
|
-
"@fluidframework/core-interfaces": "
|
|
35
|
-
"@fluidframework/datastore-definitions": "
|
|
36
|
-
"@fluidframework/driver-definitions": "
|
|
37
|
-
"@fluidframework/runtime-definitions": "
|
|
38
|
-
"@fluidframework/runtime-utils": "
|
|
39
|
-
"@fluidframework/shared-object-base": "
|
|
30
|
+
"@fluid-experimental/property-changeset": "2.1.0-276326",
|
|
31
|
+
"@fluid-experimental/property-properties": "2.1.0-276326",
|
|
32
|
+
"@fluid-internal/client-utils": "2.1.0-276326",
|
|
33
|
+
"@fluidframework/container-definitions": "2.1.0-276326",
|
|
34
|
+
"@fluidframework/core-interfaces": "2.1.0-276326",
|
|
35
|
+
"@fluidframework/datastore-definitions": "2.1.0-276326",
|
|
36
|
+
"@fluidframework/driver-definitions": "2.1.0-276326",
|
|
37
|
+
"@fluidframework/runtime-definitions": "2.1.0-276326",
|
|
38
|
+
"@fluidframework/runtime-utils": "2.1.0-276326",
|
|
39
|
+
"@fluidframework/shared-object-base": "2.1.0-276326",
|
|
40
40
|
"axios": "^1.6.2",
|
|
41
41
|
"buffer": "^6.0.3",
|
|
42
|
-
"fastest-json-copy": "^1.0.1",
|
|
43
42
|
"lodash": "^4.17.21",
|
|
44
43
|
"lz4js": "^0.2.0",
|
|
45
44
|
"msgpackr": "^1.10.1",
|
|
@@ -49,20 +48,20 @@
|
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
51
50
|
"@biomejs/biome": "^1.7.3",
|
|
52
|
-
"@fluid-experimental/property-common": "
|
|
53
|
-
"@fluid-internal/mocha-test-setup": "
|
|
54
|
-
"@fluid-private/test-drivers": "
|
|
51
|
+
"@fluid-experimental/property-common": "2.1.0-276326",
|
|
52
|
+
"@fluid-internal/mocha-test-setup": "2.1.0-276326",
|
|
53
|
+
"@fluid-private/test-drivers": "2.1.0-276326",
|
|
55
54
|
"@fluid-tools/build-cli": "^0.39.0",
|
|
56
55
|
"@fluidframework/build-common": "^2.0.3",
|
|
57
56
|
"@fluidframework/build-tools": "^0.39.0",
|
|
58
|
-
"@fluidframework/container-loader": "
|
|
59
|
-
"@fluidframework/container-runtime": "
|
|
57
|
+
"@fluidframework/container-loader": "2.1.0-276326",
|
|
58
|
+
"@fluidframework/container-runtime": "2.1.0-276326",
|
|
60
59
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
61
|
-
"@fluidframework/local-driver": "
|
|
62
|
-
"@fluidframework/sequence": "
|
|
60
|
+
"@fluidframework/local-driver": "2.1.0-276326",
|
|
61
|
+
"@fluidframework/sequence": "2.1.0-276326",
|
|
63
62
|
"@fluidframework/server-local-server": "^5.0.0",
|
|
64
|
-
"@fluidframework/test-runtime-utils": "
|
|
65
|
-
"@fluidframework/test-utils": "
|
|
63
|
+
"@fluidframework/test-runtime-utils": "2.1.0-276326",
|
|
64
|
+
"@fluidframework/test-utils": "2.1.0-276326",
|
|
66
65
|
"@microsoft/api-extractor": "^7.45.1",
|
|
67
66
|
"@types/lodash": "^4.14.118",
|
|
68
67
|
"@types/mocha": "^9.1.1",
|
package/src/propertyTree.ts
CHANGED
|
@@ -29,13 +29,12 @@ import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/inter
|
|
|
29
29
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
30
30
|
import { SharedObject, IFluidSerializer } from "@fluidframework/shared-object-base/internal";
|
|
31
31
|
import axios from "axios";
|
|
32
|
-
import { copy as cloneDeep } from "fastest-json-copy";
|
|
33
32
|
import lodash from "lodash";
|
|
34
33
|
import { Packr } from "msgpackr";
|
|
35
34
|
import { v4 as uuidv4 } from "uuid";
|
|
36
35
|
|
|
37
36
|
// eslint-disable-next-line @typescript-eslint/unbound-method -- 'lodash' import workaround.
|
|
38
|
-
const { isEmpty, findIndex, find, isEqual, range } = lodash;
|
|
37
|
+
const { isEmpty, findIndex, find, isEqual, range, cloneDeep } = lodash;
|
|
39
38
|
|
|
40
39
|
import { PropertyTreeFactory } from "./propertyTreeFactory.js";
|
|
41
40
|
|
|
@@ -377,7 +376,9 @@ export class SharedPropertyTree extends SharedObject {
|
|
|
377
376
|
message.type === MessageType.Operation &&
|
|
378
377
|
message.sequenceNumber > this.skipSequenceNumber
|
|
379
378
|
) {
|
|
380
|
-
const change: IPropertyTreeMessage = this.decodeMessage(
|
|
379
|
+
const change: IPropertyTreeMessage = this.decodeMessage(
|
|
380
|
+
cloneDeep(message.contents as IPropertyTreeMessage),
|
|
381
|
+
);
|
|
381
382
|
const content: IRemotePropertyTreeMessage = {
|
|
382
383
|
...change,
|
|
383
384
|
sequenceNumber: message.sequenceNumber,
|