fluid-framework 2.3.0-288113 → 2.3.1

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,89 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add /alpha import path to @fluidframework/tree and fluid-framework packages ([#22483](https://github.com/microsoft/FluidFramework/pull/22483)) [12242cfdb5a](https://github.com/microsoft/FluidFramework/commit/12242cfdb5aa4c342cc62f11cbf1c072840bec44)
8
+
9
+ `@fluidframework/tree` and `fluid-framework` now have a `/alpha` import path where their `@alpha` APIs are exported.
10
+
11
+ - Export SharedTree beta APIs from fluid-framework/beta ([#22469](https://github.com/microsoft/FluidFramework/pull/22469)) [c51f55c01a6](https://github.com/microsoft/FluidFramework/commit/c51f55c01a641eb030f872b684e2862e57ad5197)
12
+
13
+ `fluid-framework/beta` now contains the `@beta` APIs from `@fluidframework/tree/beta`.
14
+
15
+ - Implicitly constructed object nodes now only consider own properties during validation ([#22453](https://github.com/microsoft/FluidFramework/pull/22453)) [27faa56f5ae](https://github.com/microsoft/FluidFramework/commit/27faa56f5ae334e0b65fdd84c75764645e64f063)
16
+
17
+ When determining if some given data is compatible with a particular ObjectNode schema, both inherited and own properties were considered.
18
+ However, when constructing the node from this data, only own properties were used.
19
+ This allowed input which provided required values in inherited fields to pass validation.
20
+ When the node was constructed, it would lack these fields, and end up out of schema.
21
+ This has been fixed: both validation and node construction now only consider own properties.
22
+
23
+ This may cause some cases which previously exhibited data corruption to now throw a usage error reporting the data is incompatible.
24
+ Such cases may need to copy data from the objects with inherited properties into new objects with own properties before constructing nodes from them.
25
+
26
+ - A `@beta` version of `nodeChanged` which includes the list of properties has been added ([#22229](https://github.com/microsoft/FluidFramework/pull/22229)) [aae34dd9fe1](https://github.com/microsoft/FluidFramework/commit/aae34dd9fe1aa6c153c26035f1486f4d8944c810)
27
+
28
+ ```typescript
29
+ const factory = new SchemaFactory("example");
30
+ class Point2d extends factory.object("Point2d", {
31
+ x: factory.number,
32
+ y: factory.number,
33
+ }) {}
34
+
35
+ const point = new Point2d({ x: 0, y: 0 });
36
+
37
+ TreeBeta.on(point, "nodeChanged", (data) => {
38
+ const changed: ReadonlySet<"x" | "y"> = data.changedProperties;
39
+ if (changed.has("x")) {
40
+ // ...
41
+ }
42
+ });
43
+ ```
44
+
45
+ The payload of the `nodeChanged` event emitted by SharedTree's `TreeBeta` includes a `changedProperties` property that indicates
46
+ which properties of the node changed.
47
+
48
+ For object nodes, the list of properties uses the property identifiers defined in the schema, and not the persisted
49
+ identifiers (or "stored keys") that can be provided through `FieldProps` when defining a schema.
50
+ See the documentation for `FieldProps` for more details about the distinction between "property keys" and "stored keys".
51
+
52
+ For map nodes, every key that was added, removed, or updated by a change to the tree is included in the list of properties.
53
+
54
+ For array nodes, the set of properties will always be undefined: there is currently no API to get details about changes to an array.
55
+
56
+ Object nodes revieve strongly types sets of changed keys, allowing compile time detection of incorrect keys:
57
+
58
+ ```typescript
59
+ TreeBeta.on(point, "nodeChanged", (data) => {
60
+ // @ts-expect-error Strong typing for changed properties of object nodes detects incorrect keys:
61
+ if (data.changedProperties.has("z")) {
62
+ // ...
63
+ }
64
+ });
65
+ ```
66
+
67
+ The existing stable "nodeChanged" event's callback now is given a parameter called `unstable` of type `unknown` which is used to indicate that additional data can be provided there.
68
+ This could break existing code using "nodeChanged" in a particularly fragile way.
69
+
70
+ ```typescript
71
+ function f(optional?: number) {
72
+ // ...
73
+ }
74
+ Tree.on(point, "nodeChanged", f); // Bad
75
+ ```
76
+
77
+ Code like this which is implicitly discarding an optional argument from the function used as the listener will be broken.
78
+ It can be fixed by using an inline lambda expression:
79
+
80
+ ```typescript
81
+ function f(optional?: number) {
82
+ // ...
83
+ }
84
+ Tree.on(point, "nodeChanged", () => f()); // Safe
85
+ ```
86
+
3
87
  ## 2.2.0
4
88
 
5
89
  ### Minor Changes
package/README.md CHANGED
@@ -37,6 +37,10 @@ For more information on the related support guarantees, see [API Support Levels]
37
37
 
38
38
  To access the `public` ([SemVer](https://semver.org/)) APIs, import via `fluid-framework` like normal.
39
39
 
40
+ To access the `beta` APIs, import via `fluid-framework/beta`.
41
+
42
+ To access the `alpha` APIs, import via `fluid-framework/alpha`.
43
+
40
44
  To access the `legacy` APIs, import via `fluid-framework/legacy`.
41
45
 
42
46
  ## API Documentation
package/alpha.d.ts ADDED
@@ -0,0 +1,11 @@
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" in @fluid-tools/build-cli.
9
+ */
10
+
11
+ export * from "./lib/alpha.js";
@@ -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-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/alpha.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
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-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/alpha.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
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-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/beta.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
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-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts",
5
+ "bundledPackages": ["@fluidframework/*"]
6
+ }
@@ -1,6 +1,9 @@
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-report.esm.current.json",
4
- "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/alpha.d.ts",
5
+ "apiReport": {
6
+ "reportVariants": ["public", "beta", "alpha"]
7
+ },
5
8
  "bundledPackages": ["@fluidframework/*"]
6
9
  }