@fluidframework/map 2.117.0 → 3.0.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/README.md +53 -50
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/api-report/map.legacy.beta.api.md +9 -9
  5. package/api-report/map.legacy.public.api.md +4 -2
  6. package/dist/directory.js +171 -165
  7. package/dist/directory.js.map +1 -1
  8. package/dist/directoryFactory.d.ts +1 -1
  9. package/dist/directoryFactory.d.ts.map +1 -1
  10. package/dist/directoryFactory.js +15 -15
  11. package/dist/directoryFactory.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/interfaces.d.ts +26 -15
  16. package/dist/interfaces.d.ts.map +1 -1
  17. package/dist/interfaces.js.map +1 -1
  18. package/dist/legacy.d.ts +0 -1
  19. package/dist/localValues.d.ts.map +1 -1
  20. package/dist/map.js +9 -6
  21. package/dist/map.js.map +1 -1
  22. package/dist/mapFactory.d.ts +1 -1
  23. package/dist/mapFactory.d.ts.map +1 -1
  24. package/dist/mapFactory.js +15 -15
  25. package/dist/mapFactory.js.map +1 -1
  26. package/dist/mapKernel.js +109 -104
  27. package/dist/mapKernel.js.map +1 -1
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.d.ts.map +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/dist/utils.d.ts.map +1 -1
  33. package/lib/directory.js +171 -165
  34. package/lib/directory.js.map +1 -1
  35. package/lib/directoryFactory.js +15 -15
  36. package/lib/directoryFactory.js.map +1 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/interfaces.d.ts +26 -15
  41. package/lib/interfaces.d.ts.map +1 -1
  42. package/lib/interfaces.js.map +1 -1
  43. package/lib/legacy.d.ts +1 -2
  44. package/lib/localValues.d.ts.map +1 -1
  45. package/lib/map.js +9 -6
  46. package/lib/map.js.map +1 -1
  47. package/lib/mapFactory.js +15 -15
  48. package/lib/mapFactory.js.map +1 -1
  49. package/lib/mapKernel.js +109 -104
  50. package/lib/mapKernel.js.map +1 -1
  51. package/lib/packageVersion.d.ts +1 -1
  52. package/lib/packageVersion.d.ts.map +1 -1
  53. package/lib/packageVersion.js +1 -1
  54. package/lib/packageVersion.js.map +1 -1
  55. package/lib/public.d.ts +1 -1
  56. package/lib/utils.d.ts.map +1 -1
  57. package/package.json +44 -60
  58. package/src/index.ts +0 -1
  59. package/src/interfaces.ts +31 -17
  60. package/src/packageVersion.ts +1 -1
  61. package/tsconfig.json +1 -1
  62. package/internal.d.ts +0 -11
  63. package/legacy.d.ts +0 -11
  64. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  65. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "2.117.0",
3
+ "version": "3.0.0",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,50 +14,30 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "import": {
18
- "types": "./lib/public.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/public.d.ts",
23
- "default": "./dist/index.js"
17
+ "types": "./lib/public.d.ts",
18
+ "default": "./lib/index.js",
19
+ "internal-entrypoint-generation": {
20
+ "types": "./dist/public.d.ts"
24
21
  }
25
22
  },
26
23
  "./legacy": {
27
- "import": {
28
- "types": "./lib/legacy.d.ts",
29
- "default": "./lib/index.js"
30
- },
31
- "require": {
32
- "types": "./dist/legacy.d.ts",
33
- "default": "./dist/index.js"
24
+ "types": "./lib/legacy.d.ts",
25
+ "default": "./lib/index.js",
26
+ "internal-entrypoint-generation": {
27
+ "types": "./dist/legacy.d.ts"
34
28
  }
35
29
  },
36
30
  "./internal": {
37
- "import": {
38
- "types": "./lib/index.d.ts",
39
- "default": "./lib/index.js"
40
- },
41
- "require": {
42
- "types": "./dist/index.d.ts",
43
- "default": "./dist/index.js"
44
- }
31
+ "types": "./lib/index.d.ts",
32
+ "default": "./lib/index.js"
45
33
  },
46
34
  "./internal/test": {
47
35
  "allow-ff-test-exports": {
48
- "import": {
49
- "types": "./lib/test/index.d.ts",
50
- "default": "./lib/test/index.js"
51
- },
52
- "require": {
53
- "types": "./dist/test/index.d.ts",
54
- "default": "./dist/test/index.js"
55
- }
36
+ "types": "./lib/test/index.d.ts",
37
+ "default": "./lib/test/index.js"
56
38
  }
57
39
  }
58
40
  },
59
- "main": "lib/index.js",
60
- "types": "lib/public.d.ts",
61
41
  "c8": {
62
42
  "all": true,
63
43
  "cache-dir": "nyc/.cache",
@@ -81,32 +61,32 @@
81
61
  "temp-directory": "nyc/.nyc_output"
82
62
  },
83
63
  "dependencies": {
84
- "@fluid-internal/client-utils": "~2.117.0",
85
- "@fluidframework/core-interfaces": "~2.117.0",
86
- "@fluidframework/core-utils": "~2.117.0",
87
- "@fluidframework/datastore-definitions": "~2.117.0",
88
- "@fluidframework/driver-definitions": "~2.117.0",
89
- "@fluidframework/driver-utils": "~2.117.0",
90
- "@fluidframework/runtime-definitions": "~2.117.0",
91
- "@fluidframework/runtime-utils": "~2.117.0",
92
- "@fluidframework/shared-object-base": "~2.117.0",
93
- "@fluidframework/telemetry-utils": "~2.117.0",
64
+ "@fluid-internal/client-utils": "~3.0.0",
65
+ "@fluidframework/core-interfaces": "~3.0.0",
66
+ "@fluidframework/core-utils": "~3.0.0",
67
+ "@fluidframework/datastore-definitions": "~3.0.0",
68
+ "@fluidframework/driver-definitions": "~3.0.0",
69
+ "@fluidframework/driver-utils": "~3.0.0",
70
+ "@fluidframework/runtime-definitions": "~3.0.0",
71
+ "@fluidframework/runtime-utils": "~3.0.0",
72
+ "@fluidframework/shared-object-base": "~3.0.0",
73
+ "@fluidframework/telemetry-utils": "~3.0.0",
94
74
  "path-browserify": "^1.0.1"
95
75
  },
96
76
  "devDependencies": {
97
77
  "@arethetypeswrong/cli": "^0.18.5",
98
78
  "@biomejs/biome": "~2.4.5",
99
- "@fluid-internal/mocha-test-setup": "~2.117.0",
100
- "@fluid-private/stochastic-test-utils": "~2.117.0",
101
- "@fluid-private/test-dds-utils": "~2.117.0",
79
+ "@fluid-internal/mocha-test-setup": "~3.0.0",
80
+ "@fluid-private/stochastic-test-utils": "~3.0.0",
81
+ "@fluid-private/test-dds-utils": "~3.0.0",
102
82
  "@fluid-tools/benchmark": "^0.59.0",
103
83
  "@fluid-tools/build-cli": "^0.67.0",
104
84
  "@fluidframework/build-common": "^2.0.3",
105
85
  "@fluidframework/build-tools": "^0.67.0",
106
- "@fluidframework/container-definitions": "~2.117.0",
86
+ "@fluidframework/container-definitions": "~3.0.0",
107
87
  "@fluidframework/eslint-config-fluid": "^14.0.0",
108
88
  "@fluidframework/map-previous": "npm:@fluidframework/map@2.116.0",
109
- "@fluidframework/test-runtime-utils": "~2.117.0",
89
+ "@fluidframework/test-runtime-utils": "~3.0.0",
110
90
  "@microsoft/api-extractor": "7.58.1",
111
91
  "@types/mocha": "^10.0.10",
112
92
  "@types/node": "~22.19.17",
@@ -120,30 +100,35 @@
120
100
  "mocha": "^11.7.5",
121
101
  "mocha-multi-reporters": "^1.5.1",
122
102
  "rimraf": "^6.1.3",
123
- "typescript": "~5.4.5"
103
+ "typescript": "~6.0.3"
124
104
  },
125
105
  "typeValidation": {
126
- "broken": {},
106
+ "broken": {
107
+ "Interface_IDirectoryBeta": {
108
+ "backCompat": false
109
+ }
110
+ },
127
111
  "entrypoint": "legacy"
128
112
  },
129
113
  "scripts": {
130
114
  "bench": "cross-env FLUID_TEST_PERF_MODE=1 mocha --parentProcess",
131
115
  "build": "fluid-build . --task build",
132
116
  "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
133
- "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
134
- "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
117
+ "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor-report.current.json",
118
+ "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor-report.legacy.json",
119
+ "build:cjs": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
135
120
  "build:commonjs": "fluid-build . --task commonjs",
136
121
  "build:compile": "fluid-build . --task compile",
137
- "build:docs": "api-extractor run --local",
122
+ "build:docs": "api-extractor run --local --config api-extractor/api-extractor-model.json",
138
123
  "build:entrypoints": "fluid-build . --task build:entrypoints",
139
124
  "build:entrypoints:cjs": "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist",
140
- "build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat",
141
- "build:esnext": "tsc --project ./tsconfig.json",
125
+ "build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib",
126
+ "build:esm": "tsc --project ./tsconfig.json",
142
127
  "build:genver": "gen-version",
143
128
  "build:test": "concurrently npm:build:test:esm npm:build:test:cjs",
144
129
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
145
130
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
146
- "check:are-the-types-wrong": "attw --pack . --exclude-entrypoints ./internal/test",
131
+ "check:are-the-types-wrong": "attw --pack . --profile esm-only --exclude-entrypoints ./internal/test",
147
132
  "check:biome": "biome check .",
148
133
  "check:exports": "concurrently \"npm:check:exports:*\"",
149
134
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
@@ -153,9 +138,9 @@
153
138
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
154
139
  "check:format": "npm run check:biome",
155
140
  "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
156
- "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
157
- "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
158
- "ci:build:docs": "api-extractor run",
141
+ "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor-report.current.json",
142
+ "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor-report.legacy.json",
143
+ "ci:build:docs": "api-extractor run --config api-extractor/api-extractor-model.json",
159
144
  "clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
160
145
  "eslint": "eslint --quiet --format stylish src",
161
146
  "eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
@@ -172,7 +157,6 @@
172
157
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
173
158
  "test:snapshots:regen": "npm run test:mocha:esm -- --snapshot",
174
159
  "test:stress": "cross-env FUZZ_TEST_COUNT=100 FUZZ_STRESS_RUN=normal mocha --ignore \"lib/test/memory/**/*\" --recursive \"lib/test/**/*.spec.js\"",
175
- "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
176
160
  "typetests:gen": "flub generate typetests --dir . -v"
177
161
  }
178
162
  }
package/src/index.ts CHANGED
@@ -18,7 +18,6 @@
18
18
  export type {
19
19
  FluidMapLegacy,
20
20
  IDirectory,
21
- IDirectoryBeta,
22
21
  IDirectoryEvents,
23
22
  IDirectoryValueChanged,
24
23
  ISharedDirectory,
package/src/interfaces.ts CHANGED
@@ -4,12 +4,13 @@
4
4
  */
5
5
 
6
6
  import type {
7
+ FluidIterableIterator,
8
+ FluidMap,
7
9
  IDisposable,
8
10
  IEvent,
9
11
  IEventProvider,
10
12
  IEventThisPlaceHolder,
11
13
  } from "@fluidframework/core-interfaces";
12
- import type { FluidMap } from "@fluidframework/core-interfaces/internal";
13
14
  import type {
14
15
  ISharedObject,
15
16
  ISharedObjectEvents,
@@ -46,7 +47,7 @@ export interface IValueChanged {
46
47
  export interface IDirectory
47
48
  // TODO: Use `unknown` instead (breaking change).
48
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- extends Map<string, any>,
50
+ extends FluidMap<string, any>,
50
51
  IEventProvider<IDirectoryEvents>,
51
52
  Partial<IDisposable> {
52
53
  /**
@@ -71,6 +72,18 @@ export interface IDirectory
71
72
  */
72
73
  set<T = unknown>(key: string, value: T): this;
73
74
 
75
+ /**
76
+ * Removes all entries from the directory.
77
+ */
78
+ clear(): void;
79
+
80
+ /**
81
+ * Removes the specified element from this directory by its key.
82
+ * @param key - The key of the element to remove
83
+ * @returns `true` if an element existed and has been removed, or `false` if the element does not exist
84
+ */
85
+ delete(key: string): boolean;
86
+
74
87
  /**
75
88
  * Get the number of sub directory within the directory.
76
89
  * @returns The number of sub directory within a directory.
@@ -110,7 +123,7 @@ export interface IDirectory
110
123
  * Gets an iterator over the IDirectory children of this IDirectory.
111
124
  * @returns The IDirectory iterator
112
125
  */
113
- subdirectories(): IterableIterator<[string, IDirectory]>;
126
+ subdirectories(): FluidIterableIterator<[string, IDirectory]>;
114
127
 
115
128
  /**
116
129
  * Get an IDirectory within the directory, in order to use relative paths from that location.
@@ -160,17 +173,6 @@ export interface FluidMapLegacy<K, V> extends Omit<FluidMap<K, V>, "get" | "set"
160
173
  delete(key: K): boolean;
161
174
  }
162
175
 
163
- /**
164
- * Beta version of {@link IDirectory} which uses {@link FluidMapLegacy} for its map-like API.
165
- *
166
- * @sealed
167
- * @legacy @beta
168
- */
169
- export interface IDirectoryBeta
170
- extends Omit<IDirectory, Exclude<keyof Map<string, unknown>, "get" | "set">>,
171
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
- FluidMapLegacy<string, any> {}
173
-
174
176
  /**
175
177
  * Events emitted in response to changes to the directory data.
176
178
  *
@@ -361,7 +363,7 @@ export interface ISharedDirectory
361
363
  // https://github.com/microsoft/TypeScript/issues/31671
362
364
  // TODO: Use `unknown` instead (breaking change).
363
365
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
364
- [Symbol.iterator](): IterableIterator<[string, any]>;
366
+ [Symbol.iterator](): FluidIterableIterator<[string, any]>;
365
367
  readonly [Symbol.toStringTag]: string;
366
368
  }
367
369
 
@@ -434,7 +436,7 @@ export interface ISharedMap
434
436
  extends ISharedObject<ISharedMapEvents>,
435
437
  // TODO: Use `unknown` instead (breaking change).
436
438
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
437
- Map<string, any> {
439
+ FluidMap<string, any> {
438
440
  /**
439
441
  * Retrieves the given key from the map if it exists.
440
442
  * @param key - Key to retrieve from
@@ -451,6 +453,18 @@ export interface ISharedMap
451
453
  * @returns The {@link ISharedMap} itself
452
454
  */
453
455
  set<T = unknown>(key: string, value: T): this;
456
+
457
+ /**
458
+ * Removes all entries from the map.
459
+ */
460
+ clear(): void;
461
+
462
+ /**
463
+ * Removes the specified element from this map by its key.
464
+ * @param key - The key of the element to remove
465
+ * @returns `true` if an element existed and has been removed, or `false` if the element does not exist
466
+ */
467
+ delete(key: string): boolean;
454
468
  }
455
469
 
456
470
  /**
@@ -460,6 +474,6 @@ export interface ISharedMap
460
474
  * @legacy @beta
461
475
  */
462
476
  export interface ISharedMapBeta
463
- extends Omit<ISharedMap, Exclude<keyof Map<string, unknown>, "get" | "set">>,
477
+ extends Omit<ISharedMap, Exclude<keyof FluidMap<string, unknown>, "get" | "set">>,
464
478
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
465
479
  FluidMapLegacy<string, any> {}
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "2.117.0";
9
+ export const pkgVersion = "3.0.0";
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../common/build/build-common/tsconfig.node16.json",
2
+ "extends": "../../../common/build/build-common/tsconfig.node20.json",
3
3
  "include": ["src/**/*"],
4
4
  "exclude": ["src/test/**/*"],
5
5
  "compilerOptions": {
package/internal.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- /*
7
- * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
9
- */
10
-
11
- export * from "./lib/index.js";
package/legacy.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- /*
7
- * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
9
- */
10
-
11
- export * from "./lib/legacy.js";