@fluid-experimental/tree 2.4.0 → 2.5.0

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.
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
6
  import { type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
7
+ import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
7
8
  import { type IOpContents, type IShimDeltaHandler } from './types.js';
8
9
  /**
9
10
  * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.
@@ -31,6 +32,7 @@ export declare class MigrationShimDeltaHandler implements IShimDeltaHandler {
31
32
  isUsingNewV2(): boolean;
32
33
  attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void;
33
34
  process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
35
+ processMessages(messagesCollection: IRuntimeMessageCollection): void;
34
36
  setConnectionState(connected: boolean): void;
35
37
  reSubmit(contents: unknown, localOpMetadata: unknown): void;
36
38
  applyStashedOp(contents: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"migrationDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC7G,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,YAAW,iBAAiB;aAKjD,gBAAgB,EAAE,CACjC,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,KACpB,OAAO;IACZ,OAAO,CAAC,QAAQ,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EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAa3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAcvC,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE,OAAO,CAAC,yBAAyB;IAIjC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAmBpB"}
@@ -79,6 +79,12 @@ export class MigrationShimDeltaHandler {
79
79
  // Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class
80
80
  return this.treeDeltaHandler.process(message, local, localOpMetadata);
81
81
  }
82
+ processMessages(messagesCollection) {
83
+ const { envelope, messagesContent, local } = messagesCollection;
84
+ for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
85
+ this.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);
86
+ }
87
+ }
82
88
  setConnectionState(connected) {
83
89
  return this.treeDeltaHandler.setConnectionState(connected);
84
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"migrationDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAkC,MAAM,6CAA6C,CAAC;AAG1G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAAyB;IAGrC;IACC,6DAA6D;IAC7C,gBAIJ,EACK,kBAAkD,EAClD,UAA8B;QAN/B,qBAAgB,GAAhB,gBAAgB,CAIpB;QACK,uBAAkB,GAAlB,kBAAkB,CAAgC;QAClD,eAAU,GAAV,UAAU,CAAoB;QAaxC,cAAS,GAAG,KAAK,CAAC;IAZvB,CAAC;IACJ,8DAA8D;IACvD,mBAAmB;QACzB,OAAO,IAAI,CAAC,iBAA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AO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,MAAM,CACL,eAAe,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.\n * Intercepts processing of ops to allow for migration, and swapping from LegacySharedTree to new SharedTree\n *\n * Able to process v1 and v2 ops, differentiate between them, understand the various states and drop v1 ops after\n * migration.\n *\n * TODO: After the MSN of the barrier op, it needs to process v2 ops without needing to check for the v2 stamp.\n */\nexport class MigrationShimDeltaHandler implements IShimDeltaHandler {\n\tprivate legacyTreeHandler?: IDeltaHandler;\n\tprivate newTreeHandler?: IDeltaHandler;\n\tpublic constructor(\n\t\t// Maybe it would be better to pass in a different interface?\n\t\tpublic readonly processMigrateOp: (\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\tlocalOpMetadata: unknown\n\t\t) => boolean,\n\t\tprivate readonly submitLocalMessage: (message: IOpContents) => void,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\t// Introduction of invariant, we always expect an old handler.\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined;\n\t}\n\n\tprivate get treeDeltaHandler(): IDeltaHandler {\n\t\tconst handler = this.newTreeHandler ?? this.legacyTreeHandler;\n\t\tassert(handler !== undefined, 0x7e2 /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic isPreAttachState(): boolean {\n\t\tconst preAttach = this.legacyTreeHandler === undefined && this.newTreeHandler === undefined;\n\t\tassert(!preAttach || !this.attached, 0x82a /* Should not be attached in preAttach state */);\n\t\treturn preAttach;\n\t}\n\n\tpublic isUsingOldV1(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined && this.newTreeHandler === undefined;\n\t}\n\n\tpublic isUsingNewV2(): boolean {\n\t\tconst isUsingV2 = this.legacyTreeHandler !== undefined && this.newTreeHandler !== undefined;\n\t\tassert(!isUsingV2 || this.attached, 0x82b /* Should be attached if in v2 state */);\n\t\treturn isUsingV2;\n\t}\n\n\t// Allow for the handler to be swapped out for the new SharedTree's handler\n\tpublic attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void {\n\t\tassert(!this.isUsingNewV2(), 0x7e3 /* Can't swap tree handlers more than once! */);\n\t\tif (this.isPreAttachState()) {\n\t\t\tthis.legacyTreeHandler = treeDeltaHandler;\n\t\t\treturn;\n\t\t}\n\t\tassert(this.isUsingOldV1(), 0x7e4 /* Can only swap handlers after the old handler is loaded */);\n\t\tthis.newTreeHandler = treeDeltaHandler;\n\t\tassert(this.isUsingNewV2(), 0x7e5 /* Should be using new handler after swap */);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\tassert(!this.isPreAttachState(), 0x82c /* Can't process ops before attaching tree handler */);\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(contents)) {\n\t\t\tthis.processMigrateOp(message, local, localOpMetadata);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\t// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class\n\t\treturn this.treeDeltaHandler.process(message, local, localOpMetadata);\n\t}\n\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.treeDeltaHandler.setConnectionState(connected);\n\t}\n\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(opContents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.treeDeltaHandler.reSubmit(contents, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\t!this.shouldDropOp(opContents),\n\t\t\t0x8aa /* MigrationShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.treeDeltaHandler.applyStashedOp(contents);\n\t}\n\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (isBarrierOp(opContents)) {\n\t\t\tthrow new Error('MigrationShim does not support rollback of barrier ops');\n\t\t}\n\t\treturn this.treeDeltaHandler.rollback?.(contents, localOpMetadata);\n\t}\n\n\tprivate isInV1StateAndIsBarrierOp(contents: IOpContents): boolean {\n\t\treturn this.isUsingOldV1() && isBarrierOp(contents);\n\t}\n\n\t/**\n\t * We should drop an op when we are v2 state and the op is a v1 op or a migrate op.\n\t *\n\t * @param contents - op contents we expect to interrogate, this could be anything\n\t * @returns whether or not we should drop the op\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tassert(!this.isPreAttachState(), 0x82d /* Can't process ops before attaching tree handler */);\n\t\t// Don't drop ops when we are in v1 state\n\t\tif (this.isUsingOldV1()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Drop v1 ops when in v2 state\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x82e /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"migrationDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAkC,MAAM,6CAA6C,CAAC;AAI1G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAAyB;IAGrC;IACC,6DAA6D;IAC7C,gBAIJ,EACK,kBAAkD,EAClD,UAA8B;QAN/B,qBAAgB,GAAhB,gBAAgB,CAIpB;QACK,uBAAkB,GAAlB,kBAAkB,CAAgC;QAClD,eAAU,GAAV,UAAU,CAAoB;QAaxC,cAAS,GAAG,KAAK,CAAC;IAZvB,CAAC;IACJ,8DAA8D;IACvD,mBAAmB;QACzB,OAAO,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC;IAC7C,CAAC;IAED,IAAY,gBAAgB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,iBAAiB,CAAC;QAC9D,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC;IAChB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC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AQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,MAAM,CACL,eAAe,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.\n * Intercepts processing of ops to allow for migration, and swapping from LegacySharedTree to new SharedTree\n *\n * Able to process v1 and v2 ops, differentiate between them, understand the various states and drop v1 ops after\n * migration.\n *\n * TODO: After the MSN of the barrier op, it needs to process v2 ops without needing to check for the v2 stamp.\n */\nexport class MigrationShimDeltaHandler implements IShimDeltaHandler {\n\tprivate legacyTreeHandler?: IDeltaHandler;\n\tprivate newTreeHandler?: IDeltaHandler;\n\tpublic constructor(\n\t\t// Maybe it would be better to pass in a different interface?\n\t\tpublic readonly processMigrateOp: (\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\tlocalOpMetadata: unknown\n\t\t) => boolean,\n\t\tprivate readonly submitLocalMessage: (message: IOpContents) => void,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\t// Introduction of invariant, we always expect an old handler.\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined;\n\t}\n\n\tprivate get treeDeltaHandler(): IDeltaHandler {\n\t\tconst handler = this.newTreeHandler ?? this.legacyTreeHandler;\n\t\tassert(handler !== undefined, 0x7e2 /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic isPreAttachState(): boolean {\n\t\tconst preAttach = this.legacyTreeHandler === undefined && this.newTreeHandler === undefined;\n\t\tassert(!preAttach || !this.attached, 0x82a /* Should not be attached in preAttach state */);\n\t\treturn preAttach;\n\t}\n\n\tpublic isUsingOldV1(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined && this.newTreeHandler === undefined;\n\t}\n\n\tpublic isUsingNewV2(): boolean {\n\t\tconst isUsingV2 = this.legacyTreeHandler !== undefined && this.newTreeHandler !== undefined;\n\t\tassert(!isUsingV2 || this.attached, 0x82b /* Should be attached if in v2 state */);\n\t\treturn isUsingV2;\n\t}\n\n\t// Allow for the handler to be swapped out for the new SharedTree's handler\n\tpublic attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void {\n\t\tassert(!this.isUsingNewV2(), 0x7e3 /* Can't swap tree handlers more than once! */);\n\t\tif (this.isPreAttachState()) {\n\t\t\tthis.legacyTreeHandler = treeDeltaHandler;\n\t\t\treturn;\n\t\t}\n\t\tassert(this.isUsingOldV1(), 0x7e4 /* Can only swap handlers after the old handler is loaded */);\n\t\tthis.newTreeHandler = treeDeltaHandler;\n\t\tassert(this.isUsingNewV2(), 0x7e5 /* Should be using new handler after swap */);\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\tassert(!this.isPreAttachState(), 0x82c /* Can't process ops before attaching tree handler */);\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(contents)) {\n\t\t\tthis.processMigrateOp(message, local, localOpMetadata);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\t// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class\n\t\treturn this.treeDeltaHandler.process(message, local, localOpMetadata);\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.treeDeltaHandler.setConnectionState(connected);\n\t}\n\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(opContents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.treeDeltaHandler.reSubmit(contents, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\t!this.shouldDropOp(opContents),\n\t\t\t0x8aa /* MigrationShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.treeDeltaHandler.applyStashedOp(contents);\n\t}\n\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (isBarrierOp(opContents)) {\n\t\t\tthrow new Error('MigrationShim does not support rollback of barrier ops');\n\t\t}\n\t\treturn this.treeDeltaHandler.rollback?.(contents, localOpMetadata);\n\t}\n\n\tprivate isInV1StateAndIsBarrierOp(contents: IOpContents): boolean {\n\t\treturn this.isUsingOldV1() && isBarrierOp(contents);\n\t}\n\n\t/**\n\t * We should drop an op when we are v2 state and the op is a v1 op or a migrate op.\n\t *\n\t * @param contents - op contents we expect to interrogate, this could be anything\n\t * @returns whether or not we should drop the op\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tassert(!this.isPreAttachState(), 0x82d /* Can't process ops before attaching tree handler */);\n\t\t// Don't drop ops when we are in v1 state\n\t\tif (this.isUsingOldV1()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Drop v1 ops when in v2 state\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x82e /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
6
  import { type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
7
+ import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
7
8
  import { type IShimDeltaHandler } from './types.js';
8
9
  /**
9
10
  * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.
@@ -25,6 +26,7 @@ export declare class SharedTreeShimDeltaHandler implements IShimDeltaHandler {
25
26
  attachTreeDeltaHandler(handler: IDeltaHandler): void;
26
27
  hasTreeDeltaHandler(): boolean;
27
28
  process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
29
+ processMessages(messagesCollection: IRuntimeMessageCollection): void;
28
30
  setConnectionState(connected: boolean): void;
29
31
  reSubmit(contents: unknown, localOpMetadata: unknown): void;
30
32
  applyStashedOp(contents: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC7G,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,kBAAkB;IAElE,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAEM,YAAY,IAAI,IAAI;IAIpB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKpD,mBAAmB,IAAI,OAAO;IAI9B,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAgB3F,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAK5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAQ9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYpB"}
1
+ {"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC7G,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC1G,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,kBAAkB;IAElE,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAEM,YAAY,IAAI,IAAI;IAIpB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKpD,mBAAmB,IAAI,OAAO;IAI9B,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAe3F,eAAe,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAQpE,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAK5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAQ9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYpB"}
@@ -50,6 +50,12 @@ export class SharedTreeShimDeltaHandler {
50
50
  }
51
51
  return this.handler.process(message, local, localOpMetadata);
52
52
  }
53
+ processMessages(messagesCollection) {
54
+ const { envelope, messagesContent, local } = messagesCollection;
55
+ for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
56
+ this.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);
57
+ }
58
+ }
53
59
  // No idea whether any of the below 4 methods work as expected
54
60
  setConnectionState(connected) {
55
61
  return this.handler.setConnectionState(connected);
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAkC,MAAM,6CAA6C,CAAC;AAG1G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACtC,YAAoC,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;QAS1D,cAAS,GAAG,KAAK,CAAC;IAT2C,CAAC;IAGtE,IAAY,OAAO;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC;IAChB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,sBAAsB,CAAC,OAAsB;QACnD,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACtF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,mBAAmB;QACzB,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IACpC,CAAC;IAEM,OAAO,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC1F,uGAAuG;QACvG,cAAc;QACd,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,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,QAAqB;QACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,MAAM,CACL,eAAe,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.\n * This serves as an adapter to the real DeltaHandler, filter/process migration ops\n *\n * This should just have the ability to drop v1 & migrate ops, and process v2 ops. There may be an opportunity to\n * combine this class with the MigrationShimDeltaHandler, but for now the classes are separated. Once it is clear what\n * exact code can be shared between the two classes is and how it can be merge, we may figure out a way of merging\n * MigrationShimDeltaHandler and SharedTreeShimDeltaHandler.\n */\nexport class SharedTreeShimDeltaHandler implements IShimDeltaHandler {\n\tpublic constructor(private readonly attributes: IChannelAttributes) {}\n\n\tprivate _handler?: IDeltaHandler;\n\tprivate get handler(): IDeltaHandler {\n\t\tconst handler = this._handler;\n\t\tassert(handler !== undefined, 0x7eb /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic attachTreeDeltaHandler(handler: IDeltaHandler): void {\n\t\tassert(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this._handler !== undefined;\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\t// Drop v1 ops\n\t\tassert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);\n\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.handler.process(message, local, localOpMetadata);\n\t}\n\n\t// No idea whether any of the below 4 methods work as expected\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.handler.setConnectionState(connected);\n\t}\n\n\t// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.reSubmit(contents, localOpMetadata);\n\t}\n\n\t// We are not capable of applying stashed v1 ops.\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.handler.applyStashedOp(contents);\n\t}\n\n\t/**\n\t * We cannot rollback v1 ops, we have already migrated and are in v2 state, thus we should not be able to generate.\n\t * v1 ops\n\t */\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.rollback?.(contents, localOpMetadata);\n\t}\n\n\t/**\n\t * The SharedTreeShimDeltaHandler is already in a v2 state. Thus it should drop all v1 and migrate ops.\n\t * @param contents - the interrogable op contents to figure out if this is a v1 op, a migrate op, or a v2 op.\n\t * @returns whether or not the op is a v1 or migrate op and should be dropped/ignored.\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x834 /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAkC,MAAM,6CAA6C,CAAC;AAI1G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACtC,YAAoC,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;QAS1D,cAAS,GAAG,KAAK,CAAC;IAT2C,CAAC;IAGtE,IAAY,OAAO;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC;IAChB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,sBAAsB,CAAC,OAAsB;QACnD,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EA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AAK,CAAC,wFAAwF,CAC9F,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACzD,CAAC;IAED,iDAAiD;IAC1C,cAAc,CAAC,QAAiB;QACtC,MAAM,CACL,CAAC,IAAI,CAAC,YAAY,CAAC,QAAuB,CAAC,EAC3C,KAAK,CAAC,oGAAoG,CAC1G,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAE,QAAiB,EAAE,eAAwB;QAC3D,MAAM,CACL,CAAC,IAAI,CAAC,YAAY,CAAC,QAAuB,CAAC,EAC3C,KAAK,CAAC,wFAAwF,CAC9F,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,QAAqB;QACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,MAAM,CACL,eAAe,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.\n * This serves as an adapter to the real DeltaHandler, filter/process migration ops\n *\n * This should just have the ability to drop v1 & migrate ops, and process v2 ops. There may be an opportunity to\n * combine this class with the MigrationShimDeltaHandler, but for now the classes are separated. Once it is clear what\n * exact code can be shared between the two classes is and how it can be merge, we may figure out a way of merging\n * MigrationShimDeltaHandler and SharedTreeShimDeltaHandler.\n */\nexport class SharedTreeShimDeltaHandler implements IShimDeltaHandler {\n\tpublic constructor(private readonly attributes: IChannelAttributes) {}\n\n\tprivate _handler?: IDeltaHandler;\n\tprivate get handler(): IDeltaHandler {\n\t\tconst handler = this._handler;\n\t\tassert(handler !== undefined, 0x7eb /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic attachTreeDeltaHandler(handler: IDeltaHandler): void {\n\t\tassert(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this._handler !== undefined;\n\t}\n\n\tpublic process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\t// Drop v1 ops\n\t\tassert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);\n\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.handler.process(message, local, localOpMetadata);\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\t// No idea whether any of the below 4 methods work as expected\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.handler.setConnectionState(connected);\n\t}\n\n\t// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.reSubmit(contents, localOpMetadata);\n\t}\n\n\t// We are not capable of applying stashed v1 ops.\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.handler.applyStashedOp(contents);\n\t}\n\n\t/**\n\t * We cannot rollback v1 ops, we have already migrated and are in v2 state, thus we should not be able to generate.\n\t * v1 ops\n\t */\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.rollback?.(contents, localOpMetadata);\n\t}\n\n\t/**\n\t * The SharedTreeShimDeltaHandler is already in a v2 state. Thus it should drop all v1 and migrate ops.\n\t * @param contents - the interrogable op contents to figure out if this is a v1 op, a migrate op, or a v2 op.\n\t * @returns whether or not the op is a v1 or migrate op and should be dropped/ignored.\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x834 /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/tree",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -37,18 +37,18 @@
37
37
  "main": "lib/index.js",
38
38
  "types": "lib/index.d.ts",
39
39
  "dependencies": {
40
- "@fluid-internal/client-utils": "~2.4.0",
41
- "@fluidframework/container-definitions": "~2.4.0",
42
- "@fluidframework/core-interfaces": "~2.4.0",
43
- "@fluidframework/core-utils": "~2.4.0",
44
- "@fluidframework/datastore-definitions": "~2.4.0",
45
- "@fluidframework/driver-definitions": "~2.4.0",
46
- "@fluidframework/id-compressor": "~2.4.0",
47
- "@fluidframework/runtime-definitions": "~2.4.0",
48
- "@fluidframework/runtime-utils": "~2.4.0",
49
- "@fluidframework/shared-object-base": "~2.4.0",
50
- "@fluidframework/telemetry-utils": "~2.4.0",
51
- "@fluidframework/tree": "~2.4.0",
40
+ "@fluid-internal/client-utils": "~2.5.0",
41
+ "@fluidframework/container-definitions": "~2.5.0",
42
+ "@fluidframework/core-interfaces": "~2.5.0",
43
+ "@fluidframework/core-utils": "~2.5.0",
44
+ "@fluidframework/datastore-definitions": "~2.5.0",
45
+ "@fluidframework/driver-definitions": "~2.5.0",
46
+ "@fluidframework/id-compressor": "~2.5.0",
47
+ "@fluidframework/runtime-definitions": "~2.5.0",
48
+ "@fluidframework/runtime-utils": "~2.5.0",
49
+ "@fluidframework/shared-object-base": "~2.5.0",
50
+ "@fluidframework/telemetry-utils": "~2.5.0",
51
+ "@fluidframework/tree": "~2.5.0",
52
52
  "@tylerbu/sorted-btree-es6": "^1.8.0",
53
53
  "buffer": "^6.0.3",
54
54
  "denque": "^1.5.1",
@@ -57,21 +57,21 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@arethetypeswrong/cli": "^0.16.4",
60
- "@biomejs/biome": "~1.8.3",
61
- "@fluid-internal/mocha-test-setup": "~2.4.0",
62
- "@fluid-private/stochastic-test-utils": "~2.4.0",
63
- "@fluid-private/test-drivers": "~2.4.0",
60
+ "@biomejs/biome": "~1.9.3",
61
+ "@fluid-internal/mocha-test-setup": "~2.5.0",
62
+ "@fluid-private/stochastic-test-utils": "~2.5.0",
63
+ "@fluid-private/test-drivers": "~2.5.0",
64
64
  "@fluid-tools/benchmark": "^0.50.0",
65
65
  "@fluidframework/build-common": "^2.0.3",
66
- "@fluidframework/build-tools": "^0.48.0",
67
- "@fluidframework/container-definitions": "~2.4.0",
68
- "@fluidframework/container-loader": "~2.4.0",
69
- "@fluidframework/container-runtime": "~2.4.0",
66
+ "@fluidframework/build-tools": "^0.49.0",
67
+ "@fluidframework/container-definitions": "~2.5.0",
68
+ "@fluidframework/container-loader": "~2.5.0",
69
+ "@fluidframework/container-runtime": "~2.5.0",
70
70
  "@fluidframework/eslint-config-fluid": "^5.4.0",
71
- "@fluidframework/runtime-utils": "~2.4.0",
72
- "@fluidframework/test-runtime-utils": "~2.4.0",
73
- "@fluidframework/test-utils": "~2.4.0",
74
- "@fluidframework/undo-redo": "~2.4.0",
71
+ "@fluidframework/runtime-utils": "~2.5.0",
72
+ "@fluidframework/test-runtime-utils": "~2.5.0",
73
+ "@fluidframework/test-utils": "~2.5.0",
74
+ "@fluidframework/undo-redo": "~2.5.0",
75
75
  "@microsoft/api-extractor": "7.47.8",
76
76
  "@types/chai": "^4.0.0",
77
77
  "@types/lru-cache": "^5.1.0",
@@ -1114,8 +1114,8 @@ export class IdCompressor {
1114
1114
  if (key === inversionKey) {
1115
1115
  return IdCompressor.isUnfinalizedOverride(compressionMapping)
1116
1116
  ? compressionMapping
1117
- : compressionMapping.associatedLocalId ??
1118
- (compressionMapping.originalOverridingFinal as SessionSpaceCompressedId);
1117
+ : (compressionMapping.associatedLocalId ??
1118
+ (compressionMapping.originalOverridingFinal as SessionSpaceCompressedId));
1119
1119
  }
1120
1120
  } else {
1121
1121
  if (!isStable) {
@@ -6,6 +6,7 @@
6
6
  import { assert } from '@fluidframework/core-utils/internal';
7
7
  import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
8
8
  import { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
9
+ import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
9
10
 
10
11
  import { type IOpContents, type IShimDeltaHandler } from './types.js';
11
12
  import { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';
@@ -100,6 +101,13 @@ export class MigrationShimDeltaHandler implements IShimDeltaHandler {
100
101
  return this.treeDeltaHandler.process(message, local, localOpMetadata);
101
102
  }
102
103
 
104
+ public processMessages(messagesCollection: IRuntimeMessageCollection): void {
105
+ const { envelope, messagesContent, local } = messagesCollection;
106
+ for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
107
+ this.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);
108
+ }
109
+ }
110
+
103
111
  public setConnectionState(connected: boolean): void {
104
112
  return this.treeDeltaHandler.setConnectionState(connected);
105
113
  }
@@ -6,6 +6,7 @@
6
6
  import { assert } from '@fluidframework/core-utils/internal';
7
7
  import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
8
8
  import { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
9
+ import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
9
10
 
10
11
  import { type IOpContents, type IShimDeltaHandler } from './types.js';
11
12
  import { attributesMatch, isStampedOp } from './utils.js';
@@ -62,6 +63,13 @@ export class SharedTreeShimDeltaHandler implements IShimDeltaHandler {
62
63
  return this.handler.process(message, local, localOpMetadata);
63
64
  }
64
65
 
66
+ public processMessages(messagesCollection: IRuntimeMessageCollection): void {
67
+ const { envelope, messagesContent, local } = messagesCollection;
68
+ for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
69
+ this.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);
70
+ }
71
+ }
72
+
65
73
  // No idea whether any of the below 4 methods work as expected
66
74
  public setConnectionState(connected: boolean): void {
67
75
  return this.handler.setConnectionState(connected);