@fluidframework/tree 2.4.0-299707 → 2.5.0-302463
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/.vscode/settings.json +11 -1
- package/CHANGELOG.md +192 -0
- package/api-report/tree.alpha.api.md +150 -52
- package/api-report/tree.beta.api.md +85 -39
- package/api-report/tree.legacy.alpha.api.md +83 -38
- package/api-report/tree.legacy.public.api.md +83 -38
- package/api-report/tree.public.api.md +83 -38
- package/dist/alpha.d.ts +17 -2
- package/dist/beta.d.ts +6 -0
- package/dist/events/interop.d.ts +1 -7
- package/dist/events/interop.d.ts.map +1 -1
- package/dist/events/interop.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +2 -2
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/legacy.d.ts +6 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +6 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +1 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +6 -6
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +2 -0
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.js +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +12 -7
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +3 -3
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +7 -7
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +1 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +33 -25
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +31 -21
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +5 -1
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +4 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +13 -4
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeApiBeta.d.ts +14 -2
- package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeApiBeta.js +23 -8
- package/dist/simple-tree/api/treeApiBeta.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +69 -17
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +14 -3
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +1 -1
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +6 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +7 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +3 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/index.d.ts +4 -4
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +1 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +3 -0
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +4 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +168 -14
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +6 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +2 -2
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -2
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeUtils.d.ts +61 -0
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js +27 -0
- package/dist/util/typeUtils.js.map +1 -1
- package/lib/alpha.d.ts +17 -2
- package/lib/beta.d.ts +6 -0
- package/lib/events/interop.d.ts +1 -7
- package/lib/events/interop.d.ts.map +1 -1
- package/lib/events/interop.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +2 -2
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/legacy.d.ts +6 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +6 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +1 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +6 -6
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -0
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.js +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +12 -7
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +3 -3
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.js +7 -7
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +33 -25
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +30 -19
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +5 -1
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +13 -4
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeApiBeta.d.ts +14 -2
- package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeApiBeta.js +23 -8
- package/lib/simple-tree/api/treeApiBeta.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +69 -17
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +14 -3
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +1 -1
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +6 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +7 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +3 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/index.d.ts +4 -4
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +3 -0
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +4 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +168 -14
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +6 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +2 -2
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -2
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/index.d.ts +2 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeUtils.d.ts +61 -0
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js +25 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +48 -32
- package/src/events/interop.ts +1 -12
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
- package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -3
- package/src/feature-libraries/object-forest/objectForest.ts +1 -1
- package/src/feature-libraries/treeCursorUtils.ts +2 -2
- package/src/index.ts +16 -1
- package/src/internalTypes.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +7 -3
- package/src/shared-tree/sharedTree.ts +5 -3
- package/src/shared-tree/treeApi.ts +19 -9
- package/src/shared-tree/treeCheckout.ts +2 -0
- package/src/shared-tree-core/branch.ts +1 -1
- package/src/shared-tree-core/editManager.ts +16 -7
- package/src/simple-tree/api/create.ts +12 -7
- package/src/simple-tree/api/customTree.ts +7 -7
- package/src/simple-tree/api/index.ts +6 -1
- package/src/simple-tree/api/schemaCreationUtilities.ts +58 -35
- package/src/simple-tree/api/schemaFactory.ts +4 -0
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +3 -3
- package/src/simple-tree/api/tree.ts +27 -4
- package/src/simple-tree/api/treeApiBeta.ts +69 -3
- package/src/simple-tree/api/typesUnsafe.ts +126 -30
- package/src/simple-tree/arrayNode.ts +34 -14
- package/src/simple-tree/core/schemaCaching.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +10 -2
- package/src/simple-tree/core/treeNodeSchema.ts +11 -6
- package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
- package/src/simple-tree/core/withType.ts +10 -1
- package/src/simple-tree/index.ts +19 -2
- package/src/simple-tree/mapNode.ts +6 -3
- package/src/simple-tree/objectNode.ts +5 -3
- package/src/simple-tree/schemaTypes.ts +215 -23
- package/src/simple-tree/toFlexSchema.ts +2 -2
- package/src/simple-tree/toMapTree.ts +4 -1
- package/src/util/index.ts +6 -0
- package/src/util/typeUtils.ts +87 -0
package/.vscode/settings.json
CHANGED
|
@@ -15,7 +15,17 @@
|
|
|
15
15
|
// This extension appears to invoke mocha programmatically, meaning that the enablement of this option in the common
|
|
16
16
|
// mocha test config isn't sufficient; it also needs to be enabled here.
|
|
17
17
|
"mochaExplorer.nodeArgv": ["--conditions", "allow-ff-test-exports"],
|
|
18
|
-
"cSpell.words": [
|
|
18
|
+
"cSpell.words": [
|
|
19
|
+
"contravariance",
|
|
20
|
+
"contravariantly",
|
|
21
|
+
"covariantly",
|
|
22
|
+
"deprioritized",
|
|
23
|
+
"endregion",
|
|
24
|
+
"insertable",
|
|
25
|
+
"reentrantly",
|
|
26
|
+
"typeparam",
|
|
27
|
+
"unhydrated",
|
|
28
|
+
],
|
|
19
29
|
|
|
20
30
|
// Enable biome as default formatter, and disable rules that disagree with it
|
|
21
31
|
"editor.defaultFormatter": "biomejs.biome",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,197 @@
|
|
|
1
1
|
# @fluidframework/tree
|
|
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
|
+
- Expose the view schema from the TreeView interface ([#22547](https://github.com/microsoft/FluidFramework/pull/22547)) [2aa29d9a13](https://github.com/microsoft/FluidFramework/commit/2aa29d9a13f099b129ec6834c8cbdaf6a25db114)
|
|
45
|
+
|
|
46
|
+
Users of TreeView can now access the type-safe view schema directly on the view object via `TreeView.schema`.
|
|
47
|
+
This allows users to avoid passing the schema around in addition to the view in scenarios where both are needed.
|
|
48
|
+
It also avoids scenarios in which code wants to accept both a view and its schema and thus must constrain both to be of the same schema type.
|
|
49
|
+
|
|
50
|
+
- Metadata can now be associated with Field Schema ([#22564](https://github.com/microsoft/FluidFramework/pull/22564)) [1d9f4c97ed](https://github.com/microsoft/FluidFramework/commit/1d9f4c97edf3f2bbf23ca30c35b67f0ec38b728d)
|
|
51
|
+
|
|
52
|
+
Users of TreeView can now specify metadata when creating Field Schema.
|
|
53
|
+
This includes system-understood metadata, i.e., `description`.
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
class Point extends schemaFactory.object("Point", {
|
|
59
|
+
x: schemaFactory.required(schemaFactory.number, {
|
|
60
|
+
metadata: { description: "The horizontal component of the point." },
|
|
61
|
+
}),
|
|
62
|
+
y: schemaFactory.required(schemaFactory.number, {
|
|
63
|
+
metadata: { description: "The vertical component of the point." },
|
|
64
|
+
}),
|
|
65
|
+
}) {}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) (`getJsonSchema`) can leverage such system-understood metadata to generate useful information.
|
|
69
|
+
In the case of the `description` property, this is mapped directly to the `description` property supported by JSON Schema.
|
|
70
|
+
|
|
71
|
+
Custom, user-defined properties can also be specified.
|
|
72
|
+
These properties will not be leveraged by the system by default, but can be used as a handy means of associating common application-specific properties with Field Schema.
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
|
|
76
|
+
An application is implementing search functionality.
|
|
77
|
+
By default, the app author wishes for all app content to be indexable by search, unless otherwise specified.
|
|
78
|
+
They can leverage schema metadata to decorate fields that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
|
|
82
|
+
interface AppMetadata {
|
|
83
|
+
/**
|
|
84
|
+
* Whether or not the field should be ignored by search.
|
|
85
|
+
* @defaultValue `false`
|
|
86
|
+
*/
|
|
87
|
+
searchIgnore?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class Note extends schemaFactory.object("Note", {
|
|
91
|
+
position: schemaFactory.required(Point, {
|
|
92
|
+
metadata: {
|
|
93
|
+
description: "The position of the upper-left corner of the note."
|
|
94
|
+
custom: {
|
|
95
|
+
// Search doesn't care where the note is on the canvas.
|
|
96
|
+
// It only cares about the text content.
|
|
97
|
+
searchIgnore: true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
text: schemaFactory.required(schemaFactory.string, {
|
|
102
|
+
metadata: {
|
|
103
|
+
description: "The textual contents of the note."
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
}) {}
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
111
|
+
|
|
112
|
+
- ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
|
|
113
|
+
|
|
114
|
+
Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
|
|
115
|
+
Use the `getBranch` entry point function to acquire a branch.
|
|
116
|
+
For example:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
|
|
120
|
+
mainView.root.myData = 3;
|
|
121
|
+
const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
|
|
122
|
+
const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
|
|
123
|
+
const forkView = forkBranch.viewWith(new TreeViewConfiguration({ schema: MySchema })); // Acquire a view of the forked branch in order to read or edit its tree.
|
|
124
|
+
forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
|
|
125
|
+
mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
|
|
126
|
+
|
|
127
|
+
// Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
|
|
128
|
+
// To prevent this, use `mainBranch.merge(forkBranch, false)`.
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
|
|
133
|
+
commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
|
|
134
|
+
about revertible support in the branching APIs.
|
|
135
|
+
|
|
136
|
+
- Unhydrated SharedTree nodes now emit change events when edited ([#22661](https://github.com/microsoft/FluidFramework/pull/22661)) [d1eade6547](https://github.com/microsoft/FluidFramework/commit/d1eade65477a4e7fb1f8062cb83dfa03a8b1d800)
|
|
137
|
+
|
|
138
|
+
Newly-created SharedTree nodes which have not yet been inserted into the tree will now emit `nodeChanged` and `treeChanged` events when they are mutated via editing operations.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
const node = new Foo({ foo: 3 });
|
|
142
|
+
Tree.on(node, "nodeChanged", () => {
|
|
143
|
+
console.log("This will fire even before node is inserted!");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
node.foo = 4; // log: "This will fire even before node is inserted!";
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
|
|
150
|
+
|
|
151
|
+
`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`.
|
|
152
|
+
|
|
153
|
+
The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
|
|
154
|
+
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`.
|
|
155
|
+
|
|
156
|
+
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>`.
|
|
157
|
+
|
|
158
|
+
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`.
|
|
159
|
+
See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
|
|
160
|
+
|
|
161
|
+
- 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)
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
This has been fixed, and can now be used as follows:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const MyMap = schemaFactory.map(schemaFactory.number);
|
|
168
|
+
type MyMap = NodeFromSchema<typeof MyMap>;
|
|
169
|
+
const _fromMap: MyMap = MyMap.create(new MyMap());
|
|
170
|
+
const _fromIterable: MyMap = MyMap.create([]);
|
|
171
|
+
const _fromObject: MyMap = MyMap.create({});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
|
|
175
|
+
While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
|
|
176
|
+
](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
|
|
177
|
+
this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
|
|
178
|
+
Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
|
|
179
|
+
this change could break the build of packages exporting types referencing structurally named map and array schema.
|
|
180
|
+
This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
|
|
181
|
+
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`
|
|
182
|
+
|
|
183
|
+
- Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
|
|
184
|
+
|
|
185
|
+
When reading non-leaf children which have been read previously, they are retrieved from cache faster.
|
|
186
|
+
Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
- ✨ 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)
|
|
190
|
+
|
|
191
|
+
`adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
|
|
192
|
+
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)):
|
|
193
|
+
thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
|
|
194
|
+
|
|
3
195
|
## 2.3.0
|
|
4
196
|
|
|
5
197
|
### Minor Changes
|