@fluidframework/tree 2.33.1 → 2.40.0-336023
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 +2 -0
- package/api-report/tree.alpha.api.md +120 -50
- package/api-report/tree.beta.api.md +31 -27
- package/api-report/tree.legacy.alpha.api.md +24 -23
- package/api-report/tree.legacy.public.api.md +24 -23
- package/api-report/tree.public.api.md +24 -23
- package/dist/alpha.d.ts +16 -1
- package/dist/beta.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +0 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +2 -2
- package/dist/jsonDomainSchema.js +2 -2
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- 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 +2 -0
- package/dist/serializableDomainSchema.d.ts +3 -3
- package/dist/serializableDomainSchema.js +2 -2
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +3 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +4 -4
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +4 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -3
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +3 -3
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +4 -4
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/{treeApi.d.ts → tree.d.ts} +34 -34
- package/dist/shared-tree/tree.d.ts.map +1 -0
- package/dist/shared-tree/{treeApi.js → tree.js} +6 -6
- package/dist/shared-tree/tree.js.map +1 -0
- package/dist/shared-tree/{treeApiAlpha.d.ts → treeAlpha.d.ts} +22 -14
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -0
- package/dist/shared-tree/{treeApiAlpha.js → treeAlpha.js} +4 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -0
- package/dist/simple-tree/api/conciseTree.d.ts +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +177 -0
- package/dist/simple-tree/api/configuration.d.ts.map +1 -0
- package/dist/simple-tree/api/configuration.js +163 -0
- package/dist/simple-tree/api/configuration.js.map +1 -0
- package/dist/simple-tree/api/getJsonSchema.js +2 -2
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +7 -4
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +8 -7
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/{view.d.ts → schemaCompatibilityTester.d.ts} +8 -10
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -0
- package/dist/simple-tree/api/{view.js → schemaCompatibilityTester.js} +9 -9
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -0
- package/dist/simple-tree/api/schemaFactory.d.ts +16 -10
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +20 -12
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +12 -6
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +67 -4
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +3 -3
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +3 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +5 -174
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +1 -156
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/{lib/simple-tree/api/treeApiBeta.d.ts → dist/simple-tree/api/treeBeta.d.ts} +13 -5
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/{treeApiBeta.js → treeBeta.js} +5 -4
- package/dist/simple-tree/api/treeBeta.js.map +1 -0
- package/dist/simple-tree/api/typesUnsafe.d.ts +4 -9
- 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 +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +3 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.d.ts +3 -3
- package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +2 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +1 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/mapNodeTypes.d.ts +3 -3
- package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +18 -5
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +4 -3
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +4 -4
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +163 -13
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +107 -8
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +2 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/tableSchema.d.ts +197 -86
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +100 -45
- package/dist/tableSchema.js.map +1 -1
- package/dist/util/typeUtils.d.ts +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/lib/alpha.d.ts +16 -1
- package/lib/beta.d.ts +2 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +0 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +2 -2
- package/lib/jsonDomainSchema.js +2 -2
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- 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 +2 -0
- package/lib/serializableDomainSchema.d.ts +3 -3
- package/lib/serializableDomainSchema.js +2 -2
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -2
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +4 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +2 -3
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +3 -3
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +5 -5
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/{treeApi.d.ts → tree.d.ts} +34 -34
- package/lib/shared-tree/tree.d.ts.map +1 -0
- package/lib/shared-tree/{treeApi.js → tree.js} +5 -5
- package/lib/shared-tree/tree.js.map +1 -0
- package/lib/shared-tree/{treeApiAlpha.d.ts → treeAlpha.d.ts} +22 -14
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -0
- package/lib/shared-tree/{treeApiAlpha.js → treeAlpha.js} +4 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -0
- package/lib/simple-tree/api/conciseTree.d.ts +1 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +177 -0
- package/lib/simple-tree/api/configuration.d.ts.map +1 -0
- package/lib/simple-tree/api/configuration.js +157 -0
- package/lib/simple-tree/api/configuration.js.map +1 -0
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +7 -4
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +4 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/{view.d.ts → schemaCompatibilityTester.d.ts} +8 -10
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -0
- package/lib/simple-tree/api/{view.js → schemaCompatibilityTester.js} +7 -7
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -0
- package/lib/simple-tree/api/schemaFactory.d.ts +16 -10
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +20 -12
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +12 -6
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +67 -4
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +3 -3
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +3 -2
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +5 -174
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +0 -152
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/{dist/simple-tree/api/treeApiBeta.d.ts → lib/simple-tree/api/treeBeta.d.ts} +13 -5
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/{treeApiBeta.js → treeBeta.js} +5 -4
- package/lib/simple-tree/api/treeBeta.js.map +1 -0
- package/lib/simple-tree/api/typesUnsafe.d.ts +4 -9
- 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 +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +4 -3
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.d.ts +3 -3
- package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- 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/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -2
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/mapNodeTypes.d.ts +3 -3
- package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +18 -5
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +5 -4
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +4 -4
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +163 -13
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +96 -8
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +2 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/tableSchema.d.ts +197 -86
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +100 -45
- package/lib/tableSchema.js.map +1 -1
- package/lib/util/typeUtils.d.ts +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +20 -20
- package/src/index.ts +17 -1
- package/src/internalTypes.ts +0 -2
- package/src/jsonDomainSchema.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +3 -3
- package/src/shared-tree/independentView.ts +1 -1
- package/src/shared-tree/index.ts +3 -6
- package/src/shared-tree/schematizeTree.ts +5 -5
- package/src/shared-tree/schematizingTreeView.ts +11 -8
- package/src/shared-tree/{treeApi.ts → tree.ts} +51 -51
- package/src/shared-tree/{treeApiAlpha.ts → treeAlpha.ts} +22 -13
- package/src/simple-tree/api/conciseTree.ts +1 -1
- package/src/simple-tree/api/configuration.ts +353 -0
- package/src/simple-tree/api/getJsonSchema.ts +1 -1
- package/src/simple-tree/api/index.ts +21 -15
- package/src/simple-tree/api/{view.ts → schemaCompatibilityTester.ts} +8 -15
- package/src/simple-tree/api/schemaFactory.ts +130 -19
- package/src/simple-tree/api/schemaFactoryAlpha.ts +7 -5
- package/src/simple-tree/api/schemaFactoryRecursive.ts +102 -38
- package/src/simple-tree/api/schemaFromSimple.ts +2 -2
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
- package/src/simple-tree/api/storedSchema.ts +8 -4
- package/src/simple-tree/api/tree.ts +13 -354
- package/src/simple-tree/api/{treeApiBeta.ts → treeBeta.ts} +17 -5
- package/src/simple-tree/api/typesUnsafe.ts +15 -11
- package/src/simple-tree/arrayNode.ts +10 -5
- package/src/simple-tree/arrayNodeTypes.ts +8 -7
- package/src/simple-tree/index.ts +17 -1
- package/src/simple-tree/mapNode.ts +11 -3
- package/src/simple-tree/mapNodeTypes.ts +10 -7
- package/src/simple-tree/objectNode.ts +39 -15
- package/src/simple-tree/objectNodeTypes.ts +9 -5
- package/src/simple-tree/schemaTypes.ts +353 -25
- package/src/simple-tree/treeNodeValid.ts +2 -2
- package/src/tableSchema.ts +749 -445
- package/src/util/typeUtils.ts +1 -1
- package/dist/shared-tree/treeApi.d.ts.map +0 -1
- package/dist/shared-tree/treeApi.js.map +0 -1
- package/dist/shared-tree/treeApiAlpha.d.ts.map +0 -1
- package/dist/shared-tree/treeApiAlpha.js.map +0 -1
- package/dist/simple-tree/api/treeApiBeta.d.ts.map +0 -1
- package/dist/simple-tree/api/treeApiBeta.js.map +0 -1
- package/dist/simple-tree/api/view.d.ts.map +0 -1
- package/dist/simple-tree/api/view.js.map +0 -1
- package/lib/shared-tree/treeApi.d.ts.map +0 -1
- package/lib/shared-tree/treeApi.js.map +0 -1
- package/lib/shared-tree/treeApiAlpha.d.ts.map +0 -1
- package/lib/shared-tree/treeApiAlpha.js.map +0 -1
- package/lib/simple-tree/api/treeApiBeta.d.ts.map +0 -1
- package/lib/simple-tree/api/treeApiBeta.js.map +0 -1
- package/lib/simple-tree/api/view.d.ts.map +0 -1
- package/lib/simple-tree/api/view.js.map +0 -1
|
@@ -21,14 +21,14 @@ const sf = new SchemaFactory("com.fluidframework.serializable");
|
|
|
21
21
|
* @remarks
|
|
22
22
|
* Schema which replicate the Fluid Serializable data model with {@link TreeNode}s.
|
|
23
23
|
*
|
|
24
|
-
* Fluid Serializable data can be imported from the {@link FluidSerializableAsTree.Data|Fluid Serializable format} into this format using {@link TreeAlpha.importConcise} with the {@link FluidSerializableAsTree.(Tree:variable)} schema.
|
|
24
|
+
* Fluid Serializable data can be imported from the {@link FluidSerializableAsTree.Data|Fluid Serializable format} into this format using {@link (TreeAlpha:interface).importConcise} with the {@link FluidSerializableAsTree.(Tree:variable)} schema.
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export namespace FluidSerializableAsTree {
|
|
28
28
|
/**
|
|
29
29
|
* Data which can be serialized by Fluid.
|
|
30
30
|
* @remarks
|
|
31
|
-
* Can be encoded as a {@link FluidSerializableAsTree.(Tree:type)} using {@link TreeAlpha.importConcise}.
|
|
31
|
+
* Can be encoded as a {@link FluidSerializableAsTree.(Tree:type)} using {@link (TreeAlpha:interface).importConcise}.
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export type Data = JsonCompatible<IFluidHandle>;
|
|
@@ -100,7 +100,7 @@ export namespace FluidSerializableAsTree {
|
|
|
100
100
|
/**
|
|
101
101
|
* Arbitrary Fluid Serializable array as a {@link TreeNode}.
|
|
102
102
|
* @remarks
|
|
103
|
-
* This can be imported using {@link TreeAlpha.importConcise}.
|
|
103
|
+
* This can be imported using {@link (TreeAlpha:interface).importConcise}.
|
|
104
104
|
* @example
|
|
105
105
|
* ```typescript
|
|
106
106
|
* // Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
|
|
@@ -134,7 +134,7 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
|
|
|
134
134
|
*/
|
|
135
135
|
export interface ViewContent {
|
|
136
136
|
/**
|
|
137
|
-
* Compressed tree from {@link TreeAlpha.exportCompressed}.
|
|
137
|
+
* Compressed tree from {@link (TreeAlpha:interface).exportCompressed}.
|
|
138
138
|
* @remarks
|
|
139
139
|
* This is an owning reference:
|
|
140
140
|
* consumers of this content might modify this data in place (for example when applying edits) to avoid copying.
|
package/src/shared-tree/index.ts
CHANGED
|
@@ -45,13 +45,10 @@ export type {
|
|
|
45
45
|
SharedTreeEditBuilder,
|
|
46
46
|
} from "./sharedTreeEditBuilder.js";
|
|
47
47
|
|
|
48
|
-
export {
|
|
49
|
-
|
|
50
|
-
type TreeApi,
|
|
51
|
-
type RunTransaction,
|
|
52
|
-
} from "./treeApi.js";
|
|
48
|
+
export { Tree } from "./tree.js";
|
|
49
|
+
export type { RunTransaction } from "./tree.js";
|
|
53
50
|
|
|
54
|
-
export { TreeAlpha } from "./
|
|
51
|
+
export { TreeAlpha } from "./treeAlpha.js";
|
|
55
52
|
|
|
56
53
|
export {
|
|
57
54
|
independentInitializedView,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { isReadonlyArray } from "../util/index.js";
|
|
24
24
|
|
|
25
25
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
26
|
-
import {
|
|
26
|
+
import type { SchemaCompatibilityTester } from "../simple-tree/index.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.
|
|
@@ -113,7 +113,7 @@ export enum UpdateType {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export function evaluateUpdate(
|
|
116
|
-
viewSchema:
|
|
116
|
+
viewSchema: SchemaCompatibilityTester,
|
|
117
117
|
allowedSchemaModifications: AllowedUpdateType,
|
|
118
118
|
checkout: ITreeCheckout,
|
|
119
119
|
): UpdateType {
|
|
@@ -209,7 +209,7 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
* Ensure a {@link ITreeCheckout} can be used with a given {@link
|
|
212
|
+
* Ensure a {@link ITreeCheckout} can be used with a given {@link SchemaCompatibilityTester}.
|
|
213
213
|
*
|
|
214
214
|
* @remarks
|
|
215
215
|
* It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.
|
|
@@ -221,7 +221,7 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
221
221
|
* @returns true iff checkout now is compatible with `viewSchema`.
|
|
222
222
|
*/
|
|
223
223
|
export function ensureSchema(
|
|
224
|
-
viewSchema:
|
|
224
|
+
viewSchema: SchemaCompatibilityTester,
|
|
225
225
|
allowedSchemaModifications: AllowedUpdateType,
|
|
226
226
|
checkout: ITreeCheckout,
|
|
227
227
|
treeContent: TreeStoredContent | undefined,
|
|
@@ -241,7 +241,7 @@ export function ensureSchema(
|
|
|
241
241
|
return false;
|
|
242
242
|
}
|
|
243
243
|
case UpdateType.SchemaCompatible: {
|
|
244
|
-
checkout.updateSchema(
|
|
244
|
+
checkout.updateSchema(viewSchema.viewSchemaAsStored);
|
|
245
245
|
return true;
|
|
246
246
|
}
|
|
247
247
|
case UpdateType.Initialize: {
|
|
@@ -30,13 +30,12 @@ import {
|
|
|
30
30
|
getTreeNodeForField,
|
|
31
31
|
setField,
|
|
32
32
|
normalizeFieldSchema,
|
|
33
|
-
|
|
33
|
+
SchemaCompatibilityTester,
|
|
34
34
|
type InsertableContent,
|
|
35
35
|
type TreeViewConfiguration,
|
|
36
36
|
mapTreeFromNodeData,
|
|
37
37
|
prepareContentForHydration,
|
|
38
38
|
comparePersistedSchemaInternal,
|
|
39
|
-
toStoredSchema,
|
|
40
39
|
type TreeViewAlpha,
|
|
41
40
|
type InsertableField,
|
|
42
41
|
type ReadableField,
|
|
@@ -98,7 +97,7 @@ export class SchematizingSimpleTreeView<
|
|
|
98
97
|
IEmitter<TreeViewEvents & TreeBranchEvents> &
|
|
99
98
|
HasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();
|
|
100
99
|
|
|
101
|
-
private readonly viewSchema:
|
|
100
|
+
private readonly viewSchema: SchemaCompatibilityTester;
|
|
102
101
|
|
|
103
102
|
private readonly unregisterCallbacks = new Set<() => void>();
|
|
104
103
|
|
|
@@ -133,7 +132,11 @@ export class SchematizingSimpleTreeView<
|
|
|
133
132
|
allowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),
|
|
134
133
|
};
|
|
135
134
|
|
|
136
|
-
this.viewSchema = new
|
|
135
|
+
this.viewSchema = new SchemaCompatibilityTester(
|
|
136
|
+
this.schemaPolicy,
|
|
137
|
+
{},
|
|
138
|
+
this.rootFieldSchema,
|
|
139
|
+
);
|
|
137
140
|
// This must be initialized before `update` can be called.
|
|
138
141
|
this.currentCompatibility = {
|
|
139
142
|
canView: false,
|
|
@@ -182,7 +185,7 @@ export class SchematizingSimpleTreeView<
|
|
|
182
185
|
|
|
183
186
|
prepareContentForHydration(mapTree, this.checkout.forest);
|
|
184
187
|
initialize(this.checkout, {
|
|
185
|
-
schema:
|
|
188
|
+
schema: this.viewSchema.viewSchemaAsStored,
|
|
186
189
|
initialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),
|
|
187
190
|
});
|
|
188
191
|
});
|
|
@@ -209,7 +212,7 @@ export class SchematizingSimpleTreeView<
|
|
|
209
212
|
AllowedUpdateType.SchemaCompatible,
|
|
210
213
|
this.checkout,
|
|
211
214
|
{
|
|
212
|
-
schema:
|
|
215
|
+
schema: this.viewSchema.viewSchemaAsStored,
|
|
213
216
|
initialTree: undefined,
|
|
214
217
|
},
|
|
215
218
|
);
|
|
@@ -502,12 +505,12 @@ export function getCheckout(context: TreeBranch): TreeCheckout {
|
|
|
502
505
|
}
|
|
503
506
|
|
|
504
507
|
/**
|
|
505
|
-
* Creates a view that self-disposes
|
|
508
|
+
* Creates a view that self-disposes whenever the stored schema changes.
|
|
506
509
|
* This may only be called when the schema is already known to be compatible (typically via ensureSchema).
|
|
507
510
|
*/
|
|
508
511
|
export function requireSchema(
|
|
509
512
|
checkout: ITreeCheckout,
|
|
510
|
-
viewSchema:
|
|
513
|
+
viewSchema: SchemaCompatibilityTester,
|
|
511
514
|
onDispose: () => void,
|
|
512
515
|
nodeKeyManager: NodeIdentifierManager,
|
|
513
516
|
schemaPolicy: FullSchemaPolicy,
|
|
@@ -22,6 +22,56 @@ import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
|
22
22
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
23
23
|
import { getCheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Provides various functions for interacting with {@link TreeNode}s.
|
|
27
|
+
* @remarks
|
|
28
|
+
* This type should only be used via the {@link (Tree:variable)} export.
|
|
29
|
+
* @system @sealed @public
|
|
30
|
+
*/
|
|
31
|
+
export interface Tree extends TreeNodeApi {
|
|
32
|
+
/**
|
|
33
|
+
* Run a {@link RunTransaction | transaction}.
|
|
34
|
+
*/
|
|
35
|
+
readonly runTransaction: RunTransaction;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the subtree defined by `node` contains `other`.
|
|
38
|
+
*
|
|
39
|
+
* @returns true if `other` is an inclusive descendant of `node`, and false otherwise.
|
|
40
|
+
* @remarks
|
|
41
|
+
* This includes direct and indirect children:
|
|
42
|
+
* as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.
|
|
43
|
+
*
|
|
44
|
+
* `node` is considered to contain itself, so the case where `node === other` returns true.
|
|
45
|
+
*
|
|
46
|
+
* This is handy when checking if moving `node` into `other` would create a cycle and would thus be invalid.
|
|
47
|
+
*
|
|
48
|
+
* This check walks the parents of `other` looking for `node`,
|
|
49
|
+
* and thus runs in time proportional to the depth of child in the tree.
|
|
50
|
+
*/
|
|
51
|
+
contains(node: TreeNode, other: TreeNode): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The {@link (Tree:interface)} singleton which holds various functions for interacting with {@link TreeNode}s.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export const Tree: Tree = {
|
|
59
|
+
...treeNodeApi,
|
|
60
|
+
|
|
61
|
+
runTransaction: createRunTransaction(),
|
|
62
|
+
|
|
63
|
+
contains(parent: TreeNode, child: TreeNode): boolean {
|
|
64
|
+
let toCheck: TreeNode | undefined = child;
|
|
65
|
+
while (toCheck !== undefined) {
|
|
66
|
+
if (toCheck === parent) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
toCheck = Tree.parent(toCheck);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
25
75
|
/**
|
|
26
76
|
* A function which runs a transaction in a SharedTree.
|
|
27
77
|
* @privateRemarks
|
|
@@ -326,56 +376,6 @@ export interface RunTransaction {
|
|
|
326
376
|
): void;
|
|
327
377
|
}
|
|
328
378
|
|
|
329
|
-
/**
|
|
330
|
-
* Provides various functions for interacting with {@link TreeNode}s.
|
|
331
|
-
* @remarks
|
|
332
|
-
* This type should only be used via the public `Tree` export.
|
|
333
|
-
* @system @sealed @public
|
|
334
|
-
*/
|
|
335
|
-
export interface TreeApi extends TreeNodeApi {
|
|
336
|
-
/**
|
|
337
|
-
* Run a {@link RunTransaction | transaction}.
|
|
338
|
-
*/
|
|
339
|
-
readonly runTransaction: RunTransaction;
|
|
340
|
-
/**
|
|
341
|
-
* Check if the subtree defined by `node` contains `other`.
|
|
342
|
-
*
|
|
343
|
-
* @returns true if `other` is an inclusive descendant of `node`, and false otherwise.
|
|
344
|
-
* @remarks
|
|
345
|
-
* This includes direct and indirect children:
|
|
346
|
-
* as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.
|
|
347
|
-
*
|
|
348
|
-
* `node` is considered to contain itself, so the case where `node === other` returns true.
|
|
349
|
-
*
|
|
350
|
-
* This is handy when checking if moving `node` into `other` would create a cycle and thus is invalid.
|
|
351
|
-
*
|
|
352
|
-
* This check walks the parents of `other` looking for `node`,
|
|
353
|
-
* and thus runs in time proportional to the depth of child in the tree.
|
|
354
|
-
*/
|
|
355
|
-
contains(node: TreeNode, other: TreeNode): boolean;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* The `Tree` object holds various functions for interacting with {@link TreeNode}s.
|
|
360
|
-
* @public
|
|
361
|
-
*/
|
|
362
|
-
export const treeApi: TreeApi = {
|
|
363
|
-
...treeNodeApi,
|
|
364
|
-
|
|
365
|
-
runTransaction: createRunTransaction(),
|
|
366
|
-
|
|
367
|
-
contains(parent: TreeNode, child: TreeNode): boolean {
|
|
368
|
-
let toCheck: TreeNode | undefined = child;
|
|
369
|
-
while (toCheck !== undefined) {
|
|
370
|
-
if (toCheck === parent) {
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
toCheck = treeApi.parent(toCheck);
|
|
374
|
-
}
|
|
375
|
-
return false;
|
|
376
|
-
},
|
|
377
|
-
};
|
|
378
|
-
|
|
379
379
|
// TODO: Add more constraint types here
|
|
380
380
|
|
|
381
381
|
/** Creates a copy of `runTransaction` with the `rollback` property added so as to satisfy the `RunTransaction` interface. */
|
|
@@ -443,7 +443,7 @@ function runTransactionInCheckout<TResult>(
|
|
|
443
443
|
switch (constraint.type) {
|
|
444
444
|
case "nodeInDocument": {
|
|
445
445
|
const node = getOrCreateInnerNode(constraint.node);
|
|
446
|
-
const nodeStatus =
|
|
446
|
+
const nodeStatus = Tree.status(constraint.node);
|
|
447
447
|
if (nodeStatus !== TreeStatus.InDocument) {
|
|
448
448
|
throw new UsageError(
|
|
449
449
|
`Attempted to add a "nodeInDocument" constraint, but the node is not currently in the document. Node status: ${nodeStatus}`,
|
|
@@ -54,10 +54,12 @@ import { independentInitializedView, type ViewContent } from "./independentView.
|
|
|
54
54
|
import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Extensions to {@link Tree} and {@link TreeBeta} which are not yet stable.
|
|
58
|
-
* @
|
|
57
|
+
* Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.
|
|
58
|
+
* @remarks
|
|
59
|
+
* Use via the {@link (TreeAlpha:variable)} singleton.
|
|
60
|
+
* @system @sealed @alpha
|
|
59
61
|
*/
|
|
60
|
-
export
|
|
62
|
+
export interface TreeAlpha {
|
|
61
63
|
/**
|
|
62
64
|
* Retrieve the {@link TreeBranch | branch}, if any, for the given node.
|
|
63
65
|
* @param node - The node to query
|
|
@@ -79,7 +81,7 @@ export const TreeAlpha: {
|
|
|
79
81
|
* such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.
|
|
80
82
|
*
|
|
81
83
|
* Like with {@link TreeNodeSchemaClass}'s constructor, it's an error to provide an existing node to this API.
|
|
82
|
-
* For that case, use {@link TreeBeta.clone}.
|
|
84
|
+
* For that case, use {@link (TreeBeta:interface).clone}.
|
|
83
85
|
* @privateRemarks
|
|
84
86
|
* There should be a way to provide a source for defaulted identifiers, wither via this API or some way to add them to its output later.
|
|
85
87
|
*/
|
|
@@ -95,7 +97,7 @@ export const TreeAlpha: {
|
|
|
95
97
|
>;
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
|
-
* Less type safe version of {@link TreeAlpha.create}, suitable for importing data.
|
|
100
|
+
* Less type safe version of {@link (TreeAlpha:interface).create}, suitable for importing data.
|
|
99
101
|
* @remarks
|
|
100
102
|
* Due to {@link ConciseTree} relying on type inference from the data, its use is somewhat limited.
|
|
101
103
|
* This does not support {@link ConciseTree|ConciseTrees} with customized handle encodings or using persisted keys.
|
|
@@ -103,8 +105,8 @@ export const TreeAlpha: {
|
|
|
103
105
|
*
|
|
104
106
|
* When using this function,
|
|
105
107
|
* it is recommend to ensure your schema is unambiguous with {@link ITreeConfigurationOptions.preventAmbiguity}.
|
|
106
|
-
* If the schema is ambiguous, consider using {@link TreeAlpha.create} and {@link Unhydrated} nodes where needed,
|
|
107
|
-
* or using {@link TreeAlpha.(importVerbose:1)} and specify all types.
|
|
108
|
+
* If the schema is ambiguous, consider using {@link (TreeAlpha:interface).create} and {@link Unhydrated} nodes where needed,
|
|
109
|
+
* or using {@link (TreeAlpha:interface).(importVerbose:1)} and specify all types.
|
|
108
110
|
*
|
|
109
111
|
* Documented (and thus recoverable) error handling/reporting for this is not yet implemented,
|
|
110
112
|
* but for now most invalid inputs will throw a recoverable error.
|
|
@@ -123,7 +125,7 @@ export const TreeAlpha: {
|
|
|
123
125
|
/**
|
|
124
126
|
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
125
127
|
* @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
|
|
126
|
-
* @param data - The data used to construct the field content. See {@link TreeAlpha.(exportVerbose:1)}.
|
|
128
|
+
* @param data - The data used to construct the field content. See {@link (TreeAlpha:interface).(exportVerbose:1)}.
|
|
127
129
|
*/
|
|
128
130
|
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
129
131
|
schema: TSchema,
|
|
@@ -149,7 +151,7 @@ export const TreeAlpha: {
|
|
|
149
151
|
* Uses the {@link VerboseTree} format, with an explicit type on every node.
|
|
150
152
|
*
|
|
151
153
|
* @remarks
|
|
152
|
-
* There are several cases this may be preferred to {@link TreeAlpha.(exportConcise:1)}:
|
|
154
|
+
* There are several cases this may be preferred to {@link (TreeAlpha:interface).(exportConcise:1)}:
|
|
153
155
|
*
|
|
154
156
|
* 1. When not using {@link ITreeConfigurationOptions.preventAmbiguity} (or when using `useStableFieldKeys`), `exportConcise` can produce ambiguous data (the type may be unclear on some nodes).
|
|
155
157
|
* `exportVerbose` will always be unambiguous and thus lossless.
|
|
@@ -182,11 +184,11 @@ export const TreeAlpha: {
|
|
|
182
184
|
): JsonCompatible<IFluidHandle>;
|
|
183
185
|
|
|
184
186
|
/**
|
|
185
|
-
* Import data encoded by {@link TreeAlpha.exportCompressed}.
|
|
187
|
+
* Import data encoded by {@link (TreeAlpha:interface).exportCompressed}.
|
|
186
188
|
*
|
|
187
189
|
* @param schema - Schema with which the data must be compatible. This compatibility is not verified and must be ensured by the caller.
|
|
188
|
-
* @param compressedData - Data compressed by {@link TreeAlpha.exportCompressed}.
|
|
189
|
-
* @param options - If {@link TreeAlpha.exportCompressed} was given an `idCompressor`, it must be provided here.
|
|
190
|
+
* @param compressedData - Data compressed by {@link (TreeAlpha:interface).exportCompressed}.
|
|
191
|
+
* @param options - If {@link (TreeAlpha:interface).exportCompressed} was given an `idCompressor`, it must be provided here.
|
|
190
192
|
*
|
|
191
193
|
* @remarks
|
|
192
194
|
* If the data could have been encoded with a different schema, consider encoding the schema along side it using {@link extractPersistedSchema} and loading the data using {@link independentView}.
|
|
@@ -203,7 +205,14 @@ export const TreeAlpha: {
|
|
|
203
205
|
compressedData: JsonCompatible<IFluidHandle>,
|
|
204
206
|
options: { idCompressor?: IIdCompressor } & ICodecOptions,
|
|
205
207
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
206
|
-
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Extensions to {@link (Tree:variable)} and {@link (TreeBeta:variable)} which are not yet stable.
|
|
212
|
+
* @see {@link (TreeAlpha:interface)}.
|
|
213
|
+
* @alpha
|
|
214
|
+
*/
|
|
215
|
+
export const TreeAlpha: TreeAlpha = {
|
|
207
216
|
branch(node: TreeNode): TreeBranch | undefined {
|
|
208
217
|
const kernel = getKernel(node);
|
|
209
218
|
if (!kernel.isHydrated()) {
|
|
@@ -21,7 +21,7 @@ import { getUnhydratedContext } from "../createContext.js";
|
|
|
21
21
|
* @remarks
|
|
22
22
|
* This is "concise" meaning that explicit type information is omitted.
|
|
23
23
|
* If the schema is compatible with {@link ITreeConfigurationOptions.preventAmbiguity},
|
|
24
|
-
* types will be lossless and compatible with {@link TreeAlpha.create} (unless the options are used to customize it).
|
|
24
|
+
* types will be lossless and compatible with {@link (TreeAlpha:interface).create} (unless the options are used to customize it).
|
|
25
25
|
*
|
|
26
26
|
* Every {@link TreeNode} is an array or object.
|
|
27
27
|
* Any IFluidHandle values have been replaced by `THandle`.
|