fluid-framework 2.1.0-276985 → 2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Detect arrayNode iterator invalidation ([#21760](https://github.com/microsoft/FluidFramework/pull/21760)) [6fd320c385](https://github.com/microsoft/FluidFramework/commit/6fd320c38561e272a1acaf4248f47fc386c650e4)
8
+
9
+ When `arrayNode`s are edited concurrently during iteration, an error will be thrown.
10
+
11
+ - Some SharedDirectory/SharedMap-related APIs have been sealed ([#21836](https://github.com/microsoft/FluidFramework/pull/21836)) [b1d0427eab](https://github.com/microsoft/FluidFramework/commit/b1d0427eab3fcd55588dd80996967133db66f1b8)
12
+
13
+ Note that this is a _documentation only change._ There is no runtime or type-level impact.
14
+
15
+ Some top-level APIs within `@fluidframework/map` and `fluid-framework` have been updated to reflect their
16
+ sealed/readonly nature. That is, they are not to be implemented externally to Fluid Framework and not changed. This was
17
+ already the case, but the documentation was not clear.
18
+
19
+ Updated APIs:
20
+
21
+ - [IDirectory](https://fluidframework.com/docs/api/v2/fluid-framework/idirectory-interface) sealed
22
+ - [IDirectoryEvents](https://fluidframework.com/docs/api/v2/fluid-framework/idirectoryevents-interface) sealed
23
+ - [IDirectoryValueChanged](https://fluidframework.com/docs/api/v2/fluid-framework/idirectoryvaluechanged-interface) sealed and path property is readonly
24
+ - [ISharedDirectory](https://fluidframework.com/docs/api/v2/fluid-framework/ishareddirectory-interface) sealed
25
+ - [ISharedDirectoryEvents](https://fluidframework.com/docs/api/v2/fluid-framework/ishareddirectoryevents-interface) sealed
26
+ - [IValueChanged](https://fluidframework.com/docs/api/v2/fluid-framework/ivaluechanged-interface) sealed
27
+
28
+ - tree: Improved performance for accessing identifiers in shortId API ([#21944](https://github.com/microsoft/FluidFramework/pull/21944)) [6b4cf26d9c](https://github.com/microsoft/FluidFramework/commit/6b4cf26d9cc14c1a36cf07fd7408f1d1227e373a)
29
+
30
+ Users should see improved performance when calling the `Tree.shortId` API. Identifier field keys are now cached in the schema for faster access.
31
+
32
+ - ✨ New! Debug visualizers for TreeNodes in NodeJS and browsers ([#21895](https://github.com/microsoft/FluidFramework/pull/21895)) [0d197fefec](https://github.com/microsoft/FluidFramework/commit/0d197fefec852df2911151217ac1b71cde528a70)
33
+
34
+ TreeNodes now have custom debug visualizers to improve the debug experience in NodeJS and in browsers. Note that custom formatters must be enabled in the browser developer tools for that visualizer to be used.
35
+
36
+ - Using "delete" on tree fields now throws an error instead of not working correctly ([#21609](https://github.com/microsoft/FluidFramework/pull/21609)) [416849b1fd](https://github.com/microsoft/FluidFramework/commit/416849b1fda029870ee1c1742100de4f8dde45b7)
37
+
38
+ TypeScript allows `delete` on object node optional fields if the `exactOptionalPropertyTypes` tsconfig setting is not
39
+ enabled. This does not work correctly at runtime and now produces an informative error.
40
+
41
+ - Improved error reporting ([#21940](https://github.com/microsoft/FluidFramework/pull/21940)) [3b8a366dd1](https://github.com/microsoft/FluidFramework/commit/3b8a366dd15660f9c916832040faf772534c0755)
42
+
43
+ Several cases of invalid usage patterns for tree APIs have gained improved error reporting, as well as improved documentation on the APIs detailing what usage is supported.
44
+ These improvements include:
45
+
46
+ - Unsupported usages of schema classes: using more than one schema class derived from a single SchemaFactory generated base class. This used to hit internal asserts, but now has a descriptive user-facing UsageError. Most of this work was done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707).
47
+ - Improved detection of when prior exception may have left SharedTree in an invalid state.
48
+ These cases now report a UsageError including a reference to the prior exception. This was mainly done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707) and [b77d530](https://github.com/microsoft/FluidFramework/commit/b77d530b9252201c40a90d1a2a6315f76f1a4a4b).
49
+
3
50
  ## 2.0.0-rc.5.0.0
4
51
 
5
52
  ### Minor Changes
package/README.md CHANGED
@@ -9,7 +9,7 @@ There are some packages there are not included as part of this `fluid-framework`
9
9
  - Fluid Framework [developer tools](https://github.com/microsoft/FluidFramework/tree/main/packages/tools/devtools/devtools).
10
10
  - `@fluidframework/app-insights-logger`: to route Fluid telemetry to Azure App Insights.
11
11
 
12
- <!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
12
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_HEADER) -->
13
13
 
14
14
  <!-- prettier-ignore-start -->
15
15
  <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
@@ -22,14 +22,13 @@ library consumers should always prefer `^`.
22
22
 
23
23
  If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
24
24
 
25
- <!-- prettier-ignore-end -->
26
-
27
- <!-- AUTO-GENERATED-CONTENT:END -->
25
+ ## Installation
28
26
 
29
- <!-- AUTO-GENERATED-CONTENT:START (README_IMPORT_INSTRUCTIONS:includeHeading=TRUE) -->
27
+ To get started, install the package by running the following command:
30
28
 
31
- <!-- prettier-ignore-start -->
32
- <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
29
+ ```bash
30
+ npm i fluid-framework
31
+ ```
33
32
 
34
33
  ## Importing from this package
35
34
 
@@ -40,6 +39,10 @@ To access the `public` ([SemVer](https://semver.org/)) APIs, import via `fluid-f
40
39
 
41
40
  To access the `legacy` APIs, import via `fluid-framework/legacy`.
42
41
 
42
+ ## API Documentation
43
+
44
+ API documentation for **fluid-framework** is available at <https://fluidframework.com/docs/apis/fluid-framework>.
45
+
43
46
  <!-- prettier-ignore-end -->
44
47
 
45
48
  <!-- AUTO-GENERATED-CONTENT:END -->
@@ -66,14 +69,54 @@ The `fluid-framework` package offers the following data structures:
66
69
 
67
70
  Check out the [Hello World tutorial](https://fluidframework.com/docs/start/tutorial/) using `fluid-framework`.
68
71
 
69
- <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE&installation=FALSE&importInstructions=FALSE) -->
72
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_FOOTER) -->
70
73
 
71
74
  <!-- prettier-ignore-start -->
72
75
  <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
73
76
 
74
- ## API Documentation
77
+ ## Minimum Client Requirements
75
78
 
76
- API documentation for **fluid-framework** is available at <https://fluidframework.com/docs/apis/fluid-framework>.
79
+ These are the platform requirements for the current version of Fluid Framework Client Packages.
80
+ These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
81
+ For Long Term Support (LTS) versions this can require supporting these platforms for several years.
82
+
83
+ It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
84
+ If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
85
+ When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
86
+
87
+ ### Supported Runtimes
88
+
89
+ - NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
90
+ - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
91
+
92
+ ### Supported Tools
93
+
94
+ - TypeScript 5.4:
95
+ - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
96
+ - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
97
+ - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
98
+ - `exactOptionalPropertyTypes` is currently not fully supported.
99
+ If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
100
+ - [webpack](https://webpack.js.org/) 5
101
+ - We are not intending to be prescriptive about what bundler to use.
102
+ Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
103
+
104
+ ### Module Resolution
105
+
106
+ [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
107
+ Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
108
+
109
+ ### Module Formats
110
+
111
+ - ES Modules:
112
+ ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
113
+ - CommonJs:
114
+ Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
115
+ This is done to accommodate some workflows without good ES Module support.
116
+ If you have a workflow you would like included in this list, file an issue.
117
+ Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
118
+
119
+ - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
77
120
 
78
121
  ## Contribution Guidelines
79
122
 
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
3
  "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
- "mainEntryPointFilePath": "<projectFolder>/dist/legacy.d.ts"
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/legacy.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
3
  "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
- "mainEntryPointFilePath": "<projectFolder>/lib/legacy.d.ts"
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/legacy.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
3
  "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
- "mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts"
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
3
  "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
- "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
5
6
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.current.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
6
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-base.esm.legacy.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.legacy.json",
4
4
  "bundledPackages": ["@fluidframework/*"]
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.esm.current.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-model.esm.json",
4
4
  "bundledPackages": ["@fluidframework/*"],
5
5
  "messages": {
6
6
  "extractorMessageReporting": {
@@ -682,6 +682,7 @@ type ScopedSchemaName<TScope extends string | undefined, TName extends number |
682
682
 
683
683
  // @public @sealed
684
684
  export interface SharedObjectKind<out TSharedObject = unknown> extends ErasedType<readonly ["SharedObjectKind", TSharedObject]> {
685
+ is(value: IFluidLoadable): value is IFluidLoadable & TSharedObject;
685
686
  }
686
687
 
687
688
  // @public
@@ -741,6 +742,7 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
741
742
  moveToStart(sourceIndex: number, source: TMoveFrom): void;
742
743
  removeAt(index: number): void;
743
744
  removeRange(start?: number, end?: number): void;
745
+ values(): IterableIterator<T>;
744
746
  }
745
747
 
746
748
  // @public @sealed
@@ -794,7 +796,7 @@ export interface TreeNodeApi {
794
796
  parent(node: TreeNode): TreeNode | undefined;
795
797
  schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
796
798
  shortId(node: TreeNode): number | string | undefined;
797
- readonly status: (node: TreeNode) => TreeStatus;
799
+ status(node: TreeNode): TreeStatus;
798
800
  }
799
801
 
800
802
  // @public
@@ -148,7 +148,7 @@ export interface IConnection {
148
148
  // @public
149
149
  export type ICriticalContainerError = IErrorBase;
150
150
 
151
- // @alpha
151
+ // @public @sealed
152
152
  export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable> {
153
153
  readonly absolutePath: string;
154
154
  countSubDirectory?(): number;
@@ -162,7 +162,7 @@ export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryE
162
162
  subdirectories(): IterableIterator<[string, IDirectory]>;
163
163
  }
164
164
 
165
- // @alpha
165
+ // @public @sealed
166
166
  export interface IDirectoryEvents extends IEvent {
167
167
  (event: "containedValueChanged", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
168
168
  (event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
@@ -171,7 +171,7 @@ export interface IDirectoryEvents extends IEvent {
171
171
  (event: "undisposed", listener: (target: IEventThisPlaceHolder) => void): any;
172
172
  }
173
173
 
174
- // @alpha
174
+ // @public @sealed
175
175
  export interface IDirectoryValueChanged extends IValueChanged {
176
176
  path: string;
177
177
  }
@@ -682,7 +682,7 @@ export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
682
682
  (event: "memberRemoved", listener: MemberChangedListener<M>): void;
683
683
  }
684
684
 
685
- // @alpha
685
+ // @alpha @sealed
686
686
  export interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>, Omit<IDirectory, "on" | "once" | "off"> {
687
687
  // (undocumented)
688
688
  [Symbol.iterator](): IterableIterator<[string, any]>;
@@ -690,7 +690,7 @@ export interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents &
690
690
  readonly [Symbol.toStringTag]: string;
691
691
  }
692
692
 
693
- // @alpha
693
+ // @alpha @sealed
694
694
  export interface ISharedDirectoryEvents extends ISharedObjectEvents {
695
695
  (event: "valueChanged", listener: (changed: IDirectoryValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
696
696
  (event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
@@ -830,7 +830,7 @@ export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = Im
830
830
  readonly schema: TSchema;
831
831
  }
832
832
 
833
- // @alpha @sealed
833
+ // @public @sealed
834
834
  export interface IValueChanged {
835
835
  readonly key: string;
836
836
  readonly previousValue: any;
@@ -1075,6 +1075,7 @@ export type SharedMap = ISharedMap;
1075
1075
 
1076
1076
  // @public @sealed
1077
1077
  export interface SharedObjectKind<out TSharedObject = unknown> extends ErasedType<readonly ["SharedObjectKind", TSharedObject]> {
1078
+ is(value: IFluidLoadable): value is IFluidLoadable & TSharedObject;
1078
1079
  }
1079
1080
 
1080
1081
  // @alpha
@@ -1151,6 +1152,7 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
1151
1152
  moveToStart(sourceIndex: number, source: TMoveFrom): void;
1152
1153
  removeAt(index: number): void;
1153
1154
  removeRange(start?: number, end?: number): void;
1155
+ values(): IterableIterator<T>;
1154
1156
  }
1155
1157
 
1156
1158
  // @public @sealed
@@ -1204,7 +1206,7 @@ export interface TreeNodeApi {
1204
1206
  parent(node: TreeNode): TreeNode | undefined;
1205
1207
  schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
1206
1208
  shortId(node: TreeNode): number | string | undefined;
1207
- readonly status: (node: TreeNode) => TreeStatus;
1209
+ status(node: TreeNode): TreeStatus;
1208
1210
  }
1209
1211
 
1210
1212
  // @public
@@ -1301,6 +1303,4 @@ export interface WithType<TName extends string = string> {
1301
1303
  get [typeNameSymbol](): TName;
1302
1304
  }
1303
1305
 
1304
- // (No @packageDocumentation comment for this package)
1305
-
1306
1306
  ```