@fluidframework/merge-tree 3.0.1 → 3.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/merge-tree",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Merge tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -61,30 +61,30 @@
61
61
  "temp-directory": "nyc/.nyc_output"
62
62
  },
63
63
  "dependencies": {
64
- "@fluid-internal/client-utils": "~3.0.1",
65
- "@fluidframework/container-definitions": "~3.0.1",
66
- "@fluidframework/core-interfaces": "~3.0.1",
67
- "@fluidframework/core-utils": "~3.0.1",
68
- "@fluidframework/datastore-definitions": "~3.0.1",
69
- "@fluidframework/driver-definitions": "~3.0.1",
70
- "@fluidframework/runtime-definitions": "~3.0.1",
71
- "@fluidframework/runtime-utils": "~3.0.1",
72
- "@fluidframework/shared-object-base": "~3.0.1",
73
- "@fluidframework/telemetry-utils": "~3.0.1"
64
+ "@fluid-internal/client-utils": "~3.1.0",
65
+ "@fluidframework/container-definitions": "~3.1.0",
66
+ "@fluidframework/core-interfaces": "~3.1.0",
67
+ "@fluidframework/core-utils": "~3.1.0",
68
+ "@fluidframework/datastore-definitions": "~3.1.0",
69
+ "@fluidframework/driver-definitions": "~3.1.0",
70
+ "@fluidframework/runtime-definitions": "~3.1.0",
71
+ "@fluidframework/runtime-utils": "~3.1.0",
72
+ "@fluidframework/shared-object-base": "~3.1.0",
73
+ "@fluidframework/telemetry-utils": "~3.1.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@arethetypeswrong/cli": "^0.18.5",
77
77
  "@biomejs/biome": "~2.4.5",
78
- "@fluid-internal/mocha-test-setup": "~3.0.1",
79
- "@fluid-private/stochastic-test-utils": "~3.0.1",
80
- "@fluid-private/test-pairwise-generator": "~3.0.1",
78
+ "@fluid-internal/mocha-test-setup": "~3.1.0",
79
+ "@fluid-private/stochastic-test-utils": "~3.1.0",
80
+ "@fluid-private/test-pairwise-generator": "~3.1.0",
81
81
  "@fluid-tools/benchmark": "^0.59.0",
82
82
  "@fluid-tools/build-cli": "^0.67.0",
83
83
  "@fluidframework/build-common": "^2.0.3",
84
84
  "@fluidframework/build-tools": "^0.67.0",
85
85
  "@fluidframework/eslint-config-fluid": "^14.0.0",
86
86
  "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.116.0",
87
- "@fluidframework/test-runtime-utils": "~3.0.1",
87
+ "@fluidframework/test-runtime-utils": "~3.1.0",
88
88
  "@microsoft/api-extractor": "7.58.1",
89
89
  "@types/diff": "^3.5.1",
90
90
  "@types/mocha": "^10.0.10",
package/src/client.ts CHANGED
@@ -31,7 +31,6 @@ import {
31
31
  } from "@fluidframework/telemetry-utils/internal";
32
32
 
33
33
  import { MergeTreeTextHelper, type IMergeTreeTextHelper } from "./MergeTreeTextHelper.js";
34
- import { RedBlackTree } from "./collections/index.js";
35
34
  import { NonCollabClient, SquashClient, UniversalSequenceNumber } from "./constants.js";
36
35
  import { type LocalReferencePosition, SlidingPreference } from "./localReference.js";
37
36
  import {
@@ -54,7 +53,6 @@ import {
54
53
  type ISegmentPrivate,
55
54
  type Marker,
56
55
  type SegmentGroup,
57
- compareStrings,
58
56
  isSegmentLeaf,
59
57
  type ISegmentInternal,
60
58
  type ISegmentLeaf,
@@ -173,7 +171,7 @@ export class Client extends TypedEventEmitter<IClientEvents> {
173
171
 
174
172
  private readonly _mergeTree: MergeTree;
175
173
 
176
- private readonly clientNameToIds = new RedBlackTree<string, number>(compareStrings);
174
+ private readonly clientNameToIds = new Map<string, number>();
177
175
  private readonly shortClientIdMap: string[] = [];
178
176
 
179
177
  /**
@@ -829,14 +827,14 @@ export class Client extends TypedEventEmitter<IClientEvents> {
829
827
  }
830
828
 
831
829
  getOrAddShortClientId(longClientId: string): number {
832
- if (!this.clientNameToIds.get(longClientId)) {
830
+ if (!this.clientNameToIds.has(longClientId)) {
833
831
  this.addLongClientId(longClientId);
834
832
  }
835
833
  return this.getShortClientId(longClientId);
836
834
  }
837
835
 
838
836
  protected getShortClientId(longClientId: string): number {
839
- return this.clientNameToIds.get(longClientId)!.data;
837
+ return this.clientNameToIds.get(longClientId)!;
840
838
  }
841
839
 
842
840
  getLongClientId(shortClientId: number): string {
@@ -844,7 +842,7 @@ export class Client extends TypedEventEmitter<IClientEvents> {
844
842
  }
845
843
 
846
844
  addLongClientId(longClientId: string): void {
847
- this.clientNameToIds.put(longClientId, this.shortClientIdMap.length);
845
+ this.clientNameToIds.set(longClientId, this.shortClientIdMap.length);
848
846
  this.shortClientIdMap.push(longClientId);
849
847
  }
850
848
 
@@ -1718,9 +1716,9 @@ export class Client extends TypedEventEmitter<IClientEvents> {
1718
1716
  );
1719
1717
  } else {
1720
1718
  const oldClientId = this.longClientId;
1721
- const oldData = this.clientNameToIds.get(oldClientId)!.data;
1719
+ const oldData = this.clientNameToIds.get(oldClientId)!;
1722
1720
  this.longClientId = longClientId;
1723
- this.clientNameToIds.put(longClientId, oldData);
1721
+ this.clientNameToIds.set(longClientId, oldData);
1724
1722
  this.shortClientIdMap[oldData] = longClientId;
1725
1723
  }
1726
1724
  }
@@ -694,13 +694,3 @@ export class CollaborationWindow {
694
694
  };
695
695
  }
696
696
  }
697
-
698
- /**
699
- * Compares two numbers.
700
- */
701
- export const compareNumbers = (a: number, b: number): number => a - b;
702
-
703
- /**
704
- * Compares two strings.
705
- */
706
- export const compareStrings = (a: string, b: string): number => a.localeCompare(b);