fluid-framework 2.4.0-299707 → 2.4.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,116 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ✨ New! Alpha API for providing SharedTree configuration options ([#22701](https://github.com/microsoft/FluidFramework/pull/22701)) [40d3648ddf](https://github.com/microsoft/FluidFramework/commit/40d3648ddfb5223ef6daef49a4f5cab1cfa52b71)
8
+
9
+ A new alpha `configuredSharedTree` had been added.
10
+ This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
11
+ The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
12
+
13
+ ```typescript
14
+ import {
15
+ ForestType,
16
+ TreeCompressionStrategy,
17
+ configuredSharedTree,
18
+ typeboxValidator,
19
+ } from "@fluid-framework/alpha";
20
+ // Maximum debuggability and validation enabled:
21
+ const SharedTree = configuredSharedTree({
22
+ forest: ForestType.Expensive,
23
+ jsonValidator: typeboxValidator,
24
+ treeEncodeType: TreeCompressionStrategy.Uncompressed,
25
+ });
26
+ // Opts into the under development optimized tree storage planned to be the eventual default implementation:
27
+ const SharedTree = configuredSharedTree({
28
+ forest: ForestType.Optimized,
29
+ });
30
+ ```
31
+
32
+ - ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
33
+
34
+ `extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
35
+ This can be used write tests which snapshot an applications schema.
36
+ Such tests can be used to detect schema changes which could would impact document compatibility,
37
+ and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
38
+
39
+ - Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
40
+
41
+ Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
42
+ This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
43
+
44
+ - ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
45
+
46
+ Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
47
+ Use the `getBranch` entry point function to acquire a branch.
48
+ For example:
49
+
50
+ ```ts
51
+ function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
52
+ mainView.root.myData = 3;
53
+ const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
54
+ const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
55
+ const forkView = forkBranch.viewWith(new TreeViewConfiguration({ schema: MySchema })); // Acquire a view of the forked branch in order to read or edit its tree.
56
+ forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
57
+ mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
58
+
59
+ // Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
60
+ // To prevent this, use `mainBranch.merge(forkBranch, false)`.
61
+ }
62
+ ```
63
+
64
+ Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
65
+ commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
66
+ about revertible support in the branching APIs.
67
+
68
+ - SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
69
+
70
+ `RestrictiveReadonlyRecord` was an attempt to implement a version of TypeScript's built-in `Record<TKey, TValue>` type that would prohibit (instead of leaving unrestricted like Record does) values under keys that do not extend `TKey`.
71
+
72
+ The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
73
+ Fixing this bug appears to be impossible within the current limitation of TypeScript, however this library does not require any case other than `TKey` being exactly `string`.
74
+
75
+ To reduce the risk of users of the tree library using the problematic `RestrictiveReadonlyRecord` type, it has been deprecated and replaced with a more specific type that avoids the bug, `RestrictiveStringRecord<TValue>`.
76
+
77
+ To highlight that this new type is not intended for direct use by users of tree, and instead is just used as part of the typing of its public API, `RestrictiveStringRecord` has been tagged with `@system`.
78
+ See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
79
+
80
+ - Fix `.create` on structurally named MapNode and ArrayNode schema ([#22522](https://github.com/microsoft/FluidFramework/pull/22522)) [b3f91ae91c](https://github.com/microsoft/FluidFramework/commit/b3f91ae91cb750a6a7696ab5ea17c00895bb6d92)
81
+
82
+ Constructing a structurally named MapNode or ArrayNode schema (using the overload of `SchemaFactory.map` or `SchemaFactory.array` which does not take an explicit name), returned a `TreeNodeSchema` instead of a `TreeNodeSchemaNonClass`, which resulted in the `create` static method not being exposed.
83
+ This has been fixed, and can now be used as follows:
84
+
85
+ ```typescript
86
+ const MyMap = schemaFactory.map(schemaFactory.number);
87
+ type MyMap = NodeFromSchema<typeof MyMap>;
88
+ const _fromMap: MyMap = MyMap.create(new MyMap());
89
+ const _fromIterable: MyMap = MyMap.create([]);
90
+ const _fromObject: MyMap = MyMap.create({});
91
+ ```
92
+
93
+ This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
94
+ While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
95
+ ](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
96
+ this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
97
+ Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
98
+ this change could break the build of packages exporting types referencing structurally named map and array schema.
99
+ This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
100
+ any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
101
+
102
+ - Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
103
+
104
+ When reading non-leaf children which have been read previously, they are retrieved from cache faster.
105
+ Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
106
+ Overall this showed a roughly 5% speed up in a read heavy test application (the BubbleBench example) but gains are expected to vary a lot based on use-case.
107
+
108
+ - ✨ New! Alpha APIs for producing SharedTree schema from enums ([#20035](https://github.com/microsoft/FluidFramework/pull/20035)) [5f9bbe011a](https://github.com/microsoft/FluidFramework/commit/5f9bbe011a18ccac08a70340f6d20e60ce30c4a4)
109
+
110
+ `adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
111
+ These unstable alpha APIs are relatively simple helpers on-top of public APIs (source: [schemaCreationUtilities.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/simple-tree/schemaCreationUtilities.ts)):
112
+ thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
113
+
3
114
  ## 2.3.0
4
115
 
5
116
  ### Minor Changes
@@ -958,7 +958,8 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
958
958
 
959
959
  // @beta @sealed
960
960
  export const TreeBeta: {
961
- readonly on: <K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>) => () => void;
961
+ on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
962
+ clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
962
963
  };
963
964
 
964
965
  // @alpha @sealed
@@ -793,7 +793,8 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
793
793
 
794
794
  // @beta @sealed
795
795
  export const TreeBeta: {
796
- readonly on: <K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>) => () => void;
796
+ on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
797
+ clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
797
798
  };
798
799
 
799
800
  // @public @sealed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.4.0-299707",
3
+ "version": "2.4.0",
4
4
  "description": "The main entry point into Fluid Framework public packages",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -57,16 +57,16 @@
57
57
  "main": "lib/index.js",
58
58
  "types": "lib/public.d.ts",
59
59
  "dependencies": {
60
- "@fluidframework/container-definitions": "2.4.0-299707",
61
- "@fluidframework/container-loader": "2.4.0-299707",
62
- "@fluidframework/core-interfaces": "2.4.0-299707",
63
- "@fluidframework/driver-definitions": "2.4.0-299707",
64
- "@fluidframework/fluid-static": "2.4.0-299707",
65
- "@fluidframework/map": "2.4.0-299707",
66
- "@fluidframework/runtime-utils": "2.4.0-299707",
67
- "@fluidframework/sequence": "2.4.0-299707",
68
- "@fluidframework/shared-object-base": "2.4.0-299707",
69
- "@fluidframework/tree": "2.4.0-299707"
60
+ "@fluidframework/container-definitions": "~2.4.0",
61
+ "@fluidframework/container-loader": "~2.4.0",
62
+ "@fluidframework/core-interfaces": "~2.4.0",
63
+ "@fluidframework/driver-definitions": "~2.4.0",
64
+ "@fluidframework/fluid-static": "~2.4.0",
65
+ "@fluidframework/map": "~2.4.0",
66
+ "@fluidframework/runtime-utils": "~2.4.0",
67
+ "@fluidframework/sequence": "~2.4.0",
68
+ "@fluidframework/shared-object-base": "~2.4.0",
69
+ "@fluidframework/tree": "~2.4.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@arethetypeswrong/cli": "^0.16.4",