@fluidframework/tree 2.5.0-302463 → 2.10.0-304831
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 -0
- package/CHANGELOG.md +371 -0
- package/api-report/tree.alpha.api.md +161 -69
- package/api-report/tree.beta.api.md +36 -37
- package/api-report/tree.legacy.alpha.api.md +35 -36
- package/api-report/tree.legacy.public.api.md +35 -36
- package/api-report/tree.public.api.md +35 -36
- package/dist/alpha.d.ts +15 -0
- package/dist/codec/codec.d.ts +24 -0
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +26 -1
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +3 -7
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +4 -10
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +1 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +29 -4
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/revertible.d.ts +1 -1
- package/dist/core/revertible.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +2 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +3 -0
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- 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/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/shared-tree/independentView.d.ts +57 -0
- package/dist/shared-tree/independentView.d.ts.map +1 -0
- package/dist/shared-tree/independentView.js +89 -0
- package/dist/shared-tree/independentView.js.map +1 -0
- package/dist/shared-tree/index.d.ts +3 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +13 -9
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +32 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +10 -7
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +147 -0
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -0
- package/dist/shared-tree/treeApiAlpha.js +122 -0
- package/dist/shared-tree/treeApiAlpha.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +19 -17
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +16 -7
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +13 -6
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +70 -28
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +28 -3
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +2 -1
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +5 -23
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +4 -19
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +1 -0
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +5 -5
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +10 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +6 -16
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +11 -11
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +125 -7
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +12 -4
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeApiBeta.d.ts +8 -5
- package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeApiBeta.js +3 -15
- package/dist/simple-tree/api/treeApiBeta.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
- 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/api/verboseTree.d.ts +3 -0
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +9 -15
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +1 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +45 -9
- 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.d.ts +2 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +3 -0
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +1 -2
- 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/createContext.js +2 -2
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/index.d.ts +5 -5
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +15 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +6 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +3 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +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/schemaTypes.d.ts +45 -7
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +61 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/{toFlexSchema.d.ts → toStoredSchema.d.ts} +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -0
- package/dist/simple-tree/{toFlexSchema.js → toStoredSchema.js} +1 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -0
- package/dist/simple-tree/treeNodeValid.d.ts +5 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +7 -1
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +9 -0
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +7 -3
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +13 -3
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +15 -0
- package/lib/codec/codec.d.ts +24 -0
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +25 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +2 -2
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +2 -2
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +3 -7
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +3 -8
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +1 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +27 -3
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/revertible.d.ts +1 -1
- package/lib/core/revertible.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +2 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +3 -0
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- 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/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/shared-tree/independentView.d.ts +57 -0
- package/lib/shared-tree/independentView.d.ts.map +1 -0
- package/lib/shared-tree/independentView.js +84 -0
- package/lib/shared-tree/independentView.js.map +1 -0
- package/lib/shared-tree/index.d.ts +3 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -0
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +13 -9
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +33 -2
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +10 -7
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +147 -0
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -0
- package/lib/shared-tree/treeApiAlpha.js +119 -0
- package/lib/shared-tree/treeApiAlpha.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +19 -17
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +16 -7
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +13 -6
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +70 -28
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +29 -4
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +2 -1
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +5 -23
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +2 -16
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +1 -0
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +5 -5
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +5 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +6 -16
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +11 -11
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +125 -7
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +9 -2
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeApiBeta.d.ts +8 -5
- package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeApiBeta.js +4 -16
- package/lib/simple-tree/api/treeApiBeta.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
- 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/api/verboseTree.d.ts +3 -0
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +9 -15
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +1 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +45 -9
- 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.d.ts +2 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +4 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +1 -2
- 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/createContext.js +1 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/index.d.ts +5 -5
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +4 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +6 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +3 -0
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +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/schemaTypes.d.ts +45 -7
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +59 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/{toFlexSchema.d.ts → toStoredSchema.d.ts} +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -0
- package/lib/simple-tree/{toFlexSchema.js → toStoredSchema.js} +1 -1
- package/lib/simple-tree/toStoredSchema.js.map +1 -0
- package/lib/simple-tree/treeNodeValid.d.ts +5 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +7 -1
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +9 -0
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +7 -3
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +13 -3
- package/lib/util/utils.js.map +1 -1
- package/package.json +26 -53
- package/src/codec/codec.ts +25 -0
- package/src/codec/index.ts +1 -0
- package/src/core/rebase/index.ts +1 -1
- package/src/core/rebase/types.ts +3 -15
- package/src/core/rebase/utils.ts +35 -3
- package/src/core/revertible.ts +1 -1
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +9 -0
- package/src/feature-libraries/flex-tree/lazyNode.ts +5 -0
- package/src/index.ts +20 -5
- package/src/internalTypes.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +176 -0
- package/src/shared-tree/index.ts +9 -1
- package/src/shared-tree/schematizingTreeView.ts +66 -17
- package/src/shared-tree/sharedTree.ts +29 -11
- package/src/shared-tree/treeApiAlpha.ts +401 -0
- package/src/shared-tree/treeCheckout.ts +39 -19
- package/src/shared-tree-core/editManager.ts +112 -54
- package/src/shared-tree-core/sharedTreeCore.ts +37 -8
- package/src/simple-tree/api/conciseTree.ts +2 -1
- package/src/simple-tree/api/create.ts +21 -58
- package/src/simple-tree/api/customTree.ts +1 -0
- package/src/simple-tree/api/index.ts +13 -7
- package/src/simple-tree/api/schemaCreationUtilities.ts +4 -5
- package/src/simple-tree/api/schemaFactory.ts +24 -12
- package/src/simple-tree/api/storedSchema.ts +1 -1
- package/src/simple-tree/api/tree.ts +148 -14
- package/src/simple-tree/api/treeApiBeta.ts +35 -35
- package/src/simple-tree/api/typesUnsafe.ts +4 -4
- package/src/simple-tree/api/verboseTree.ts +3 -0
- package/src/simple-tree/arrayNode.ts +21 -23
- package/src/simple-tree/core/getOrCreateNode.ts +1 -1
- package/src/simple-tree/core/treeNodeSchema.ts +99 -31
- package/src/simple-tree/core/unhydratedFlexTree.ts +6 -0
- package/src/simple-tree/core/withType.ts +1 -9
- package/src/simple-tree/createContext.ts +1 -1
- package/src/simple-tree/index.ts +15 -2
- package/src/simple-tree/leafNodeSchema.ts +6 -1
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/schemaTypes.ts +128 -14
- package/src/simple-tree/treeNodeValid.ts +11 -1
- package/src/util/index.ts +1 -0
- package/src/util/typeCheck.ts +13 -0
- package/src/util/utils.ts +20 -7
- package/dist/simple-tree/toFlexSchema.d.ts.map +0 -1
- package/dist/simple-tree/toFlexSchema.js.map +0 -1
- package/lib/simple-tree/toFlexSchema.d.ts.map +0 -1
- package/lib/simple-tree/toFlexSchema.js.map +0 -1
- /package/docs/{main → user-facing}/merge-semantics.md +0 -0
- /package/src/simple-tree/{toFlexSchema.ts → toStoredSchema.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -58,8 +58,12 @@ export {
|
|
|
58
58
|
rollback,
|
|
59
59
|
type ForestOptions,
|
|
60
60
|
getBranch,
|
|
61
|
-
type
|
|
61
|
+
type BranchableTree,
|
|
62
62
|
type TreeBranchFork,
|
|
63
|
+
independentInitializedView,
|
|
64
|
+
type ViewContent,
|
|
65
|
+
TreeAlpha,
|
|
66
|
+
independentView,
|
|
63
67
|
} from "./shared-tree/index.js";
|
|
64
68
|
|
|
65
69
|
export {
|
|
@@ -133,6 +137,8 @@ export {
|
|
|
133
137
|
type InsertableContent,
|
|
134
138
|
type FactoryContent,
|
|
135
139
|
type FactoryContentObject,
|
|
140
|
+
type ReadableField,
|
|
141
|
+
type ReadSchema,
|
|
136
142
|
// test recursive schema for checking that d.ts files handles schema correctly
|
|
137
143
|
test_RecursiveObject,
|
|
138
144
|
test_RecursiveObject_base,
|
|
@@ -140,8 +146,13 @@ export {
|
|
|
140
146
|
// Beta APIs
|
|
141
147
|
TreeBeta,
|
|
142
148
|
type TreeChangeEventsBeta,
|
|
149
|
+
type VerboseTreeNode,
|
|
150
|
+
type EncodeOptions,
|
|
151
|
+
type ParseOptions,
|
|
152
|
+
type VerboseTree,
|
|
143
153
|
extractPersistedSchema,
|
|
144
154
|
comparePersistedSchema,
|
|
155
|
+
type ConciseTree,
|
|
145
156
|
// Back to normal types
|
|
146
157
|
type JsonTreeSchema,
|
|
147
158
|
type JsonSchemaId,
|
|
@@ -162,16 +173,20 @@ export {
|
|
|
162
173
|
type ReadonlyArrayNode,
|
|
163
174
|
type InsertableTreeNodeFromAllowedTypes,
|
|
164
175
|
type Input,
|
|
176
|
+
type TreeBranch,
|
|
177
|
+
type TreeBranchEvents,
|
|
178
|
+
asTreeViewAlpha,
|
|
165
179
|
} from "./simple-tree/index.js";
|
|
166
180
|
export {
|
|
167
181
|
SharedTree,
|
|
168
182
|
configuredSharedTree,
|
|
169
183
|
} from "./treeFactory.js";
|
|
170
184
|
|
|
171
|
-
export
|
|
172
|
-
ICodecOptions,
|
|
173
|
-
JsonValidator,
|
|
174
|
-
SchemaValidationFunction,
|
|
185
|
+
export {
|
|
186
|
+
type ICodecOptions,
|
|
187
|
+
type JsonValidator,
|
|
188
|
+
type SchemaValidationFunction,
|
|
189
|
+
FluidClientVersion,
|
|
175
190
|
} from "./codec/index.js";
|
|
176
191
|
export { noopValidator } from "./codec/index.js";
|
|
177
192
|
export { typeboxValidator } from "./external-utilities/index.js";
|
package/src/internalTypes.ts
CHANGED
package/src/packageVersion.ts
CHANGED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
+
import {
|
|
9
|
+
type IIdCompressor,
|
|
10
|
+
createIdCompressor,
|
|
11
|
+
} from "@fluidframework/id-compressor/internal";
|
|
12
|
+
import type { ICodecOptions } from "../codec/index.js";
|
|
13
|
+
import {
|
|
14
|
+
type RevisionTag,
|
|
15
|
+
RevisionTagCodec,
|
|
16
|
+
TreeStoredSchemaRepository,
|
|
17
|
+
initializeForest,
|
|
18
|
+
type ITreeCursorSynchronous,
|
|
19
|
+
mapCursorField,
|
|
20
|
+
} from "../core/index.js";
|
|
21
|
+
import {
|
|
22
|
+
createNodeKeyManager,
|
|
23
|
+
makeFieldBatchCodec,
|
|
24
|
+
makeSchemaCodec,
|
|
25
|
+
type FieldBatchEncodingContext,
|
|
26
|
+
defaultSchemaPolicy,
|
|
27
|
+
chunkTree,
|
|
28
|
+
defaultChunkPolicy,
|
|
29
|
+
TreeCompressionStrategy,
|
|
30
|
+
} from "../feature-libraries/index.js";
|
|
31
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
32
|
+
import type { Format } from "../feature-libraries/schema-index/format.js";
|
|
33
|
+
import type {
|
|
34
|
+
TreeViewConfiguration,
|
|
35
|
+
ImplicitFieldSchema,
|
|
36
|
+
TreeViewAlpha,
|
|
37
|
+
} from "../simple-tree/index.js";
|
|
38
|
+
import type { JsonCompatibleReadOnly, JsonCompatible } from "../util/index.js";
|
|
39
|
+
import {
|
|
40
|
+
buildConfiguredForest,
|
|
41
|
+
defaultSharedTreeOptions,
|
|
42
|
+
type ForestOptions,
|
|
43
|
+
} from "./sharedTree.js";
|
|
44
|
+
import { createTreeCheckout } from "./treeCheckout.js";
|
|
45
|
+
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Such a view can never experience collaboration or be persisted to to a Fluid Container.
|
|
52
|
+
*
|
|
53
|
+
* This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.
|
|
54
|
+
* @alpha
|
|
55
|
+
*/
|
|
56
|
+
export function independentView<const TSchema extends ImplicitFieldSchema>(
|
|
57
|
+
config: TreeViewConfiguration<TSchema>,
|
|
58
|
+
options: ForestOptions & { idCompressor?: IIdCompressor | undefined },
|
|
59
|
+
): TreeViewAlpha<TSchema> {
|
|
60
|
+
const idCompressor: IIdCompressor = options.idCompressor ?? createIdCompressor();
|
|
61
|
+
const mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();
|
|
62
|
+
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
63
|
+
const schema = new TreeStoredSchemaRepository();
|
|
64
|
+
const forest = buildConfiguredForest(
|
|
65
|
+
options.forest ?? defaultSharedTreeOptions.forest,
|
|
66
|
+
schema,
|
|
67
|
+
idCompressor,
|
|
68
|
+
);
|
|
69
|
+
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
70
|
+
forest,
|
|
71
|
+
schema,
|
|
72
|
+
});
|
|
73
|
+
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
74
|
+
checkout,
|
|
75
|
+
config,
|
|
76
|
+
createNodeKeyManager(idCompressor),
|
|
77
|
+
);
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* Such a view can never experience collaboration or be persisted to to a Fluid Container.
|
|
85
|
+
*
|
|
86
|
+
* This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.
|
|
87
|
+
* @alpha
|
|
88
|
+
*/
|
|
89
|
+
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(
|
|
90
|
+
config: TreeViewConfiguration<TSchema>,
|
|
91
|
+
options: ForestOptions & ICodecOptions,
|
|
92
|
+
content: ViewContent,
|
|
93
|
+
): TreeViewAlpha<TSchema> {
|
|
94
|
+
const idCompressor: IIdCompressor = content.idCompressor;
|
|
95
|
+
const mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();
|
|
96
|
+
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
97
|
+
|
|
98
|
+
const fieldBatchCodec = makeFieldBatchCodec(options, 1);
|
|
99
|
+
const schemaCodec = makeSchemaCodec(options);
|
|
100
|
+
|
|
101
|
+
const schema = new TreeStoredSchemaRepository(schemaCodec.decode(content.schema as Format));
|
|
102
|
+
const forest = buildConfiguredForest(
|
|
103
|
+
options.forest ?? defaultSharedTreeOptions.forest,
|
|
104
|
+
schema,
|
|
105
|
+
idCompressor,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const context: FieldBatchEncodingContext = {
|
|
109
|
+
encodeType: TreeCompressionStrategy.Compressed,
|
|
110
|
+
idCompressor,
|
|
111
|
+
originatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?
|
|
112
|
+
schema: { schema, policy: defaultSchemaPolicy },
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const fieldCursors = fieldBatchCodec.decode(content.tree as JsonCompatibleReadOnly, context);
|
|
116
|
+
assert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
117
|
+
// Checked above.
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
119
|
+
const cursors = fieldCursorToNodesCursors(fieldCursors[0]!);
|
|
120
|
+
|
|
121
|
+
initializeForest(forest, cursors, revisionTagCodec, idCompressor, false);
|
|
122
|
+
|
|
123
|
+
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
124
|
+
forest,
|
|
125
|
+
schema,
|
|
126
|
+
});
|
|
127
|
+
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
128
|
+
checkout,
|
|
129
|
+
config,
|
|
130
|
+
createNodeKeyManager(idCompressor),
|
|
131
|
+
);
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function fieldCursorToNodesCursors(
|
|
136
|
+
fieldCursor: ITreeCursorSynchronous,
|
|
137
|
+
): ITreeCursorSynchronous[] {
|
|
138
|
+
return mapCursorField(fieldCursor, copyNodeCursor);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* TODO: avoid needing this, or optimize it.
|
|
143
|
+
*/
|
|
144
|
+
function copyNodeCursor(cursor: ITreeCursorSynchronous): ITreeCursorSynchronous {
|
|
145
|
+
const copy = chunkTree(cursor, {
|
|
146
|
+
policy: defaultChunkPolicy,
|
|
147
|
+
idCompressor: undefined,
|
|
148
|
+
}).cursor();
|
|
149
|
+
copy.enterNode(0);
|
|
150
|
+
return copy;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The portion of SharedTree data typically persisted by the container.
|
|
155
|
+
* Usable with {@link independentInitializedView} to create a {@link TreeView}
|
|
156
|
+
* without loading a container.
|
|
157
|
+
* @alpha
|
|
158
|
+
*/
|
|
159
|
+
export interface ViewContent {
|
|
160
|
+
/**
|
|
161
|
+
* Compressed tree from {@link TreeAlpha.exportCompressed}.
|
|
162
|
+
* @remarks
|
|
163
|
+
* This is an owning reference:
|
|
164
|
+
* consumers of this content might modify this data in place (for example when applying edits) to avoid copying.
|
|
165
|
+
*/
|
|
166
|
+
readonly tree: JsonCompatible<IFluidHandle>;
|
|
167
|
+
/**
|
|
168
|
+
* Persisted schema from {@link extractPersistedSchema}.
|
|
169
|
+
*/
|
|
170
|
+
readonly schema: JsonCompatible;
|
|
171
|
+
/**
|
|
172
|
+
* IIdCompressor which will be used to decompress any compressed identifiers in `tree`
|
|
173
|
+
* as well as for any other identifiers added to the view.
|
|
174
|
+
*/
|
|
175
|
+
readonly idCompressor: IIdCompressor;
|
|
176
|
+
}
|
package/src/shared-tree/index.ts
CHANGED
|
@@ -26,7 +26,7 @@ export {
|
|
|
26
26
|
type CheckoutEvents,
|
|
27
27
|
type ITransaction,
|
|
28
28
|
type ITreeCheckoutFork,
|
|
29
|
-
type
|
|
29
|
+
type BranchableTree,
|
|
30
30
|
type TreeBranchFork,
|
|
31
31
|
} from "./treeCheckout.js";
|
|
32
32
|
|
|
@@ -46,3 +46,11 @@ export {
|
|
|
46
46
|
type RunTransaction,
|
|
47
47
|
rollback,
|
|
48
48
|
} from "./treeApi.js";
|
|
49
|
+
|
|
50
|
+
export { TreeAlpha } from "./treeApiAlpha.js";
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
independentInitializedView,
|
|
54
|
+
type ViewContent,
|
|
55
|
+
independentView,
|
|
56
|
+
} from "./independentView.js";
|
|
@@ -29,8 +29,6 @@ import {
|
|
|
29
29
|
type FieldSchema,
|
|
30
30
|
type ImplicitFieldSchema,
|
|
31
31
|
type SchemaCompatibilityStatus,
|
|
32
|
-
type InsertableTreeFieldFromImplicitField,
|
|
33
|
-
type TreeFieldFromImplicitField,
|
|
34
32
|
type TreeView,
|
|
35
33
|
type TreeViewEvents,
|
|
36
34
|
getTreeNodeForField,
|
|
@@ -43,13 +41,24 @@ import {
|
|
|
43
41
|
prepareContentForHydration,
|
|
44
42
|
comparePersistedSchemaInternal,
|
|
45
43
|
toStoredSchema,
|
|
44
|
+
type TreeViewAlpha,
|
|
45
|
+
type InsertableField,
|
|
46
|
+
type ReadableField,
|
|
47
|
+
type ReadSchema,
|
|
48
|
+
type UnsafeUnknownSchema,
|
|
49
|
+
type TreeBranch,
|
|
50
|
+
type TreeBranchEvents,
|
|
46
51
|
} from "../simple-tree/index.js";
|
|
47
52
|
import { Breakable, breakingClass, disposeSymbol, type WithBreakable } from "../util/index.js";
|
|
48
53
|
|
|
49
54
|
import { canInitialize, ensureSchema, initialize } from "./schematizeTree.js";
|
|
50
55
|
import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
|
|
51
56
|
import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
|
|
52
|
-
import {
|
|
57
|
+
import {
|
|
58
|
+
HydratedContext,
|
|
59
|
+
SimpleContextSlot,
|
|
60
|
+
areImplicitFieldSchemaEqual,
|
|
61
|
+
} from "../simple-tree/index.js";
|
|
53
62
|
/**
|
|
54
63
|
* Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
|
|
55
64
|
* exists and error if creating a second.
|
|
@@ -60,8 +69,9 @@ export const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();
|
|
|
60
69
|
* Implementation of TreeView wrapping a FlexTreeView.
|
|
61
70
|
*/
|
|
62
71
|
@breakingClass
|
|
63
|
-
export class SchematizingSimpleTreeView<
|
|
64
|
-
|
|
72
|
+
export class SchematizingSimpleTreeView<
|
|
73
|
+
in out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
|
|
74
|
+
> implements TreeBranch, TreeViewAlpha<TRootSchema>, WithBreakable
|
|
65
75
|
{
|
|
66
76
|
/**
|
|
67
77
|
* The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
|
|
@@ -75,9 +85,9 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
75
85
|
*/
|
|
76
86
|
private currentCompatibility: SchemaCompatibilityStatus | undefined;
|
|
77
87
|
private readonly schemaPolicy: SchemaPolicy;
|
|
78
|
-
public readonly events: Listenable<TreeViewEvents> &
|
|
79
|
-
IEmitter<TreeViewEvents> &
|
|
80
|
-
HasListeners<TreeViewEvents> = createEmitter();
|
|
88
|
+
public readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &
|
|
89
|
+
IEmitter<TreeViewEvents & TreeBranchEvents> &
|
|
90
|
+
HasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();
|
|
81
91
|
|
|
82
92
|
private readonly viewSchema: ViewSchema;
|
|
83
93
|
|
|
@@ -96,7 +106,7 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
96
106
|
|
|
97
107
|
public constructor(
|
|
98
108
|
public readonly checkout: TreeCheckout,
|
|
99
|
-
public readonly config: TreeViewConfiguration<TRootSchema
|
|
109
|
+
public readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,
|
|
100
110
|
public readonly nodeKeyManager: NodeKeyManager,
|
|
101
111
|
public readonly breaker: Breakable = new Breakable("SchematizingSimpleTreeView"),
|
|
102
112
|
private readonly onDispose?: () => void,
|
|
@@ -124,17 +134,24 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
124
134
|
this.update();
|
|
125
135
|
|
|
126
136
|
this.unregisterCallbacks.add(
|
|
127
|
-
this.checkout.events.on("
|
|
128
|
-
this.events.emit("
|
|
129
|
-
|
|
137
|
+
this.checkout.events.on("changed", (data, getRevertible) => {
|
|
138
|
+
this.events.emit("changed", data, getRevertible);
|
|
139
|
+
this.events.emit("commitApplied", data, getRevertible);
|
|
140
|
+
}),
|
|
130
141
|
);
|
|
131
142
|
}
|
|
132
143
|
|
|
133
|
-
public
|
|
144
|
+
public hasRootSchema<TSchema extends ImplicitFieldSchema>(
|
|
145
|
+
schema: TSchema,
|
|
146
|
+
): this is TreeViewAlpha<TSchema> {
|
|
147
|
+
return areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public get schema(): ReadSchema<TRootSchema> {
|
|
134
151
|
return this.config.schema;
|
|
135
152
|
}
|
|
136
153
|
|
|
137
|
-
public initialize(content:
|
|
154
|
+
public initialize(content: InsertableField<TRootSchema>): void {
|
|
138
155
|
this.ensureUndisposed();
|
|
139
156
|
|
|
140
157
|
const compatibility = this.compatibility;
|
|
@@ -338,9 +355,13 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
338
355
|
this.checkout.forest.anchors.slots.delete(ViewSlot);
|
|
339
356
|
this.currentCompatibility = undefined;
|
|
340
357
|
this.onDispose?.();
|
|
358
|
+
if (this.checkout.isBranch && !this.checkout.disposed) {
|
|
359
|
+
// All (non-main) branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.
|
|
360
|
+
this.checkout.dispose();
|
|
361
|
+
}
|
|
341
362
|
}
|
|
342
363
|
|
|
343
|
-
public get root():
|
|
364
|
+
public get root(): ReadableField<TRootSchema> {
|
|
344
365
|
this.breaker.use();
|
|
345
366
|
if (!this.compatibility.canView) {
|
|
346
367
|
throw new UsageError(
|
|
@@ -348,10 +369,10 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
348
369
|
);
|
|
349
370
|
}
|
|
350
371
|
const view = this.getView();
|
|
351
|
-
return getTreeNodeForField(view.flexTree) as
|
|
372
|
+
return getTreeNodeForField(view.flexTree) as ReadableField<TRootSchema>;
|
|
352
373
|
}
|
|
353
374
|
|
|
354
|
-
public set root(newRoot:
|
|
375
|
+
public set root(newRoot: InsertableField<TRootSchema>) {
|
|
355
376
|
this.breaker.use();
|
|
356
377
|
if (!this.compatibility.canView) {
|
|
357
378
|
throw new UsageError(
|
|
@@ -365,6 +386,34 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
|
|
|
365
386
|
newRoot as InsertableContent | undefined,
|
|
366
387
|
);
|
|
367
388
|
}
|
|
389
|
+
|
|
390
|
+
// #region Branching
|
|
391
|
+
|
|
392
|
+
public fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TRootSchema> {
|
|
393
|
+
return this.checkout.branch().viewWith(this.config);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
public merge(context: TreeBranch, disposeMerged = true): void {
|
|
397
|
+
this.checkout.merge(getCheckout(context), disposeMerged);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
public rebaseOnto(context: TreeBranch): void {
|
|
401
|
+
getCheckout(context).rebase(this.checkout);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// #endregion Branching
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.
|
|
409
|
+
* @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.
|
|
410
|
+
* Other checkout implementations (e.g. not associated with a view) may be supported in the future.
|
|
411
|
+
*/
|
|
412
|
+
function getCheckout(context: TreeBranch): TreeCheckout {
|
|
413
|
+
if (context instanceof SchematizingSimpleTreeView) {
|
|
414
|
+
return context.checkout;
|
|
415
|
+
}
|
|
416
|
+
throw new UsageError("Unsupported context implementation");
|
|
368
417
|
}
|
|
369
418
|
|
|
370
419
|
/**
|
|
@@ -53,8 +53,11 @@ import {
|
|
|
53
53
|
import type {
|
|
54
54
|
ITree,
|
|
55
55
|
ImplicitFieldSchema,
|
|
56
|
+
ReadSchema,
|
|
56
57
|
TreeView,
|
|
58
|
+
TreeViewAlpha,
|
|
57
59
|
TreeViewConfiguration,
|
|
60
|
+
UnsafeUnknownSchema,
|
|
58
61
|
} from "../simple-tree/index.js";
|
|
59
62
|
|
|
60
63
|
import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
|
|
@@ -65,7 +68,7 @@ import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
|
|
|
65
68
|
import {
|
|
66
69
|
type CheckoutEvents,
|
|
67
70
|
type TreeCheckout,
|
|
68
|
-
type
|
|
71
|
+
type BranchableTree,
|
|
69
72
|
createTreeCheckout,
|
|
70
73
|
} from "./treeCheckout.js";
|
|
71
74
|
import { breakingClass, throwIfBroken } from "../util/index.js";
|
|
@@ -324,10 +327,21 @@ export class SharedTree
|
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
329
|
|
|
330
|
+
// For the new TreeViewAlpha API
|
|
331
|
+
public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
332
|
+
config: TreeViewConfiguration<ReadSchema<TRoot>>,
|
|
333
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;
|
|
334
|
+
|
|
335
|
+
// For the old TreeView API
|
|
327
336
|
public viewWith<TRoot extends ImplicitFieldSchema>(
|
|
328
337
|
config: TreeViewConfiguration<TRoot>,
|
|
329
|
-
): SchematizingSimpleTreeView<TRoot>
|
|
330
|
-
|
|
338
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;
|
|
339
|
+
|
|
340
|
+
public viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
341
|
+
config: TreeViewConfiguration<ReadSchema<TRoot>>,
|
|
342
|
+
): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {
|
|
343
|
+
return this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &
|
|
344
|
+
TreeView<ReadSchema<TRoot>>;
|
|
331
345
|
}
|
|
332
346
|
|
|
333
347
|
protected override async loadCore(services: IChannelStorageService): Promise<void> {
|
|
@@ -338,32 +352,36 @@ export class SharedTree
|
|
|
338
352
|
}
|
|
339
353
|
|
|
340
354
|
/**
|
|
341
|
-
* Get a {@link
|
|
355
|
+
* Get a {@link BranchableTree} from a {@link ITree}.
|
|
342
356
|
* @remarks The branch can be used for "version control"-style coordination of edits on the tree.
|
|
343
357
|
* @privateRemarks This function will be removed if/when the branching API becomes public,
|
|
344
358
|
* but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.
|
|
345
359
|
* @alpha
|
|
360
|
+
* @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.
|
|
346
361
|
*/
|
|
347
|
-
export function getBranch(tree: ITree):
|
|
362
|
+
export function getBranch(tree: ITree): BranchableTree;
|
|
348
363
|
/**
|
|
349
|
-
* Get a {@link
|
|
364
|
+
* Get a {@link BranchableTree} from a {@link TreeView}.
|
|
350
365
|
* @remarks The branch can be used for "version control"-style coordination of edits on the tree.
|
|
351
366
|
* Branches are currently an unstable "alpha" API and are subject to change in the future.
|
|
352
367
|
* @privateRemarks This function will be removed if/when the branching API becomes public,
|
|
353
368
|
* but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.
|
|
354
369
|
* @alpha
|
|
370
|
+
* @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.
|
|
355
371
|
*/
|
|
356
|
-
export function getBranch<T extends ImplicitFieldSchema>(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
372
|
+
export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
373
|
+
view: TreeViewAlpha<T>,
|
|
374
|
+
): BranchableTree;
|
|
375
|
+
export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(
|
|
376
|
+
treeOrView: ITree | TreeViewAlpha<T>,
|
|
377
|
+
): BranchableTree {
|
|
360
378
|
assert(
|
|
361
379
|
treeOrView instanceof SharedTree || treeOrView instanceof SchematizingSimpleTreeView,
|
|
362
380
|
0xa48 /* Unsupported implementation */,
|
|
363
381
|
);
|
|
364
382
|
const checkout: TreeCheckout = treeOrView.checkout;
|
|
365
383
|
// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.
|
|
366
|
-
return checkout as unknown as
|
|
384
|
+
return checkout as unknown as BranchableTree;
|
|
367
385
|
}
|
|
368
386
|
|
|
369
387
|
/**
|