@fluid-experimental/tree 2.70.0-361092 → 2.70.0-361788

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/tree",
3
- "version": "2.70.0-361092",
3
+ "version": "2.70.0-361788",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -27,18 +27,18 @@
27
27
  "main": "lib/index.js",
28
28
  "types": "lib/index.d.ts",
29
29
  "dependencies": {
30
- "@fluid-internal/client-utils": "2.70.0-361092",
31
- "@fluidframework/container-definitions": "2.70.0-361092",
32
- "@fluidframework/core-interfaces": "2.70.0-361092",
33
- "@fluidframework/core-utils": "2.70.0-361092",
34
- "@fluidframework/datastore-definitions": "2.70.0-361092",
35
- "@fluidframework/driver-definitions": "2.70.0-361092",
36
- "@fluidframework/id-compressor": "2.70.0-361092",
37
- "@fluidframework/runtime-definitions": "2.70.0-361092",
38
- "@fluidframework/runtime-utils": "2.70.0-361092",
39
- "@fluidframework/shared-object-base": "2.70.0-361092",
40
- "@fluidframework/telemetry-utils": "2.70.0-361092",
41
- "@fluidframework/tree": "2.70.0-361092",
30
+ "@fluid-internal/client-utils": "2.70.0-361788",
31
+ "@fluidframework/container-definitions": "2.70.0-361788",
32
+ "@fluidframework/core-interfaces": "2.70.0-361788",
33
+ "@fluidframework/core-utils": "2.70.0-361788",
34
+ "@fluidframework/datastore-definitions": "2.70.0-361788",
35
+ "@fluidframework/driver-definitions": "2.70.0-361788",
36
+ "@fluidframework/id-compressor": "2.70.0-361788",
37
+ "@fluidframework/runtime-definitions": "2.70.0-361788",
38
+ "@fluidframework/runtime-utils": "2.70.0-361788",
39
+ "@fluidframework/shared-object-base": "2.70.0-361788",
40
+ "@fluidframework/telemetry-utils": "2.70.0-361788",
41
+ "@fluidframework/tree": "2.70.0-361788",
42
42
  "@tylerbu/sorted-btree-es6": "^1.8.0",
43
43
  "buffer": "^6.0.3",
44
44
  "denque": "^1.5.1",
@@ -48,20 +48,20 @@
48
48
  "devDependencies": {
49
49
  "@arethetypeswrong/cli": "^0.17.1",
50
50
  "@biomejs/biome": "~1.9.3",
51
- "@fluid-internal/mocha-test-setup": "2.70.0-361092",
52
- "@fluid-private/stochastic-test-utils": "2.70.0-361092",
53
- "@fluid-private/test-drivers": "2.70.0-361092",
51
+ "@fluid-internal/mocha-test-setup": "2.70.0-361788",
52
+ "@fluid-private/stochastic-test-utils": "2.70.0-361788",
53
+ "@fluid-private/test-drivers": "2.70.0-361788",
54
54
  "@fluid-tools/benchmark": "^0.51.0",
55
55
  "@fluidframework/build-common": "^2.0.3",
56
56
  "@fluidframework/build-tools": "^0.58.3",
57
- "@fluidframework/container-definitions": "2.70.0-361092",
58
- "@fluidframework/container-loader": "2.70.0-361092",
59
- "@fluidframework/container-runtime": "2.70.0-361092",
57
+ "@fluidframework/container-definitions": "2.70.0-361788",
58
+ "@fluidframework/container-loader": "2.70.0-361788",
59
+ "@fluidframework/container-runtime": "2.70.0-361788",
60
60
  "@fluidframework/eslint-config-fluid": "^6.1.0",
61
- "@fluidframework/runtime-utils": "2.70.0-361092",
62
- "@fluidframework/test-runtime-utils": "2.70.0-361092",
63
- "@fluidframework/test-utils": "2.70.0-361092",
64
- "@fluidframework/undo-redo": "2.70.0-361092",
61
+ "@fluidframework/runtime-utils": "2.70.0-361788",
62
+ "@fluidframework/test-runtime-utils": "2.70.0-361788",
63
+ "@fluidframework/test-utils": "2.70.0-361788",
64
+ "@fluidframework/undo-redo": "2.70.0-361788",
65
65
  "@microsoft/api-extractor": "7.52.11",
66
66
  "@types/chai": "^4.0.0",
67
67
  "@types/lru-cache": "^5.1.0",
package/src/SharedTree.ts CHANGED
@@ -14,8 +14,12 @@ import {
14
14
  IChannelServices,
15
15
  IChannelStorageService,
16
16
  } from '@fluidframework/datastore-definitions/internal';
17
- import { ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
18
- import { ISummaryTreeWithStats, ITelemetryContext } from '@fluidframework/runtime-definitions/internal';
17
+ import {
18
+ ISummaryTreeWithStats,
19
+ ITelemetryContext,
20
+ type IRuntimeMessageCollection,
21
+ type ISequencedMessageEnvelope,
22
+ } from '@fluidframework/runtime-definitions/internal';
19
23
  import {
20
24
  IFluidSerializer,
21
25
  ISharedObjectEvents,
@@ -212,8 +216,8 @@ export class SharedTreeFactory implements IChannelFactory {
212
216
 
213
217
  /**
214
218
  * Get a factory for SharedTree to register with the data store.
215
- * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
216
- * documentation](../docs/Write-Format.md) for more information.
219
+ * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format
220
+ * documentation} for more information.
217
221
  * @param options - Configuration options for this tree
218
222
  * @returns A factory that creates `SharedTree`s and loads them from storage.
219
223
  */
@@ -379,7 +383,7 @@ export interface StashedLocalOpMetadata {
379
383
  const stashedSessionId = '8477b8d5-cf6c-4673-8345-8f076a8f9bc6' as SessionId;
380
384
 
381
385
  /**
382
- * A [distributed tree](../Readme.md).
386
+ * A {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/README.md | distributed tree}.
383
387
  * @alpha
384
388
  */
385
389
  export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
@@ -397,7 +401,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
397
401
  * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
398
402
  * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
399
403
  * written.
400
- * See [the write format documentation](../docs/Write-Format.md) for more information.
404
+ * See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format documentation} for more information.
401
405
  * @param options - Configuration options for this tree
402
406
  * @returns A factory that creates `SharedTree`s and loads them from storage.
403
407
  */
@@ -530,8 +534,8 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
530
534
  * Create a new SharedTree.
531
535
  * @param runtime - The runtime the SharedTree will be associated with
532
536
  * @param id - Unique ID for the SharedTree
533
- * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
534
- * documentation](../docs/Write-Format.md) for more information.
537
+ * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See {@link https://github.com/microsoft/FluidFramework/blob/main/experimental/dds/tree/docs/Write-Format.md | the write format
538
+ * documentation} for more information.
535
539
  * @param options - Configuration options for this tree
536
540
  */
537
541
  public constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);
@@ -995,14 +999,19 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
995
999
  }
996
1000
 
997
1001
  /**
998
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
1002
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
999
1003
  */
1000
- protected processCore(message: unknown, local: boolean): void {
1001
- const typedMessage = message as Omit<ISequencedDocumentMessage, 'contents'> & {
1002
- contents: SharedTreeOp_0_0_2 | SharedTreeOp;
1003
- };
1004
- this.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);
1005
- const op = typedMessage.contents;
1004
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
1005
+ const { envelope, messagesContent } = messagesCollection;
1006
+ for (const messageContent of messagesContent) {
1007
+ this.processMessage(envelope, messageContent.contents);
1008
+ }
1009
+ }
1010
+
1011
+ private processMessage(messageEnvelope: ISequencedMessageEnvelope, contents: unknown): void {
1012
+ const typedContents = contents as SharedTreeOp_0_0_2 | SharedTreeOp;
1013
+ this.cachingLogViewer.setMinimumSequenceNumber(messageEnvelope.minimumSequenceNumber);
1014
+ const op = typedContents;
1006
1015
  if (op.version === undefined) {
1007
1016
  // Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.
1008
1017
  (op as { version: WriteFormat | undefined }).version = WriteFormat.v0_0_2;
@@ -1024,7 +1033,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
1024
1033
  if (op.version === WriteFormat.v0_1_1) {
1025
1034
  this.internStringsFromEdit(edit);
1026
1035
  }
1027
- this.processSequencedEdit(edit, typedMessage);
1036
+ this.processSequencedEdit(edit, messageEnvelope);
1028
1037
  }
1029
1038
  } else if (type === SharedTreeOpType.Update) {
1030
1039
  this.processVersionUpdate(op.version);
@@ -1071,7 +1080,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
1071
1080
  }
1072
1081
  }
1073
1082
 
1074
- private processSequencedEdit(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage): void {
1083
+ private processSequencedEdit(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope): void {
1075
1084
  const { id: editId } = edit;
1076
1085
  const wasLocalEdit = this.editLog.isLocalEdit(editId);
1077
1086
 
@@ -1086,9 +1095,9 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
1086
1095
  }
1087
1096
 
1088
1097
  if (wasLocalEdit) {
1089
- this.editLog.addSequencedEdit(edit, message);
1098
+ this.editLog.addSequencedEdit(edit, messageEnvelope);
1090
1099
  } else {
1091
- this.applyEditLocally(edit, message);
1100
+ this.applyEditLocally(edit, messageEnvelope);
1092
1101
  }
1093
1102
  }
1094
1103
 
@@ -1311,10 +1320,10 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
1311
1320
  }
1312
1321
  }
1313
1322
 
1314
- private applyEditLocally(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage | undefined): void {
1315
- const isSequenced = message !== undefined;
1323
+ private applyEditLocally(edit: Edit<ChangeInternal>, messageEnvelope: ISequencedMessageEnvelope | undefined): void {
1324
+ const isSequenced = messageEnvelope !== undefined;
1316
1325
  if (isSequenced) {
1317
- this.editLog.addSequencedEdit(edit, message);
1326
+ this.editLog.addSequencedEdit(edit, messageEnvelope);
1318
1327
  } else {
1319
1328
  this.editLog.addLocalEdit(edit);
1320
1329
  }
@@ -265,7 +265,7 @@ export class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent
265
265
  * twice, we will be in a "v2" state even though we really are in a "v1" state. We will encounter unexpected op
266
266
  * dropping behavior or lack thereof and may corrupt the document.
267
267
  * @param services - the services to generate the shim services from
268
- * @returns - shim services
268
+ * @returns shim services
269
269
  */
270
270
  private generateShimServicesOnce(services: IChannelServices): IShimChannelServices {
271
271
  assert(