@fluidframework/tree 2.4.0 → 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 +12 -1
- package/CHANGELOG.md +371 -0
- package/api-report/tree.alpha.api.md +271 -80
- package/api-report/tree.beta.api.md +100 -51
- package/api-report/tree.legacy.alpha.api.md +99 -50
- package/api-report/tree.legacy.public.api.md +99 -50
- package/api-report/tree.public.api.md +99 -50
- package/dist/alpha.d.ts +32 -2
- package/dist/beta.d.ts +6 -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/events/interop.d.ts +1 -7
- package/dist/events/interop.d.ts.map +1 -1
- package/dist/events/interop.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/flex-tree/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/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +2 -2
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/legacy.d.ts +6 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +6 -0
- package/dist/shared-tree/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/treeApi.d.ts +6 -6
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/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 +11 -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 +80 -33
- 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 +6 -24
- 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 +2 -2
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +7 -7
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +10 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +25 -27
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +31 -21
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +16 -12
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +4 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/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 +122 -5
- 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 +69 -17
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/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 +15 -4
- 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 +51 -11
- 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 +2 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/createContext.js +2 -2
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/index.d.ts +6 -6
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +15 -5
- 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 +6 -0
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +4 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +210 -18
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +66 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -2
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/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 +3 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/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/typeUtils.d.ts +61 -0
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js +27 -0
- package/dist/util/typeUtils.js.map +1 -1
- package/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 +32 -2
- package/lib/beta.d.ts +6 -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/events/interop.d.ts +1 -7
- package/lib/events/interop.d.ts.map +1 -1
- package/lib/events/interop.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/flex-tree/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/feature-libraries/object-forest/objectForest.js +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +2 -2
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/legacy.d.ts +6 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +6 -0
- package/lib/shared-tree/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/treeApi.d.ts +6 -6
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/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 +11 -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 +80 -33
- 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 +6 -24
- 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 +2 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +7 -7
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +6 -4
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +25 -27
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +30 -19
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +16 -12
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +3 -3
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/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 +122 -5
- 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 +69 -17
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/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 +15 -4
- 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 +51 -11
- 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 +2 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/createContext.js +1 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/index.d.ts +6 -6
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +5 -5
- 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 +6 -0
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +4 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +210 -18
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +64 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -2
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/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 +3 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/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/typeUtils.d.ts +61 -0
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js +25 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/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 +55 -30
- 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/events/interop.ts +1 -12
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +9 -0
- package/src/feature-libraries/flex-tree/lazyNode.ts +5 -0
- package/src/feature-libraries/object-forest/objectForest.ts +1 -1
- package/src/feature-libraries/treeCursorUtils.ts +2 -2
- package/src/index.ts +36 -6
- package/src/internalTypes.ts +4 -0
- 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 +64 -13
- package/src/shared-tree/sharedTree.ts +29 -9
- package/src/shared-tree/treeApi.ts +19 -9
- package/src/shared-tree/treeApiAlpha.ts +401 -0
- package/src/shared-tree/treeCheckout.ts +28 -5
- package/src/shared-tree-core/editManager.ts +126 -59
- 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 +33 -65
- package/src/simple-tree/api/customTree.ts +3 -2
- package/src/simple-tree/api/index.ts +19 -8
- package/src/simple-tree/api/schemaCreationUtilities.ts +59 -37
- package/src/simple-tree/api/schemaFactory.ts +28 -12
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +3 -3
- package/src/simple-tree/api/storedSchema.ts +1 -1
- package/src/simple-tree/api/tree.ts +152 -7
- package/src/simple-tree/api/treeApiBeta.ts +35 -31
- package/src/simple-tree/api/typesUnsafe.ts +125 -30
- package/src/simple-tree/api/verboseTree.ts +3 -0
- package/src/simple-tree/arrayNode.ts +38 -17
- package/src/simple-tree/core/getOrCreateNode.ts +1 -1
- package/src/simple-tree/core/treeNodeSchema.ts +107 -34
- package/src/simple-tree/core/unhydratedFlexTree.ts +6 -0
- package/src/simple-tree/core/withType.ts +2 -1
- package/src/simple-tree/createContext.ts +1 -1
- package/src/simple-tree/index.ts +34 -3
- package/src/simple-tree/leafNodeSchema.ts +6 -1
- package/src/simple-tree/mapNode.ts +13 -4
- package/src/simple-tree/objectNode.ts +5 -3
- package/src/simple-tree/schemaTypes.ts +342 -36
- package/src/simple-tree/toMapTree.ts +4 -1
- package/src/simple-tree/treeNodeValid.ts +11 -1
- package/src/util/index.ts +7 -0
- package/src/util/typeCheck.ts +13 -0
- package/src/util/typeUtils.ts +87 -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
|
@@ -53,6 +53,14 @@ const minimumPossibleSequenceId: SequenceId = {
|
|
|
53
53
|
sequenceNumber: minimumPossibleSequenceNumber,
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A special revision tag for the initial {@link EditManager.trunkBase} commit.
|
|
58
|
+
* @remarks This tag is used to supply the _initial_ trunk base with a known revision.
|
|
59
|
+
* The trunk base may advance over time, after which point the trunk base will have a different revision.
|
|
60
|
+
* When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.
|
|
61
|
+
*/
|
|
62
|
+
const rootRevision = "root" as const satisfies RevisionTag;
|
|
63
|
+
|
|
56
64
|
/**
|
|
57
65
|
* Max number of telemetry log call that may be aggregated before being sent.
|
|
58
66
|
*/
|
|
@@ -152,7 +160,7 @@ export class EditManager<
|
|
|
152
160
|
logger?: ITelemetryLoggerExt,
|
|
153
161
|
) {
|
|
154
162
|
this.trunkBase = {
|
|
155
|
-
revision:
|
|
163
|
+
revision: rootRevision,
|
|
156
164
|
change: changeFamily.rebaser.compose([]),
|
|
157
165
|
};
|
|
158
166
|
this.sequenceMap.set(minimumPossibleSequenceId, this.trunkBase);
|
|
@@ -262,30 +270,62 @@ export class EditManager<
|
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
/**
|
|
265
|
-
*
|
|
266
|
-
* @param
|
|
267
|
-
* @
|
|
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.
|
|
268
280
|
*/
|
|
269
|
-
private
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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);
|
|
275
302
|
if (currentBranches !== undefined) {
|
|
276
|
-
const newBranches = getOrCreate(this.trunkBranches,
|
|
303
|
+
const newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());
|
|
277
304
|
for (const branch of currentBranches) {
|
|
278
|
-
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) {
|
|
279
308
|
newBranches.add(branch);
|
|
280
309
|
currentBranches.delete(branch);
|
|
281
310
|
}
|
|
282
311
|
}
|
|
312
|
+
// Clean up our trunk branches map by removing any empty sets.
|
|
283
313
|
if (currentBranches.size === 0) {
|
|
284
|
-
this.trunkBranches.delete(
|
|
314
|
+
this.trunkBranches.delete(previousSequenceId);
|
|
315
|
+
}
|
|
316
|
+
if (newBranches.size === 0) {
|
|
317
|
+
this.trunkBranches.delete(sequenceId);
|
|
285
318
|
}
|
|
286
319
|
}
|
|
287
320
|
}
|
|
288
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
|
+
|
|
289
329
|
/**
|
|
290
330
|
* Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,
|
|
291
331
|
* if they are not retained by revertibles or local branches.
|
|
@@ -293,7 +333,10 @@ export class EditManager<
|
|
|
293
333
|
*
|
|
294
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.
|
|
295
335
|
*/
|
|
296
|
-
public advanceMinimumSequenceNumber(
|
|
336
|
+
public advanceMinimumSequenceNumber(
|
|
337
|
+
minimumSequenceNumber: SeqNumber,
|
|
338
|
+
trimTrunk = true,
|
|
339
|
+
): void {
|
|
297
340
|
if (minimumSequenceNumber === this.minimumSequenceNumber) {
|
|
298
341
|
return;
|
|
299
342
|
}
|
|
@@ -304,16 +347,17 @@ export class EditManager<
|
|
|
304
347
|
);
|
|
305
348
|
|
|
306
349
|
this.minimumSequenceNumber = minimumSequenceNumber;
|
|
307
|
-
|
|
350
|
+
if (trimTrunk) {
|
|
351
|
+
this.trimTrunk();
|
|
352
|
+
}
|
|
308
353
|
}
|
|
309
354
|
|
|
310
355
|
/**
|
|
311
356
|
* Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine
|
|
312
357
|
* if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.
|
|
313
|
-
* @returns the number of commits that were removed from the trunk
|
|
314
358
|
*/
|
|
315
359
|
private trimTrunk(): void {
|
|
316
|
-
/** The sequence id of the
|
|
360
|
+
/** The sequence id of the most recent commit on the trunk that will be trimmed */
|
|
317
361
|
let trunkTailSequenceId: SequenceId = {
|
|
318
362
|
sequenceNumber: this.minimumSequenceNumber,
|
|
319
363
|
indexInBatch: Number.POSITIVE_INFINITY,
|
|
@@ -363,34 +407,45 @@ export class EditManager<
|
|
|
363
407
|
newTrunkBase,
|
|
364
408
|
this.trunkBase,
|
|
365
409
|
).map((c) => c.revision);
|
|
366
|
-
// Copying the revision of the old trunk base into the new trunk base means we don't need to write out the original
|
|
367
|
-
// revision to summaries. All clients agree that the trunk base always has the same hardcoded revision.
|
|
368
|
-
newTrunkBase.revision = this.trunkBase.revision;
|
|
369
|
-
// Overwriting the change is not strictly necessary, but done here for consistency (so all trunk bases are deeply equal).
|
|
370
|
-
newTrunkBase.change = this.trunkBase.change;
|
|
371
410
|
// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.
|
|
372
411
|
delete newTrunkBase.parent;
|
|
373
412
|
this.trunkBase = newTrunkBase;
|
|
374
413
|
|
|
375
414
|
// Update any state that is derived from trunk commits
|
|
376
|
-
this.sequenceMap.editRange(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
(s,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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
|
+
});
|
|
394
449
|
|
|
395
450
|
const trunkSize = getPathFromBase(this.trunk.getHead(), this.trunkBase).length;
|
|
396
451
|
assert(
|
|
@@ -429,6 +484,9 @@ export class EditManager<
|
|
|
429
484
|
0x428 /* Clients with local changes cannot be used to generate summaries */,
|
|
430
485
|
);
|
|
431
486
|
|
|
487
|
+
// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.
|
|
488
|
+
this.trimTrunk();
|
|
489
|
+
|
|
432
490
|
let oldestCommitInCollabWindow = this.getClosestTrunkCommit(this.minimumSequenceNumber)[1];
|
|
433
491
|
assert(
|
|
434
492
|
oldestCommitInCollabWindow.parent !== undefined ||
|
|
@@ -442,6 +500,10 @@ export class EditManager<
|
|
|
442
500
|
|
|
443
501
|
const trunk = getPathFromBase(this.trunk.getHead(), oldestCommitInCollabWindow).map(
|
|
444
502
|
(c) => {
|
|
503
|
+
assert(
|
|
504
|
+
c !== this.trunkBase,
|
|
505
|
+
0xa61 /* Serialized trunk should not include the trunk base */,
|
|
506
|
+
);
|
|
445
507
|
const metadata =
|
|
446
508
|
this.trunkMetadata.get(c.revision) ?? fail("Expected metadata for trunk commit");
|
|
447
509
|
const commit: SequencedCommit<TChangeset> = {
|
|
@@ -464,11 +526,16 @@ export class EditManager<
|
|
|
464
526
|
findCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??
|
|
465
527
|
fail("Expected branch to be based on trunk");
|
|
466
528
|
|
|
529
|
+
const base = ancestor === this.trunkBase ? rootRevision : ancestor.revision;
|
|
467
530
|
return [
|
|
468
531
|
sessionId,
|
|
469
532
|
{
|
|
470
|
-
base
|
|
533
|
+
base,
|
|
471
534
|
commits: branchPath.map((c) => {
|
|
535
|
+
assert(
|
|
536
|
+
c !== this.trunkBase,
|
|
537
|
+
0xa62 /* Serialized branch should not include the trunk base */,
|
|
538
|
+
);
|
|
472
539
|
const commit: Commit<TChangeset> = {
|
|
473
540
|
change: c.change,
|
|
474
541
|
revision: c.revision,
|
|
@@ -533,8 +600,16 @@ export class EditManager<
|
|
|
533
600
|
}
|
|
534
601
|
}
|
|
535
602
|
|
|
536
|
-
private getCommitSequenceId(
|
|
537
|
-
|
|
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;
|
|
538
613
|
}
|
|
539
614
|
|
|
540
615
|
public getTrunkChanges(): readonly TChangeset[] {
|
|
@@ -586,6 +661,12 @@ export class EditManager<
|
|
|
586
661
|
0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,
|
|
587
662
|
);
|
|
588
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
|
+
|
|
589
670
|
const commitsSequenceNumber = this.getBatch(sequenceNumber);
|
|
590
671
|
const sequenceId: SequenceId =
|
|
591
672
|
commitsSequenceNumber.length === 0
|
|
@@ -598,17 +679,7 @@ export class EditManager<
|
|
|
598
679
|
};
|
|
599
680
|
|
|
600
681
|
if (newCommit.sessionId === this.localSessionId) {
|
|
601
|
-
|
|
602
|
-
const firstLocalCommit = this.localCommits.shift();
|
|
603
|
-
assert(
|
|
604
|
-
firstLocalCommit !== undefined,
|
|
605
|
-
0x6b5 /* Received a sequenced change from the local session despite having no local changes */,
|
|
606
|
-
);
|
|
607
|
-
|
|
608
|
-
// The first local branch commit is already rebased over the trunk, so we can push it directly to the trunk.
|
|
609
|
-
this.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, this.localSessionId);
|
|
610
|
-
this.fastForwardBranches(headTrunkCommit, sequenceId);
|
|
611
|
-
return;
|
|
682
|
+
return this.fastForwardNextLocalCommit(sequenceId);
|
|
612
683
|
}
|
|
613
684
|
|
|
614
685
|
// Get the revision that the remote change is based on
|
|
@@ -665,11 +736,7 @@ export class EditManager<
|
|
|
665
736
|
return [commit, commits];
|
|
666
737
|
}
|
|
667
738
|
|
|
668
|
-
private pushCommitToTrunk(
|
|
669
|
-
sequenceId: SequenceId,
|
|
670
|
-
commit: Commit<TChangeset>,
|
|
671
|
-
local = false,
|
|
672
|
-
): void {
|
|
739
|
+
private pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {
|
|
673
740
|
const mintedCommit = mintCommit(this.trunk.getHead(), commit);
|
|
674
741
|
this.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);
|
|
675
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,21 +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
|
-
InsertableTreeFieldFromImplicitField,
|
|
14
11
|
TreeFieldFromImplicitField,
|
|
15
12
|
FieldSchema,
|
|
16
13
|
FieldKind,
|
|
14
|
+
UnsafeUnknownSchema,
|
|
15
|
+
InsertableField,
|
|
16
|
+
TreeLeafValue,
|
|
17
17
|
} from "../schemaTypes.js";
|
|
18
18
|
import {
|
|
19
19
|
getOrCreateNodeFromInnerNode,
|
|
20
20
|
UnhydratedFlexTreeNode,
|
|
21
|
+
type TreeNode,
|
|
21
22
|
type Unhydrated,
|
|
22
23
|
} from "../core/index.js";
|
|
23
24
|
import {
|
|
@@ -28,15 +29,8 @@ import {
|
|
|
28
29
|
type NodeKeyManager,
|
|
29
30
|
} from "../../feature-libraries/index.js";
|
|
30
31
|
import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
31
|
-
import { toStoredSchema } from "../
|
|
32
|
-
import { inSchemaOrThrow, mapTreeFromNodeData
|
|
33
|
-
import {
|
|
34
|
-
applySchemaToParserOptions,
|
|
35
|
-
cursorFromVerbose,
|
|
36
|
-
type ParseOptions,
|
|
37
|
-
type VerboseTree,
|
|
38
|
-
type VerboseTreeNode,
|
|
39
|
-
} from "./verboseTree.js";
|
|
32
|
+
import { toStoredSchema } from "../toStoredSchema.js";
|
|
33
|
+
import { inSchemaOrThrow, mapTreeFromNodeData } from "../toMapTree.js";
|
|
40
34
|
import { getUnhydratedContext } from "../createContext.js";
|
|
41
35
|
|
|
42
36
|
/**
|
|
@@ -49,18 +43,28 @@ import { getUnhydratedContext } from "../createContext.js";
|
|
|
49
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.
|
|
50
44
|
*
|
|
51
45
|
* Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.
|
|
52
|
-
*
|
|
53
|
-
* @privateRemarks
|
|
54
|
-
* This could be exposed as a public `Tree.create` function.
|
|
46
|
+
* For that case, use {@link TreeBeta.clone}.
|
|
55
47
|
*/
|
|
56
|
-
export function createFromInsertable<
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
export function createFromInsertable<
|
|
49
|
+
const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
|
|
50
|
+
>(
|
|
51
|
+
schema: UnsafeUnknownSchema extends TSchema
|
|
52
|
+
? ImplicitFieldSchema
|
|
53
|
+
: TSchema & ImplicitFieldSchema,
|
|
54
|
+
data: InsertableField<TSchema>,
|
|
59
55
|
context?: NodeKeyManager | undefined,
|
|
60
|
-
): Unhydrated<
|
|
56
|
+
): Unhydrated<
|
|
57
|
+
TSchema extends ImplicitFieldSchema
|
|
58
|
+
? TreeFieldFromImplicitField<TSchema>
|
|
59
|
+
: TreeNode | TreeLeafValue | undefined
|
|
60
|
+
> {
|
|
61
61
|
const cursor = cursorFromInsertable(schema, data, context);
|
|
62
62
|
const result = cursor === undefined ? undefined : createFromCursor(schema, cursor);
|
|
63
|
-
return result as Unhydrated<
|
|
63
|
+
return result as Unhydrated<
|
|
64
|
+
TSchema extends ImplicitFieldSchema
|
|
65
|
+
? TreeFieldFromImplicitField<TSchema>
|
|
66
|
+
: TreeNode | TreeLeafValue | undefined
|
|
67
|
+
>;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
/**
|
|
@@ -72,9 +76,13 @@ export function createFromInsertable<TSchema extends ImplicitFieldSchema>(
|
|
|
72
76
|
* this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.
|
|
73
77
|
* When `undefined` is provided (for an optional field), `undefined` is returned.
|
|
74
78
|
*/
|
|
75
|
-
export function cursorFromInsertable<
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
export function cursorFromInsertable<
|
|
80
|
+
TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
|
|
81
|
+
>(
|
|
82
|
+
schema: UnsafeUnknownSchema extends TSchema
|
|
83
|
+
? ImplicitFieldSchema
|
|
84
|
+
: TSchema & ImplicitFieldSchema,
|
|
85
|
+
data: InsertableField<TSchema>,
|
|
78
86
|
context?: NodeKeyManager | undefined,
|
|
79
87
|
):
|
|
80
88
|
| ITreeCursorSynchronous
|
|
@@ -87,7 +95,7 @@ export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
|
|
|
87
95
|
};
|
|
88
96
|
|
|
89
97
|
const mapTree = mapTreeFromNodeData(
|
|
90
|
-
data as
|
|
98
|
+
data as InsertableField<UnsafeUnknownSchema>,
|
|
91
99
|
schema,
|
|
92
100
|
context,
|
|
93
101
|
schemaValidationPolicy,
|
|
@@ -102,50 +110,10 @@ export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
|
|
|
102
110
|
return cursorForMapTreeNode(mapTree);
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
/**
|
|
106
|
-
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
107
|
-
* @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.
|
|
108
|
-
* @param data - The data used to construct the field content. See `Tree.cloneToJSONVerbose`.
|
|
109
|
-
* @privateRemarks
|
|
110
|
-
* This could be exposed as a public `Tree.createFromVerbose` function.
|
|
111
|
-
*/
|
|
112
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema, THandle>(
|
|
113
|
-
schema: TSchema,
|
|
114
|
-
data: VerboseTreeNode<THandle> | undefined,
|
|
115
|
-
options: ParseOptions<THandle>,
|
|
116
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
120
|
-
* @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.
|
|
121
|
-
* @param data - The data used to construct the field content. See `Tree.cloneToJSONVerbose`.
|
|
122
|
-
*/
|
|
123
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema>(
|
|
124
|
-
schema: TSchema,
|
|
125
|
-
data: VerboseTreeNode | undefined,
|
|
126
|
-
options?: Partial<ParseOptions<IFluidHandle>>,
|
|
127
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
128
|
-
|
|
129
|
-
export function createFromVerbose<TSchema extends ImplicitFieldSchema, THandle>(
|
|
130
|
-
schema: TSchema,
|
|
131
|
-
data: VerboseTreeNode<THandle> | undefined,
|
|
132
|
-
options?: Partial<ParseOptions<THandle>>,
|
|
133
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
134
|
-
const config: ParseOptions<THandle> = {
|
|
135
|
-
valueConverter: (input: VerboseTree<THandle>) => {
|
|
136
|
-
return input as TreeLeafValue | VerboseTreeNode<THandle>;
|
|
137
|
-
},
|
|
138
|
-
...options,
|
|
139
|
-
};
|
|
140
|
-
const schemalessConfig = applySchemaToParserOptions(schema, config);
|
|
141
|
-
const cursor = cursorFromVerbose(data, schemalessConfig);
|
|
142
|
-
return createFromCursor(schema, cursor);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
113
|
/**
|
|
146
114
|
* Creates an unhydrated simple-tree field from a cursor in nodes mode.
|
|
147
115
|
*/
|
|
148
|
-
export function createFromCursor<TSchema extends ImplicitFieldSchema>(
|
|
116
|
+
export function createFromCursor<const TSchema extends ImplicitFieldSchema>(
|
|
149
117
|
schema: TSchema,
|
|
150
118
|
cursor: ITreeCursorSynchronous | undefined,
|
|
151
119
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
@@ -28,6 +28,7 @@ import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Options for how to encode a tree.
|
|
31
|
+
* @alpha
|
|
31
32
|
*/
|
|
32
33
|
export interface EncodeOptions<TCustom> {
|
|
33
34
|
/**
|
|
@@ -102,8 +103,8 @@ export function customFromCursorInner<TChild, THandle>(
|
|
|
102
103
|
const storedKey = reader.getFieldKey();
|
|
103
104
|
const key =
|
|
104
105
|
isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
|
|
105
|
-
? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
|
|
106
|
-
fail("missing property key")
|
|
106
|
+
? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
|
|
107
|
+
fail("missing property key"))
|
|
107
108
|
: storedKey;
|
|
108
109
|
// Length is checked above.
|
|
109
110
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -12,6 +12,10 @@ export {
|
|
|
12
12
|
type ITreeViewConfiguration,
|
|
13
13
|
type SchemaCompatibilityStatus,
|
|
14
14
|
type ITreeConfigurationOptions,
|
|
15
|
+
type TreeViewAlpha,
|
|
16
|
+
type TreeBranch,
|
|
17
|
+
type TreeBranchEvents,
|
|
18
|
+
asTreeViewAlpha,
|
|
15
19
|
} from "./tree.js";
|
|
16
20
|
export { SchemaFactory, type ScopedSchemaName } from "./schemaFactory.js";
|
|
17
21
|
export type {
|
|
@@ -22,10 +26,9 @@ export {
|
|
|
22
26
|
adaptEnum,
|
|
23
27
|
enumFromStrings,
|
|
24
28
|
singletonSchema,
|
|
25
|
-
typedObjectValues,
|
|
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,
|
|
@@ -62,17 +65,25 @@ export type {
|
|
|
62
65
|
NodeBuilderDataUnsafe,
|
|
63
66
|
NodeFromSchemaUnsafe,
|
|
64
67
|
ReadonlyMapInlined,
|
|
68
|
+
TreeNodeSchemaClassUnsafe,
|
|
69
|
+
TreeNodeSchemaUnsafe,
|
|
70
|
+
AllowedTypesUnsafe,
|
|
71
|
+
TreeNodeSchemaNonClassUnsafe,
|
|
72
|
+
InsertableTreeNodeFromAllowedTypesUnsafe,
|
|
65
73
|
} from "./typesUnsafe.js";
|
|
66
74
|
|
|
67
|
-
export
|
|
68
|
-
VerboseTreeNode,
|
|
69
|
-
ParseOptions,
|
|
70
|
-
VerboseTree,
|
|
75
|
+
export {
|
|
76
|
+
type VerboseTreeNode,
|
|
77
|
+
type ParseOptions,
|
|
78
|
+
type VerboseTree,
|
|
79
|
+
applySchemaToParserOptions,
|
|
80
|
+
cursorFromVerbose,
|
|
81
|
+
verboseFromCursor,
|
|
71
82
|
} from "./verboseTree.js";
|
|
72
83
|
|
|
73
84
|
export type { EncodeOptions } from "./customTree.js";
|
|
74
85
|
|
|
75
|
-
export type
|
|
86
|
+
export { type ConciseTree, conciseFromCursor } from "./conciseTree.js";
|
|
76
87
|
|
|
77
88
|
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
|
|
78
89
|
|