@fluidframework/tree 2.5.0-302463 → 2.5.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 -0
- package/CHANGELOG.md +371 -0
- package/api-report/tree.alpha.api.md +151 -57
- package/api-report/tree.beta.api.md +29 -25
- package/api-report/tree.legacy.alpha.api.md +28 -24
- package/api-report/tree.legacy.public.api.md +28 -24
- package/api-report/tree.public.api.md +28 -24
- 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 +0 -4
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +1 -7
- 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/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/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 +12 -8
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +28 -0
- 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 +12 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +9 -4
- 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 +115 -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 +1 -1
- 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 +1 -1
- 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 +4 -4
- 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 +0 -4
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +0 -5
- 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/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/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 +12 -8
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +29 -1
- 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 +12 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +9 -4
- 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 +115 -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 +1 -1
- 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 +1 -1
- 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 +4 -4
- 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 +30 -21
- 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 +0 -12
- package/src/core/rebase/utils.ts +35 -3
- 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/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 +58 -11
- package/src/shared-tree/sharedTree.ts +29 -11
- package/src/shared-tree/treeApiAlpha.ts +401 -0
- package/src/shared-tree/treeCheckout.ts +26 -5
- 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 +136 -14
- package/src/simple-tree/api/treeApiBeta.ts +35 -35
- package/src/simple-tree/api/typesUnsafe.ts +1 -2
- package/src/simple-tree/api/verboseTree.ts +3 -0
- package/src/simple-tree/arrayNode.ts +4 -3
- 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 -1
- 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/src/simple-tree/{toFlexSchema.ts → toStoredSchema.ts} +0 -0
|
@@ -270,30 +270,62 @@ export class EditManager<
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
|
-
*
|
|
274
|
-
* @param
|
|
275
|
-
* @
|
|
273
|
+
* Promote the oldest un-sequenced commit on the local branch to the head of the trunk.
|
|
274
|
+
* @param sequenceId - The sequence id of the new trunk commit
|
|
275
|
+
* @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.
|
|
276
|
+
* The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.
|
|
277
|
+
* The first commit will be "the same" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.
|
|
278
|
+
* Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.
|
|
279
|
+
* Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.
|
|
276
280
|
*/
|
|
277
|
-
private
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
private fastForwardNextLocalCommit(sequenceId: SequenceId): void {
|
|
282
|
+
// First, push the local commit to the trunk.
|
|
283
|
+
// We are mutating our `localCommits` cache here, but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.
|
|
284
|
+
const firstLocalCommit = this.localCommits.shift();
|
|
285
|
+
assert(
|
|
286
|
+
firstLocalCommit !== undefined,
|
|
287
|
+
0x6b5 /* Received a sequenced change from the local session despite having no local changes */,
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
const previousSequenceId = this.getCommitSequenceId(this.trunk.getHead());
|
|
291
|
+
this.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, this.localSessionId);
|
|
292
|
+
|
|
293
|
+
// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.
|
|
294
|
+
// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)
|
|
295
|
+
// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.
|
|
296
|
+
// Intuitively, this makes sense because:
|
|
297
|
+
// 1. The trunk's head just advanced forward by some (sequence) amount.
|
|
298
|
+
// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).
|
|
299
|
+
// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.
|
|
300
|
+
// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).
|
|
301
|
+
const currentBranches = this.trunkBranches.get(previousSequenceId);
|
|
283
302
|
if (currentBranches !== undefined) {
|
|
284
|
-
const newBranches = getOrCreate(this.trunkBranches,
|
|
303
|
+
const newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());
|
|
285
304
|
for (const branch of currentBranches) {
|
|
286
|
-
if
|
|
305
|
+
// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).
|
|
306
|
+
// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.
|
|
307
|
+
if (findAncestor(branch.getHead(), (c) => c === firstLocalCommit) !== undefined) {
|
|
287
308
|
newBranches.add(branch);
|
|
288
309
|
currentBranches.delete(branch);
|
|
289
310
|
}
|
|
290
311
|
}
|
|
312
|
+
// Clean up our trunk branches map by removing any empty sets.
|
|
291
313
|
if (currentBranches.size === 0) {
|
|
292
|
-
this.trunkBranches.delete(
|
|
314
|
+
this.trunkBranches.delete(previousSequenceId);
|
|
315
|
+
}
|
|
316
|
+
if (newBranches.size === 0) {
|
|
317
|
+
this.trunkBranches.delete(sequenceId);
|
|
293
318
|
}
|
|
294
319
|
}
|
|
295
320
|
}
|
|
296
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Return the sequence number at which the given commit was sequenced on the trunk, or undefined if the commit is not part of the trunk.
|
|
324
|
+
*/
|
|
325
|
+
public getSequenceNumber(trunkCommit: GraphCommit<TChangeset>): SeqNumber | undefined {
|
|
326
|
+
return this.trunkMetadata.get(trunkCommit.revision)?.sequenceId.sequenceNumber;
|
|
327
|
+
}
|
|
328
|
+
|
|
297
329
|
/**
|
|
298
330
|
* Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,
|
|
299
331
|
* if they are not retained by revertibles or local branches.
|
|
@@ -301,7 +333,10 @@ export class EditManager<
|
|
|
301
333
|
*
|
|
302
334
|
* @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.
|
|
303
335
|
*/
|
|
304
|
-
public advanceMinimumSequenceNumber(
|
|
336
|
+
public advanceMinimumSequenceNumber(
|
|
337
|
+
minimumSequenceNumber: SeqNumber,
|
|
338
|
+
trimTrunk = true,
|
|
339
|
+
): void {
|
|
305
340
|
if (minimumSequenceNumber === this.minimumSequenceNumber) {
|
|
306
341
|
return;
|
|
307
342
|
}
|
|
@@ -312,16 +347,17 @@ export class EditManager<
|
|
|
312
347
|
);
|
|
313
348
|
|
|
314
349
|
this.minimumSequenceNumber = minimumSequenceNumber;
|
|
315
|
-
|
|
350
|
+
if (trimTrunk) {
|
|
351
|
+
this.trimTrunk();
|
|
352
|
+
}
|
|
316
353
|
}
|
|
317
354
|
|
|
318
355
|
/**
|
|
319
356
|
* Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine
|
|
320
357
|
* if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.
|
|
321
|
-
* @returns the number of commits that were removed from the trunk
|
|
322
358
|
*/
|
|
323
359
|
private trimTrunk(): void {
|
|
324
|
-
/** The sequence id of the
|
|
360
|
+
/** The sequence id of the most recent commit on the trunk that will be trimmed */
|
|
325
361
|
let trunkTailSequenceId: SequenceId = {
|
|
326
362
|
sequenceNumber: this.minimumSequenceNumber,
|
|
327
363
|
indexInBatch: Number.POSITIVE_INFINITY,
|
|
@@ -376,24 +412,40 @@ export class EditManager<
|
|
|
376
412
|
this.trunkBase = newTrunkBase;
|
|
377
413
|
|
|
378
414
|
// Update any state that is derived from trunk commits
|
|
379
|
-
this.sequenceMap.editRange(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
(s,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
415
|
+
this.sequenceMap.editRange(minimumPossibleSequenceId, sequenceId, true, (s, commit) => {
|
|
416
|
+
// Cleanup look-aside data for each evicted commit
|
|
417
|
+
this.trunkMetadata.delete(commit.revision);
|
|
418
|
+
// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`
|
|
419
|
+
if (equalSequenceIds(s, sequenceId)) {
|
|
420
|
+
assert(
|
|
421
|
+
commit === newTrunkBase,
|
|
422
|
+
0x729 /* Expected last evicted commit to be new trunk base */,
|
|
423
|
+
);
|
|
424
|
+
} else {
|
|
425
|
+
Reflect.defineProperty(commit, "change", {
|
|
426
|
+
get: () =>
|
|
427
|
+
assert(
|
|
428
|
+
false,
|
|
429
|
+
0xa5e /* Should not access 'change' property of an evicted commit */,
|
|
430
|
+
),
|
|
431
|
+
});
|
|
432
|
+
Reflect.defineProperty(commit, "revision", {
|
|
433
|
+
get: () =>
|
|
434
|
+
assert(
|
|
435
|
+
false,
|
|
436
|
+
0xa5f /* Should not access 'revision' property of an evicted commit */,
|
|
437
|
+
),
|
|
438
|
+
});
|
|
439
|
+
Reflect.defineProperty(commit, "parent", {
|
|
440
|
+
get: () =>
|
|
441
|
+
assert(
|
|
442
|
+
false,
|
|
443
|
+
0xa60 /* Should not access 'parent' property of an evicted commit */,
|
|
444
|
+
),
|
|
445
|
+
});
|
|
446
|
+
return { delete: true };
|
|
447
|
+
}
|
|
448
|
+
});
|
|
397
449
|
|
|
398
450
|
const trunkSize = getPathFromBase(this.trunk.getHead(), this.trunkBase).length;
|
|
399
451
|
assert(
|
|
@@ -432,6 +484,9 @@ export class EditManager<
|
|
|
432
484
|
0x428 /* Clients with local changes cannot be used to generate summaries */,
|
|
433
485
|
);
|
|
434
486
|
|
|
487
|
+
// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.
|
|
488
|
+
this.trimTrunk();
|
|
489
|
+
|
|
435
490
|
let oldestCommitInCollabWindow = this.getClosestTrunkCommit(this.minimumSequenceNumber)[1];
|
|
436
491
|
assert(
|
|
437
492
|
oldestCommitInCollabWindow.parent !== undefined ||
|
|
@@ -445,7 +500,10 @@ export class EditManager<
|
|
|
445
500
|
|
|
446
501
|
const trunk = getPathFromBase(this.trunk.getHead(), oldestCommitInCollabWindow).map(
|
|
447
502
|
(c) => {
|
|
448
|
-
assert(
|
|
503
|
+
assert(
|
|
504
|
+
c !== this.trunkBase,
|
|
505
|
+
0xa61 /* Serialized trunk should not include the trunk base */,
|
|
506
|
+
);
|
|
449
507
|
const metadata =
|
|
450
508
|
this.trunkMetadata.get(c.revision) ?? fail("Expected metadata for trunk commit");
|
|
451
509
|
const commit: SequencedCommit<TChangeset> = {
|
|
@@ -476,7 +534,7 @@ export class EditManager<
|
|
|
476
534
|
commits: branchPath.map((c) => {
|
|
477
535
|
assert(
|
|
478
536
|
c !== this.trunkBase,
|
|
479
|
-
|
|
537
|
+
0xa62 /* Serialized branch should not include the trunk base */,
|
|
480
538
|
);
|
|
481
539
|
const commit: Commit<TChangeset> = {
|
|
482
540
|
change: c.change,
|
|
@@ -542,8 +600,16 @@ export class EditManager<
|
|
|
542
600
|
}
|
|
543
601
|
}
|
|
544
602
|
|
|
545
|
-
private getCommitSequenceId(
|
|
546
|
-
|
|
603
|
+
private getCommitSequenceId(trunkCommitOrTrunkBase: GraphCommit<TChangeset>): SequenceId {
|
|
604
|
+
const id = this.trunkMetadata.get(trunkCommitOrTrunkBase.revision)?.sequenceId;
|
|
605
|
+
if (id === undefined) {
|
|
606
|
+
assert(
|
|
607
|
+
trunkCommitOrTrunkBase === this.trunkBase,
|
|
608
|
+
0xa63 /* Commit must be either be on the trunk or be the trunk base */,
|
|
609
|
+
);
|
|
610
|
+
return minimumPossibleSequenceId;
|
|
611
|
+
}
|
|
612
|
+
return id;
|
|
547
613
|
}
|
|
548
614
|
|
|
549
615
|
public getTrunkChanges(): readonly TChangeset[] {
|
|
@@ -595,6 +661,12 @@ export class EditManager<
|
|
|
595
661
|
0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,
|
|
596
662
|
);
|
|
597
663
|
|
|
664
|
+
assert(
|
|
665
|
+
sequenceNumber >= // This is ">=", not ">" because changes in the same batch will have the same sequence number
|
|
666
|
+
(this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),
|
|
667
|
+
0xa64 /* Attempted to sequence change with an outdated sequence number */,
|
|
668
|
+
);
|
|
669
|
+
|
|
598
670
|
const commitsSequenceNumber = this.getBatch(sequenceNumber);
|
|
599
671
|
const sequenceId: SequenceId =
|
|
600
672
|
commitsSequenceNumber.length === 0
|
|
@@ -607,17 +679,7 @@ export class EditManager<
|
|
|
607
679
|
};
|
|
608
680
|
|
|
609
681
|
if (newCommit.sessionId === this.localSessionId) {
|
|
610
|
-
|
|
611
|
-
const firstLocalCommit = this.localCommits.shift();
|
|
612
|
-
assert(
|
|
613
|
-
firstLocalCommit !== undefined,
|
|
614
|
-
0x6b5 /* Received a sequenced change from the local session despite having no local changes */,
|
|
615
|
-
);
|
|
616
|
-
|
|
617
|
-
// The first local branch commit is already rebased over the trunk, so we can push it directly to the trunk.
|
|
618
|
-
this.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, this.localSessionId);
|
|
619
|
-
this.fastForwardBranches(headTrunkCommit, sequenceId);
|
|
620
|
-
return;
|
|
682
|
+
return this.fastForwardNextLocalCommit(sequenceId);
|
|
621
683
|
}
|
|
622
684
|
|
|
623
685
|
// Get the revision that the remote change is based on
|
|
@@ -674,11 +736,7 @@ export class EditManager<
|
|
|
674
736
|
return [commit, commits];
|
|
675
737
|
}
|
|
676
738
|
|
|
677
|
-
private pushCommitToTrunk(
|
|
678
|
-
sequenceId: SequenceId,
|
|
679
|
-
commit: Commit<TChangeset>,
|
|
680
|
-
local = false,
|
|
681
|
-
): void {
|
|
739
|
+
private pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {
|
|
682
740
|
const mintedCommit = mintCommit(this.trunk.getHead(), commit);
|
|
683
741
|
this.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);
|
|
684
742
|
}
|
|
@@ -27,6 +27,7 @@ import type { ICodecOptions, IJsonCodec } from "../codec/index.js";
|
|
|
27
27
|
import {
|
|
28
28
|
type ChangeFamily,
|
|
29
29
|
type ChangeFamilyEditor,
|
|
30
|
+
findAncestor,
|
|
30
31
|
type GraphCommit,
|
|
31
32
|
type RevisionTag,
|
|
32
33
|
RevisionTagCodec,
|
|
@@ -80,7 +81,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
80
81
|
public readonly breaker: Breakable = new Breakable("Shared Tree");
|
|
81
82
|
|
|
82
83
|
private readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;
|
|
83
|
-
private readonly summarizables: readonly Summarizable[];
|
|
84
|
+
private readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];
|
|
84
85
|
/**
|
|
85
86
|
* The sequence number that this instance is at.
|
|
86
87
|
* This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.
|
|
@@ -308,14 +309,42 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
protected async loadCore(services: IChannelStorageService): Promise<void> {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
),
|
|
312
|
+
const [editManagerSummarizer, ...summarizables] = this.summarizables;
|
|
313
|
+
const loadEditManager = this.loadSummarizable(editManagerSummarizer, services);
|
|
314
|
+
const loadSummarizables = summarizables.map(async (s) =>
|
|
315
|
+
this.loadSummarizable(s, services),
|
|
316
316
|
);
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
if (this.detachedRevision !== undefined) {
|
|
319
|
+
// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.
|
|
320
|
+
// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.
|
|
321
|
+
await loadEditManager;
|
|
322
|
+
// Find the most recent detached revision in the summary trunk...
|
|
323
|
+
let latestDetachedSequenceNumber: SeqNumber | undefined;
|
|
324
|
+
findAncestor(this.editManager.getTrunkHead(), (c) => {
|
|
325
|
+
const sequenceNumber = this.editManager.getSequenceNumber(c);
|
|
326
|
+
if (sequenceNumber !== undefined && sequenceNumber < 0) {
|
|
327
|
+
latestDetachedSequenceNumber = sequenceNumber;
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
});
|
|
332
|
+
// ...and set our detached revision to be as it would be if we had been already created that revision.
|
|
333
|
+
this.detachedRevision = latestDetachedSequenceNumber ?? this.detachedRevision;
|
|
334
|
+
await Promise.all(loadSummarizables);
|
|
335
|
+
} else {
|
|
336
|
+
await Promise.all([loadEditManager, ...loadSummarizables]);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private async loadSummarizable(
|
|
341
|
+
summarizable: Summarizable,
|
|
342
|
+
services: IChannelStorageService,
|
|
343
|
+
): Promise<void> {
|
|
344
|
+
return summarizable.load(
|
|
345
|
+
scopeStorageService(services, summarizablesTreeKey, summarizable.key),
|
|
346
|
+
(contents) => this.serializer.parse(contents),
|
|
347
|
+
);
|
|
319
348
|
}
|
|
320
349
|
|
|
321
350
|
/**
|
|
@@ -351,7 +380,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
351
380
|
newRevision,
|
|
352
381
|
this.detachedRevision,
|
|
353
382
|
);
|
|
354
|
-
this.editManager.advanceMinimumSequenceNumber(newRevision);
|
|
383
|
+
this.editManager.advanceMinimumSequenceNumber(newRevision, false);
|
|
355
384
|
return undefined;
|
|
356
385
|
}
|
|
357
386
|
const message = this.messageCodec.encode(
|
|
@@ -16,13 +16,14 @@ import { getUnhydratedContext } from "../createContext.js";
|
|
|
16
16
|
* @remarks
|
|
17
17
|
* This is "concise" meaning that explicit type information is omitted.
|
|
18
18
|
* If the schema is compatible with {@link ITreeConfigurationOptions.preventAmbiguity},
|
|
19
|
-
* types will be lossless and compatible with {@link
|
|
19
|
+
* types will be lossless and compatible with {@link TreeAlpha.create} (unless the options are used to customize it).
|
|
20
20
|
*
|
|
21
21
|
* Every {@link TreeNode} is an array or object.
|
|
22
22
|
* Any IFluidHandle values have been replaced by `THandle`.
|
|
23
23
|
* @privateRemarks
|
|
24
24
|
* This can store all possible simple trees,
|
|
25
25
|
* but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
|
|
26
|
+
* @alpha
|
|
26
27
|
*/
|
|
27
28
|
export type ConciseTree<THandle = IFluidHandle> =
|
|
28
29
|
| Exclude<TreeLeafValue, IFluidHandle>
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
7
|
|
|
9
8
|
import type { ITreeCursorSynchronous, SchemaAndPolicy } from "../../core/index.js";
|
|
10
9
|
import type {
|
|
11
|
-
TreeLeafValue,
|
|
12
10
|
ImplicitFieldSchema,
|
|
13
11
|
TreeFieldFromImplicitField,
|
|
14
12
|
FieldSchema,
|
|
15
13
|
FieldKind,
|
|
16
14
|
UnsafeUnknownSchema,
|
|
17
15
|
InsertableField,
|
|
16
|
+
TreeLeafValue,
|
|
18
17
|
} from "../schemaTypes.js";
|
|
19
18
|
import {
|
|
20
19
|
getOrCreateNodeFromInnerNode,
|
|
21
20
|
UnhydratedFlexTreeNode,
|
|
21
|
+
type TreeNode,
|
|
22
22
|
type Unhydrated,
|
|
23
23
|
} from "../core/index.js";
|
|
24
24
|
import {
|
|
@@ -29,15 +29,8 @@ import {
|
|
|
29
29
|
type NodeKeyManager,
|
|
30
30
|
} from "../../feature-libraries/index.js";
|
|
31
31
|
import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
32
|
-
import { toStoredSchema } from "../
|
|
32
|
+
import { toStoredSchema } from "../toStoredSchema.js";
|
|
33
33
|
import { inSchemaOrThrow, mapTreeFromNodeData } from "../toMapTree.js";
|
|
34
|
-
import {
|
|
35
|
-
applySchemaToParserOptions,
|
|
36
|
-
cursorFromVerbose,
|
|
37
|
-
type ParseOptions,
|
|
38
|
-
type VerboseTree,
|
|
39
|
-
type VerboseTreeNode,
|
|
40
|
-
} from "./verboseTree.js";
|
|
41
34
|
import { getUnhydratedContext } from "../createContext.js";
|
|
42
35
|
|
|
43
36
|
/**
|
|
@@ -50,18 +43,28 @@ import { getUnhydratedContext } from "../createContext.js";
|
|
|
50
43
|
* 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.
|
|
51
44
|
*
|
|
52
45
|
* Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.
|
|
53
|
-
*
|
|
54
|
-
* @privateRemarks
|
|
55
|
-
* This could be exposed as a public `Tree.create` function.
|
|
46
|
+
* For that case, use {@link TreeBeta.clone}.
|
|
56
47
|
*/
|
|
57
|
-
export function createFromInsertable<
|
|
58
|
-
|
|
48
|
+
export function createFromInsertable<
|
|
49
|
+
const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
|
|
50
|
+
>(
|
|
51
|
+
schema: UnsafeUnknownSchema extends TSchema
|
|
52
|
+
? ImplicitFieldSchema
|
|
53
|
+
: TSchema & ImplicitFieldSchema,
|
|
59
54
|
data: InsertableField<TSchema>,
|
|
60
55
|
context?: NodeKeyManager | undefined,
|
|
61
|
-
): Unhydrated<
|
|
56
|
+
): Unhydrated<
|
|
57
|
+
TSchema extends ImplicitFieldSchema
|
|
58
|
+
? TreeFieldFromImplicitField<TSchema>
|
|
59
|
+
: TreeNode | TreeLeafValue | undefined
|
|
60
|
+
> {
|
|
62
61
|
const cursor = cursorFromInsertable(schema, data, context);
|
|
63
62
|
const result = cursor === undefined ? undefined : createFromCursor(schema, cursor);
|
|
64
|
-
return result as Unhydrated<
|
|
63
|
+
return result as Unhydrated<
|
|
64
|
+
TSchema extends ImplicitFieldSchema
|
|
65
|
+
? TreeFieldFromImplicitField<TSchema>
|
|
66
|
+
: TreeNode | TreeLeafValue | undefined
|
|
67
|
+
>;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
/**
|
|
@@ -107,50 +110,10 @@ export function cursorFromInsertable<
|
|
|
107
110
|
return cursorForMapTreeNode(mapTree);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
/**
|
|
111
|
-
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
112
|
-
* @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.
|
|
113
|
-
* @param data - The data used to construct the field content. See `Tree.cloneToJSONVerbose`.
|
|
114
|
-
* @privateRemarks
|
|
115
|
-
* This could be exposed as a public `Tree.createFromVerbose` function.
|
|
116
|
-
*/
|
|
117
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema, THandle>(
|
|
118
|
-
schema: TSchema,
|
|
119
|
-
data: VerboseTreeNode<THandle> | undefined,
|
|
120
|
-
options: ParseOptions<THandle>,
|
|
121
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
125
|
-
* @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 `Tree.cloneToJSONVerbose`.
|
|
127
|
-
*/
|
|
128
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema>(
|
|
129
|
-
schema: TSchema,
|
|
130
|
-
data: VerboseTreeNode | undefined,
|
|
131
|
-
options?: Partial<ParseOptions<IFluidHandle>>,
|
|
132
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
133
|
-
|
|
134
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema, THandle>(
|
|
135
|
-
schema: TSchema,
|
|
136
|
-
data: VerboseTreeNode<THandle> | undefined,
|
|
137
|
-
options?: Partial<ParseOptions<THandle>>,
|
|
138
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
139
|
-
const config: ParseOptions<THandle> = {
|
|
140
|
-
valueConverter: (input: VerboseTree<THandle>) => {
|
|
141
|
-
return input as TreeLeafValue | VerboseTreeNode<THandle>;
|
|
142
|
-
},
|
|
143
|
-
...options,
|
|
144
|
-
};
|
|
145
|
-
const schemalessConfig = applySchemaToParserOptions(schema, config);
|
|
146
|
-
const cursor = cursorFromVerbose(data, schemalessConfig);
|
|
147
|
-
return createFromCursor(schema, cursor);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
113
|
/**
|
|
151
114
|
* Creates an unhydrated simple-tree field from a cursor in nodes mode.
|
|
152
115
|
*/
|
|
153
|
-
export function createFromCursor<TSchema extends ImplicitFieldSchema>(
|
|
116
|
+
export function createFromCursor<const TSchema extends ImplicitFieldSchema>(
|
|
154
117
|
schema: TSchema,
|
|
155
118
|
cursor: ITreeCursorSynchronous | undefined,
|
|
156
119
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
@@ -13,6 +13,9 @@ export {
|
|
|
13
13
|
type SchemaCompatibilityStatus,
|
|
14
14
|
type ITreeConfigurationOptions,
|
|
15
15
|
type TreeViewAlpha,
|
|
16
|
+
type TreeBranch,
|
|
17
|
+
type TreeBranchEvents,
|
|
18
|
+
asTreeViewAlpha,
|
|
16
19
|
} from "./tree.js";
|
|
17
20
|
export { SchemaFactory, type ScopedSchemaName } from "./schemaFactory.js";
|
|
18
21
|
export type {
|
|
@@ -24,8 +27,8 @@ export {
|
|
|
24
27
|
enumFromStrings,
|
|
25
28
|
singletonSchema,
|
|
26
29
|
} from "./schemaCreationUtilities.js";
|
|
27
|
-
export { treeNodeApi, type TreeNodeApi } from "./treeNodeApi.js";
|
|
28
|
-
export { createFromInsertable, cursorFromInsertable } from "./create.js";
|
|
30
|
+
export { treeNodeApi, type TreeNodeApi, tryGetSchema } from "./treeNodeApi.js";
|
|
31
|
+
export { createFromInsertable, cursorFromInsertable, createFromCursor } from "./create.js";
|
|
29
32
|
export type { SimpleTreeSchema } from "./simpleSchema.js";
|
|
30
33
|
export {
|
|
31
34
|
type JsonSchemaId,
|
|
@@ -69,15 +72,18 @@ export type {
|
|
|
69
72
|
InsertableTreeNodeFromAllowedTypesUnsafe,
|
|
70
73
|
} from "./typesUnsafe.js";
|
|
71
74
|
|
|
72
|
-
export
|
|
73
|
-
VerboseTreeNode,
|
|
74
|
-
ParseOptions,
|
|
75
|
-
VerboseTree,
|
|
75
|
+
export {
|
|
76
|
+
type VerboseTreeNode,
|
|
77
|
+
type ParseOptions,
|
|
78
|
+
type VerboseTree,
|
|
79
|
+
applySchemaToParserOptions,
|
|
80
|
+
cursorFromVerbose,
|
|
81
|
+
verboseFromCursor,
|
|
76
82
|
} from "./verboseTree.js";
|
|
77
83
|
|
|
78
84
|
export type { EncodeOptions } from "./customTree.js";
|
|
79
85
|
|
|
80
|
-
export type
|
|
86
|
+
export { type ConciseTree, conciseFromCursor } from "./conciseTree.js";
|
|
81
87
|
|
|
82
88
|
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
|
|
83
89
|
|
|
@@ -62,11 +62,10 @@ export function singletonSchema<TScope extends string, TName extends string | nu
|
|
|
62
62
|
NodeKind.Object,
|
|
63
63
|
SingletonNodeType,
|
|
64
64
|
Record<string, never>,
|
|
65
|
-
true
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
) => SingletonNodeType) = SingletonSchema;
|
|
65
|
+
true,
|
|
66
|
+
Record<string, never>,
|
|
67
|
+
undefined
|
|
68
|
+
> = SingletonSchema;
|
|
70
69
|
|
|
71
70
|
return toReturn;
|
|
72
71
|
}
|
|
@@ -341,7 +341,8 @@ export class SchemaFactory<
|
|
|
341
341
|
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>,
|
|
342
342
|
MapNodeInsertableData<T>,
|
|
343
343
|
true,
|
|
344
|
-
T
|
|
344
|
+
T,
|
|
345
|
+
undefined
|
|
345
346
|
>;
|
|
346
347
|
|
|
347
348
|
/**
|
|
@@ -363,7 +364,8 @@ export class SchemaFactory<
|
|
|
363
364
|
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
364
365
|
MapNodeInsertableData<T>,
|
|
365
366
|
true,
|
|
366
|
-
T
|
|
367
|
+
T,
|
|
368
|
+
undefined
|
|
367
369
|
>;
|
|
368
370
|
|
|
369
371
|
/**
|
|
@@ -395,7 +397,8 @@ export class SchemaFactory<
|
|
|
395
397
|
TreeMapNode<T>,
|
|
396
398
|
MapNodeInsertableData<T>,
|
|
397
399
|
true,
|
|
398
|
-
T
|
|
400
|
+
T,
|
|
401
|
+
undefined
|
|
399
402
|
>;
|
|
400
403
|
}
|
|
401
404
|
// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.
|
|
@@ -405,7 +408,8 @@ export class SchemaFactory<
|
|
|
405
408
|
TreeMapNode<T>,
|
|
406
409
|
MapNodeInsertableData<T>,
|
|
407
410
|
true,
|
|
408
|
-
T
|
|
411
|
+
T,
|
|
412
|
+
undefined
|
|
409
413
|
> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);
|
|
410
414
|
return out;
|
|
411
415
|
}
|
|
@@ -430,7 +434,8 @@ export class SchemaFactory<
|
|
|
430
434
|
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
431
435
|
MapNodeInsertableData<T>,
|
|
432
436
|
ImplicitlyConstructable,
|
|
433
|
-
T
|
|
437
|
+
T,
|
|
438
|
+
undefined
|
|
434
439
|
> {
|
|
435
440
|
return mapSchema(
|
|
436
441
|
this.scoped(name),
|
|
@@ -482,7 +487,8 @@ export class SchemaFactory<
|
|
|
482
487
|
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,
|
|
483
488
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
484
489
|
true,
|
|
485
|
-
T
|
|
490
|
+
T,
|
|
491
|
+
undefined
|
|
486
492
|
>;
|
|
487
493
|
|
|
488
494
|
/**
|
|
@@ -506,7 +512,8 @@ export class SchemaFactory<
|
|
|
506
512
|
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
|
|
507
513
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
508
514
|
true,
|
|
509
|
-
T
|
|
515
|
+
T,
|
|
516
|
+
undefined
|
|
510
517
|
>;
|
|
511
518
|
|
|
512
519
|
/**
|
|
@@ -535,7 +542,8 @@ export class SchemaFactory<
|
|
|
535
542
|
TreeArrayNode<T>,
|
|
536
543
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
537
544
|
true,
|
|
538
|
-
T
|
|
545
|
+
T,
|
|
546
|
+
undefined
|
|
539
547
|
>;
|
|
540
548
|
}
|
|
541
549
|
const out: TreeNodeSchemaBoth<
|
|
@@ -544,7 +552,8 @@ export class SchemaFactory<
|
|
|
544
552
|
TreeArrayNode<T>,
|
|
545
553
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
546
554
|
true,
|
|
547
|
-
T
|
|
555
|
+
T,
|
|
556
|
+
undefined
|
|
548
557
|
> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);
|
|
549
558
|
return out;
|
|
550
559
|
}
|
|
@@ -573,7 +582,8 @@ export class SchemaFactory<
|
|
|
573
582
|
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,
|
|
574
583
|
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
575
584
|
ImplicitlyConstructable,
|
|
576
|
-
T
|
|
585
|
+
T,
|
|
586
|
+
undefined
|
|
577
587
|
> {
|
|
578
588
|
return arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);
|
|
579
589
|
}
|
|
@@ -747,7 +757,8 @@ export class SchemaFactory<
|
|
|
747
757
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
748
758
|
},
|
|
749
759
|
false,
|
|
750
|
-
T
|
|
760
|
+
T,
|
|
761
|
+
undefined
|
|
751
762
|
>;
|
|
752
763
|
}
|
|
753
764
|
|
|
@@ -793,7 +804,8 @@ export class SchemaFactory<
|
|
|
793
804
|
// Ideally this would be included, but doing so breaks recursive types.
|
|
794
805
|
// | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,
|
|
795
806
|
false,
|
|
796
|
-
T
|
|
807
|
+
T,
|
|
808
|
+
undefined
|
|
797
809
|
>;
|
|
798
810
|
}
|
|
799
811
|
}
|