@fluidframework/tree 2.4.0-299374 → 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/.vscode/settings.json +1 -9
- package/CHANGELOG.md +192 -0
- package/api-report/tree.alpha.api.md +23 -79
- package/api-report/tree.beta.api.md +23 -47
- package/api-report/tree.legacy.alpha.api.md +21 -46
- package/api-report/tree.legacy.public.api.md +21 -46
- package/api-report/tree.public.api.md +21 -46
- package/dist/alpha.d.ts +0 -9
- package/dist/beta.d.ts +0 -2
- 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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- 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 +0 -2
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +0 -2
- package/dist/shared-tree/schematizingTreeView.js +1 -1
- package/dist/shared-tree/schematizingTreeView.js.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-core/branch.js +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +5 -5
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +3 -12
- 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 +9 -48
- 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 +3 -14
- 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 +5 -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 +1 -3
- 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.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +6 -58
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +1 -6
- 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 +2 -4
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/lib/alpha.d.ts +0 -9
- package/lib/beta.d.ts +0 -2
- 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/index.d.ts +1 -1
- package/lib/index.d.ts.map +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 +0 -2
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +0 -2
- package/lib/shared-tree/schematizingTreeView.js +1 -1
- package/lib/shared-tree/schematizingTreeView.js.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-core/branch.js +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/customTree.js +5 -5
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +3 -12
- 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 +9 -48
- 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 +3 -14
- 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 +5 -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 +1 -3
- 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 +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +6 -58
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +0 -5
- 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 +2 -4
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/package.json +23 -39
- package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -3
- package/src/index.ts +0 -9
- package/src/internalTypes.ts +0 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +1 -1
- package/src/shared-tree/sharedTree.ts +1 -1
- package/src/shared-tree/treeApi.ts +9 -19
- package/src/shared-tree-core/branch.ts +1 -1
- package/src/simple-tree/api/customTree.ts +5 -5
- package/src/simple-tree/api/index.ts +0 -5
- package/src/simple-tree/api/tree.ts +2 -24
- package/src/simple-tree/api/treeApiBeta.ts +65 -3
- package/src/simple-tree/api/typesUnsafe.ts +18 -82
- package/src/simple-tree/arrayNode.ts +14 -34
- 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 +5 -7
- package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
- package/src/simple-tree/core/withType.ts +1 -10
- package/src/simple-tree/index.ts +1 -15
- package/src/simple-tree/schemaTypes.ts +5 -68
- package/src/simple-tree/toFlexSchema.ts +2 -2
- package/src/simple-tree/toMapTree.ts +1 -4
package/.vscode/settings.json
CHANGED
|
@@ -15,15 +15,7 @@
|
|
|
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": [
|
|
19
|
-
"contravariantly",
|
|
20
|
-
"covariantly",
|
|
21
|
-
"deprioritized",
|
|
22
|
-
"endregion",
|
|
23
|
-
"insertable",
|
|
24
|
-
"reentrantly",
|
|
25
|
-
"unhydrated",
|
|
26
|
-
],
|
|
18
|
+
"cSpell.words": ["deprioritized", "endregion", "insertable", "reentrantly", "unhydrated"],
|
|
27
19
|
|
|
28
20
|
// Enable biome as default formatter, and disable rules that disagree with it
|
|
29
21
|
"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
|
|
@@ -16,9 +16,6 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
16
16
|
// @public
|
|
17
17
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
18
18
|
|
|
19
|
-
// @public
|
|
20
|
-
type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
21
|
-
|
|
22
19
|
// @public
|
|
23
20
|
type ApplyKind<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = {
|
|
24
21
|
[FieldKind.Required]: T;
|
|
@@ -61,14 +58,6 @@ type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ?
|
|
|
61
58
|
// @alpha
|
|
62
59
|
export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible;
|
|
63
60
|
|
|
64
|
-
// @alpha
|
|
65
|
-
export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
|
|
66
|
-
|
|
67
|
-
// @alpha
|
|
68
|
-
export type FactoryContentObject = {
|
|
69
|
-
readonly [P in string]?: InsertableContent;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
61
|
// @public
|
|
73
62
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
74
63
|
|
|
@@ -162,15 +151,6 @@ export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
|
162
151
|
// @public
|
|
163
152
|
type _InlineTrick = 0;
|
|
164
153
|
|
|
165
|
-
// @alpha
|
|
166
|
-
export type Insertable<TSchema extends ImplicitAllowedTypes | UnsafeUnknownSchema> = TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : InsertableContent;
|
|
167
|
-
|
|
168
|
-
// @alpha
|
|
169
|
-
export type InsertableContent = Unhydrated<TreeNode> | FactoryContent;
|
|
170
|
-
|
|
171
|
-
// @alpha
|
|
172
|
-
export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = TSchema extends ImplicitFieldSchema ? InsertableTreeFieldFromImplicitField<TSchema> : InsertableContent | undefined;
|
|
173
|
-
|
|
174
154
|
// @public
|
|
175
155
|
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
176
156
|
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
@@ -186,7 +166,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
|
|
|
186
166
|
};
|
|
187
167
|
|
|
188
168
|
// @public
|
|
189
|
-
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
169
|
+
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
190
170
|
|
|
191
171
|
// @public
|
|
192
172
|
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;
|
|
@@ -195,7 +175,7 @@ export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforce
|
|
|
195
175
|
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? InsertableTypedNode<TSchema> : TSchema extends AllowedTypes ? InsertableTypedNode<FlexListToUnion<TSchema>> : never;
|
|
196
176
|
|
|
197
177
|
// @public
|
|
198
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
178
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypes ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
|
|
199
179
|
|
|
200
180
|
// @public
|
|
201
181
|
export type InsertableTypedNode<T extends TreeNodeSchema> = (T extends {
|
|
@@ -240,9 +220,6 @@ declare namespace InternalTypes {
|
|
|
240
220
|
NodeBuilderDataUnsafe,
|
|
241
221
|
NodeFromSchemaUnsafe,
|
|
242
222
|
ReadonlyMapInlined,
|
|
243
|
-
TreeNodeSchemaUnsafe,
|
|
244
|
-
AllowedTypesUnsafe,
|
|
245
|
-
TreeNodeSchemaNonClassUnsafe,
|
|
246
223
|
FlexList,
|
|
247
224
|
FlexListToUnion,
|
|
248
225
|
ExtractItemType,
|
|
@@ -370,10 +347,10 @@ export interface MakeNominal {
|
|
|
370
347
|
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
371
348
|
|
|
372
349
|
// @public
|
|
373
|
-
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind,
|
|
350
|
+
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
374
351
|
|
|
375
352
|
// @public
|
|
376
|
-
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
353
|
+
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
377
354
|
|
|
378
355
|
// @beta @sealed
|
|
379
356
|
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
@@ -384,7 +361,7 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
|
384
361
|
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
385
362
|
|
|
386
363
|
// @public
|
|
387
|
-
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
364
|
+
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
388
365
|
|
|
389
366
|
// @public
|
|
390
367
|
export interface NodeInDocumentConstraint {
|
|
@@ -418,10 +395,6 @@ type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<I
|
|
|
418
395
|
// @public
|
|
419
396
|
export type Off = () => void;
|
|
420
397
|
|
|
421
|
-
// @public @sealed
|
|
422
|
-
export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
|
|
423
|
-
}
|
|
424
|
-
|
|
425
398
|
// @public @sealed
|
|
426
399
|
interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
427
400
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
@@ -473,17 +446,17 @@ export const rollback: unique symbol;
|
|
|
473
446
|
// @public @sealed
|
|
474
447
|
export interface RunTransaction {
|
|
475
448
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
|
|
476
|
-
<TView extends TreeView<
|
|
449
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
|
|
477
450
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
|
|
478
|
-
<TView extends TreeView<
|
|
451
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
|
|
479
452
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
|
|
480
|
-
<TView extends TreeView<
|
|
453
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void): void;
|
|
481
454
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
482
|
-
<TView extends TreeView<
|
|
455
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
483
456
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
484
|
-
<TView extends TreeView<
|
|
457
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
485
458
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
486
|
-
<TView extends TreeView<
|
|
459
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
487
460
|
readonly rollback: typeof rollback;
|
|
488
461
|
}
|
|
489
462
|
|
|
@@ -574,7 +547,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
574
547
|
}
|
|
575
548
|
|
|
576
549
|
// @public @sealed
|
|
577
|
-
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes
|
|
550
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>, TreeArrayNode> {
|
|
578
551
|
}
|
|
579
552
|
|
|
580
553
|
// @public
|
|
@@ -583,7 +556,7 @@ export const TreeArrayNode: {
|
|
|
583
556
|
};
|
|
584
557
|
|
|
585
558
|
// @public @sealed
|
|
586
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom
|
|
559
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
587
560
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
588
561
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
589
562
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -605,12 +578,13 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> ex
|
|
|
605
578
|
}
|
|
606
579
|
|
|
607
580
|
// @public @sealed
|
|
608
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes
|
|
581
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
|
|
609
582
|
}
|
|
610
583
|
|
|
611
584
|
// @beta @sealed
|
|
612
585
|
export const TreeBeta: {
|
|
613
|
-
|
|
586
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
587
|
+
clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
614
588
|
};
|
|
615
589
|
|
|
616
590
|
// @alpha @sealed
|
|
@@ -644,7 +618,7 @@ export enum TreeCompressionStrategy {
|
|
|
644
618
|
}
|
|
645
619
|
|
|
646
620
|
// @public
|
|
647
|
-
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
621
|
+
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
648
622
|
|
|
649
623
|
// @public
|
|
650
624
|
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
@@ -693,19 +667,13 @@ export interface TreeNodeApi {
|
|
|
693
667
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
694
668
|
|
|
695
669
|
// @public
|
|
696
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
670
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
697
671
|
|
|
698
672
|
// @public @sealed
|
|
699
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode
|
|
673
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
700
674
|
|
|
701
675
|
// @public @sealed
|
|
702
|
-
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
703
|
-
// @sealed
|
|
704
|
-
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
// @public
|
|
708
|
-
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
676
|
+
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
709
677
|
// @sealed
|
|
710
678
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
711
679
|
}
|
|
@@ -721,20 +689,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
721
689
|
}
|
|
722
690
|
|
|
723
691
|
// @public @sealed
|
|
724
|
-
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
692
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
725
693
|
// (undocumented)
|
|
726
694
|
create(data: TInsertable): TNode;
|
|
727
695
|
}
|
|
728
696
|
|
|
729
|
-
// @public
|
|
730
|
-
interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
731
|
-
// (undocumented)
|
|
732
|
-
create(data: TInsertable): TNode;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
// @public
|
|
736
|
-
type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends Unenforced<TreeNode | TreeLeafValue> = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
737
|
-
|
|
738
697
|
// @public
|
|
739
698
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
740
699
|
|
|
@@ -750,7 +709,7 @@ export enum TreeStatus {
|
|
|
750
709
|
}
|
|
751
710
|
|
|
752
711
|
// @public @sealed
|
|
753
|
-
export interface TreeView<
|
|
712
|
+
export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
754
713
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
755
714
|
readonly events: Listenable<TreeViewEvents>;
|
|
756
715
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
@@ -760,15 +719,6 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
760
719
|
upgradeSchema(): void;
|
|
761
720
|
}
|
|
762
721
|
|
|
763
|
-
// @alpha
|
|
764
|
-
export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> extends Omit<TreeView<TSchema extends ImplicitFieldSchema ? TSchema : ImplicitFieldSchema>, "root" | "initialize"> {
|
|
765
|
-
// (undocumented)
|
|
766
|
-
initialize(content: InsertableField<TSchema>): void;
|
|
767
|
-
// (undocumented)
|
|
768
|
-
get root(): TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeLeafValue | TreeNode;
|
|
769
|
-
set root(newRoot: InsertableField<TSchema>);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
722
|
// @public @sealed
|
|
773
723
|
export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
774
724
|
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
@@ -804,12 +754,6 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
804
754
|
// @public
|
|
805
755
|
export type Unhydrated<T> = T;
|
|
806
756
|
|
|
807
|
-
// @alpha
|
|
808
|
-
export const UnsafeUnknownSchema: unique symbol;
|
|
809
|
-
|
|
810
|
-
// @alpha
|
|
811
|
-
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
812
|
-
|
|
813
757
|
// @public
|
|
814
758
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
815
759
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
@@ -830,7 +774,7 @@ export interface ViewableTree {
|
|
|
830
774
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
831
775
|
// @deprecated
|
|
832
776
|
get [typeNameSymbol](): TName;
|
|
833
|
-
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind,
|
|
777
|
+
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind, unknown, never, boolean, TInfo>;
|
|
834
778
|
}
|
|
835
779
|
|
|
836
780
|
// (No @packageDocumentation comment for this package)
|